Fix JIT compilation when there are a lot of functions.

[INTERPRETER]
* BUG: Fix JIT compilation when there are a lot of functions.
This commit is contained in:
gambas 2019-08-21 22:08:45 +02:00
parent 69231c5ab6
commit 411ee75e7d

View file

@ -186,6 +186,7 @@ static bool create_function(CLASS *class, int index)
int i;
int len;
char *name;
int jit_index;
arch = class->component ? class->component->archive : NULL;
@ -232,12 +233,13 @@ static bool create_function(CLASS *class, int index)
if (!_jit_func)
ARRAY_create(&_jit_func);
jit_index = ARRAY_count(_jit_func);
jit = (JIT_FUNCTION *)ARRAY_add(&_jit_func);
jit->addr = addr;
jit->code = func->code;
func->code = (PCODE *)jit;
func->code = (PCODE *)(intptr_t)jit_index;
return FALSE;
}
@ -271,7 +273,7 @@ bool JIT_exec(bool ret_on_stack)
FP = func;
EC = NULL;
jit = (JIT_FUNCTION *)(func->code);
jit = &_jit_func[(intptr_t)func->code];
PROFILE_ENTER_FUNCTION();
@ -327,7 +329,7 @@ bool JIT_exec(bool ret_on_stack)
PCODE *JIT_get_code(FUNCTION *func)
{
if (func->fast_linked)
return ((JIT_FUNCTION *)(func->code))->code;
return _jit_func[(intptr_t)func->code].code;
else
return func->code;
}