aboutsummaryrefslogtreecommitdiffstats
path: root/vm_dump.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-10 06:14:07 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-10 06:14:07 +0000
commitea4c97904e37df0937af1742b41f3bb999b785b8 (patch)
treec2e9a9e62f287300406293effd8d28d43ba6fbf8 /vm_dump.c
parentfd31eb3f5c2047415ae741ef7cdd7a5f985ebc7a (diff)
downloadruby-ea4c97904e37df0937af1742b41f3bb999b785b8.tar.gz
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
Diffstat (limited to 'vm_dump.c')
-rw-r--r--vm_dump.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/vm_dump.c b/vm_dump.c
index bb2b2415c4..a65542b0f8 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -13,6 +13,7 @@
#include "addr2line.h"
#include "vm_core.h"
#include "internal.h"
+#include "iseq.h"
/* see vm_insnhelper.h for the values */
#ifndef VMDEBUG
@@ -359,7 +360,6 @@ rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp,VALUE *_pc)
rb_iseq_t *iseq = cfp->iseq;
if (iseq != 0) {
- VALUE *seq = iseq->iseq;
ptrdiff_t pc = _pc - iseq->iseq_encoded;
int i;
@@ -371,7 +371,9 @@ rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp,VALUE *_pc)
/* printf("%3"PRIdPTRDIFF" ", VM_CFP_CNT(th, cfp)); */
if (pc >= 0) {
- rb_iseq_disasm_insn(0, seq, (size_t)pc, iseq, 0);
+ const VALUE *iseq_original = rb_iseq_original_iseq(iseq);
+
+ rb_iseq_disasm_insn(0, iseq_original, (size_t)pc, iseq, 0);
}
}