[INTERPRETER]
* NEW: JIT: Support for QUIT and STOP EVENT instructions. [GB.JIT] * NEW: Implement QUIT and STOP EVENT instructions.
This commit is contained in:
parent
29d94d3feb
commit
128b5de2f2
@ -47,6 +47,7 @@ typedef
|
||||
void **cp;
|
||||
char **op;
|
||||
GB_VALUE *ret;
|
||||
bool *exec_debug;
|
||||
void (*debug)(const char *fmt, ...);
|
||||
JIT_PCODE *(*get_code)(void *class, int index);
|
||||
void (*throw)(int code, ...) NORETURN;
|
||||
@ -75,6 +76,8 @@ typedef
|
||||
void (*push_complex)(void);
|
||||
void (*push_vargs)(void);
|
||||
void (*pop_vargs)(void);
|
||||
void (*exec_quit)(ushort code);
|
||||
void (*exec_break)(ushort code);
|
||||
}
|
||||
JIT_INTERFACE;
|
||||
|
||||
|
@ -340,6 +340,7 @@ const void *const GAMBAS_JitApi[] =
|
||||
(void *)&CP,
|
||||
(void *)&OP,
|
||||
(void *)&TEMP,
|
||||
(void *)&EXEC_debug,
|
||||
(void *)JIT_debug,
|
||||
(void *)JIT_get_code,
|
||||
(void *)THROW,
|
||||
@ -368,6 +369,8 @@ const void *const GAMBAS_JitApi[] =
|
||||
(void *)EXEC_push_complex,
|
||||
(void *)EXEC_push_vargs,
|
||||
(void *)EXEC_drop_vargs,
|
||||
(void *)EXEC_quit,
|
||||
(void *)EXEC_break,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -1943,7 +1943,7 @@ void EXEC_new(ushort code)
|
||||
}
|
||||
|
||||
|
||||
void EXEC_quit(void)
|
||||
void EXEC_do_quit(void)
|
||||
{
|
||||
GAMBAS_DoNotRaiseEvent = TRUE;
|
||||
|
||||
|
@ -239,7 +239,7 @@ void *EXEC_create_object(CLASS *class, int np, char *event);
|
||||
void EXEC_new(ushort code);
|
||||
|
||||
void EXEC_release_return_value(void);
|
||||
void EXEC_quit(void);
|
||||
void EXEC_do_quit(void);
|
||||
|
||||
void EXEC_dup(int n);
|
||||
|
||||
@ -345,6 +345,9 @@ void SUBR_left(ushort code);
|
||||
void SUBR_mid(ushort code);
|
||||
void SUBR_right(ushort code);
|
||||
|
||||
void EXEC_quit(ushort code);
|
||||
void EXEC_break(ushort code);
|
||||
|
||||
void EXEC_push_array(ushort code);
|
||||
void EXEC_pop_array(ushort code);
|
||||
|
||||
|
@ -66,8 +66,6 @@
|
||||
|
||||
static void my_VALUE_class_read(CLASS *class, VALUE *value, char *addr, CTYPE ctype, void *ref);
|
||||
static void my_VALUE_class_constant(CLASS *class, VALUE *value, int ind);
|
||||
static void _quit(ushort code);
|
||||
static void _break(ushort code);
|
||||
|
||||
//static void _SUBR_comp(ushort code);
|
||||
static void _SUBR_compe(ushort code);
|
||||
@ -1860,14 +1858,14 @@ _CATCH:
|
||||
|
||||
_BREAK:
|
||||
|
||||
_break(code);
|
||||
EXEC_break(code);
|
||||
goto _NEXT;
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
|
||||
_QUIT:
|
||||
|
||||
_quit(code);
|
||||
EXEC_quit(code);
|
||||
goto _NEXT;
|
||||
|
||||
/*-----------------------------------------------*/
|
||||
@ -3927,12 +3925,12 @@ __POP_ARRAY_2:
|
||||
POP(); /* free the object */
|
||||
}
|
||||
|
||||
static void _quit(ushort code)
|
||||
void EXEC_quit(ushort code)
|
||||
{
|
||||
switch(code & 3)
|
||||
{
|
||||
case 0:
|
||||
EXEC_quit();
|
||||
EXEC_do_quit();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@ -3948,12 +3946,12 @@ static void _quit(ushort code)
|
||||
VALUE_conv(&SP[-1], T_BYTE);
|
||||
SP--;
|
||||
EXEC_quit_value = (uchar)SP->_integer.value;
|
||||
EXEC_quit();
|
||||
EXEC_do_quit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void _break(ushort code)
|
||||
void EXEC_break(ushort code)
|
||||
{
|
||||
if (EXEC_debug)
|
||||
{
|
||||
|
@ -386,3 +386,5 @@ enum
|
||||
#define ERROR_handler (*(ERROR_HANDLER **)(JIT.error_handler))
|
||||
#define ERROR_reset JIT.error_reset
|
||||
|
||||
#define BREAK(_pc, _code) (PC = &pc[_pc], SP = sp, JIT.exec_break(_code))
|
||||
#define QUIT(_code) (SP = sp, JIT.exec_quit(_code))
|
||||
|
@ -2656,11 +2656,27 @@ _SUBR_BIT:
|
||||
|
||||
_BREAK:
|
||||
|
||||
/*if (*(JIT.exec_debug))
|
||||
JIT_print(" BREAK(%d,0x%04X);\n", _pc, code);*/
|
||||
goto _MAIN;
|
||||
|
||||
_QUIT:
|
||||
|
||||
JIT_print(" ");
|
||||
|
||||
if ((code & 3) == 3)
|
||||
{
|
||||
check_stack(1);
|
||||
JIT_print("%s,", push_expr(-1, T_BYTE));
|
||||
pop_stack(1);
|
||||
}
|
||||
|
||||
JIT_print(" QUIT(0x%04X);\n", code);
|
||||
goto _MAIN;
|
||||
|
||||
_TRY:
|
||||
|
||||
JIT_print(" TRY {\n", _pc);
|
||||
JIT_print(" TRY {\n");
|
||||
p++;
|
||||
goto _MAIN;
|
||||
|
||||
@ -2723,7 +2739,6 @@ _ON_GOTO_GOSUB:
|
||||
_PUSH_EVENT:
|
||||
_PUSH_EXTERN:
|
||||
_BYREF:
|
||||
_QUIT:
|
||||
_CALL_QUICK:
|
||||
_CALL_SLOW:
|
||||
_ILLEGAL:
|
||||
|
Loading…
x
Reference in New Issue
Block a user