diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-22 08:31:38 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-22 08:31:38 +0000 |
commit | 8bcf7fc40266faa09cf8b6cebb2d96c1bb8d51ee (patch) | |
tree | 719fe00c607d84a4339d7cfef7754eec8590d2e3 /vm.c | |
parent | 9c46e774c15668b7fbf3df8a9a9ea912b5908738 (diff) | |
download | ruby-8bcf7fc40266faa09cf8b6cebb2d96c1bb8d51ee.tar.gz |
* vm_core.h: add a data type rb_location_t to store iseq location
information.
rb_location_t#filename, filepath, name and line_no was moved from
rb_iseq_t. rb_location_t#basename is a new field which is
similar to `name' field without any decoration.
`name' field contains some decoration such as `block in foo'.
`basename' only contains `foo'.
rb_iseq_t contains memory object of rb_location_t.
* iseq.c: setup rb_location_t for each rb_iseq_t memory objects.
* compile.c, proc.c, vm.c, vm_dump.c, vm_eval.c, vm_insnhelper.c,
vm_method.c: support about it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -767,8 +767,8 @@ vm_backtrace_each(rb_thread_t *th, int lev, void (*init)(void *), rb_backtrace_i rb_iseq_t *iseq = cfp->iseq; line_no = rb_vm_get_sourceline(cfp); - file = iseq->filename; - if ((*iter)(arg, file, line_no, iseq->name)) break; + file = iseq->location.filename; + if ((*iter)(arg, file, line_no, iseq->location.name)) break; } } else if (RUBYVM_CFUNC_FRAME_P(cfp)) { @@ -833,7 +833,7 @@ rb_sourcefilename(void) rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp); if (cfp) { - return cfp->iseq->filename; + return cfp->iseq->location.filename; } else { return Qnil; @@ -847,7 +847,7 @@ rb_sourcefile(void) rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp); if (cfp) { - return RSTRING_PTR(cfp->iseq->filename); + return RSTRING_PTR(cfp->iseq->location.filename); } else { return 0; @@ -1511,9 +1511,9 @@ rb_thread_current_status(const rb_thread_t *th) if (cfp->pc != 0) { rb_iseq_t *iseq = cfp->iseq; int line_no = rb_vm_get_sourceline(cfp); - char *file = RSTRING_PTR(iseq->filename); + char *file = RSTRING_PTR(iseq->location.filename); str = rb_sprintf("%s:%d:in `%s'", - file, line_no, RSTRING_PTR(iseq->name)); + file, line_no, RSTRING_PTR(iseq->location.name)); } } else if (cfp->me->def->original_id) { @@ -2258,7 +2258,7 @@ rb_vm_set_progname(VALUE filename) rb_thread_t *th = GET_VM()->main_thread; rb_control_frame_t *cfp = (void *)(th->stack + th->stack_size); --cfp; - cfp->iseq->filename = filename; + cfp->iseq->location.filename = filename; } #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE |