• 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 "base/enums.h"
21 #include "jni/quick/calling_convention.h"
22 
23 namespace art {
24 namespace arm64 {
25 
26 class Arm64ManagedRuntimeCallingConvention final : public ManagedRuntimeCallingConvention {
27  public:
Arm64ManagedRuntimeCallingConvention(bool is_static,bool is_synchronized,const char * shorty)28   Arm64ManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty)
29       : ManagedRuntimeCallingConvention(is_static,
30                                         is_synchronized,
31                                         shorty,
32                                         PointerSize::k64) {}
~Arm64ManagedRuntimeCallingConvention()33   ~Arm64ManagedRuntimeCallingConvention() override {}
34   // Calling convention
35   ManagedRegister ReturnRegister() const override;
36   // Managed runtime calling convention
37   ManagedRegister MethodRegister() override;
38   bool IsCurrentParamInRegister() override;
39   bool IsCurrentParamOnStack() override;
40   ManagedRegister CurrentParamRegister() override;
41   FrameOffset CurrentParamStackOffset() override;
42 
43  private:
44   DISALLOW_COPY_AND_ASSIGN(Arm64ManagedRuntimeCallingConvention);
45 };
46 
47 class Arm64JniCallingConvention final : public JniCallingConvention {
48  public:
49   Arm64JniCallingConvention(bool is_static,
50                             bool is_synchronized,
51                             bool is_fast_native,
52                             bool is_critical_native,
53                             const char* shorty);
~Arm64JniCallingConvention()54   ~Arm64JniCallingConvention() override {}
55   // Calling convention
56   ManagedRegister ReturnRegister() const override;
57   ManagedRegister IntReturnRegister() const override;
58   // JNI calling convention
59   size_t FrameSize() const override;
60   size_t OutFrameSize() const override;
61   ArrayRef<const ManagedRegister> CalleeSaveRegisters() const override;
62   ArrayRef<const ManagedRegister> CalleeSaveScratchRegisters() const override;
63   ArrayRef<const ManagedRegister> ArgumentScratchRegisters() 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 HasSmallReturnType();
74   }
75 
76   // Locking argument register, used to pass the synchronization object for calls
77   // to `JniLockObject()` and `JniUnlockObject()`.
78   ManagedRegister LockingArgumentRegister() const override;
79 
80   // Hidden argument register, used to pass the method pointer for @CriticalNative call.
81   ManagedRegister HiddenArgumentRegister() const override;
82 
83   // Whether to use tail call (used only for @CriticalNative).
84   bool UseTailCall() const override;
85 
86  private:
87   DISALLOW_COPY_AND_ASSIGN(Arm64JniCallingConvention);
88 };
89 
90 }  // namespace arm64
91 }  // namespace art
92 
93 #endif  // ART_COMPILER_JNI_QUICK_ARM64_CALLING_CONVENTION_ARM64_H_
94