From d2883d370f0fdf118d4e3cd3df8a9a4958f254e5 Mon Sep 17 00:00:00 2001 From: Abdulrahman Alattas Date: Wed, 9 Oct 2024 11:10:24 -0400 Subject: [PATCH] Add the correct address as ClassUnloading PicSite in POWER LE POWER patches class unload constants by `address |= 1` of a 32bit value given it might be an instruction, to correctly invalidate the constant we offset the `acursor` differently for LE and BE to overwrite the least-significant bit in the constant. Signed-off-by: Abdulrahman Alattas --- compiler/p/codegen/OMRConstantDataSnippet.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/p/codegen/OMRConstantDataSnippet.cpp b/compiler/p/codegen/OMRConstantDataSnippet.cpp index 3c4e8a3473..05229a8d22 100644 --- a/compiler/p/codegen/OMRConstantDataSnippet.cpp +++ b/compiler/p/codegen/OMRConstantDataSnippet.cpp @@ -300,8 +300,11 @@ OMR::ConstantDataSnippet::emitAddressConstant(PPCConstant *acursor, ui { // Register an unload assumption on the lower 32bit of the class constant. // The patching code thinks it's low bit tagging an instruction not a class pointer!! + int PICOffset = 0; // For LE or BE 32-bit + if (cg()->comp()->target().cpu.isBigEndian() && cg()->comp()->target().is64Bit()) + PICOffset = 4; cg()-> - jitAddPicToPatchOnClassUnload((void *)acursor->getConstantValue(), (void *)(codeCursor+((cg()->comp()->target().is64Bit())?4:0)) ); + jitAddPicToPatchOnClassUnload((void *)acursor->getConstantValue(), (void *)(codeCursor+PICOffset)); } }