From 1be176f5a78750e2f0e32470f8c83e3d1643954d Mon Sep 17 00:00:00 2001 From: Santiago Aboy Solanes Date: Tue, 23 Jan 2024 13:55:50 +0000 Subject: Revert^5 "Disable write-barrier elimination pass" This reverts commit 31b949bc4a76e5c6d00a8e18c346f123b5321a1c. Reason for revert: PS1 is reland as-is PS2 has two fixes: * Missed poisoning heap references in a code path * Removed incorrect DCHECK Change-Id: I81b317ddc704dbd8a173f5d5c624dbc69e2d9e60 Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Test: art/test/testrunner/testrunner.py --target --64 --optimizing -b Both commnands with `export ART_HEAP_POISONING=true` Bug: 301833859 Bug: 310755375 Bug: 260843353 --- compiler/optimizing/intrinsics_x86.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'compiler/optimizing/intrinsics_x86.cc') diff --git a/compiler/optimizing/intrinsics_x86.cc b/compiler/optimizing/intrinsics_x86.cc index 5986a2f3a0..b21f36cfcf 100644 --- a/compiler/optimizing/intrinsics_x86.cc +++ b/compiler/optimizing/intrinsics_x86.cc @@ -2023,11 +2023,11 @@ static void GenUnsafePut(LocationSummary* locations, if (type == DataType::Type::kReference) { bool value_can_be_null = true; // TODO: Worth finding out this information? - codegen->MarkGCCard(locations->GetTemp(0).AsRegister(), - locations->GetTemp(1).AsRegister(), - base, - value_loc.AsRegister(), - value_can_be_null); + codegen->MaybeMarkGCCard(locations->GetTemp(0).AsRegister(), + locations->GetTemp(1).AsRegister(), + base, + value_loc.AsRegister(), + value_can_be_null); } } @@ -2363,7 +2363,7 @@ static void GenReferenceCAS(HInvoke* invoke, bool value_can_be_null = true; // TODO: Worth finding out this information? NearLabel skip_mark_gc_card; __ j(kNotZero, &skip_mark_gc_card); - codegen->MarkGCCard(temp, temp2, base, value, value_can_be_null); + codegen->MaybeMarkGCCard(temp, temp2, base, value, value_can_be_null); __ Bind(&skip_mark_gc_card); // If heap poisoning is enabled, we need to unpoison the values @@ -2629,7 +2629,7 @@ static void GenUnsafeGetAndUpdate(HInvoke* invoke, // Mark card for object as a new value shall be stored. bool new_value_can_be_null = true; // TODO: Worth finding out this information? DCHECK_EQ(temp2, ECX); // Byte register for `MarkGCCard()`. - codegen->MarkGCCard(temp1, temp2, base, /*value=*/ out_reg, new_value_can_be_null); + codegen->MaybeMarkGCCard(temp1, temp2, base, /*value=*/out_reg, new_value_can_be_null); if (kPoisonHeapReferences) { // Use a temp to avoid poisoning base of the field address, which might happen if `out` @@ -3357,7 +3357,7 @@ void IntrinsicCodeGeneratorX86::VisitSystemArrayCopy(HInvoke* invoke) { } // We only need one card marking on the destination array. - codegen_->MarkGCCard(temp1, temp3, dest, Register(kNoRegister), /* emit_null_check= */ false); + codegen_->MarkGCCard(temp1, temp3, dest); __ Bind(&skip_copy_and_write_barrier); } @@ -4176,7 +4176,8 @@ static void GenerateVarHandleSet(HInvoke* invoke, CodeGeneratorX86* codegen) { is_volatile, /* value_can_be_null */ true, // Value can be null, and this write barrier is not being relied on for other sets. - WriteBarrierKind::kEmitWithNullCheck); + value_type == DataType::Type::kReference ? WriteBarrierKind::kEmitNotBeingReliedOn : + WriteBarrierKind::kDontEmit); __ Bind(slow_path->GetExitLabel()); } @@ -4336,8 +4337,7 @@ static void GenerateVarHandleGetAndSet(HInvoke* invoke, CodeGeneratorX86* codege /* always_update_field= */ true, &temp2); } - codegen->MarkGCCard( - temp, temp2, reference, value.AsRegister(), /* emit_null_check= */ false); + codegen->MarkGCCard(temp, temp2, reference); if (kPoisonHeapReferences) { __ movl(temp, value.AsRegister()); __ PoisonHeapReference(temp); -- cgit v1.2.3-59-g8ed1b