mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
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.
This commit is contained in:
parent
04591e1be7
commit
5f10bd634f
Notes:
git
2022-03-24 23:04:20 +09:00
28 changed files with 601 additions and 601 deletions
24
vm_dump.c
24
vm_dump.c
|
@ -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++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue