1 /* 2 * Copyright (C) 2011 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_ARM_CALLING_CONVENTION_ARM_H_ 18 #define ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_ 19 20 #include "base/enums.h" 21 #include "jni/quick/calling_convention.h" 22 23 namespace art { 24 namespace arm { 25 26 constexpr size_t kFramePointerSize = static_cast<size_t>(PointerSize::k32); 27 28 class ArmManagedRuntimeCallingConvention final : public ManagedRuntimeCallingConvention { 29 public: ArmManagedRuntimeCallingConvention(bool is_static,bool is_synchronized,const char * shorty)30 ArmManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty) 31 : ManagedRuntimeCallingConvention(is_static, 32 is_synchronized, 33 shorty, 34 PointerSize::k32) {} ~ArmManagedRuntimeCallingConvention()35 ~ArmManagedRuntimeCallingConvention() 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(ArmManagedRuntimeCallingConvention); 51 }; 52 53 class ArmJniCallingConvention final : public JniCallingConvention { 54 public: 55 ArmJniCallingConvention(bool is_static, 56 bool is_synchronized, 57 bool is_critical_native, 58 const char* shorty); ~ArmJniCallingConvention()59 ~ArmJniCallingConvention() override {} 60 // Calling convention 61 ManagedRegister ReturnRegister() override; 62 ManagedRegister IntReturnRegister() override; 63 ManagedRegister InterproceduralScratchRegister() override; 64 // JNI calling convention 65 void Next() override; // Override default behavior for AAPCS 66 size_t FrameSize() override; 67 size_t OutArgSize() override; 68 ArrayRef<const ManagedRegister> CalleeSaveRegisters() const override; 69 ManagedRegister ReturnScratchRegister() const override; 70 uint32_t CoreSpillMask() const override; 71 uint32_t FpSpillMask() const override; 72 bool IsCurrentParamInRegister() override; 73 bool IsCurrentParamOnStack() override; 74 ManagedRegister CurrentParamRegister() override; 75 FrameOffset CurrentParamStackOffset() override; 76 77 // AAPCS mandates return values are extended. RequiresSmallResultTypeExtension()78 bool RequiresSmallResultTypeExtension() const override { 79 return false; 80 } 81 82 protected: 83 size_t NumberOfOutgoingStackArgs() override; 84 85 private: 86 // Padding to ensure longs and doubles are not split in AAPCS 87 size_t padding_; 88 89 DISALLOW_COPY_AND_ASSIGN(ArmJniCallingConvention); 90 }; 91 92 } // namespace arm 93 } // namespace art 94 95 #endif // ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_ 96