8355363: [BACKOUT] 8354668: Missing REX2 prefix accounting in ZGC barriers leads to incorrect encoding
Reviewed-by: chagedorn
This commit is contained in:
parent
263983d0fb
commit
c2e90bcc80
@ -391,8 +391,8 @@ void ZBarrierSetAssembler::store_barrier_fast(MacroAssembler* masm,
|
|||||||
if (rnew_zaddress != noreg) {
|
if (rnew_zaddress != noreg) {
|
||||||
// noreg means null; no need to color
|
// noreg means null; no need to color
|
||||||
__ movptr(rnew_zpointer, rnew_zaddress);
|
__ movptr(rnew_zpointer, rnew_zaddress);
|
||||||
|
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatLoadGoodBeforeShl);
|
||||||
__ shlq(rnew_zpointer, barrier_Relocation::unpatched);
|
__ shlq(rnew_zpointer, barrier_Relocation::unpatched);
|
||||||
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatLoadGoodAfterShX);
|
|
||||||
__ orq_imm32(rnew_zpointer, barrier_Relocation::unpatched);
|
__ orq_imm32(rnew_zpointer, barrier_Relocation::unpatched);
|
||||||
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatStoreGoodAfterOr);
|
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatStoreGoodAfterOr);
|
||||||
}
|
}
|
||||||
@ -969,13 +969,13 @@ void ZBarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm,
|
|||||||
#define __ ce->masm()->
|
#define __ ce->masm()->
|
||||||
|
|
||||||
static void z_uncolor(LIR_Assembler* ce, LIR_Opr ref) {
|
static void z_uncolor(LIR_Assembler* ce, LIR_Opr ref) {
|
||||||
|
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatLoadGoodBeforeShl);
|
||||||
__ shrq(ref->as_register(), barrier_Relocation::unpatched);
|
__ shrq(ref->as_register(), barrier_Relocation::unpatched);
|
||||||
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatLoadGoodAfterShX);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void z_color(LIR_Assembler* ce, LIR_Opr ref) {
|
static void z_color(LIR_Assembler* ce, LIR_Opr ref) {
|
||||||
|
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatLoadGoodBeforeShl);
|
||||||
__ shlq(ref->as_register(), barrier_Relocation::unpatched);
|
__ shlq(ref->as_register(), barrier_Relocation::unpatched);
|
||||||
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatLoadGoodAfterShX);
|
|
||||||
__ orq_imm32(ref->as_register(), barrier_Relocation::unpatched);
|
__ orq_imm32(ref->as_register(), barrier_Relocation::unpatched);
|
||||||
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatStoreGoodAfterOr);
|
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatStoreGoodAfterOr);
|
||||||
}
|
}
|
||||||
@ -1278,8 +1278,8 @@ void ZBarrierSetAssembler::generate_c2_store_barrier_stub(MacroAssembler* masm,
|
|||||||
|
|
||||||
static int patch_barrier_relocation_offset(int format) {
|
static int patch_barrier_relocation_offset(int format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case ZBarrierRelocationFormatLoadGoodAfterShX:
|
case ZBarrierRelocationFormatLoadGoodBeforeShl:
|
||||||
return -1;
|
return 3;
|
||||||
|
|
||||||
case ZBarrierRelocationFormatStoreGoodAfterCmp:
|
case ZBarrierRelocationFormatStoreGoodAfterCmp:
|
||||||
return -2;
|
return -2;
|
||||||
@ -1300,7 +1300,7 @@ static int patch_barrier_relocation_offset(int format) {
|
|||||||
|
|
||||||
static uint16_t patch_barrier_relocation_value(int format) {
|
static uint16_t patch_barrier_relocation_value(int format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case ZBarrierRelocationFormatLoadGoodAfterShX:
|
case ZBarrierRelocationFormatLoadGoodBeforeShl:
|
||||||
return (uint16_t)ZPointerLoadShift;
|
return (uint16_t)ZPointerLoadShift;
|
||||||
|
|
||||||
case ZBarrierRelocationFormatMarkBadAfterTest:
|
case ZBarrierRelocationFormatMarkBadAfterTest:
|
||||||
@ -1327,7 +1327,7 @@ void ZBarrierSetAssembler::patch_barrier_relocation(address addr, int format) {
|
|||||||
const int offset = patch_barrier_relocation_offset(format);
|
const int offset = patch_barrier_relocation_offset(format);
|
||||||
const uint16_t value = patch_barrier_relocation_value(format);
|
const uint16_t value = patch_barrier_relocation_value(format);
|
||||||
uint8_t* const patch_addr = (uint8_t*)addr + offset;
|
uint8_t* const patch_addr = (uint8_t*)addr + offset;
|
||||||
if (format == ZBarrierRelocationFormatLoadGoodAfterShX) {
|
if (format == ZBarrierRelocationFormatLoadGoodBeforeShl) {
|
||||||
*patch_addr = (uint8_t)value;
|
*patch_addr = (uint8_t)value;
|
||||||
} else {
|
} else {
|
||||||
*(uint16_t*)patch_addr = value;
|
*(uint16_t*)patch_addr = value;
|
||||||
|
@ -49,7 +49,7 @@ class ZLoadBarrierStubC2;
|
|||||||
class ZStoreBarrierStubC2;
|
class ZStoreBarrierStubC2;
|
||||||
#endif // COMPILER2
|
#endif // COMPILER2
|
||||||
|
|
||||||
const int ZBarrierRelocationFormatLoadGoodAfterShX = 0;
|
const int ZBarrierRelocationFormatLoadGoodBeforeShl = 0;
|
||||||
const int ZBarrierRelocationFormatLoadBadAfterTest = 1;
|
const int ZBarrierRelocationFormatLoadBadAfterTest = 1;
|
||||||
const int ZBarrierRelocationFormatMarkBadAfterTest = 2;
|
const int ZBarrierRelocationFormatMarkBadAfterTest = 2;
|
||||||
const int ZBarrierRelocationFormatStoreGoodAfterCmp = 3;
|
const int ZBarrierRelocationFormatStoreGoodAfterCmp = 3;
|
||||||
|
@ -35,15 +35,15 @@ source %{
|
|||||||
#include "gc/z/zBarrierSetAssembler.hpp"
|
#include "gc/z/zBarrierSetAssembler.hpp"
|
||||||
|
|
||||||
static void z_color(MacroAssembler* masm, const MachNode* node, Register ref) {
|
static void z_color(MacroAssembler* masm, const MachNode* node, Register ref) {
|
||||||
|
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatLoadGoodBeforeShl);
|
||||||
__ shlq(ref, barrier_Relocation::unpatched);
|
__ shlq(ref, barrier_Relocation::unpatched);
|
||||||
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatLoadGoodAfterShX);
|
|
||||||
__ orq_imm32(ref, barrier_Relocation::unpatched);
|
__ orq_imm32(ref, barrier_Relocation::unpatched);
|
||||||
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatStoreGoodAfterOr);
|
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatStoreGoodAfterOr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void z_uncolor(MacroAssembler* masm, const MachNode* node, Register ref) {
|
static void z_uncolor(MacroAssembler* masm, const MachNode* node, Register ref) {
|
||||||
|
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatLoadGoodBeforeShl);
|
||||||
__ shrq(ref, barrier_Relocation::unpatched);
|
__ shrq(ref, barrier_Relocation::unpatched);
|
||||||
__ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatLoadGoodAfterShX);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void z_keep_alive_load_barrier(MacroAssembler* masm, const MachNode* node, Address ref_addr, Register ref) {
|
static void z_keep_alive_load_barrier(MacroAssembler* masm, const MachNode* node, Address ref_addr, Register ref) {
|
||||||
|
@ -221,7 +221,7 @@ bool CodeInstaller::pd_relocate(address pc, jint mark) {
|
|||||||
return true;
|
return true;
|
||||||
#if INCLUDE_ZGC
|
#if INCLUDE_ZGC
|
||||||
case Z_BARRIER_RELOCATION_FORMAT_LOAD_GOOD_BEFORE_SHL:
|
case Z_BARRIER_RELOCATION_FORMAT_LOAD_GOOD_BEFORE_SHL:
|
||||||
_instructions->relocate(pc, barrier_Relocation::spec(), ZBarrierRelocationFormatLoadGoodAfterShX);
|
_instructions->relocate(pc, barrier_Relocation::spec(), ZBarrierRelocationFormatLoadGoodBeforeShl);
|
||||||
return true;
|
return true;
|
||||||
case Z_BARRIER_RELOCATION_FORMAT_LOAD_BAD_AFTER_TEST:
|
case Z_BARRIER_RELOCATION_FORMAT_LOAD_BAD_AFTER_TEST:
|
||||||
_instructions->relocate(pc, barrier_Relocation::spec(), ZBarrierRelocationFormatLoadBadAfterTest);
|
_instructions->relocate(pc, barrier_Relocation::spec(), ZBarrierRelocationFormatLoadBadAfterTest);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user