From 09cd3027e9989f9804fbe58543ebe5493160edf5 Mon Sep 17 00:00:00 2001 From: ValKmjolnir Date: Wed, 5 Feb 2025 17:56:57 +0800 Subject: [PATCH] :bug: exec_check also needs CHECK_INTERRUPT --- src/nasal_vm.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/nasal_vm.cpp b/src/nasal_vm.cpp index 1eee155..84df332 100644 --- a/src/nasal_vm.cpp +++ b/src/nasal_vm.cpp @@ -569,15 +569,15 @@ void vm::run(const codegen& gen, ); #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 - - // 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[] = { &&vmexit, &&repl, @@ -705,15 +705,16 @@ vmexit: return; #ifndef _MSC_VER -// may cause stackoverflow +// IR which may cause stackoverflow #define exec_check(op) {\ op();\ + CHECK_INTERRUPT;\ if (ctx.top