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 constexpr size_t kFramePointerSize = static_cast<size_t>(PointerSize::k64); 27 28 class Arm64ManagedRuntimeCallingConvention FINAL : public ManagedRuntimeCallingConvention { 29 public: Arm64ManagedRuntimeCallingConvention(bool is_static,bool is_synchronized,const char * shorty)30 Arm64ManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty) 31 : ManagedRuntimeCallingConvention(is_static, 32 is_synchronized, 33 shorty, 34 PointerSize::k64) {} ~Arm64ManagedRuntimeCallingConvention()35 ~Arm64ManagedRuntimeCallingConvention() OVERRIDE {} 36 // Calling convention 37 ManagedRegister ReturnRegister() OVERRIDE; 38 ManagedRegister InterproceduralScratchRegister() OVERRIDE; 39 // Managed runtime calling convention 40 ManagedRegister MethodRegister() OVERRIDE; 41 bool IsCurrentParamInRegister() OVERRIDE; 42 bool IsCurrentParamOnStack() OVERRIDE; 43 ManagedRegister CurrentParamRegister() OVERRIDE; 44 FrameOffset CurrentParamStackOffset() OVERRIDE; 45 const ManagedRegisterEntrySpills& EntrySpills() OVERRIDE; 46 47 private: 48 ManagedRegisterEntrySpills entry_spills_; 49 50 DISALLOW_COPY_AND_ASSIGN(Arm64ManagedRuntimeCallingConvention); 51 }; 52 53 class Arm64JniCallingConvention FINAL : public JniCallingConvention { 54 public: 55 Arm64JniCallingConvention(bool is_static, 56 bool is_synchronized, 57 bool is_critical_native, 58 const char* shorty); ~Arm64JniCallingConvention()59 ~Arm64JniCallingConvention() OVERRIDE {} 60 // Calling convention 61 ManagedRegister ReturnRegister() OVERRIDE; 62 ManagedRegister IntReturnRegister() OVERRIDE; 63 ManagedRegister InterproceduralScratchRegister() OVERRIDE; 64 // JNI calling convention 65 size_t FrameSize() OVERRIDE; 66 size_t OutArgSize() OVERRIDE; 67 ArrayRef<const ManagedRegister> CalleeSaveRegisters() const OVERRIDE; 68 ManagedRegister ReturnScratchRegister() const OVERRIDE; 69 uint32_t CoreSpillMask() const OVERRIDE; 70 uint32_t FpSpillMask() const OVERRIDE; 71 bool IsCurrentParamInRegister() OVERRIDE; 72 bool IsCurrentParamOnStack() OVERRIDE; 73 ManagedRegister CurrentParamRegister() OVERRIDE; 74 FrameOffset CurrentParamStackOffset() OVERRIDE; 75 76 // aarch64 calling convention leaves upper bits undefined. RequiresSmallResultTypeExtension()77 bool RequiresSmallResultTypeExtension() const OVERRIDE { 78 return true; 79 } 80 81 protected: 82 size_t NumberOfOutgoingStackArgs() OVERRIDE; 83 84 private: 85 DISALLOW_COPY_AND_ASSIGN(Arm64JniCallingConvention); 86 }; 87 88 } // namespace arm64 89 } // namespace art 90 91 #endif // ART_COMPILER_JNI_QUICK_ARM64_CALLING_CONVENTION_ARM64_H_ 92