RClass->m_tbl with serial. This prevents double marking method
tables, since many classes/modules can share the same method table.
This improves minor mark time in a large application by 30%.
* internal.h (struct method_table_wrapper): Define new
wrapper struct with additional serial.
* internal.h (RCLASS_M_TBL_INIT): New macro for initializing method
table wrapper and st_table.
* method.h (void rb_sweep_method_entry): Rename rb_free_m_table to
rb_free_m_tbl for consistentcy
* .gdbinit (define rb_method_entry): Update rb_method_entry gdb helper
for new method table structure.
* class.c: Use RCLASS_M_TBL_WRAPPER and
RCLASS_M_TBL_INIT macros.
* class.c (rb_include_class_new): Share WRAPPER between module and
iclass, so serial can prevent double marking.
* eval.c (rb_prepend_module): ditto.
* eval.c (rb_using_refinement): ditto.
* gc.c: Mark and free new wrapper struct.
* gc.c (obj_memsize_of): Count size of additional wrapper struct.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RGenGC is designed as 2 generational GC, young and old generation.
Young objects will be promoted to old objects after one GC.
Old objects are not collect until major (full) GC.
The issue of this approach is some objects can promoted as old
objects accidentally and not freed until major GC.
Major GC is not frequently so short-lived but accidentally becoming
old objects are not freed.
For example, the program "loop{Array.new(1_000_000)}" consumes huge
memories because short lived objects (an array which has 1M
elements) are promoted while GC and they are not freed before major
GC.
To solve this problem, generational GC with more generations
technique is known. This patch implements three generations gen GC.
At first, newly created objects are "Infant" objects.
After surviving one GC, "Infant" objects are promoted to "Young"
objects.
"Young" objects are promoted to "Old" objects after surviving
next GC.
"Infant" and "Young" objects are collected if it is not marked
while minor GC. So that this technique solves this problem.
Representation of generations:
* Infant: !FL_PROMOTED and !oldgen_bitmap [00]
* Young : FL_PROMOTED and !oldgen_bitmap [10]
* Old : FL_PROMOTED and oldgen_bitmap [11]
The macro "RGENGC_THREEGEN" enables/disables this feature, and
turned off as default because there are several problems.
(1) Failed sometimes (Heisenbugs).
(2) Performance down.
Especially on write barriers. We need to detect Young or Old
object by oldgen_bitmap. It is slower than checking flags.
To evaluate this feature on more applications, I commit this patch.
Reports are very welcome.
This patch includes some refactoring (renaming names, etc).
* include/ruby/ruby.h: catch up 3gen GC.
* .gdbinit: fix to show a prompt "[PROMOTED]" for promoted objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* .gdbinit (rp): insert a colon between type "SYMBOL" and ID value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* .gdbinit (rp_id): show ID type.
* template/id.h.tmpl (ruby_id_types): make enum for debugger.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* .gdbinit (rp_string): extract from rp.
* .gdbinit (rp_id): use rp_string to show the content.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* .gdbinit (rb_classname): follow classname() change at r36584, which
hash second argument now. reported by 36584 via IRC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* .gdbinit (hook-run): initialize color sequences for each runs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* .gdbinit: revert colored prompt because incremental search does not
work well with invisible sequence in prompt.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* .gdbinit: colorize prompt and output headers, so boundaries get
clearer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* .gdbinit (rp): FLONUM support.
* include/ruby/ruby.h (ruby_special_consts): define FLONUM constants
always, so that they are available from gdb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* .gdbinit (rp): improve for class/iclass/module so print content of
RClass.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
on [ruby-core:26155] by Joshua ben Jore <twists AT gmail.com>.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c (rb_str_rindex_m): need not to call rb_enc_check on
regexp.
* re.c (unescape_escaped_nonascii): try ASCII-8BIT encoding for
broken strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(REG_ENCODING_NONE): ditto.
(rb_char_to_option_kcode): return ARG_ENCODING_NONE for n.
(rb_reg_prepare_re): warn /ascii/n =~ "non-ascii".
(rb_reg_initialize): set REG_ENCODING_NONE from ARG_ENCODING_NONE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e