Ignore errors when loading a class for the JIT compiler.

[INTERPRETER]
* BUG: Ignore errors when loading a class for the JIT compiler.

[GB.JIT]
* BUG: Loading a class during JIT compilation can fail. Take that into account.
This commit is contained in:
gambas 2019-06-11 22:32:12 +02:00
parent a1d9ffc57d
commit ce37d6ff67
4 changed files with 19 additions and 2 deletions

View file

@ -362,7 +362,7 @@ const void *const GAMBAS_JitApi[] =
(void *)EXEC_enum_next,
(void *)SYMBOL_find,
(void *)JIT_load_class,
(void *)CLASS_load_without_init,
(void *)JIT_load_class_without_init,
(void *)&ERROR_current,
(void *)&ERROR_handler,
(void *)ERROR_reset,

View file

@ -391,3 +391,16 @@ void JIT_load_class(CLASS *class)
{
CLASS_load(class);
}
void JIT_load_class_without_init(CLASS *class)
{
TRY
{
CLASS_load_without_init(class);
}
CATCH
{
class->error = FALSE;
}
END_TRY
}

View file

@ -54,5 +54,6 @@ void JIT_exit(void);
bool JIT_can_compile(ARCHIVE *arch);
void JIT_load_class(CLASS *class);
void JIT_load_class_without_init(CLASS *class);
#endif

View file

@ -545,7 +545,10 @@ void JIT_load_class_without_init(CLASS *class)
int JIT_find_symbol(CLASS *class, const char *name)
{
JIT_load_class_without_init(class);
return JIT.find_symbol(class->table, class->sort, class->n_desc, sizeof(CLASS_DESC_SYMBOL), TF_IGNORE_CASE, name, strlen(name), NULL);
if (class->loaded)
return JIT.find_symbol(class->table, class->sort, class->n_desc, sizeof(CLASS_DESC_SYMBOL), TF_IGNORE_CASE, name, strlen(name), NULL);
else
return NO_SYMBOL;
}