From 5e13d453acc03fda08dae23e085f7161a73f7032 Mon Sep 17 00:00:00 2001 From: Andra Danciu Date: Tue, 8 Sep 2020 14:35:09 +0000 Subject: X86: Implement VarHandle.compareAndSet() for fields. This commit implements VarHandle compareAndExchange access mode for fields (both static and instance). Int64 and Float64 are not implemented because ParallelMove might fail when moving register pairs. Test: ART_HEAP_POISONING=true art/test.py --host --32 -r -t 712-varhandle-invocations Test: ART_HEAP_POISONING=false art/test.py --host --32 -r -t 712-varhandle-invocations Bug: 65872996 Change-Id: I92e51c348f076c23413e419948f03197c286a619 --- compiler/utils/x86/assembler_x86.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'compiler/utils/x86/assembler_x86.h') diff --git a/compiler/utils/x86/assembler_x86.h b/compiler/utils/x86/assembler_x86.h index 522d57a63d..2fe3b7bec5 100644 --- a/compiler/utils/x86/assembler_x86.h +++ b/compiler/utils/x86/assembler_x86.h @@ -795,6 +795,8 @@ class X86Assembler final : public Assembler { void rep_movsw(); X86Assembler* lock(); + void cmpxchgb(const Address& address, ByteRegister reg); + void cmpxchgw(const Address& address, Register reg); void cmpxchgl(const Address& address, Register reg); void cmpxchg8b(const Address& address); @@ -812,6 +814,14 @@ class X86Assembler final : public Assembler { void LoadLongConstant(XmmRegister dst, int64_t value); void LoadDoubleConstant(XmmRegister dst, double value); + void LockCmpxchgb(const Address& address, ByteRegister reg) { + lock()->cmpxchgb(address, reg); + } + + void LockCmpxchgw(const Address& address, Register reg) { + lock()->cmpxchgw(address, reg); + } + void LockCmpxchgl(const Address& address, Register reg) { lock()->cmpxchgl(address, reg); } -- cgit v1.2.3-59-g8ed1b