🐛 exec_check also needs CHECK_INTERRUPT
This commit is contained in:
parent
e405c3e6d4
commit
09cd3027e9
|
@ -569,15 +569,15 @@ void vm::run(const codegen& gen,
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
|
|
||||||
|
// interrupt check macro for computed goto mode.
|
||||||
|
#define CHECK_INTERRUPT { \
|
||||||
|
if (interrupt_ptr && interrupt_ptr->load()) { \
|
||||||
|
throw std::runtime_error("VM execution interrupted by timeout"); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
// using labels as values/computed goto
|
// using labels as values/computed goto
|
||||||
|
|
||||||
// Define an interrupt check macro for computed goto mode.
|
|
||||||
#define CHECK_INTERRUPT { \
|
|
||||||
if (interrupt_ptr && interrupt_ptr->load()) { \
|
|
||||||
throw std::runtime_error("VM execution interrupted by timeout"); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
const void* oprs[] = {
|
const void* oprs[] = {
|
||||||
&&vmexit,
|
&&vmexit,
|
||||||
&&repl,
|
&&repl,
|
||||||
|
@ -705,15 +705,16 @@ vmexit:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
// may cause stackoverflow
|
// IR which may cause stackoverflow
|
||||||
#define exec_check(op) {\
|
#define exec_check(op) {\
|
||||||
op();\
|
op();\
|
||||||
|
CHECK_INTERRUPT;\
|
||||||
if (ctx.top<ctx.canary)\
|
if (ctx.top<ctx.canary)\
|
||||||
goto *code[++ctx.pc];\
|
goto *code[++ctx.pc];\
|
||||||
die("stack overflow");\
|
die("stack overflow");\
|
||||||
goto *code[++ctx.pc];\
|
goto *code[++ctx.pc];\
|
||||||
}
|
}
|
||||||
// do not cause stackoverflow
|
// IR which does not cause stackoverflow
|
||||||
#define exec_nodie(op) {\
|
#define exec_nodie(op) {\
|
||||||
op();\
|
op();\
|
||||||
CHECK_INTERRUPT;\
|
CHECK_INTERRUPT;\
|
||||||
|
|
Loading…
Reference in New Issue