diff options
| -rw-r--r-- | compiler/optimizing/code_generator_x86.cc | 123 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator_x86.h | 9 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator_x86_64.cc | 99 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator_x86_64.h | 9 | ||||
| -rw-r--r-- | compiler/optimizing/intrinsics_x86.cc | 18 | ||||
| -rw-r--r-- | compiler/optimizing/intrinsics_x86_64.cc | 24 |
6 files changed, 80 insertions, 202 deletions
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index 675c5e0699..1369e5f413 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -62,7 +62,7 @@ class NullCheckSlowPathX86 : public SlowPathCode { // Live registers will be restored in the catch block if caught. SaveLiveRegisters(codegen, instruction_->GetLocations()); } - x86_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pThrowNullPointer), + x86_codegen->InvokeRuntime(kQuickThrowNullPointer, instruction_, instruction_->GetDexPc(), this); @@ -88,10 +88,7 @@ class DivZeroCheckSlowPathX86 : public SlowPathCode { // Live registers will be restored in the catch block if caught. SaveLiveRegisters(codegen, instruction_->GetLocations()); } - x86_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pThrowDivZero), - instruction_, - instruction_->GetDexPc(), - this); + x86_codegen->InvokeRuntime(kQuickThrowDivZero, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes<kQuickThrowDivZero, void, void>(); } @@ -165,13 +162,10 @@ class BoundsCheckSlowPathX86 : public SlowPathCode { length_loc, Location::RegisterLocation(calling_convention.GetRegisterAt(1)), Primitive::kPrimInt); - uint32_t entry_point_offset = instruction_->AsBoundsCheck()->IsStringCharAt() - ? QUICK_ENTRY_POINT(pThrowStringBounds) - : QUICK_ENTRY_POINT(pThrowArrayBounds); - x86_codegen->InvokeRuntime(entry_point_offset, - instruction_, - instruction_->GetDexPc(), - this); + QuickEntrypointEnum entrypoint = instruction_->AsBoundsCheck()->IsStringCharAt() + ? kQuickThrowStringBounds + : kQuickThrowArrayBounds; + x86_codegen->InvokeRuntime(entrypoint, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes<kQuickThrowStringBounds, void, int32_t, int32_t>(); CheckEntrypointTypes<kQuickThrowArrayBounds, void, int32_t, int32_t>(); } @@ -192,10 +186,7 @@ class SuspendCheckSlowPathX86 : public SlowPathCode { void EmitNativeCode(CodeGenerator* codegen) OVERRIDE { CodeGeneratorX86* x86_codegen = down_cast<CodeGeneratorX86*>(codegen); __ Bind(GetEntryLabel()); - x86_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pTestSuspend), - instruction_, - instruction_->GetDexPc(), - this); + x86_codegen->InvokeRuntime(kQuickTestSuspend, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes<kQuickTestSuspend, void, void>(); if (successor_ == nullptr) { __ jmp(GetReturnLabel()); @@ -237,10 +228,7 @@ class LoadStringSlowPathX86 : public SlowPathCode { InvokeRuntimeCallingConvention calling_convention; const uint32_t string_index = instruction_->AsLoadString()->GetStringIndex(); __ movl(calling_convention.GetRegisterAt(0), Immediate(string_index)); - x86_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pResolveString), - instruction_, - instruction_->GetDexPc(), - this); + x86_codegen->InvokeRuntime(kQuickResolveString, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes<kQuickResolveString, void*, uint32_t>(); x86_codegen->Move32(locations->Out(), Location::RegisterLocation(EAX)); RestoreLiveRegisters(codegen, locations); @@ -272,8 +260,8 @@ class LoadClassSlowPathX86 : public SlowPathCode { InvokeRuntimeCallingConvention calling_convention; __ movl(calling_convention.GetRegisterAt(0), Immediate(cls_->GetTypeIndex())); - x86_codegen->InvokeRuntime(do_clinit_ ? QUICK_ENTRY_POINT(pInitializeStaticStorage) - : QUICK_ENTRY_POINT(pInitializeType), + x86_codegen->InvokeRuntime(do_clinit_ ? kQuickInitializeStaticStorage + : kQuickInitializeType, at_, dex_pc_, this); if (do_clinit_) { CheckEntrypointTypes<kQuickInitializeStaticStorage, void*, uint32_t>(); @@ -342,7 +330,7 @@ class TypeCheckSlowPathX86 : public SlowPathCode { Primitive::kPrimNot); if (instruction_->IsInstanceOf()) { - x86_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pInstanceofNonTrivial), + x86_codegen->InvokeRuntime(kQuickInstanceofNonTrivial, instruction_, instruction_->GetDexPc(), this); @@ -350,10 +338,7 @@ class TypeCheckSlowPathX86 : public SlowPathCode { kQuickInstanceofNonTrivial, size_t, const mirror::Class*, const mirror::Class*>(); } else { DCHECK(instruction_->IsCheckCast()); - x86_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pCheckCast), - instruction_, - instruction_->GetDexPc(), - this); + x86_codegen->InvokeRuntime(kQuickCheckCast, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes<kQuickCheckCast, void, const mirror::Class*, const mirror::Class*>(); } @@ -385,10 +370,7 @@ class DeoptimizationSlowPathX86 : public SlowPathCode { CodeGeneratorX86* x86_codegen = down_cast<CodeGeneratorX86*>(codegen); __ Bind(GetEntryLabel()); SaveLiveRegisters(codegen, instruction_->GetLocations()); - x86_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pDeoptimize), - instruction_, - instruction_->GetDexPc(), - this); + x86_codegen->InvokeRuntime(kQuickDeoptimize, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes<kQuickDeoptimize, void, void>(); } @@ -427,10 +409,7 @@ class ArraySetSlowPathX86 : public SlowPathCode { codegen->GetMoveResolver()->EmitNativeCode(¶llel_move); CodeGeneratorX86* x86_codegen = down_cast<CodeGeneratorX86*>(codegen); - x86_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pAputObject), - instruction_, - instruction_->GetDexPc(), - this); + x86_codegen->InvokeRuntime(kQuickAputObject, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes<kQuickAputObject, void, mirror::Array*, int32_t, mirror::Object*>(); RestoreLiveRegisters(codegen, locations); __ jmp(GetExitLabel()); @@ -648,10 +627,7 @@ class ReadBarrierForHeapReferenceSlowPathX86 : public SlowPathCode { codegen->GetMoveResolver()->EmitNativeCode(¶llel_move); __ movl(calling_convention.GetRegisterAt(2), Immediate(offset_)); } - x86_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pReadBarrierSlow), - instruction_, - instruction_->GetDexPc(), - this); + x86_codegen->InvokeRuntime(kQuickReadBarrierSlow, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes< kQuickReadBarrierSlow, mirror::Object*, mirror::Object*, mirror::Object*, uint32_t>(); x86_codegen->Move32(out_, Location::RegisterLocation(EAX)); @@ -715,7 +691,7 @@ class ReadBarrierForRootSlowPathX86 : public SlowPathCode { InvokeRuntimeCallingConvention calling_convention; CodeGeneratorX86* x86_codegen = down_cast<CodeGeneratorX86*>(codegen); x86_codegen->Move32(Location::RegisterLocation(calling_convention.GetRegisterAt(0)), root_); - x86_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pReadBarrierForRootSlow), + x86_codegen->InvokeRuntime(kQuickReadBarrierForRootSlow, instruction_, instruction_->GetDexPc(), this); @@ -808,25 +784,21 @@ void CodeGeneratorX86::InvokeRuntime(QuickEntrypointEnum entrypoint, HInstruction* instruction, uint32_t dex_pc, SlowPathCode* slow_path) { - InvokeRuntime(GetThreadOffset<kX86PointerSize>(entrypoint).Int32Value(), - instruction, - dex_pc, - slow_path); -} - -void CodeGeneratorX86::InvokeRuntime(int32_t entry_point_offset, - HInstruction* instruction, - uint32_t dex_pc, - SlowPathCode* slow_path) { ValidateInvokeRuntime(instruction, slow_path); - __ fs()->call(Address::Absolute(entry_point_offset)); - RecordPcInfo(instruction, dex_pc, slow_path); + GenerateInvokeRuntime(GetThreadOffset<kX86PointerSize>(entrypoint).Int32Value()); + if (EntrypointRequiresStackMap(entrypoint)) { + RecordPcInfo(instruction, dex_pc, slow_path); + } } void CodeGeneratorX86::InvokeRuntimeWithoutRecordingPcInfo(int32_t entry_point_offset, HInstruction* instruction, SlowPathCode* slow_path) { ValidateInvokeRuntimeWithoutRecordingPcInfo(instruction, slow_path); + GenerateInvokeRuntime(entry_point_offset); +} + +void CodeGeneratorX86::GenerateInvokeRuntime(int32_t entry_point_offset) { __ fs()->call(Address::Absolute(entry_point_offset)); } @@ -2597,19 +2569,13 @@ void InstructionCodeGeneratorX86::VisitTypeConversion(HTypeConversion* conversio case Primitive::kPrimFloat: // Processing a Dex `float-to-long' instruction. - codegen_->InvokeRuntime(QUICK_ENTRY_POINT(pF2l), - conversion, - conversion->GetDexPc(), - nullptr); + codegen_->InvokeRuntime(kQuickF2l, conversion, conversion->GetDexPc()); CheckEntrypointTypes<kQuickF2l, int64_t, float>(); break; case Primitive::kPrimDouble: // Processing a Dex `double-to-long' instruction. - codegen_->InvokeRuntime(QUICK_ENTRY_POINT(pD2l), - conversion, - conversion->GetDexPc(), - nullptr); + codegen_->InvokeRuntime(kQuickD2l, conversion, conversion->GetDexPc()); CheckEntrypointTypes<kQuickD2l, int64_t, double>(); break; @@ -3455,16 +3421,10 @@ void InstructionCodeGeneratorX86::GenerateDivRemIntegral(HBinaryOperation* instr DCHECK_EQ(EDX, out.AsRegisterPairHigh<Register>()); if (is_div) { - codegen_->InvokeRuntime(QUICK_ENTRY_POINT(pLdiv), - instruction, - instruction->GetDexPc(), - nullptr); + codegen_->InvokeRuntime(kQuickLdiv, instruction, instruction->GetDexPc()); CheckEntrypointTypes<kQuickLdiv, int64_t, int64_t, int64_t>(); } else { - codegen_->InvokeRuntime(QUICK_ENTRY_POINT(pLmod), - instruction, - instruction->GetDexPc(), - nullptr); + codegen_->InvokeRuntime(kQuickLmod, instruction, instruction->GetDexPc()); CheckEntrypointTypes<kQuickLmod, int64_t, int64_t, int64_t>(); } break; @@ -4044,10 +4004,7 @@ void InstructionCodeGeneratorX86::VisitNewInstance(HNewInstance* instruction) { __ call(Address(temp, code_offset.Int32Value())); codegen_->RecordPcInfo(instruction, instruction->GetDexPc()); } else { - codegen_->InvokeRuntime(instruction->GetEntrypoint(), - instruction, - instruction->GetDexPc(), - nullptr); + codegen_->InvokeRuntime(instruction->GetEntrypoint(), instruction, instruction->GetDexPc()); CheckEntrypointTypes<kQuickAllocObjectWithAccessCheck, void*, uint32_t, ArtMethod*>(); DCHECK(!codegen_->IsLeafMethod()); } @@ -4068,10 +4025,7 @@ void InstructionCodeGeneratorX86::VisitNewArray(HNewArray* instruction) { __ movl(calling_convention.GetRegisterAt(0), Immediate(instruction->GetTypeIndex())); // Note: if heap poisoning is enabled, the entry point takes cares // of poisoning the reference. - codegen_->InvokeRuntime(instruction->GetEntrypoint(), - instruction, - instruction->GetDexPc(), - nullptr); + codegen_->InvokeRuntime(instruction->GetEntrypoint(), instruction, instruction->GetDexPc()); CheckEntrypointTypes<kQuickAllocArrayWithAccessCheck, void*, uint32_t, int32_t, ArtMethod*>(); DCHECK(!codegen_->IsLeafMethod()); } @@ -6069,10 +6023,7 @@ void InstructionCodeGeneratorX86::VisitLoadClass(HLoadClass* cls) { LocationSummary* locations = cls->GetLocations(); if (cls->NeedsAccessCheck()) { codegen_->MoveConstant(locations->GetTemp(0), cls->GetTypeIndex()); - codegen_->InvokeRuntime(QUICK_ENTRY_POINT(pInitializeTypeAndVerifyAccess), - cls, - cls->GetDexPc(), - nullptr); + codegen_->InvokeRuntime(kQuickInitializeTypeAndVerifyAccess, cls, cls->GetDexPc()); CheckEntrypointTypes<kQuickInitializeTypeAndVerifyAccess, void*, uint32_t>(); return; } @@ -6313,10 +6264,7 @@ void LocationsBuilderX86::VisitThrow(HThrow* instruction) { } void InstructionCodeGeneratorX86::VisitThrow(HThrow* instruction) { - codegen_->InvokeRuntime(QUICK_ENTRY_POINT(pDeliverException), - instruction, - instruction->GetDexPc(), - nullptr); + codegen_->InvokeRuntime(kQuickDeliverException, instruction, instruction->GetDexPc()); CheckEntrypointTypes<kQuickDeliverException, void, mirror::Object*>(); } @@ -6761,11 +6709,10 @@ void LocationsBuilderX86::VisitMonitorOperation(HMonitorOperation* instruction) } void InstructionCodeGeneratorX86::VisitMonitorOperation(HMonitorOperation* instruction) { - codegen_->InvokeRuntime(instruction->IsEnter() ? QUICK_ENTRY_POINT(pLockObject) - : QUICK_ENTRY_POINT(pUnlockObject), + codegen_->InvokeRuntime(instruction->IsEnter() ? kQuickLockObject + : kQuickUnlockObject, instruction, - instruction->GetDexPc(), - nullptr); + instruction->GetDexPc()); if (instruction->IsEnter()) { CheckEntrypointTypes<kQuickLockObject, void, mirror::Object*>(); } else { diff --git a/compiler/optimizing/code_generator_x86.h b/compiler/optimizing/code_generator_x86.h index c644e401ff..df65fa2f4a 100644 --- a/compiler/optimizing/code_generator_x86.h +++ b/compiler/optimizing/code_generator_x86.h @@ -327,12 +327,7 @@ class CodeGeneratorX86 : public CodeGenerator { void InvokeRuntime(QuickEntrypointEnum entrypoint, HInstruction* instruction, uint32_t dex_pc, - SlowPathCode* slow_path) OVERRIDE; - - void InvokeRuntime(int32_t entry_point_offset, - HInstruction* instruction, - uint32_t dex_pc, - SlowPathCode* slow_path); + SlowPathCode* slow_path = nullptr) OVERRIDE; // Generate code to invoke a runtime entry point, but do not record // PC-related information in a stack map. @@ -340,6 +335,8 @@ class CodeGeneratorX86 : public CodeGenerator { HInstruction* instruction, SlowPathCode* slow_path); + void GenerateInvokeRuntime(int32_t entry_point_offset); + size_t GetWordSize() const OVERRIDE { return kX86WordSize; } diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index 87b6de3f39..aef4cd7ef5 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -66,7 +66,7 @@ class NullCheckSlowPathX86_64 : public SlowPathCode { // Live registers will be restored in the catch block if caught. SaveLiveRegisters(codegen, instruction_->GetLocations()); } - x86_64_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pThrowNullPointer), + x86_64_codegen->InvokeRuntime(kQuickThrowNullPointer, instruction_, instruction_->GetDexPc(), this); @@ -92,10 +92,7 @@ class DivZeroCheckSlowPathX86_64 : public SlowPathCode { // Live registers will be restored in the catch block if caught. SaveLiveRegisters(codegen, instruction_->GetLocations()); } - x86_64_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pThrowDivZero), - instruction_, - instruction_->GetDexPc(), - this); + x86_64_codegen->InvokeRuntime(kQuickThrowDivZero, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes<kQuickThrowDivZero, void, void>(); } @@ -149,10 +146,7 @@ class SuspendCheckSlowPathX86_64 : public SlowPathCode { void EmitNativeCode(CodeGenerator* codegen) OVERRIDE { CodeGeneratorX86_64* x86_64_codegen = down_cast<CodeGeneratorX86_64*>(codegen); __ Bind(GetEntryLabel()); - x86_64_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pTestSuspend), - instruction_, - instruction_->GetDexPc(), - this); + x86_64_codegen->InvokeRuntime(kQuickTestSuspend, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes<kQuickTestSuspend, void, void>(); if (successor_ == nullptr) { __ jmp(GetReturnLabel()); @@ -219,13 +213,10 @@ class BoundsCheckSlowPathX86_64 : public SlowPathCode { length_loc, Location::RegisterLocation(calling_convention.GetRegisterAt(1)), Primitive::kPrimInt); - uint32_t entry_point_offset = instruction_->AsBoundsCheck()->IsStringCharAt() - ? QUICK_ENTRY_POINT(pThrowStringBounds) - : QUICK_ENTRY_POINT(pThrowArrayBounds); - x86_64_codegen->InvokeRuntime(entry_point_offset, - instruction_, - instruction_->GetDexPc(), - this); + QuickEntrypointEnum entrypoint = instruction_->AsBoundsCheck()->IsStringCharAt() + ? kQuickThrowStringBounds + : kQuickThrowArrayBounds; + x86_64_codegen->InvokeRuntime(entrypoint, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes<kQuickThrowStringBounds, void, int32_t, int32_t>(); CheckEntrypointTypes<kQuickThrowArrayBounds, void, int32_t, int32_t>(); } @@ -257,9 +248,7 @@ class LoadClassSlowPathX86_64 : public SlowPathCode { InvokeRuntimeCallingConvention calling_convention; __ movl(CpuRegister(calling_convention.GetRegisterAt(0)), Immediate(cls_->GetTypeIndex())); - x86_64_codegen->InvokeRuntime(do_clinit_ ? - QUICK_ENTRY_POINT(pInitializeStaticStorage) : - QUICK_ENTRY_POINT(pInitializeType), + x86_64_codegen->InvokeRuntime(do_clinit_ ? kQuickInitializeStaticStorage : kQuickInitializeType, at_, dex_pc_, this); @@ -314,7 +303,7 @@ class LoadStringSlowPathX86_64 : public SlowPathCode { InvokeRuntimeCallingConvention calling_convention; const uint32_t string_index = instruction_->AsLoadString()->GetStringIndex(); __ movl(CpuRegister(calling_convention.GetRegisterAt(0)), Immediate(string_index)); - x86_64_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pResolveString), + x86_64_codegen->InvokeRuntime(kQuickResolveString, instruction_, instruction_->GetDexPc(), this); @@ -362,18 +351,12 @@ class TypeCheckSlowPathX86_64 : public SlowPathCode { Primitive::kPrimNot); if (instruction_->IsInstanceOf()) { - x86_64_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pInstanceofNonTrivial), - instruction_, - dex_pc, - this); + x86_64_codegen->InvokeRuntime(kQuickInstanceofNonTrivial, instruction_, dex_pc, this); CheckEntrypointTypes< kQuickInstanceofNonTrivial, size_t, const mirror::Class*, const mirror::Class*>(); } else { DCHECK(instruction_->IsCheckCast()); - x86_64_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pCheckCast), - instruction_, - dex_pc, - this); + x86_64_codegen->InvokeRuntime(kQuickCheckCast, instruction_, dex_pc, this); CheckEntrypointTypes<kQuickCheckCast, void, const mirror::Class*, const mirror::Class*>(); } @@ -406,10 +389,7 @@ class DeoptimizationSlowPathX86_64 : public SlowPathCode { CodeGeneratorX86_64* x86_64_codegen = down_cast<CodeGeneratorX86_64*>(codegen); __ Bind(GetEntryLabel()); SaveLiveRegisters(codegen, instruction_->GetLocations()); - x86_64_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pDeoptimize), - instruction_, - instruction_->GetDexPc(), - this); + x86_64_codegen->InvokeRuntime(kQuickDeoptimize, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes<kQuickDeoptimize, void, void>(); } @@ -448,10 +428,7 @@ class ArraySetSlowPathX86_64 : public SlowPathCode { codegen->GetMoveResolver()->EmitNativeCode(¶llel_move); CodeGeneratorX86_64* x86_64_codegen = down_cast<CodeGeneratorX86_64*>(codegen); - x86_64_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pAputObject), - instruction_, - instruction_->GetDexPc(), - this); + x86_64_codegen->InvokeRuntime(kQuickAputObject, instruction_, instruction_->GetDexPc(), this); CheckEntrypointTypes<kQuickAputObject, void, mirror::Array*, int32_t, mirror::Object*>(); RestoreLiveRegisters(codegen, locations); __ jmp(GetExitLabel()); @@ -666,7 +643,7 @@ class ReadBarrierForHeapReferenceSlowPathX86_64 : public SlowPathCode { codegen->GetMoveResolver()->EmitNativeCode(¶llel_move); __ movl(CpuRegister(calling_convention.GetRegisterAt(2)), Immediate(offset_)); } - x86_64_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pReadBarrierSlow), + x86_64_codegen->InvokeRuntime(kQuickReadBarrierSlow, instruction_, instruction_->GetDexPc(), this); @@ -734,7 +711,7 @@ class ReadBarrierForRootSlowPathX86_64 : public SlowPathCode { InvokeRuntimeCallingConvention calling_convention; CodeGeneratorX86_64* x86_64_codegen = down_cast<CodeGeneratorX86_64*>(codegen); x86_64_codegen->Move(Location::RegisterLocation(calling_convention.GetRegisterAt(0)), root_); - x86_64_codegen->InvokeRuntime(QUICK_ENTRY_POINT(pReadBarrierForRootSlow), + x86_64_codegen->InvokeRuntime(kQuickReadBarrierForRootSlow, instruction_, instruction_->GetDexPc(), this); @@ -1036,25 +1013,21 @@ void CodeGeneratorX86_64::InvokeRuntime(QuickEntrypointEnum entrypoint, HInstruction* instruction, uint32_t dex_pc, SlowPathCode* slow_path) { - InvokeRuntime(GetThreadOffset<kX86_64PointerSize>(entrypoint).Int32Value(), - instruction, - dex_pc, - slow_path); -} - -void CodeGeneratorX86_64::InvokeRuntime(int32_t entry_point_offset, - HInstruction* instruction, - uint32_t dex_pc, - SlowPathCode* slow_path) { ValidateInvokeRuntime(instruction, slow_path); - __ gs()->call(Address::Absolute(entry_point_offset, /* no_rip */ true)); - RecordPcInfo(instruction, dex_pc, slow_path); + GenerateInvokeRuntime(GetThreadOffset<kX86_64PointerSize>(entrypoint).Int32Value()); + if (EntrypointRequiresStackMap(entrypoint)) { + RecordPcInfo(instruction, dex_pc, slow_path); + } } void CodeGeneratorX86_64::InvokeRuntimeWithoutRecordingPcInfo(int32_t entry_point_offset, HInstruction* instruction, SlowPathCode* slow_path) { ValidateInvokeRuntimeWithoutRecordingPcInfo(instruction, slow_path); + GenerateInvokeRuntime(entry_point_offset); +} + +void CodeGeneratorX86_64::GenerateInvokeRuntime(int32_t entry_point_offset) { __ gs()->call(Address::Absolute(entry_point_offset, /* no_rip */ true)); } @@ -3972,10 +3945,7 @@ void InstructionCodeGeneratorX86_64::VisitNewInstance(HNewInstance* instruction) __ call(Address(temp, code_offset.SizeValue())); codegen_->RecordPcInfo(instruction, instruction->GetDexPc()); } else { - codegen_->InvokeRuntime(instruction->GetEntrypoint(), - instruction, - instruction->GetDexPc(), - nullptr); + codegen_->InvokeRuntime(instruction->GetEntrypoint(), instruction, instruction->GetDexPc()); CheckEntrypointTypes<kQuickAllocObjectWithAccessCheck, void*, uint32_t, ArtMethod*>(); DCHECK(!codegen_->IsLeafMethod()); } @@ -3997,10 +3967,7 @@ void InstructionCodeGeneratorX86_64::VisitNewArray(HNewArray* instruction) { instruction->GetTypeIndex()); // Note: if heap poisoning is enabled, the entry point takes cares // of poisoning the reference. - codegen_->InvokeRuntime(instruction->GetEntrypoint(), - instruction, - instruction->GetDexPc(), - nullptr); + codegen_->InvokeRuntime(instruction->GetEntrypoint(), instruction, instruction->GetDexPc()); CheckEntrypointTypes<kQuickAllocArrayWithAccessCheck, void*, uint32_t, int32_t, ArtMethod*>(); DCHECK(!codegen_->IsLeafMethod()); @@ -5495,10 +5462,7 @@ void InstructionCodeGeneratorX86_64::VisitLoadClass(HLoadClass* cls) { LocationSummary* locations = cls->GetLocations(); if (cls->NeedsAccessCheck()) { codegen_->MoveConstant(locations->GetTemp(0), cls->GetTypeIndex()); - codegen_->InvokeRuntime(QUICK_ENTRY_POINT(pInitializeTypeAndVerifyAccess), - cls, - cls->GetDexPc(), - nullptr); + codegen_->InvokeRuntime(kQuickInitializeTypeAndVerifyAccess, cls, cls->GetDexPc()); CheckEntrypointTypes<kQuickInitializeTypeAndVerifyAccess, void*, uint32_t>(); return; } @@ -5715,10 +5679,7 @@ void LocationsBuilderX86_64::VisitThrow(HThrow* instruction) { } void InstructionCodeGeneratorX86_64::VisitThrow(HThrow* instruction) { - codegen_->InvokeRuntime(QUICK_ENTRY_POINT(pDeliverException), - instruction, - instruction->GetDexPc(), - nullptr); + codegen_->InvokeRuntime(kQuickDeliverException, instruction, instruction->GetDexPc()); CheckEntrypointTypes<kQuickDeliverException, void, mirror::Object*>(); } @@ -6216,11 +6177,9 @@ void LocationsBuilderX86_64::VisitMonitorOperation(HMonitorOperation* instructio } void InstructionCodeGeneratorX86_64::VisitMonitorOperation(HMonitorOperation* instruction) { - codegen_->InvokeRuntime(instruction->IsEnter() ? QUICK_ENTRY_POINT(pLockObject) - : QUICK_ENTRY_POINT(pUnlockObject), + codegen_->InvokeRuntime(instruction->IsEnter() ? kQuickLockObject : kQuickUnlockObject, instruction, - instruction->GetDexPc(), - nullptr); + instruction->GetDexPc()); if (instruction->IsEnter()) { CheckEntrypointTypes<kQuickLockObject, void, mirror::Object*>(); } else { diff --git a/compiler/optimizing/code_generator_x86_64.h b/compiler/optimizing/code_generator_x86_64.h index 44844ac67a..f23bff5e1f 100644 --- a/compiler/optimizing/code_generator_x86_64.h +++ b/compiler/optimizing/code_generator_x86_64.h @@ -309,12 +309,7 @@ class CodeGeneratorX86_64 : public CodeGenerator { void InvokeRuntime(QuickEntrypointEnum entrypoint, HInstruction* instruction, uint32_t dex_pc, - SlowPathCode* slow_path) OVERRIDE; - - void InvokeRuntime(int32_t entry_point_offset, - HInstruction* instruction, - uint32_t dex_pc, - SlowPathCode* slow_path); + SlowPathCode* slow_path = nullptr) OVERRIDE; // Generate code to invoke a runtime entry point, but do not record // PC-related information in a stack map. @@ -322,6 +317,8 @@ class CodeGeneratorX86_64 : public CodeGenerator { HInstruction* instruction, SlowPathCode* slow_path); + void GenerateInvokeRuntime(int32_t entry_point_offset); + size_t GetWordSize() const OVERRIDE { return kX86_64WordSize; } diff --git a/compiler/optimizing/intrinsics_x86.cc b/compiler/optimizing/intrinsics_x86.cc index cf4a040551..ef4d0f1d2e 100644 --- a/compiler/optimizing/intrinsics_x86.cc +++ b/compiler/optimizing/intrinsics_x86.cc @@ -963,7 +963,7 @@ static void GenFPToFPCall(HInvoke* invoke, CodeGeneratorX86* codegen, QuickEntry } // Now do the actual call. - __ fs()->call(Address::Absolute(GetThreadOffset<kX86PointerSize>(entry))); + codegen->InvokeRuntime(entry, invoke, invoke->GetDexPc()); // Extract the return value from the FP stack. __ fstpl(Address(ESP, 0)); @@ -972,8 +972,6 @@ static void GenFPToFPCall(HInvoke* invoke, CodeGeneratorX86* codegen, QuickEntry // And clean up the stack. __ addl(ESP, Immediate(16)); __ cfi().AdjustCFAOffset(-16); - - codegen->RecordPcInfo(invoke, invoke->GetDexPc()); } void IntrinsicLocationsBuilderX86::VisitMathCos(HInvoke* invoke) { @@ -1343,7 +1341,7 @@ void IntrinsicCodeGeneratorX86::VisitStringCompareTo(HInvoke* invoke) { codegen_->AddSlowPath(slow_path); __ j(kEqual, slow_path->GetEntryLabel()); - __ fs()->call(Address::Absolute(QUICK_ENTRYPOINT_OFFSET(kX86PointerSize, pStringCompareTo))); + codegen_->InvokeRuntime(kQuickStringCompareTo, invoke, invoke->GetDexPc(), slow_path); __ Bind(slow_path->GetExitLabel()); } @@ -1616,9 +1614,8 @@ void IntrinsicCodeGeneratorX86::VisitStringNewStringFromBytes(HInvoke* invoke) { codegen_->AddSlowPath(slow_path); __ j(kEqual, slow_path->GetEntryLabel()); - __ fs()->call(Address::Absolute(QUICK_ENTRYPOINT_OFFSET(kX86PointerSize, pAllocStringFromBytes))); + codegen_->InvokeRuntime(kQuickAllocStringFromBytes, invoke, invoke->GetDexPc()); CheckEntrypointTypes<kQuickAllocStringFromBytes, void*, void*, int32_t, int32_t, int32_t>(); - codegen_->RecordPcInfo(invoke, invoke->GetDexPc()); __ Bind(slow_path->GetExitLabel()); } @@ -1634,17 +1631,14 @@ void IntrinsicLocationsBuilderX86::VisitStringNewStringFromChars(HInvoke* invoke } void IntrinsicCodeGeneratorX86::VisitStringNewStringFromChars(HInvoke* invoke) { - X86Assembler* assembler = GetAssembler(); - // No need to emit code checking whether `locations->InAt(2)` is a null // pointer, as callers of the native method // // java.lang.StringFactory.newStringFromChars(int offset, int charCount, char[] data) // // all include a null check on `data` before calling that method. - __ fs()->call(Address::Absolute(QUICK_ENTRYPOINT_OFFSET(kX86PointerSize, pAllocStringFromChars))); + codegen_->InvokeRuntime(kQuickAllocStringFromChars, invoke, invoke->GetDexPc()); CheckEntrypointTypes<kQuickAllocStringFromChars, void*, int32_t, int32_t, void*>(); - codegen_->RecordPcInfo(invoke, invoke->GetDexPc()); } void IntrinsicLocationsBuilderX86::VisitStringNewStringFromString(HInvoke* invoke) { @@ -1666,10 +1660,8 @@ void IntrinsicCodeGeneratorX86::VisitStringNewStringFromString(HInvoke* invoke) codegen_->AddSlowPath(slow_path); __ j(kEqual, slow_path->GetEntryLabel()); - __ fs()->call( - Address::Absolute(QUICK_ENTRYPOINT_OFFSET(kX86PointerSize, pAllocStringFromString))); + codegen_->InvokeRuntime(kQuickAllocStringFromString, invoke, invoke->GetDexPc()); CheckEntrypointTypes<kQuickAllocStringFromString, void*, void*>(); - codegen_->RecordPcInfo(invoke, invoke->GetDexPc()); __ Bind(slow_path->GetExitLabel()); } diff --git a/compiler/optimizing/intrinsics_x86_64.cc b/compiler/optimizing/intrinsics_x86_64.cc index a4ee546237..c7e30071f0 100644 --- a/compiler/optimizing/intrinsics_x86_64.cc +++ b/compiler/optimizing/intrinsics_x86_64.cc @@ -766,10 +766,8 @@ static void GenFPToFPCall(HInvoke* invoke, CodeGeneratorX86_64* codegen, LocationSummary* locations = invoke->GetLocations(); DCHECK(locations->WillCall()); DCHECK(invoke->IsInvokeStaticOrDirect()); - X86_64Assembler* assembler = codegen->GetAssembler(); - __ gs()->call(Address::Absolute(GetThreadOffset<kX86_64PointerSize>(entry), true)); - codegen->RecordPcInfo(invoke, invoke->GetDexPc()); + codegen->InvokeRuntime(entry, invoke, invoke->GetDexPc()); } void IntrinsicLocationsBuilderX86_64::VisitMathCos(HInvoke* invoke) { @@ -1510,8 +1508,7 @@ void IntrinsicCodeGeneratorX86_64::VisitStringCompareTo(HInvoke* invoke) { codegen_->AddSlowPath(slow_path); __ j(kEqual, slow_path->GetEntryLabel()); - __ gs()->call(Address::Absolute(QUICK_ENTRYPOINT_OFFSET(kX86_64PointerSize, pStringCompareTo), - /* no_rip */ true)); + codegen_->InvokeRuntime(kQuickStringCompareTo, invoke, invoke->GetDexPc(), slow_path); __ Bind(slow_path->GetExitLabel()); } @@ -1783,11 +1780,8 @@ void IntrinsicCodeGeneratorX86_64::VisitStringNewStringFromBytes(HInvoke* invoke codegen_->AddSlowPath(slow_path); __ j(kEqual, slow_path->GetEntryLabel()); - __ gs()->call(Address::Absolute(QUICK_ENTRYPOINT_OFFSET(kX86_64PointerSize, - pAllocStringFromBytes), - /* no_rip */ true)); + codegen_->InvokeRuntime(kQuickAllocStringFromBytes, invoke, invoke->GetDexPc()); CheckEntrypointTypes<kQuickAllocStringFromBytes, void*, void*, int32_t, int32_t, int32_t>(); - codegen_->RecordPcInfo(invoke, invoke->GetDexPc()); __ Bind(slow_path->GetExitLabel()); } @@ -1803,19 +1797,14 @@ void IntrinsicLocationsBuilderX86_64::VisitStringNewStringFromChars(HInvoke* inv } void IntrinsicCodeGeneratorX86_64::VisitStringNewStringFromChars(HInvoke* invoke) { - X86_64Assembler* assembler = GetAssembler(); - // No need to emit code checking whether `locations->InAt(2)` is a null // pointer, as callers of the native method // // java.lang.StringFactory.newStringFromChars(int offset, int charCount, char[] data) // // all include a null check on `data` before calling that method. - __ gs()->call(Address::Absolute(QUICK_ENTRYPOINT_OFFSET(kX86_64PointerSize, - pAllocStringFromChars), - /* no_rip */ true)); + codegen_->InvokeRuntime(kQuickAllocStringFromChars, invoke, invoke->GetDexPc()); CheckEntrypointTypes<kQuickAllocStringFromChars, void*, int32_t, int32_t, void*>(); - codegen_->RecordPcInfo(invoke, invoke->GetDexPc()); } void IntrinsicLocationsBuilderX86_64::VisitStringNewStringFromString(HInvoke* invoke) { @@ -1837,11 +1826,8 @@ void IntrinsicCodeGeneratorX86_64::VisitStringNewStringFromString(HInvoke* invok codegen_->AddSlowPath(slow_path); __ j(kEqual, slow_path->GetEntryLabel()); - __ gs()->call(Address::Absolute(QUICK_ENTRYPOINT_OFFSET(kX86_64PointerSize, - pAllocStringFromString), - /* no_rip */ true)); + codegen_->InvokeRuntime(kQuickAllocStringFromString, invoke, invoke->GetDexPc()); CheckEntrypointTypes<kQuickAllocStringFromString, void*, void*>(); - codegen_->RecordPcInfo(invoke, invoke->GetDexPc()); __ Bind(slow_path->GetExitLabel()); } |