From 82702eb07f8593b93116a2a82fca2619659de0e1 Mon Sep 17 00:00:00 2001 From: howsohazard <143410553+howsohazard@users.noreply.github.com> Date: Tue, 23 Jul 2024 16:14:17 -0400 Subject: [PATCH] 21018: Fixes issue where while opcode could be stuck in an infinite loop with performance constraints (#192) --- src/Amalgam/interpreter/InterpreterOpcodesBase.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Amalgam/interpreter/InterpreterOpcodesBase.cpp b/src/Amalgam/interpreter/InterpreterOpcodesBase.cpp index a3ec09a3..c7f1770e 100644 --- a/src/Amalgam/interpreter/InterpreterOpcodesBase.cpp +++ b/src/Amalgam/interpreter/InterpreterOpcodesBase.cpp @@ -574,7 +574,9 @@ EvaluableNodeReference Interpreter::InterpretNode_ENT_WHILE(EvaluableNode *en, b if(!condition_true) break; - if(AreExecutionResourcesExhausted()) + //count an extra cycle for each loop + //this ensures that even if all of the nodes are immediate, it'll still count the performance + if(AreExecutionResourcesExhausted(true)) return EvaluableNodeReference::Null(); SetTopPreviousResultInConstructionStack(previous_result);