diff options
| author | Vladimir Marko <vmarko@google.com> | 2018-08-10 14:22:10 +0100 |
|---|---|---|
| committer | Vladimir Marko <vmarko@google.com> | 2018-08-14 10:30:43 +0100 |
| commit | 1bf0b7ad2fc6ba0cc51d0df2890f9f2d0b05b32b (patch) | |
| tree | 76e97da9d2819558771b03061fabac01de488b11 /compiler/optimizing/code_generator_arm_vixl.h | |
| parent | 248141f724cbb9d436f13181b5301172c4385cc2 (diff) | |
| download | art-1bf0b7ad2fc6ba0cc51d0df2890f9f2d0b05b32b.tar.gz art-1bf0b7ad2fc6ba0cc51d0df2890f9f2d0b05b32b.tar.bz2 art-1bf0b7ad2fc6ba0cc51d0df2890f9f2d0b05b32b.zip | |
ARM: Reimplement the UnsafeCASObject intrinsic.
Clean up the shared code for all the UnsafeCAS* intrinsics
to avoid deprecated instructions (IT should only be followed
by a single 16-bit instruction) and simplify heap poisoning
code (to be more readable at the cost of performance).
For the UnsafeCASObject with Baker read barriers, drop the
old code updating the field. Perform the main path CAS loop
and redirect the flow for failure to a slow path that marks
the old value and compares it with the expected value (if
not marking, this is just a few instructions to determine
that they differ). If it's the same, the old value is known
to be the from-space reference to the expected object and
the slow path performs a modified CAS loop checking for both
expected object references (from-space and to-space).
Also replace all uses of vixl's EmissionCheckScope with the
ExactAssemblyScope in the arm32 codegen; all these uses are
related to the Baker read barrier using introspection.
Test: Already covered by 160-read-barrier-stress.
Test: m test-art-host-gtest
Test: Pixel 2 XL boots.
Test: testrunner.py --target --optimizing --32
Test: ART_HEAP_POISONING=true testrunner.py --target --optimizing --32
Bug: 36141117
Change-Id: If0b77d278826eb909b437ea9a1336afec575ccdf
Diffstat (limited to 'compiler/optimizing/code_generator_arm_vixl.h')
| -rw-r--r-- | compiler/optimizing/code_generator_arm_vixl.h | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/compiler/optimizing/code_generator_arm_vixl.h b/compiler/optimizing/code_generator_arm_vixl.h index 2fd18cab47..f9eb876dcb 100644 --- a/compiler/optimizing/code_generator_arm_vixl.h +++ b/compiler/optimizing/code_generator_arm_vixl.h @@ -622,6 +622,11 @@ class CodeGeneratorARMVIXL : public CodeGenerator { vixl::aarch32::Register obj, uint32_t offset, ReadBarrierOption read_barrier_option); + // Generate ADD for UnsafeCASObject to reconstruct the old value from + // `old_value - expected` and mark it with Baker read barrier. + void GenerateUnsafeCasOldValueAddWithBakerReadBarrier(vixl::aarch32::Register old_value, + vixl::aarch32::Register adjusted_old_value, + vixl::aarch32::Register expected); // Fast path implementation of ReadBarrier::Barrier for a heap // reference field load when Baker's read barriers are used. // Overload suitable for Unsafe.getObject/-Volatile() intrinsic. @@ -647,35 +652,6 @@ class CodeGeneratorARMVIXL : public CodeGenerator { Location temp, bool needs_null_check); - // Generate code checking whether the the reference field at the - // address `obj + field_offset`, held by object `obj`, needs to be - // marked, and if so, marking it and updating the field within `obj` - // with the marked value. - // - // This routine is used for the implementation of the - // UnsafeCASObject intrinsic with Baker read barriers. - // - // This method has a structure similar to - // GenerateReferenceLoadWithBakerReadBarrier, but note that argument - // `ref` is only as a temporary here, and thus its value should not - // be used afterwards. - void UpdateReferenceFieldWithBakerReadBarrier(HInstruction* instruction, - Location ref, - vixl::aarch32::Register obj, - Location field_offset, - Location temp, - bool needs_null_check, - vixl::aarch32::Register temp2); - - // Generate a heap reference load (with no read barrier). - void GenerateRawReferenceLoad(HInstruction* instruction, - Location ref, - vixl::aarch32::Register obj, - uint32_t offset, - Location index, - ScaleFactor scale_factor, - bool needs_null_check); - // Emit code checking the status of the Marking Register, and // aborting the program if MR does not match the value stored in the // art::Thread object. Code is only emitted in debug mode and if |
