diff options
author | Mathieu Chartier <mathieuc@google.com> | 2013-11-14 17:45:16 -0800 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2013-11-20 11:14:11 -0800 |
commit | cbb2d20bea2861f244da2e2318d8c088300a3710 (patch) | |
tree | 9735d496716cf165ea0ee2d7e2f62d723ffc7734 /runtime/interpreter | |
parent | d31fb9718a6180304cd951619dc36be8e090a641 (diff) | |
download | android_art-cbb2d20bea2861f244da2e2318d8c088300a3710.tar.gz android_art-cbb2d20bea2861f244da2e2318d8c088300a3710.tar.bz2 android_art-cbb2d20bea2861f244da2e2318d8c088300a3710.zip |
Refactor allocation entrypoints.
Adds support for switching entrypoints during runtime. Enables
addition of new allocators with out requiring significant copy
paste. Slight speedup on ritzperf probably due to more inlining.
TODO: Ensuring that the entire allocation path is inlined so
that the switch statement in the allocation code is optimized
out.
Rosalloc measurements:
4583
4453
4439
4434
4751
After change:
4184
4287
4131
4335
4097
Change-Id: I1352a3cbcdf6dae93921582726324d91312df5c9
Diffstat (limited to 'runtime/interpreter')
-rw-r--r-- | runtime/interpreter/interpreter_common.cc | 4 | ||||
-rw-r--r-- | runtime/interpreter/interpreter_goto_table_impl.cc | 10 | ||||
-rw-r--r-- | runtime/interpreter/interpreter_switch_impl.cc | 10 |
3 files changed, 14 insertions, 10 deletions
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index 08221b723d..c9756ac04d 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -193,7 +193,7 @@ bool DoFilledNewArray(const Instruction* inst, const ShadowFrame& shadow_frame, } return false; } - Object* newArray = Array::Alloc<kMovingCollector, true>(self, arrayClass, length); + Object* newArray = Array::Alloc<true>(self, arrayClass, length); if (UNLIKELY(newArray == NULL)) { DCHECK(self->IsExceptionPending()); return false; @@ -279,7 +279,7 @@ static void UnstartedRuntimeInvoke(Thread* self, MethodHelper& mh, // TODO: getDeclaredField calls GetType once the field is found to ensure a // NoClassDefFoundError is thrown if the field's type cannot be resolved. Class* jlr_Field = self->DecodeJObject(WellKnownClasses::java_lang_reflect_Field)->AsClass(); - SirtRef<Object> field(self, jlr_Field->AllocObject(self)); + SirtRef<Object> field(self, jlr_Field->AllocNonMovableObject(self)); CHECK(field.get() != NULL); ArtMethod* c = jlr_Field->FindDeclaredDirectMethod("<init>", "(Ljava/lang/reflect/ArtField;)V"); uint32_t args[1]; diff --git a/runtime/interpreter/interpreter_goto_table_impl.cc b/runtime/interpreter/interpreter_goto_table_impl.cc index aa6bcd696f..99c85bdb2e 100644 --- a/runtime/interpreter/interpreter_goto_table_impl.cc +++ b/runtime/interpreter/interpreter_goto_table_impl.cc @@ -509,8 +509,9 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* HANDLE_INSTRUCTION_END(); HANDLE_INSTRUCTION_START(NEW_INSTANCE) { - Object* obj = AllocObjectFromCodeInstrumented(inst->VRegB_21c(), shadow_frame.GetMethod(), - self, do_access_check); + Object* obj = AllocObjectFromCode<do_access_check, true>( + inst->VRegB_21c(), shadow_frame.GetMethod(), self, + Runtime::Current()->GetHeap()->GetCurrentAllocator()); if (UNLIKELY(obj == NULL)) { HANDLE_PENDING_EXCEPTION(); } else { @@ -522,8 +523,9 @@ JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* HANDLE_INSTRUCTION_START(NEW_ARRAY) { int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data)); - Object* obj = AllocArrayFromCodeInstrumented(inst->VRegC_22c(), shadow_frame.GetMethod(), - length, self, do_access_check); + Object* obj = AllocArrayFromCode<do_access_check, true>( + inst->VRegC_22c(), shadow_frame.GetMethod(), length, self, + Runtime::Current()->GetHeap()->GetCurrentAllocator()); if (UNLIKELY(obj == NULL)) { HANDLE_PENDING_EXCEPTION(); } else { diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc index bd0d87eefc..675095f442 100644 --- a/runtime/interpreter/interpreter_switch_impl.cc +++ b/runtime/interpreter/interpreter_switch_impl.cc @@ -422,8 +422,9 @@ JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem } case Instruction::NEW_INSTANCE: { PREAMBLE(); - Object* obj = AllocObjectFromCodeInstrumented(inst->VRegB_21c(), shadow_frame.GetMethod(), - self, do_access_check); + Object* obj = AllocObjectFromCode<do_access_check, true>( + inst->VRegB_21c(), shadow_frame.GetMethod(), self, + Runtime::Current()->GetHeap()->GetCurrentAllocator()); if (UNLIKELY(obj == NULL)) { HANDLE_PENDING_EXCEPTION(); } else { @@ -435,8 +436,9 @@ JValue ExecuteSwitchImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem case Instruction::NEW_ARRAY: { PREAMBLE(); int32_t length = shadow_frame.GetVReg(inst->VRegB_22c(inst_data)); - Object* obj = AllocArrayFromCodeInstrumented(inst->VRegC_22c(), shadow_frame.GetMethod(), - length, self, do_access_check); + Object* obj = AllocArrayFromCode<do_access_check, true>( + inst->VRegC_22c(), shadow_frame.GetMethod(), length, self, + Runtime::Current()->GetHeap()->GetCurrentAllocator()); if (UNLIKELY(obj == NULL)) { HANDLE_PENDING_EXCEPTION(); } else { |