summaryrefslogtreecommitdiff
path: root/runtime/interpreter/interpreter_common.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2019-07-26 13:03:13 +0100
committer Vladimir Marko <vmarko@google.com> 2019-07-29 12:33:14 +0000
commit672c08092a7d95bb504bceb712812f72524d90da (patch)
treee539c269d8733b13e43c41f9784d0c6c8200a9d6 /runtime/interpreter/interpreter_common.cc
parente91d787c2de859789ec6e467bd04ee28b22a8c4e (diff)
Update Transaction for boot image extension.
And clean up transaction-related code to keep test code out of the production binaries. Test: Add TransactionTest#Constraints to transaction_test. Test: m test-art-host-gtest Test: testrunner.py --host Test: aosp_taimen-userdebug boots. Change-Id: Iefe5f1cfde95f564069249148f9e7d71564d7a10
Diffstat (limited to 'runtime/interpreter/interpreter_common.cc')
-rw-r--r--runtime/interpreter/interpreter_common.cc26
1 files changed, 17 insertions, 9 deletions
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index 9953743f04..e017b17c0a 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -109,7 +109,7 @@ bool DoFieldGet(Thread* self, ShadowFrame& shadow_frame, const Instruction* inst
if (is_static) {
obj = f->GetDeclaringClass();
if (transaction_active) {
- if (Runtime::Current()->GetTransaction()->ReadConstraint(obj.Ptr(), f)) {
+ if (Runtime::Current()->GetTransaction()->ReadConstraint(self, obj, f)) {
Runtime::Current()->AbortTransactionAndThrowAbortError(self, "Can't read static fields of "
+ obj->PrettyTypeOf() + " since it does not belong to clinit's class.");
return false;
@@ -321,14 +321,6 @@ bool DoFieldPut(Thread* self, const ShadowFrame& shadow_frame, const Instruction
ObjPtr<mirror::Object> obj;
if (is_static) {
obj = f->GetDeclaringClass();
- if (transaction_active) {
- if (Runtime::Current()->GetTransaction()->WriteConstraint(obj.Ptr(), f)) {
- Runtime::Current()->AbortTransactionAndThrowAbortError(
- self, "Can't set fields of " + obj->PrettyTypeOf());
- return false;
- }
- }
-
} else {
obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
if (UNLIKELY(obj == nullptr)) {
@@ -336,6 +328,22 @@ bool DoFieldPut(Thread* self, const ShadowFrame& shadow_frame, const Instruction
return false;
}
}
+ if (transaction_active) {
+ Runtime* runtime = Runtime::Current();
+ if (runtime->GetTransaction()->WriteConstraint(self, obj, f)) {
+ if (is_static) {
+ runtime->AbortTransactionAndThrowAbortError(
+ self, "Can't set fields of " + obj->PrettyTypeOf());
+ } else {
+ // This can happen only when compiling a boot image extension.
+ DCHECK(!runtime->GetTransaction()->IsStrict());
+ DCHECK(runtime->GetHeap()->ObjectIsInBootImageSpace(obj));
+ runtime->AbortTransactionAndThrowAbortError(
+ self, "Can't set fields of boot image objects");
+ }
+ return false;
+ }
+ }
uint32_t vregA = is_static ? inst->VRegA_21c(inst_data) : inst->VRegA_22c(inst_data);
JValue value = GetFieldValue<field_type>(shadow_frame, vregA);