• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ART_COMPILER_JNI_QUICK_ARM64_CALLING_CONVENTION_ARM64_H_
18 #define ART_COMPILER_JNI_QUICK_ARM64_CALLING_CONVENTION_ARM64_H_
19 
20 #include "jni/quick/calling_convention.h"
21 
22 namespace art {
23 namespace arm64 {
24 
25 constexpr size_t kFramePointerSize = 8;
26 
27 class Arm64ManagedRuntimeCallingConvention FINAL : public ManagedRuntimeCallingConvention {
28  public:
Arm64ManagedRuntimeCallingConvention(bool is_static,bool is_synchronized,const char * shorty)29   Arm64ManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty)
30       : ManagedRuntimeCallingConvention(is_static, is_synchronized, shorty, kFramePointerSize) {}
~Arm64ManagedRuntimeCallingConvention()31   ~Arm64ManagedRuntimeCallingConvention() OVERRIDE {}
32   // Calling convention
33   ManagedRegister ReturnRegister() OVERRIDE;
34   ManagedRegister InterproceduralScratchRegister() OVERRIDE;
35   // Managed runtime calling convention
36   ManagedRegister MethodRegister() OVERRIDE;
37   bool IsCurrentParamInRegister() OVERRIDE;
38   bool IsCurrentParamOnStack() OVERRIDE;
39   ManagedRegister CurrentParamRegister() OVERRIDE;
40   FrameOffset CurrentParamStackOffset() OVERRIDE;
41   const ManagedRegisterEntrySpills& EntrySpills() OVERRIDE;
42 
43  private:
44   ManagedRegisterEntrySpills entry_spills_;
45 
46   DISALLOW_COPY_AND_ASSIGN(Arm64ManagedRuntimeCallingConvention);
47 };
48 
49 class Arm64JniCallingConvention FINAL : public JniCallingConvention {
50  public:
51   explicit Arm64JniCallingConvention(bool is_static, bool is_synchronized, const char* shorty);
~Arm64JniCallingConvention()52   ~Arm64JniCallingConvention() OVERRIDE {}
53   // Calling convention
54   ManagedRegister ReturnRegister() OVERRIDE;
55   ManagedRegister IntReturnRegister() OVERRIDE;
56   ManagedRegister InterproceduralScratchRegister() OVERRIDE;
57   // JNI calling convention
58   size_t FrameSize() OVERRIDE;
59   size_t OutArgSize() OVERRIDE;
CalleeSaveRegisters()60   const std::vector<ManagedRegister>& CalleeSaveRegisters() const OVERRIDE {
61     return callee_save_regs_;
62   }
63   ManagedRegister ReturnScratchRegister() const OVERRIDE;
64   uint32_t CoreSpillMask() const OVERRIDE;
65   uint32_t FpSpillMask() const OVERRIDE;
66   bool IsCurrentParamInRegister() OVERRIDE;
67   bool IsCurrentParamOnStack() OVERRIDE;
68   ManagedRegister CurrentParamRegister() OVERRIDE;
69   FrameOffset CurrentParamStackOffset() OVERRIDE;
70 
71   // aarch64 calling convention leaves upper bits undefined.
RequiresSmallResultTypeExtension()72   bool RequiresSmallResultTypeExtension() const OVERRIDE {
73     return true;
74   }
75 
76  protected:
77   size_t NumberOfOutgoingStackArgs() OVERRIDE;
78 
79  private:
80   // TODO: these values aren't unique and can be shared amongst instances
81   std::vector<ManagedRegister> callee_save_regs_;
82 
83   DISALLOW_COPY_AND_ASSIGN(Arm64JniCallingConvention);
84 };
85 
86 }  // namespace arm64
87 }  // namespace art
88 
89 #endif  // ART_COMPILER_JNI_QUICK_ARM64_CALLING_CONVENTION_ARM64_H_
90