diff options
author | 卜部昌平 <[email protected]> | 2020-07-06 15:10:10 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2020-07-10 12:23:41 +0900 |
commit | 0e276dc458f94d9d79a0f7c7669bde84abe80f21 (patch) | |
tree | fb1d6fe1bb5dd271e1331466fd45d672136b53cb /vm_insnhelper.c | |
parent | 215c6fa3d012221d89420cbdf1416f65d7179a24 (diff) |
vm_push_frame: move assignments around
Struct assignment using a compound literal is more readable than before,
to me at least. It seems compilers reorder assignments anyways.
Neither speedup nor slowdown is observed on my machine.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3296
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index fffe5407fe..e026667af9 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -352,14 +352,6 @@ vm_push_frame(rb_execution_context_t *ec, CHECK_VM_STACK_OVERFLOW0(cfp, sp, local_size + stack_max); vm_check_canary(ec, sp); - ec->cfp = cfp; - - /* setup new frame */ - cfp->pc = (VALUE *)pc; - cfp->iseq = (rb_iseq_t *)iseq; - cfp->self = self; - cfp->block_code = NULL; - /* setup vm value stack */ /* initialize local variables */ @@ -370,15 +362,23 @@ vm_push_frame(rb_execution_context_t *ec, /* setup ep with managing data */ *sp++ = cref_or_me; /* ep[-2] / Qnil or T_IMEMO(cref) or T_IMEMO(ment) */ *sp++ = specval /* ep[-1] / block handler or prev env ptr */; - *sp = type; /* ep[-0] / ENV_FLAGS */ - - /* Store initial value of ep as bp to skip calculation cost of bp on JIT cancellation. */ - cfp->ep = sp; - cfp->__bp__ = cfp->sp = sp + 1; + *sp++ = type; /* ep[-0] / ENV_FLAGS */ + /* setup new frame */ + *cfp = (const struct rb_control_frame_struct) { + .pc = pc, + .sp = sp, + .iseq = iseq, + .self = self, + .ep = sp - 1, + .block_code = NULL, + .__bp__ = sp, /* Store initial value of ep as bp to skip calculation cost of bp on JIT cancellation. */ #if VM_DEBUG_BP_CHECK - cfp->bp_check = sp + 1; + .bp_check = sp, #endif + }; + + ec->cfp = cfp; if (VMDEBUG == 2) { SDR(); |