From ea4c97904e37df0937af1742b41f3bb999b785b8 Mon Sep 17 00:00:00 2001 From: normal Date: Wed, 10 Sep 2014 06:14:07 +0000 Subject: compile: translate iseq in-place running "ruby -rpp -e 'pp GC.stat'", a reduction in malloc usage is shown: before: :malloc_increase=>118784, :oldmalloc_increase=>1178736, after: :malloc_increase=>99832, :oldmalloc_increase=>1031976, For "ruby -e exit", valgrind reports over 300K reduction in overall allocations (and unnecessary memory copies). before: total heap usage: 49,622 allocs, 20,492 frees, 8,697,493 bytes allocated after: total heap usage: 48,935 allocs, 19,805 frees, 8,373,773 bytes allocated (numbers from x86-64) v2 changes based on ko1 recommendations [ruby-core:64883]: - squashed in-place direct thread translation to avoid alloc+copy - renamed rb_iseq_untranslate_threaded_code to rb_iseq_original_iseq, cache new iseq->iseq_original field. * compile.c (rb_iseq_translate_threaded_code): modify in-place w/o copy (rb_vm_addr2insn): new function for debug (rb_iseq_original_iseq): ditto (iseq_set_sequence): assign iseq_encoded directly [Feature #10185] * vm_core (rb_iseq_t): move original ->iseq to bottom * iseq.c (iseq_free, iseq_free): adjust for new layout (rb_iseq_disasm): use original iseq for dump (iseq_data_to_ary): ditto (rb_iseq_line_trace_each): ditto (rb_iseq_build_for_ruby2cext): use iseq_encoded directly * vm_dump.c (rb_vmdebug_debug_print_pre): use original iseq git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- iseq.h | 1 + 1 file changed, 1 insertion(+) (limited to 'iseq.h') diff --git a/iseq.h b/iseq.h index da2b678c1b..bf3a714e9d 100644 --- a/iseq.h +++ b/iseq.h @@ -17,6 +17,7 @@ RUBY_SYMBOL_EXPORT_BEGIN /* compile.c */ VALUE rb_iseq_compile_node(VALUE self, NODE *node); int rb_iseq_translate_threaded_code(rb_iseq_t *iseq); +VALUE *rb_iseq_original_iseq(rb_iseq_t *iseq); VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args, VALUE exception, VALUE body); -- cgit v1.2.3