From 63d9d81bd25c2d0050b96793805d1b981300823e Mon Sep 17 00:00:00 2001 From: gambas Date: Wed, 13 Mar 2019 12:59:14 +0100 Subject: [PATCH] Disabling JIT compiler works correctly again. [INTERPRETER] * BUG: Disabling JIT compiler works correctly again. --- main/gbx/gbx_exec.c | 5 +---- main/gbx/gbx_exec_loop.c | 9 +++------ main/gbx/gbx_jit.c | 8 +++++--- main/gbx/gbx_jit.h | 2 +- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/main/gbx/gbx_exec.c b/main/gbx/gbx_exec.c index c5b6990ea..4e0823bbd 100644 --- a/main/gbx/gbx_exec.c +++ b/main/gbx/gbx_exec.c @@ -879,11 +879,8 @@ static void error_EXEC_function_real(void) void EXEC_function_real() { EXEC.func = &EXEC.class->load->func[EXEC.index]; - if (EXEC.func->fast) - { - JIT_exec(FALSE); + if (EXEC.func->fast && !JIT_exec(FALSE)) return; - } // We need to push a void frame, because EXEC_leave looks at *PC to know if a return value is expected STACK_push_frame(&EXEC_current, 0); diff --git a/main/gbx/gbx_exec_loop.c b/main/gbx/gbx_exec_loop.c index 7189740d8..98a6acaa5 100644 --- a/main/gbx/gbx_exec_loop.c +++ b/main/gbx/gbx_exec_loop.c @@ -1145,9 +1145,8 @@ _CALL: __EXEC_ENTER: - if (EXEC.func->fast) + if (EXEC.func->fast && !JIT_exec(TRUE)) { - JIT_exec(TRUE); goto _NEXT; } else @@ -1231,9 +1230,8 @@ _CALL: EXEC.class = EXEC.desc->class; EXEC.func = &EXEC.class->load->func[EXEC.index]; - if (EXEC.func->fast) + if (EXEC.func->fast && !JIT_exec(TRUE)) { - JIT_exec(TRUE); goto _NEXT; } else @@ -1411,9 +1409,8 @@ _CALL_SLOW: EXEC.func = &EXEC.class->load->func[EXEC.index]; - if (EXEC.func->fast) + if (EXEC.func->fast && !JIT_exec(TRUE)) { - JIT_exec(TRUE); goto _NEXT; } else diff --git a/main/gbx/gbx_jit.c b/main/gbx/gbx_jit.c index 1931ec467..414d01eec 100644 --- a/main/gbx/gbx_jit.c +++ b/main/gbx/gbx_jit.c @@ -61,7 +61,7 @@ void JIT_abort(void) { static GB_FUNCTION _func; - if (!_component_loaded) + if (!_component_loaded || JIT_disabled) return; if (GB_GetFunction(&_func, CLASS_find_global("Jit"), "_Abort", NULL, NULL)) @@ -232,7 +232,7 @@ static bool create_function(CLASS *class, int index) } -void JIT_exec(bool ret_on_stack) +bool JIT_exec(bool ret_on_stack) { VALUE *sp = SP; JIT_FUNCTION *jit; @@ -250,7 +250,7 @@ void JIT_exec(bool ret_on_stack) if (!func->fast_linked) { if (create_function(class, EXEC.index)) - return; + return TRUE; } STACK_push_frame(&EXEC_current, func->stack_usage); @@ -309,6 +309,8 @@ void JIT_exec(bool ret_on_stack) *SP++ = ret; ret.type = T_VOID; } + + return FALSE; } PCODE *JIT_get_code(FUNCTION *func) diff --git a/main/gbx/gbx_jit.h b/main/gbx/gbx_jit.h index 9c992359c..3efb78579 100644 --- a/main/gbx/gbx_jit.h +++ b/main/gbx/gbx_jit.h @@ -40,7 +40,7 @@ extern bool JIT_disabled; void JIT_compile(ARCHIVE *arch); void JIT_debug(const char *fmt, ...); -void JIT_exec(bool ret_on_stack); +bool JIT_exec(bool ret_on_stack); PCODE *JIT_get_code(FUNCTION *func); CLASS_CONST *JIT_get_constant(int index); void *JIT_get_class_ref(int index);