16ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic/* 26ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Copyright (C) 2015 The Android Open Source Project 36ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * 46ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Licensed under the Apache License, Version 2.0 (the "License"); 56ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * you may not use this file except in compliance with the License. 66ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * You may obtain a copy of the License at 76ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * 86ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * http://www.apache.org/licenses/LICENSE-2.0 96ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * 106ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * Unless required by applicable law or agreed to in writing, software 116ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * distributed under the License is distributed on an "AS IS" BASIS, 126ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 136ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * See the License for the specific language governing permissions and 146ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic * limitations under the License. 156ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic */ 166ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 176ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic#ifndef ART_COMPILER_JNI_QUICK_MIPS64_CALLING_CONVENTION_MIPS64_H_ 186ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic#define ART_COMPILER_JNI_QUICK_MIPS64_CALLING_CONVENTION_MIPS64_H_ 196ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 206ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic#include "jni/quick/calling_convention.h" 216ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 226ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagicnamespace art { 236ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagicnamespace mips64 { 246ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 256ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagicconstexpr size_t kFramePointerSize = 8; 266ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 276ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagicclass Mips64ManagedRuntimeCallingConvention FINAL : public ManagedRuntimeCallingConvention { 286ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic public: 296ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic Mips64ManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty) 306ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic : ManagedRuntimeCallingConvention(is_static, is_synchronized, shorty, kFramePointerSize) {} 316ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ~Mips64ManagedRuntimeCallingConvention() OVERRIDE {} 326ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic // Calling convention 336ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister ReturnRegister() OVERRIDE; 346ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister InterproceduralScratchRegister() OVERRIDE; 356ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic // Managed runtime calling convention 366ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister MethodRegister() OVERRIDE; 376ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bool IsCurrentParamInRegister() OVERRIDE; 386ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bool IsCurrentParamOnStack() OVERRIDE; 396ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister CurrentParamRegister() OVERRIDE; 406ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic FrameOffset CurrentParamStackOffset() OVERRIDE; 416ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic const ManagedRegisterEntrySpills& EntrySpills() OVERRIDE; 426ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 436ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic private: 446ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegisterEntrySpills entry_spills_; 456ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 466ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic DISALLOW_COPY_AND_ASSIGN(Mips64ManagedRuntimeCallingConvention); 476ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic}; 486ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 496ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagicclass Mips64JniCallingConvention FINAL : public JniCallingConvention { 506ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic public: 513887c468d731420e929e6ad3acf190d5431e94fcRoland Levillain Mips64JniCallingConvention(bool is_static, bool is_synchronized, const char* shorty); 526ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ~Mips64JniCallingConvention() OVERRIDE {} 536ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic // Calling convention 546ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister ReturnRegister() OVERRIDE; 556ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister IntReturnRegister() OVERRIDE; 566ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister InterproceduralScratchRegister() OVERRIDE; 576ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic // JNI calling convention 586ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic size_t FrameSize() OVERRIDE; 596ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic size_t OutArgSize() OVERRIDE; 606ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic const std::vector<ManagedRegister>& CalleeSaveRegisters() const OVERRIDE { 616ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic return callee_save_regs_; 626ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic } 636ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister ReturnScratchRegister() const OVERRIDE; 646ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic uint32_t CoreSpillMask() const OVERRIDE; 656ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic uint32_t FpSpillMask() const OVERRIDE { 666ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic return 0; // Floats aren't spilled in JNI down call 676ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic } 686ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bool IsCurrentParamInRegister() OVERRIDE; 696ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bool IsCurrentParamOnStack() OVERRIDE; 706ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister CurrentParamRegister() OVERRIDE; 716ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic FrameOffset CurrentParamStackOffset() OVERRIDE; 726ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 736ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic // Mips64 does not need to extend small return types. 746ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bool RequiresSmallResultTypeExtension() const OVERRIDE { 756ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic return false; 766ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic } 776ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 786ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic protected: 796ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic size_t NumberOfOutgoingStackArgs() OVERRIDE; 806ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 816ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic private: 826ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic // TODO: these values aren't unique and can be shared amongst instances 836ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic std::vector<ManagedRegister> callee_save_regs_; 846ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 856ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic DISALLOW_COPY_AND_ASSIGN(Mips64JniCallingConvention); 866ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic}; 876ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 886ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic} // namespace mips64 896ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic} // namespace art 906ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 916ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic#endif // ART_COMPILER_JNI_QUICK_MIPS64_CALLING_CONVENTION_MIPS64_H_ 92