diff options
author | 2020-11-11 17:02:26 +0000 | |
---|---|---|
committer | 2020-11-12 10:53:53 +0000 | |
commit | e17530a19a717879c8dd8e70073de6aaf4ee455f (patch) | |
tree | 745e7e23519d37ae5fcafcf9f63c5e707779ce1b /compiler/optimizing/intrinsics_x86.cc | |
parent | bb6cda60e4418c0ab557ea4090e046bed8206763 (diff) |
arm64: Fix VarHandle intrinsics for non-Baker read barrier.
It turns out the artReadBarrierSlow() ignores the passed
reference and reloads the field from the object. This makes
some of the VarHandle intrinsics broken for the TABLELOOKUP
configuration. This change disables the broken variants of
these intrinsics (but leaves support code in place) and
cleans up locations for those variants that remain active.
Also refactor reference argument checks and do a few other
small cleanups (renames, comment updates, etc.).
Test: testrunner.py --target --64 --optimizing
Test: Repeat with ART_USE_READ_BARRIER=false ART_HEAP_POISONING=true.
Test: Repeat with ART_READ_BARRIER_TYPE=TABLELOOKUP.
(Ignore two pre-existing checker test failures.)
Bug: 71781600
Change-Id: I8d28a4883771a8db2b283737bb643b36c7038c26
Diffstat (limited to 'compiler/optimizing/intrinsics_x86.cc')
-rw-r--r-- | compiler/optimizing/intrinsics_x86.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/compiler/optimizing/intrinsics_x86.cc b/compiler/optimizing/intrinsics_x86.cc index 4dbf3d9578..ea2ed57d1b 100644 --- a/compiler/optimizing/intrinsics_x86.cc +++ b/compiler/optimizing/intrinsics_x86.cc @@ -3272,23 +3272,23 @@ static bool IsValidFieldVarHandleExpected(HInvoke* invoke) { } uint32_t number_of_arguments = invoke->GetNumberOfArguments(); - DataType::Type type = invoke->GetType(); + DataType::Type return_type = invoke->GetType(); mirror::VarHandle::AccessModeTemplate access_mode_template = mirror::VarHandle::GetAccessModeTemplateByIntrinsic(invoke->GetIntrinsic()); switch (access_mode_template) { case mirror::VarHandle::AccessModeTemplate::kGet: // The return type should be the same as varType, so it shouldn't be void. - if (type == DataType::Type::kVoid) { + if (return_type == DataType::Type::kVoid) { return false; } break; case mirror::VarHandle::AccessModeTemplate::kSet: - if (type != DataType::Type::kVoid) { + if (return_type != DataType::Type::kVoid) { return false; } break; case mirror::VarHandle::AccessModeTemplate::kCompareAndSet: { - if (type != DataType::Type::kBool) { + if (return_type != DataType::Type::kBool) { return false; } uint32_t expected_value_index = number_of_arguments - 2; @@ -3305,13 +3305,17 @@ static bool IsValidFieldVarHandleExpected(HInvoke* invoke) { DataType::Type value_type = GetDataTypeFromShorty(invoke, number_of_arguments - 1); if (IsVarHandleGetAndAdd(invoke) && (value_type == DataType::Type::kReference || value_type == DataType::Type::kBool)) { - // We should only add numerical types + // We should only add numerical types. return false; } else if (IsVarHandleGetAndBitwiseOp(invoke) && !DataType::IsIntegralType(value_type)) { // We can only apply operators to bitwise integral types. + // Note that bitwise VarHandle operations accept a non-integral boolean type and + // perform the appropriate logical operation. However, the result is the same as + // using the bitwise operation on our boolean representation and this fits well + // with DataType::IsIntegralType() treating the compiler type kBool as integral. return false; } - if (value_type != type) { + if (value_type != return_type) { return false; } break; @@ -3322,7 +3326,7 @@ static bool IsValidFieldVarHandleExpected(HInvoke* invoke) { DataType::Type expected_value_type = GetDataTypeFromShorty(invoke, expected_value_index); DataType::Type new_value_type = GetDataTypeFromShorty(invoke, new_value_index); - if (expected_value_type != new_value_type || type != expected_value_type) { + if (expected_value_type != new_value_type || return_type != expected_value_type) { return false; } break; |