From db15ea652d13811e236e1f12c88807ebfed05da9 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Thu, 2 May 2024 10:56:42 +0000 Subject: Refactor transaction checks in switch interpreter. Prepare for moving the transactional interpreter from `runtime/` to `dex2oat/` by moving transaction checking code to a new file `active_transaction_checker.h`, and breaking unstarted runtime dependency on transaction code by adding an indirection with a virtual call through `ClassLinker`. Consistently return the same value from contraint checks. Previously we were returning the negated result from the `CheckWrite{,Value}Constraint()` compared to the value we received from `Transaction::Write{,Value}Constraint()`. Test: m test-art-host-gtest Test: testrunner.py --host --interp-ac Change-Id: I88a168b6c770932d014e3a40486480590cef0401 --- runtime/class_linker.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'runtime/class_linker.cc') diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 5b00a87217..08cc153d84 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -11166,6 +11166,27 @@ void ClassLinker::SetEnablePublicSdkChecks([[maybe_unused]] bool enabled) { UNREACHABLE(); } +bool ClassLinker::TransactionWriteConstraint( + [[maybe_unused]] Thread* self, [[maybe_unused]] ObjPtr obj) const { + // Should not be called on ClassLinker, only on AotClassLinker that overrides this. + LOG(FATAL) << "UNREACHABLE"; + UNREACHABLE(); +} + +bool ClassLinker::TransactionWriteValueConstraint( + [[maybe_unused]] Thread* self, [[maybe_unused]] ObjPtr value) const { + // Should not be called on ClassLinker, only on AotClassLinker that overrides this. + LOG(FATAL) << "UNREACHABLE"; + UNREACHABLE(); +} + +bool ClassLinker::TransactionAllocationConstraint( + [[maybe_unused]] Thread* self, [[maybe_unused]] ObjPtr klass) const { + // Should not be called on ClassLinker, only on AotClassLinker that overrides this. + LOG(FATAL) << "UNREACHABLE"; + UNREACHABLE(); +} + void ClassLinker::RemoveDexFromCaches(const DexFile& dex_file) { ReaderMutexLock mu(Thread::Current(), *Locks::dex_lock_); -- cgit v1.2.3-59-g8ed1b