summaryrefslogtreecommitdiffstats
path: root/compiler/image_writer.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-10-23 16:48:06 -0700
committerMathieu Chartier <mathieuc@google.com>2014-10-27 16:49:43 -0700
commit2d2621a1463d2f3f03fa73503fa42e43657cdcfc (patch)
tree1f7cf393693d72db5c186f99b04ac511958c6418 /compiler/image_writer.cc
parentac293277b69882105810fabd6c53f55de58823fe (diff)
downloadandroid_art-2d2621a1463d2f3f03fa73503fa42e43657cdcfc.tar.gz
android_art-2d2621a1463d2f3f03fa73503fa42e43657cdcfc.tar.bz2
android_art-2d2621a1463d2f3f03fa73503fa42e43657cdcfc.zip
Optimize method linking
Added more inlining, removed imt array allocation and replaced it with a handle scope. Removed some un-necessary handle scopes. Added logic to base interface method tables from the superclass so that we dont need to reconstruct for every interface (large win). Facebook launch Dalvik KK MR2: TotalTime: 3165 TotalTime: 3652 TotalTime: 3143 TotalTime: 3298 TotalTime: 3212 TotalTime: 3211 Facebook launch TOT before: WaitTime: 3702 WaitTime: 3616 WaitTime: 3616 WaitTime: 3687 WaitTime: 3742 WaitTime: 3767 After optimizations: WaitTime: 2903 WaitTime: 2953 WaitTime: 2918 WaitTime: 2940 WaitTime: 2879 WaitTime: 2792 LinkInterfaceMethods no longer one of the hottest methods, new list: 4.73% art::ClassLinker::LinkVirtualMethods(art::Thread*, art::Handle<art::mirror::Class>) 3.07% art::DexFile::FindClassDef(char const*) const 2.94% art::mirror::Class::FindDeclaredStaticField(art::mirror::DexCache const*, unsigned int) 2.90% art::DexFile::FindStringId(char const*) const Bug: 18054905 Bug: 16828525 (cherry picked from commit 1fb463e42cf1d67595cff66d19c0f99e3046f4c4) Change-Id: I27cc70178fd3655fbe5a3178887fcba189d21321
Diffstat (limited to 'compiler/image_writer.cc')
-rw-r--r--compiler/image_writer.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index 235aba823c..7baae6e754 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -454,6 +454,8 @@ ObjectArray<Object>* ImageWriter::CreateImageRoots() const {
ObjectArray<Object>::Alloc(self, object_array_class.Get(), ImageHeader::kImageRootsMax)));
image_roots->Set<false>(ImageHeader::kResolutionMethod, runtime->GetResolutionMethod());
image_roots->Set<false>(ImageHeader::kImtConflictMethod, runtime->GetImtConflictMethod());
+ image_roots->Set<false>(ImageHeader::kImtUnimplementedMethod,
+ runtime->GetImtUnimplementedMethod());
image_roots->Set<false>(ImageHeader::kDefaultImt, runtime->GetDefaultImt());
image_roots->Set<false>(ImageHeader::kCalleeSaveMethod,
runtime->GetCalleeSaveMethod(Runtime::kSaveAll));
@@ -690,7 +692,7 @@ void ImageWriter::FixupObject(Object* orig, Object* copy) {
const uint8_t* ImageWriter::GetQuickCode(mirror::ArtMethod* method, bool* quick_is_interpreted) {
DCHECK(!method->IsResolutionMethod() && !method->IsImtConflictMethod() &&
- !method->IsAbstract()) << PrettyMethod(method);
+ !method->IsImtUnimplementedMethod() && !method->IsAbstract()) << PrettyMethod(method);
// Use original code if it exists. Otherwise, set the code pointer to the resolution
// trampoline.
@@ -721,9 +723,11 @@ const uint8_t* ImageWriter::GetQuickCode(mirror::ArtMethod* method, bool* quick_
const uint8_t* ImageWriter::GetQuickEntryPoint(mirror::ArtMethod* method) {
// Calculate the quick entry point following the same logic as FixupMethod() below.
// The resolution method has a special trampoline to call.
- if (UNLIKELY(method == Runtime::Current()->GetResolutionMethod())) {
+ Runtime* runtime = Runtime::Current();
+ if (UNLIKELY(method == runtime->GetResolutionMethod())) {
return GetOatAddress(quick_resolution_trampoline_offset_);
- } else if (UNLIKELY(method == Runtime::Current()->GetImtConflictMethod())) {
+ } else if (UNLIKELY(method == runtime->GetImtConflictMethod() ||
+ method == runtime->GetImtUnimplementedMethod())) {
return GetOatAddress(quick_imt_conflict_trampoline_offset_);
} else {
// We assume all methods have code. If they don't currently then we set them to the use the
@@ -743,10 +747,12 @@ void ImageWriter::FixupMethod(ArtMethod* orig, ArtMethod* copy) {
// oat_begin_
// The resolution method has a special trampoline to call.
- if (UNLIKELY(orig == Runtime::Current()->GetResolutionMethod())) {
+ Runtime* runtime = Runtime::Current();
+ if (UNLIKELY(orig == runtime->GetResolutionMethod())) {
copy->SetEntryPointFromPortableCompiledCode<kVerifyNone>(GetOatAddress(portable_resolution_trampoline_offset_));
copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(GetOatAddress(quick_resolution_trampoline_offset_));
- } else if (UNLIKELY(orig == Runtime::Current()->GetImtConflictMethod())) {
+ } else if (UNLIKELY(orig == runtime->GetImtConflictMethod() ||
+ orig == runtime->GetImtUnimplementedMethod())) {
copy->SetEntryPointFromPortableCompiledCode<kVerifyNone>(GetOatAddress(portable_imt_conflict_trampoline_offset_));
copy->SetEntryPointFromQuickCompiledCode<kVerifyNone>(GetOatAddress(quick_imt_conflict_trampoline_offset_));
} else {