diff options
Diffstat (limited to 'runtime/interpreter/interpreter_common.h')
-rw-r--r-- | runtime/interpreter/interpreter_common.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h index d2238d1d23..24fb8a83c4 100644 --- a/runtime/interpreter/interpreter_common.h +++ b/runtime/interpreter/interpreter_common.h @@ -20,7 +20,6 @@ #include "android-base/macros.h" #include "instrumentation.h" #include "interpreter.h" -#include "transaction.h" #include <math.h> @@ -86,6 +85,12 @@ class InactiveTransactionChecker { return false; } + ALWAYS_INLINE static bool ReadConstraint([[maybe_unused]] Thread* self, + [[maybe_unused]] ObjPtr<mirror::Object> value) + REQUIRES_SHARED(Locks::mutator_lock_) { + return false; + } + ALWAYS_INLINE static bool AllocationConstraint([[maybe_unused]] Thread* self, [[maybe_unused]] ObjPtr<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_) { @@ -397,12 +402,10 @@ ALWAYS_INLINE bool DoFieldGet(Thread* self, ObjPtr<mirror::Object> obj; if (is_static) { obj = field->GetDeclaringClass(); - if (transaction_active) { - if (Runtime::Current()->GetTransaction()->ReadConstraint(obj)) { - Runtime::Current()->AbortTransactionAndThrowAbortError(self, "Can't read static fields of " - + obj->PrettyTypeOf() + " since it does not belong to clinit's class."); - return false; - } + using TransactionChecker = typename std::conditional_t< + transaction_active, ActiveTransactionChecker, InactiveTransactionChecker>; + if (TransactionChecker::ReadConstraint(self, obj)) { + return false; } } else { obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data)); |