From 0a099577fc03f490a0c0f7bdd6205047bf699fa2 Mon Sep 17 00:00:00 2001 From: Abdulrahman Alattas Date: Tue, 29 Nov 2022 10:19:23 -0700 Subject: [PATCH] Check sequence boundary before generating next sequence transition Signed-off-by: Abdulrahman Alattas --- runtime/compiler/p/codegen/J9TreeEvaluator.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/runtime/compiler/p/codegen/J9TreeEvaluator.cpp b/runtime/compiler/p/codegen/J9TreeEvaluator.cpp index 47b22dce017..f412095738f 100644 --- a/runtime/compiler/p/codegen/J9TreeEvaluator.cpp +++ b/runtime/compiler/p/codegen/J9TreeEvaluator.cpp @@ -4090,15 +4090,14 @@ TR::Register *J9::Power::TreeEvaluator::VMinstanceOfEvaluator(TR::Node *node, TR break; } - genInstanceOfTransitionToNextSequence(node, iter, nextSequenceLabel, doneLabel, cr0Reg, resultReg, initialResult, oppositeResultLabel, profiledClassIsInstanceOf, cg); - - --numSequencesRemaining; - ++iter; - - if (*iter != HelperCall) + if (--numSequencesRemaining > 0) { - generateLabelInstruction(cg, TR::InstOpCode::label, node, nextSequenceLabel); - nextSequenceLabel = generateLabelSymbol(cg); + genInstanceOfTransitionToNextSequence(node, iter, nextSequenceLabel, doneLabel, cr0Reg, resultReg, initialResult, oppositeResultLabel, profiledClassIsInstanceOf, cg); + if (*++iter != HelperCall) + { + generateLabelInstruction(cg, TR::InstOpCode::label, node, nextSequenceLabel); + nextSequenceLabel = generateLabelSymbol(cg); + } } }