Skip to content

Commit

Permalink
Guard a call to VMwrtbarWithoutStoreEvaluator
Browse files Browse the repository at this point in the history
Guard a call to VMwrtbarWithoutStoreEvaluator (which is only
compatible with non-realtime GC) to ensure it is not called
under realtime GC.

Signed-off-by: Dylan Tuttle <[email protected]>
  • Loading branch information
dylanjtuttle committed Sep 6, 2023
1 parent 999dfbc commit c6c8af3
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions runtime/compiler/x/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9703,11 +9703,24 @@ static TR::Register* inlineCompareAndSwapObjectNative(TR::Node* node, TR::CodeGe
generateRegInstruction(TR::InstOpCode::SETE1Reg, node, result, cg);
generateRegRegInstruction(TR::InstOpCode::MOVZXReg4Reg1, node, result, result, cg);

// We could insert a runtime test for whether the write actually succeeded or not.
// However, since in practice it will almost always succeed we do not want to
// penalize general runtime performance especially if it is still correct to do
// a write barrier even if the store never actually happened.
TR::TreeEvaluator::VMwrtbarWithoutStoreEvaluator(node, objectNode, newValueNode, NULL, cg->generateScratchRegisterManager(), cg);
// Non-realtime: Generate a write barrier for this kind of object.
//
if (!comp->getOptions()->realTimeGC())
{
// We could insert a runtime test for whether the write actually succeeded or not.
// However, since in practice it will almost always succeed we do not want to
// penalize general runtime performance especially if it is still correct to do
// a write barrier even if the store never actually happened.
TR_X86ScratchRegisterManager *scratchRegisterManager = cg->generateScratchRegisterManager();

TR::TreeEvaluator::VMwrtbarWithoutStoreEvaluator(
node,
objectNode,
newValueNode,
NULL,
scratchRegisterManager,
cg);
}

cg->stopUsingRegister(tmp);
cg->stopUsingRegister(EAX);
Expand Down

0 comments on commit c6c8af3

Please sign in to comment.