diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-04-29 11:13:16 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-04-30 11:55:39 -0700 |
commit | b2c7ead6bb5c98282cdfbc89db8984a004bea030 (patch) | |
tree | 8c7ca6ea7d57863b60e3f3afac88cb186396aea3 /runtime/interpreter/interpreter_goto_table_impl.cc | |
parent | be4706907e226959623c0fb4937cf3979f440a97 (diff) | |
download | android_art-b2c7ead6bb5c98282cdfbc89db8984a004bea030.tar.gz android_art-b2c7ead6bb5c98282cdfbc89db8984a004bea030.tar.bz2 android_art-b2c7ead6bb5c98282cdfbc89db8984a004bea030.zip |
Don't allow allocating finalizable objects during transactions.
It doesn't make sense to allocate finalizable objects during a
transcation since they will never get finalized without a started
runtime.
Before StatusInitialized in core.host.oatdump.txt: 3564
After StatusInitialized in core.host.oatdump.txt: 3564
Bug: 14078487
Change-Id: I7070536f7bb87bfc691d4268bd39a3eca492f48e
Diffstat (limited to 'runtime/interpreter/interpreter_goto_table_impl.cc')
-rw-r--r-- | runtime/interpreter/interpreter_goto_table_impl.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/interpreter/interpreter_goto_table_impl.cc b/runtime/interpreter/interpreter_goto_table_impl.cc index d0bb0010cb..74b7c42c32 100644 --- a/runtime/interpreter/interpreter_goto_table_impl.cc +++ b/runtime/interpreter/interpreter_goto_table_impl.cc @@ -496,7 +496,7 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* } HANDLE_INSTRUCTION_END(); - HANDLE_INSTRUCTION_START(ARRAY_LENGTH) { + HANDLE_INSTRUCTION_START(ARRAY_LENGTH) { Object* array = shadow_frame.GetVRegReference(inst->VRegB_12x(inst_data)); if (UNLIKELY(array == NULL)) { ThrowNullPointerExceptionFromDexPC(shadow_frame.GetCurrentLocationForThrow()); @@ -509,12 +509,20 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* HANDLE_INSTRUCTION_END(); HANDLE_INSTRUCTION_START(NEW_INSTANCE) { + Runtime* runtime = Runtime::Current(); Object* obj = AllocObjectFromCode<do_access_check, true>( inst->VRegB_21c(), shadow_frame.GetMethod(), self, - Runtime::Current()->GetHeap()->GetCurrentAllocator()); + runtime->GetHeap()->GetCurrentAllocator()); if (UNLIKELY(obj == NULL)) { HANDLE_PENDING_EXCEPTION(); } else { + // Don't allow finalizable objects to be allocated during a transaction since these can't be + // finalized without a started runtime. + if (transaction_active && obj->GetClass()->IsFinalizable()) { + AbortTransaction(self, "Allocating finalizable object in transcation: %s", + PrettyTypeOf(obj).c_str()); + HANDLE_PENDING_EXCEPTION(); + } shadow_frame.SetVRegReference(inst->VRegA_21c(inst_data), obj); ADVANCE(2); } |