diff options
author | 2024-05-17 13:34:46 +0000 | |
---|---|---|
committer | 2024-05-20 09:32:57 +0000 | |
commit | c2a37f8de53b1b2d3e6ecb5105fd4753c06b2c60 (patch) | |
tree | 1aefa68e0e14f1999eae44c51416800d67f4c898 /runtime/interpreter/interpreter_switch_impl-inl.h | |
parent | 84c0eddb305a3248046edd3f2f8bba03aab3efec (diff) |
Fix transaction records for `fill-array-data`.
We need to record old array elements, not the new ones, so
call `RecordArrayElementsInTransaction()` earlier. Move the
implementation where it's actually needed, check for NPE
(due to the reordering) and avoid unnecessary read barriers.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing --interp-ac
Change-Id: I6282afed941b1a32468aceb970c3e72283b445ba
Diffstat (limited to 'runtime/interpreter/interpreter_switch_impl-inl.h')
-rw-r--r-- | runtime/interpreter/interpreter_switch_impl-inl.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/runtime/interpreter/interpreter_switch_impl-inl.h b/runtime/interpreter/interpreter_switch_impl-inl.h index ec152a5d07..ce0117f724 100644 --- a/runtime/interpreter/interpreter_switch_impl-inl.h +++ b/runtime/interpreter/interpreter_switch_impl-inl.h @@ -721,12 +721,11 @@ class InstructionHandler { const Instruction::ArrayDataPayload* payload = reinterpret_cast<const Instruction::ArrayDataPayload*>(payload_addr); ObjPtr<mirror::Object> obj = GetVRegReference(A()); + // If we have an active transaction, record old values before we overwrite them. + TransactionChecker::RecordArrayElementsInTransaction(obj, payload->element_count); if (!FillArrayData(obj, payload)) { return false; // Pending exception. } - if (transaction_active) { - RecordArrayElementsInTransaction(obj->AsArray(), payload->element_count); - } return true; } |