1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Revert "vm_insnhelper.h: simplify EXEC_EC_CFP implementation"

This reverts commit r64711, because EXEC_EC_CFP on JIT-ed code does not
call jit_func with the patch when catch_except_p is true. It wasn't intentional.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2018-09-13 07:12:07 +00:00
parent 8bc5c172f9
commit 26a11ae771
4 changed files with 9 additions and 7 deletions

4
mjit.h
View file

@ -89,7 +89,7 @@ mjit_target_iseq_p(struct rb_iseq_constant_body *body)
/* Try to execute the current iseq in ec. Use JIT code if it is ready. /* Try to execute the current iseq in ec. Use JIT code if it is ready.
If it is not, add ISEQ to the compilation queue and return Qundef. */ If it is not, add ISEQ to the compilation queue and return Qundef. */
static inline VALUE static inline VALUE
mjit_exec(rb_execution_context_t *ec, int guard_except_p) mjit_exec(rb_execution_context_t *ec)
{ {
const rb_iseq_t *iseq; const rb_iseq_t *iseq;
struct rb_iseq_constant_body *body; struct rb_iseq_constant_body *body;
@ -102,8 +102,6 @@ mjit_exec(rb_execution_context_t *ec, int guard_except_p)
iseq = ec->cfp->iseq; iseq = ec->cfp->iseq;
body = iseq->body; body = iseq->body;
total_calls = ++body->total_calls; total_calls = ++body->total_calls;
if (guard_except_p && body->catch_except_p)
return Qundef;
func = body->jit_func; func = body->jit_func;
if (UNLIKELY((uintptr_t)func <= (uintptr_t)LAST_JIT_ISEQ_FUNC)) { if (UNLIKELY((uintptr_t)func <= (uintptr_t)LAST_JIT_ISEQ_FUNC)) {

View file

@ -60,7 +60,7 @@
fprintf(f, " v = vm_exec(ec, TRUE);\n"); fprintf(f, " v = vm_exec(ec, TRUE);\n");
} }
else { else {
fprintf(f, " if ((v = mjit_exec(ec, FALSE)) == Qundef) {\n"); fprintf(f, " if ((v = mjit_exec(ec)) == Qundef) {\n");
fprintf(f, " VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n"); /* This is vm_call0_body's code after vm_call_iseq_setup */ fprintf(f, " VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH);\n"); /* This is vm_call0_body's code after vm_call_iseq_setup */
fprintf(f, " v = vm_exec(ec, FALSE);\n"); fprintf(f, " v = vm_exec(ec, FALSE);\n");
fprintf(f, " }\n"); fprintf(f, " }\n");

2
vm.c
View file

@ -1806,7 +1806,7 @@ vm_exec(rb_execution_context_t *ec, int mjit_enable_p)
_tag.retval = Qnil; _tag.retval = Qnil;
if ((state = EC_EXEC_TAG()) == TAG_NONE) { if ((state = EC_EXEC_TAG()) == TAG_NONE) {
if (!mjit_enable_p || (result = mjit_exec(ec, FALSE)) == Qundef) { if (!mjit_enable_p || (result = mjit_exec(ec)) == Qundef) {
result = vm_exec_core(ec, initial); result = vm_exec_core(ec, initial);
} }
goto vm_loop_start; /* fallback to the VM */ goto vm_loop_start; /* fallback to the VM */

View file

@ -144,7 +144,11 @@ enum vm_regan_acttype {
the caller frame may have stack values in the local variables and the cancelling the caller frame may have stack values in the local variables and the cancelling
the caller frame will purge them. But directly calling mjit_exec is faster... */ the caller frame will purge them. But directly calling mjit_exec is faster... */
#define EXEC_EC_CFP(val) do { \ #define EXEC_EC_CFP(val) do { \
if ((val = mjit_exec(ec, TRUE)) == Qundef) { \ if (ec->cfp->iseq->body->catch_except_p) { \
VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH); \
val = vm_exec(ec, TRUE); \
} \
else if ((val = mjit_exec(ec)) == Qundef) { \
VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH); \ VM_ENV_FLAGS_SET(ec->cfp->ep, VM_FRAME_FLAG_FINISH); \
val = vm_exec(ec, FALSE); \ val = vm_exec(ec, FALSE); \
} \ } \
@ -153,7 +157,7 @@ enum vm_regan_acttype {
/* When calling from VM, longjmp in the callee won't purge any JIT-ed caller frames. /* When calling from VM, longjmp in the callee won't purge any JIT-ed caller frames.
So it's safe to directly call mjit_exec. */ So it's safe to directly call mjit_exec. */
#define EXEC_EC_CFP(val) do { \ #define EXEC_EC_CFP(val) do { \
if ((val = mjit_exec(ec, FALSE)) == Qundef) { \ if ((val = mjit_exec(ec)) == Qundef) { \
RESTORE_REGS(); \ RESTORE_REGS(); \
NEXT_INSN(); \ NEXT_INSN(); \
} \ } \