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 20542451cc546779f5c67840e105c51205a1b0a8fdAndreas Gampe#include "base/enums.h" 216ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic#include "jni/quick/calling_convention.h" 226ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 236ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagicnamespace art { 246ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagicnamespace mips64 { 256ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 266ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagicconstexpr size_t kFramePointerSize = 8; 27542451cc546779f5c67840e105c51205a1b0a8fdAndreas Gampestatic_assert(kFramePointerSize == static_cast<size_t>(PointerSize::k64), 28542451cc546779f5c67840e105c51205a1b0a8fdAndreas Gampe "Invalid frame pointer size"); 296ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 306ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagicclass Mips64ManagedRuntimeCallingConvention FINAL : public ManagedRuntimeCallingConvention { 316ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic public: 326ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic Mips64ManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty) 33542451cc546779f5c67840e105c51205a1b0a8fdAndreas Gampe : ManagedRuntimeCallingConvention(is_static, 34542451cc546779f5c67840e105c51205a1b0a8fdAndreas Gampe is_synchronized, 35542451cc546779f5c67840e105c51205a1b0a8fdAndreas Gampe shorty, 36542451cc546779f5c67840e105c51205a1b0a8fdAndreas Gampe PointerSize::k64) {} 376ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ~Mips64ManagedRuntimeCallingConvention() OVERRIDE {} 386ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic // Calling convention 396ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister ReturnRegister() OVERRIDE; 406ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister InterproceduralScratchRegister() OVERRIDE; 416ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic // Managed runtime calling convention 426ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister MethodRegister() OVERRIDE; 436ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bool IsCurrentParamInRegister() OVERRIDE; 446ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bool IsCurrentParamOnStack() OVERRIDE; 456ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister CurrentParamRegister() OVERRIDE; 466ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic FrameOffset CurrentParamStackOffset() OVERRIDE; 476ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic const ManagedRegisterEntrySpills& EntrySpills() OVERRIDE; 486ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 496ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic private: 506ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegisterEntrySpills entry_spills_; 516ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 526ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic DISALLOW_COPY_AND_ASSIGN(Mips64ManagedRuntimeCallingConvention); 536ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic}; 546ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 556ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagicclass Mips64JniCallingConvention FINAL : public JniCallingConvention { 566ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic public: 57cc8b04e5481ca7567d337d9358f92dc2195fc137Goran Jakovljevic Mips64JniCallingConvention(bool is_static, 58cc8b04e5481ca7567d337d9358f92dc2195fc137Goran Jakovljevic bool is_synchronized, 59cc8b04e5481ca7567d337d9358f92dc2195fc137Goran Jakovljevic bool is_critical_native, 60cc8b04e5481ca7567d337d9358f92dc2195fc137Goran Jakovljevic const char* shorty); 616ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ~Mips64JniCallingConvention() OVERRIDE {} 626ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic // Calling convention 636ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister ReturnRegister() OVERRIDE; 646ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister IntReturnRegister() OVERRIDE; 656ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister InterproceduralScratchRegister() OVERRIDE; 666ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic // JNI calling convention 676ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic size_t FrameSize() OVERRIDE; 686ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic size_t OutArgSize() OVERRIDE; 693224838dfe9c95330ad963286f2c47e9546d3b5cVladimir Marko ArrayRef<const ManagedRegister> CalleeSaveRegisters() const OVERRIDE; 706ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister ReturnScratchRegister() const OVERRIDE; 716ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic uint32_t CoreSpillMask() const OVERRIDE; 723224838dfe9c95330ad963286f2c47e9546d3b5cVladimir Marko uint32_t FpSpillMask() const OVERRIDE; 736ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bool IsCurrentParamInRegister() OVERRIDE; 746ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bool IsCurrentParamOnStack() OVERRIDE; 756ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic ManagedRegister CurrentParamRegister() OVERRIDE; 766ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic FrameOffset CurrentParamStackOffset() OVERRIDE; 776ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 786ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic // Mips64 does not need to extend small return types. 796ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic bool RequiresSmallResultTypeExtension() const OVERRIDE { 806ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic return false; 816ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic } 826ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 836ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic protected: 846ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic size_t NumberOfOutgoingStackArgs() OVERRIDE; 856ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 866ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic private: 876ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic DISALLOW_COPY_AND_ASSIGN(Mips64JniCallingConvention); 886ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic}; 896ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 906ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic} // namespace mips64 916ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic} // namespace art 926ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic 936ea651f0f4c7de4580beb2e887d86802c1ae0738Maja Gagic#endif // ART_COMPILER_JNI_QUICK_MIPS64_CALLING_CONVENTION_MIPS64_H_ 94