1 /* 2 * Copyright (C) 2015 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_MIPS64_CALLING_CONVENTION_MIPS64_H_ 18 #define ART_COMPILER_JNI_QUICK_MIPS64_CALLING_CONVENTION_MIPS64_H_ 19 20 #include "jni/quick/calling_convention.h" 21 22 namespace art { 23 namespace mips64 { 24 25 constexpr size_t kFramePointerSize = 8; 26 27 class Mips64ManagedRuntimeCallingConvention FINAL : public ManagedRuntimeCallingConvention { 28 public: Mips64ManagedRuntimeCallingConvention(bool is_static,bool is_synchronized,const char * shorty)29 Mips64ManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty) 30 : ManagedRuntimeCallingConvention(is_static, is_synchronized, shorty, kFramePointerSize) {} ~Mips64ManagedRuntimeCallingConvention()31 ~Mips64ManagedRuntimeCallingConvention() 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(Mips64ManagedRuntimeCallingConvention); 47 }; 48 49 class Mips64JniCallingConvention FINAL : public JniCallingConvention { 50 public: 51 explicit Mips64JniCallingConvention(bool is_static, bool is_synchronized, const char* shorty); ~Mips64JniCallingConvention()52 ~Mips64JniCallingConvention() 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; FpSpillMask()65 uint32_t FpSpillMask() const OVERRIDE { 66 return 0; // Floats aren't spilled in JNI down call 67 } 68 bool IsCurrentParamInRegister() OVERRIDE; 69 bool IsCurrentParamOnStack() OVERRIDE; 70 ManagedRegister CurrentParamRegister() OVERRIDE; 71 FrameOffset CurrentParamStackOffset() OVERRIDE; 72 73 // Mips64 does not need to extend small return types. RequiresSmallResultTypeExtension()74 bool RequiresSmallResultTypeExtension() const OVERRIDE { 75 return false; 76 } 77 78 protected: 79 size_t NumberOfOutgoingStackArgs() OVERRIDE; 80 81 private: 82 // TODO: these values aren't unique and can be shared amongst instances 83 std::vector<ManagedRegister> callee_save_regs_; 84 85 DISALLOW_COPY_AND_ASSIGN(Mips64JniCallingConvention); 86 }; 87 88 } // namespace mips64 89 } // namespace art 90 91 #endif // ART_COMPILER_JNI_QUICK_MIPS64_CALLING_CONVENTION_MIPS64_H_ 92