diff options
| author | 2016-08-31 16:26:01 -0700 | |
|---|---|---|
| committer | 2016-09-08 19:46:31 -0700 | |
| commit | 175d09beba59060f6634ba45ebccc712accd032e (patch) | |
| tree | 531f95d86c3b4ad41cf922c4745ba26a44542dc8 | |
| parent | 35e5e9c5e1ac976145eb5a887704e026c2636fa3 (diff) | |
ART: Generate path to entrypoints in VisitLoadString for x86
Code size unmeasured, presumably ~-1%.
Generate code to go into string dex cache entrypoints in VisitLoadString
instead of with slow paths, since we now go into entrypoints almost
every time.
Change-Id: Ic4335a23934547737dbda12111f672da1e6c0ef7
Tests: test-art-host CC baker
| -rw-r--r-- | compiler/optimizing/code_generator_x86.cc | 49 |
1 files changed, 10 insertions, 39 deletions
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index b3b648f137..5953badb07 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -213,35 +213,6 @@ class SuspendCheckSlowPathX86 : public SlowPathCode { DISALLOW_COPY_AND_ASSIGN(SuspendCheckSlowPathX86); }; -class LoadStringSlowPathX86 : public SlowPathCode { - public: - explicit LoadStringSlowPathX86(HLoadString* instruction): SlowPathCode(instruction) {} - - void EmitNativeCode(CodeGenerator* codegen) OVERRIDE { - LocationSummary* locations = instruction_->GetLocations(); - DCHECK(!locations->GetLiveRegisters()->ContainsCoreRegister(locations->Out().reg())); - - CodeGeneratorX86* x86_codegen = down_cast<CodeGeneratorX86*>(codegen); - __ Bind(GetEntryLabel()); - SaveLiveRegisters(codegen, locations); - - InvokeRuntimeCallingConvention calling_convention; - const uint32_t string_index = instruction_->AsLoadString()->GetStringIndex(); - __ movl(calling_convention.GetRegisterAt(0), Immediate(string_index)); - x86_codegen->InvokeRuntime(kQuickResolveString, instruction_, instruction_->GetDexPc(), this); - CheckEntrypointTypes<kQuickResolveString, void*, uint32_t>(); - x86_codegen->Move32(locations->Out(), Location::RegisterLocation(EAX)); - RestoreLiveRegisters(codegen, locations); - - __ jmp(GetExitLabel()); - } - - const char* GetDescription() const OVERRIDE { return "LoadStringSlowPathX86"; } - - private: - DISALLOW_COPY_AND_ASSIGN(LoadStringSlowPathX86); -}; - class LoadClassSlowPathX86 : public SlowPathCode { public: LoadClassSlowPathX86(HLoadClass* cls, @@ -6135,20 +6106,20 @@ HLoadString::LoadKind CodeGeneratorX86::GetSupportedLoadStringKind( void LocationsBuilderX86::VisitLoadString(HLoadString* load) { LocationSummary::CallKind call_kind = (load->NeedsEnvironment() || kEmitCompilerReadBarrier) - ? LocationSummary::kCallOnSlowPath + ? LocationSummary::kCallOnMainOnly : LocationSummary::kNoCall; LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(load, call_kind); - if (kUseBakerReadBarrier && !load->NeedsEnvironment()) { - locations->SetCustomSlowPathCallerSaves(RegisterSet()); // No caller-save registers. - } - HLoadString::LoadKind load_kind = load->GetLoadKind(); if (load_kind == HLoadString::LoadKind::kDexCacheViaMethod || load_kind == HLoadString::LoadKind::kBootImageLinkTimePcRelative || load_kind == HLoadString::LoadKind::kDexCachePcRelative) { locations->SetInAt(0, Location::RequiresRegister()); } - locations->SetOut(Location::RequiresRegister()); + if (load_kind == HLoadString::LoadKind::kDexCacheViaMethod) { + locations->SetOut(Location::RegisterLocation(EAX)); + } else { + locations->SetOut(Location::RequiresRegister()); + } } void InstructionCodeGeneratorX86::VisitLoadString(HLoadString* load) { @@ -6183,10 +6154,10 @@ void InstructionCodeGeneratorX86::VisitLoadString(HLoadString* load) { } // TODO: Re-add the compiler code to do string dex cache lookup again. - SlowPathCode* slow_path = new (GetGraph()->GetArena()) LoadStringSlowPathX86(load); - codegen_->AddSlowPath(slow_path); - __ jmp(slow_path->GetEntryLabel()); - __ Bind(slow_path->GetExitLabel()); + InvokeRuntimeCallingConvention calling_convention; + __ movl(calling_convention.GetRegisterAt(0), Immediate(load->GetStringIndex())); + codegen_->InvokeRuntime(kQuickResolveString, load, load->GetDexPc()); + CheckEntrypointTypes<kQuickResolveString, void*, uint32_t>(); } static Address GetExceptionTlsAddress() { |