aboutsummaryrefslogtreecommitdiffstats
path: root/vm_dump.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-21 22:52:59 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-21 22:52:59 +0000
commite4198a73d406d9a9f61a6db2d2a243c0f5267679 (patch)
treee77fa8d9817f9ff7c53864e373784f902b4368c1 /vm_dump.c
parent6053426a669386353a6b7fe11f3d3ea8d3c11e7c (diff)
downloadruby-e4198a73d406d9a9f61a6db2d2a243c0f5267679.tar.gz
* make rb_iseq_t T_IMEMO object (type is imemo_iseq).
All contents of previous rb_iseq_t is in rb_iseq_t::body. Remove rb_iseq_t::self because rb_iseq_t is an object. RubyVM::InstructionSequence is wrapper object points T_IMEMO/iseq. So RubyVM::ISeq.of(something) method returns different wrapper objects but they point the same T_IMEMO/iseq object. This patch is big, but most of difference is replacement of iseq->xxx to iseq->body->xxx. (previous) rb_iseq_t::compile_data is also located to rb_iseq_t::compile_data. It was moved from rb_iseq_body::compile_data. Now rb_iseq_t has empty two pointers. I will split rb_iseq_body data into static data and dynamic data. * compile.c: rename some functions/macros. Now, we don't need to separate iseq and iseqval (only VALUE). * eval.c (ruby_exec_internal): `n' is rb_iseq_t (T_IMEMO/iseq). * ext/objspace/objspace.c (count_imemo_objects): count T_IMEMO/iseq. * gc.c: check T_IMEMO/iseq. * internal.h: add imemo_type::imemo_iseq. * iseq.c: define RubyVM::InstructionSequnce as T_OBJECT. Methods are implemented by functions named iseqw_.... * load.c (rb_load_internal0): rb_iseq_new_top() returns rb_iseq_t (T_IMEMO/iesq). * method.h (rb_add_method_iseq): accept rb_iseq_t (T_IMEMO/iseq). * vm_core.h (GetISeqPtr): removed because it is not T_DATA now. * vm_core.h (struct rb_iseq_body): remove padding for [Bug #10037][ruby-core:63721]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_dump.c')
-rw-r--r--vm_dump.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/vm_dump.c b/vm_dump.c
index dc27dd4c4a..553acf2800 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -39,7 +39,7 @@ control_frame_dump(rb_thread_t *th, rb_control_frame_t *cfp)
const rb_callable_method_entry_t *me;
if (cfp->block_iseq != 0 && !RUBY_VM_IFUNC_P(cfp->block_iseq)) {
- biseq_name = ""; /* RSTRING(cfp->block_iseq->location.label)->ptr; */
+ biseq_name = ""; /* RSTRING(cfp->block_iseq->body->location.label)->ptr; */
}
if (ep < 0 || (size_t)ep > th->stack_size) {
@@ -99,11 +99,11 @@ control_frame_dump(rb_thread_t *th, rb_control_frame_t *cfp)
iseq_name = "<ifunc>";
}
else {
- pc = cfp->pc - cfp->iseq->iseq_encoded;
- iseq_name = RSTRING_PTR(cfp->iseq->location.label);
+ pc = cfp->pc - cfp->iseq->body->iseq_encoded;
+ iseq_name = RSTRING_PTR(cfp->iseq->body->location.label);
line = rb_vm_get_sourceline(cfp);
if (line) {
- snprintf(posbuf, MAX_POSBUF, "%s:%d", RSTRING_PTR(cfp->iseq->location.path), line);
+ snprintf(posbuf, MAX_POSBUF, "%s:%d", RSTRING_PTR(cfp->iseq->body->location.path), line);
}
}
}
@@ -233,9 +233,9 @@ static VALUE *
vm_base_ptr(rb_control_frame_t *cfp)
{
rb_control_frame_t *prev_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
- VALUE *bp = prev_cfp->sp + cfp->iseq->local_size + 1;
+ VALUE *bp = prev_cfp->sp + cfp->iseq->body->local_size + 1;
- if (cfp->iseq->type == ISEQ_TYPE_METHOD) {
+ if (cfp->iseq->body->type == ISEQ_TYPE_METHOD) {
bp += 1;
}
return bp;
@@ -266,9 +266,9 @@ vm_stack_dump_each(rb_thread_t *th, rb_control_frame_t *cfp)
name = "<ifunc>";
}
else {
- argc = iseq->param.lead_num;
- local_size = iseq->local_size;
- name = RSTRING_PTR(iseq->location.label);
+ argc = iseq->body->param.lead_num;
+ local_size = iseq->body->local_size;
+ name = RSTRING_PTR(iseq->body->location.label);
}
/* stack trace header */
@@ -335,7 +335,7 @@ rb_vmdebug_debug_print_register(rb_thread_t *th)
ptrdiff_t cfpi;
if (RUBY_VM_NORMAL_ISEQ_P(cfp->iseq)) {
- pc = cfp->pc - cfp->iseq->iseq_encoded;
+ pc = cfp->pc - cfp->iseq->body->iseq_encoded;
}
if (ep < 0 || (size_t)ep > th->stack_size) {
@@ -361,7 +361,7 @@ rb_vmdebug_debug_print_pre(rb_thread_t *th, rb_control_frame_t *cfp,VALUE *_pc)
const rb_iseq_t *iseq = cfp->iseq;
if (iseq != 0) {
- ptrdiff_t pc = _pc - iseq->iseq_encoded;
+ ptrdiff_t pc = _pc - iseq->body->iseq_encoded;
int i;
for (i=0; i<(int)VM_CFP_CNT(th, cfp); i++) {