diff options
author | Peter Zhu <[email protected]> | 2022-03-23 15:19:48 -0400 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2022-03-24 10:03:51 -0400 |
commit | 5f10bd634fb6ae8f74a4ea730176233b0ca96954 (patch) | |
tree | 170c1c81ea63184290c9e021cc45bffbfc3f4f41 /vm_dump.c | |
parent | 04591e1be7618f64bd3bed8c53c0fcde5fcbddb8 (diff) |
Add ISEQ_BODY macro
Use ISEQ_BODY macro to get the rb_iseq_constant_body of the ISeq. Using
this macro will make it easier for us to change the allocation strategy
of rb_iseq_constant_body when using Variable Width Allocation.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5698
Diffstat (limited to 'vm_dump.c')
-rw-r--r-- | vm_dump.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -118,8 +118,8 @@ control_frame_dump(const rb_execution_context_t *ec, const rb_control_frame_t *c } else { iseq = cfp->iseq; - pc = cfp->pc - iseq->body->iseq_encoded; - iseq_name = RSTRING_PTR(iseq->body->location.label); + pc = cfp->pc - ISEQ_BODY(iseq)->iseq_encoded; + iseq_name = RSTRING_PTR(ISEQ_BODY(iseq)->location.label); line = rb_vm_get_sourceline(cfp); if (line) { snprintf(posbuf, MAX_POSBUF, "%s:%d", RSTRING_PTR(rb_iseq_path(iseq)), line); @@ -178,12 +178,12 @@ control_frame_dump(const rb_execution_context_t *ec, const rb_control_frame_t *c fprintf(stderr, " self: %s\n", rb_raw_obj_info(buff, 0x100, cfp->self)); if (iseq) { - if (iseq->body->local_table_size > 0) { + if (ISEQ_BODY(iseq)->local_table_size > 0) { fprintf(stderr, " lvars:\n"); - for (unsigned int i=0; i<iseq->body->local_table_size; i++) { - const VALUE *argv = cfp->ep - cfp->iseq->body->local_table_size - VM_ENV_DATA_SIZE + 1; + for (unsigned int i=0; i<ISEQ_BODY(iseq)->local_table_size; i++) { + const VALUE *argv = cfp->ep - ISEQ_BODY(cfp->iseq)->local_table_size - VM_ENV_DATA_SIZE + 1; fprintf(stderr, " %s: %s\n", - rb_id2name(iseq->body->local_table[i]), + rb_id2name(ISEQ_BODY(iseq)->local_table[i]), rb_raw_obj_info(buff, 0x100, argv[i])); } } @@ -278,9 +278,9 @@ static const VALUE * vm_base_ptr(const rb_control_frame_t *cfp) { const rb_control_frame_t *prev_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); - const VALUE *bp = prev_cfp->sp + cfp->iseq->body->local_table_size + VM_ENV_DATA_SIZE; + const VALUE *bp = prev_cfp->sp + ISEQ_BODY(cfp->iseq)->local_table_size + VM_ENV_DATA_SIZE; - if (cfp->iseq->body->type == ISEQ_TYPE_METHOD) { + if (ISEQ_BODY(cfp->iseq)->type == ISEQ_TYPE_METHOD) { bp += 1; } return bp; @@ -296,8 +296,8 @@ vm_stack_dump_each(const rb_execution_context_t *ec, const rb_control_frame_t *c if (VM_FRAME_RUBYFRAME_P(cfp)) { const rb_iseq_t *iseq = cfp->iseq; - argc = iseq->body->param.lead_num; - local_table_size = iseq->body->local_table_size; + argc = ISEQ_BODY(iseq)->param.lead_num; + local_table_size = ISEQ_BODY(iseq)->local_table_size; } /* stack trace header */ @@ -366,7 +366,7 @@ rb_vmdebug_debug_print_register(const rb_execution_context_t *ec) ptrdiff_t cfpi; if (VM_FRAME_RUBYFRAME_P(cfp)) { - pc = cfp->pc - cfp->iseq->body->iseq_encoded; + pc = cfp->pc - ISEQ_BODY(cfp->iseq)->iseq_encoded; } if (ep < 0 || (size_t)ep > ec->vm_stack_size) { @@ -390,7 +390,7 @@ rb_vmdebug_debug_print_pre(const rb_execution_context_t *ec, const rb_control_fr const rb_iseq_t *iseq = cfp->iseq; if (iseq != 0) { - ptrdiff_t pc = _pc - iseq->body->iseq_encoded; + ptrdiff_t pc = _pc - ISEQ_BODY(iseq)->iseq_encoded; int i; for (i=0; i<(int)VM_CFP_CNT(ec, cfp); i++) { |