diff options
author | 2020-06-08 15:05:15 +0100 | |
---|---|---|
committer | 2020-06-09 10:03:58 +0000 | |
commit | 9922f00cf68aac69209216a0726a45eb6338763c (patch) | |
tree | 7e43b55e85ed17443af1c6be6532dafbb8550495 /compiler/optimizing/intrinsics_utils.h | |
parent | 16527e892b13c9e1fb34f8d2e9993e58a72ac662 (diff) |
arm/arm64: Clean up intrinsic slow paths.
Generalize and use the slow path template IntrinsicSlowPath
from intrinsics_utils.h.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: aosp_taimen-userdebug boot image is unchanged.
Change-Id: Ia8fa4e1b31c1f190fc5f02671336caec15e4cf4d
Diffstat (limited to 'compiler/optimizing/intrinsics_utils.h')
-rw-r--r-- | compiler/optimizing/intrinsics_utils.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/compiler/optimizing/intrinsics_utils.h b/compiler/optimizing/intrinsics_utils.h index 41947f1ccd..e24d541c96 100644 --- a/compiler/optimizing/intrinsics_utils.h +++ b/compiler/optimizing/intrinsics_utils.h @@ -17,6 +17,7 @@ #ifndef ART_COMPILER_OPTIMIZING_INTRINSICS_UTILS_H_ #define ART_COMPILER_OPTIMIZING_INTRINSICS_UTILS_H_ +#include "base/casts.h" #include "base/macros.h" #include "code_generator.h" #include "locations.h" @@ -36,10 +37,12 @@ namespace art { // Note: If an invoke wasn't sharpened, we will put down an invoke-virtual here. That's potentially // sub-optimal (compared to a direct pointer call), but this is a slow-path. -template <typename TDexCallingConvention> -class IntrinsicSlowPath : public SlowPathCode { +template <typename TDexCallingConvention, + typename TSlowPathCode = SlowPathCode, + typename TAssembler = Assembler> +class IntrinsicSlowPath : public TSlowPathCode { public: - explicit IntrinsicSlowPath(HInvoke* invoke) : SlowPathCode(invoke), invoke_(invoke) { } + explicit IntrinsicSlowPath(HInvoke* invoke) : TSlowPathCode(invoke), invoke_(invoke) { } Location MoveArguments(CodeGenerator* codegen) { TDexCallingConvention calling_convention_visitor; @@ -48,10 +51,10 @@ class IntrinsicSlowPath : public SlowPathCode { } void EmitNativeCode(CodeGenerator* codegen) override { - Assembler* assembler = codegen->GetAssembler(); - assembler->Bind(GetEntryLabel()); + TAssembler* assembler = down_cast<TAssembler*>(codegen->GetAssembler()); + assembler->Bind(this->GetEntryLabel()); - SaveLiveRegisters(codegen, invoke_->GetLocations()); + this->SaveLiveRegisters(codegen, invoke_->GetLocations()); Location method_loc = MoveArguments(codegen); @@ -69,8 +72,8 @@ class IntrinsicSlowPath : public SlowPathCode { codegen->MoveFromReturnRegister(out, invoke_->GetType()); } - RestoreLiveRegisters(codegen, invoke_->GetLocations()); - assembler->Jump(GetExitLabel()); + this->RestoreLiveRegisters(codegen, invoke_->GetLocations()); + assembler->Jump(this->GetExitLabel()); } const char* GetDescription() const override { return "IntrinsicSlowPath"; } |