diff options
author | 2025-03-24 10:26:27 +0000 | |
---|---|---|
committer | 2025-03-24 07:35:14 -0700 | |
commit | abf032d28d6ee925386379369403b364fbcb0d34 (patch) | |
tree | 64f0b7299297c7a4343712030408a27d8528e209 | |
parent | efe4925792735c2fd9dd95b7c67173b119ff2968 (diff) |
Fix two issues in fast baseline compiler.
- Add a missing fence after allocation.
- Create a frame before fetching any register, otherwise, we may wrongly
use a caller-saved register that can be overwritten by the hotness
slow path.
Test: 719-varhandle-concurrency
Change-Id: I90278172e3d4f9a3561b269b35a59bd3e8ad1dfd
-rw-r--r-- | compiler/optimizing/fast_compiler_arm64.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/optimizing/fast_compiler_arm64.cc b/compiler/optimizing/fast_compiler_arm64.cc index 027d114f6d..a820fc9422 100644 --- a/compiler/optimizing/fast_compiler_arm64.cc +++ b/compiler/optimizing/fast_compiler_arm64.cc @@ -1034,6 +1034,7 @@ bool FastCompilerARM64::BuildNewInstance(uint32_t vreg, entrypoint = kQuickAllocObjectWithChecks; } InvokeRuntime(entrypoint, dex_pc); + __ Dmb(InnerShareable, BarrierWrites); if (!MoveLocation(CreateNewRegisterLocation(vreg, DataType::Type::kReference, next), calling_convention.GetReturnLocation(DataType::Type::kReference), DataType::Type::kReference)) { @@ -1871,6 +1872,8 @@ bool FastCompilerARM64::ProcessDexInstruction(const Instruction& instruction, return true; case Instruction::IGET_OBJECT: + is_object = true; + FALLTHROUGH_INTENDED; case Instruction::IGET: case Instruction::IGET_WIDE: case Instruction::IGET_BOOLEAN: @@ -1896,8 +1899,9 @@ bool FastCompilerARM64::ProcessDexInstruction(const Instruction& instruction, } } - if (can_receiver_be_null) { - // We need a frame in case the null check throws. + if (can_receiver_be_null || is_object) { + // We need a frame in case the null check throws or there is a read + // barrier. if (!EnsureHasFrame()) { return false; } @@ -1910,11 +1914,7 @@ bool FastCompilerARM64::ProcessDexInstruction(const Instruction& instruction, if (HitUnimplemented()) { return false; } - if (instruction.Opcode() == Instruction::IGET_OBJECT) { - // Generate a frame because of the read barrier. - if (!EnsureHasFrame()) { - return false; - } + if (is_object) { Register dst = WRegisterFrom( CreateNewRegisterLocation(source_or_dest_reg, DataType::Type::kReference, next)); if (HitUnimplemented()) { |