diff options
4 files changed, 8 insertions, 8 deletions
diff --git a/compiler/utils/arm/jni_macro_assembler_arm_vixl.cc b/compiler/utils/arm/jni_macro_assembler_arm_vixl.cc index b06f428e0a..2c1b4be707 100644 --- a/compiler/utils/arm/jni_macro_assembler_arm_vixl.cc +++ b/compiler/utils/arm/jni_macro_assembler_arm_vixl.cc @@ -1062,7 +1062,7 @@ void ArmVIXLJNIMacroAssembler::TryToTransitionFromRunnableToNative( vixl32::Register scratch = AsVIXLRegister(scratch_regs[0].AsArm()); vixl32::Register scratch2 = AsVIXLRegister(scratch_regs[1].AsArm()); - // CAS acquire, old_value = kRunnableStateValue, new_value = kNativeStateValue, no flags. + // CAS release, old_value = kRunnableStateValue, new_value = kNativeStateValue, no flags. vixl32::Label retry; ___ Bind(&retry); ___ Ldrex(scratch, MemOperand(tr, thread_flags_offset.Int32Value())); @@ -1070,10 +1070,10 @@ void ArmVIXLJNIMacroAssembler::TryToTransitionFromRunnableToNative( // If any flags are set, go to the slow path. ___ Cmp(scratch, kRunnableStateValue); ___ B(ne, ArmVIXLJNIMacroLabel::Cast(label)->AsArm()); + ___ Dmb(DmbOptions::ISH); // Memory barrier "any-store" for the "release" operation. ___ Strex(scratch, scratch2, MemOperand(tr, thread_flags_offset.Int32Value())); ___ Cmp(scratch, 0); ___ B(ne, &retry); - ___ Dmb(DmbOptions::ISH); // Memory barrier "load-any" for the "acquire" operation. // Clear `self->tlsPtr_.held_mutexes[kMutatorLock]`; `scratch` holds 0 at this point. ___ Str(scratch, MemOperand(tr, thread_held_mutex_mutator_lock_offset.Int32Value())); diff --git a/compiler/utils/arm64/jni_macro_assembler_arm64.cc b/compiler/utils/arm64/jni_macro_assembler_arm64.cc index 8ae1d044a8..e84fe04f43 100644 --- a/compiler/utils/arm64/jni_macro_assembler_arm64.cc +++ b/compiler/utils/arm64/jni_macro_assembler_arm64.cc @@ -901,16 +901,16 @@ void Arm64JNIMacroAssembler::TryToTransitionFromRunnableToNative( Register scratch = temps.AcquireW(); Register scratch2 = temps.AcquireW(); - // CAS acquire, old_value = kRunnableStateValue, new_value = kNativeStateValue, no flags. + // CAS release, old_value = kRunnableStateValue, new_value = kNativeStateValue, no flags. vixl::aarch64::Label retry; ___ Bind(&retry); - static_assert(thread_flags_offset.Int32Value() == 0); // LDAXR/STXR require exact address. - ___ Ldaxr(scratch, MEM_OP(reg_x(TR))); + static_assert(thread_flags_offset.Int32Value() == 0); // LDXR/STLXR require exact address. + ___ Ldxr(scratch, MEM_OP(reg_x(TR))); ___ Mov(scratch2, kNativeStateValue); // If any flags are set, go to the slow path. static_assert(kRunnableStateValue == 0u); ___ Cbnz(scratch, Arm64JNIMacroLabel::Cast(label)->AsArm64()); - ___ Stxr(scratch, scratch2, MEM_OP(reg_x(TR))); + ___ Stlxr(scratch, scratch2, MEM_OP(reg_x(TR))); ___ Cbnz(scratch, &retry); // Clear `self->tlsPtr_.held_mutexes[kMutatorLock]`. diff --git a/compiler/utils/x86/jni_macro_assembler_x86.cc b/compiler/utils/x86/jni_macro_assembler_x86.cc index fc92c30e15..8be2a32a5a 100644 --- a/compiler/utils/x86/jni_macro_assembler_x86.cc +++ b/compiler/utils/x86/jni_macro_assembler_x86.cc @@ -602,7 +602,7 @@ void X86JNIMacroAssembler::TryToTransitionFromRunnableToNative( Register saved_eax = scratch_regs[0].AsX86().AsCpuRegister(); Register scratch = scratch_regs[1].AsX86().AsCpuRegister(); - // CAS acquire, old_value = kRunnableStateValue, new_value = kNativeStateValue, no flags. + // CAS release, old_value = kRunnableStateValue, new_value = kNativeStateValue, no flags. __ movl(saved_eax, EAX); // Save EAX. static_assert(kRunnableStateValue == 0u); __ xorl(EAX, EAX); diff --git a/compiler/utils/x86_64/jni_macro_assembler_x86_64.cc b/compiler/utils/x86_64/jni_macro_assembler_x86_64.cc index 3ddb689cdf..b25d5c712e 100644 --- a/compiler/utils/x86_64/jni_macro_assembler_x86_64.cc +++ b/compiler/utils/x86_64/jni_macro_assembler_x86_64.cc @@ -682,7 +682,7 @@ void X86_64JNIMacroAssembler::TryToTransitionFromRunnableToNative( CpuRegister rax(RAX); // RAX can be freely clobbered. It does not hold any argument. CpuRegister scratch = GetScratchRegister(); - // CAS acquire, old_value = kRunnableStateValue, new_value = kNativeStateValue, no flags. + // CAS release, old_value = kRunnableStateValue, new_value = kNativeStateValue, no flags. static_assert(kRunnableStateValue == 0u); __ xorl(rax, rax); __ movl(scratch, Immediate(kNativeStateValue)); |