Dmitry Petrochenko | fca8220 | 2014-03-21 11:21:37 +0700 | [diff] [blame] | 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_X86_64_CALLING_CONVENTION_X86_64_H_ |
| 18 | #define ART_COMPILER_JNI_QUICK_X86_64_CALLING_CONVENTION_X86_64_H_ |
| 19 | |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 20 | #include "base/enums.h" |
Dmitry Petrochenko | fca8220 | 2014-03-21 11:21:37 +0700 | [diff] [blame] | 21 | #include "jni/quick/calling_convention.h" |
| 22 | |
| 23 | namespace art { |
| 24 | namespace x86_64 { |
| 25 | |
| 26 | class X86_64ManagedRuntimeCallingConvention FINAL : public ManagedRuntimeCallingConvention { |
| 27 | public: |
Roland Levillain | 3887c46 | 2015-08-12 18:15:42 +0100 | [diff] [blame] | 28 | X86_64ManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty) |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 29 | : ManagedRuntimeCallingConvention(is_static, |
| 30 | is_synchronized, |
| 31 | shorty, |
| 32 | PointerSize::k64) {} |
Dmitry Petrochenko | fca8220 | 2014-03-21 11:21:37 +0700 | [diff] [blame] | 33 | ~X86_64ManagedRuntimeCallingConvention() OVERRIDE {} |
| 34 | // Calling convention |
| 35 | ManagedRegister ReturnRegister() OVERRIDE; |
| 36 | ManagedRegister InterproceduralScratchRegister() OVERRIDE; |
| 37 | // Managed runtime calling convention |
| 38 | ManagedRegister MethodRegister() OVERRIDE; |
| 39 | bool IsCurrentParamInRegister() OVERRIDE; |
| 40 | bool IsCurrentParamOnStack() OVERRIDE; |
| 41 | ManagedRegister CurrentParamRegister() OVERRIDE; |
| 42 | FrameOffset CurrentParamStackOffset() OVERRIDE; |
| 43 | const ManagedRegisterEntrySpills& EntrySpills() OVERRIDE; |
| 44 | private: |
| 45 | ManagedRegisterEntrySpills entry_spills_; |
| 46 | DISALLOW_COPY_AND_ASSIGN(X86_64ManagedRuntimeCallingConvention); |
| 47 | }; |
| 48 | |
| 49 | class X86_64JniCallingConvention FINAL : public JniCallingConvention { |
| 50 | public: |
Roland Levillain | 3887c46 | 2015-08-12 18:15:42 +0100 | [diff] [blame] | 51 | X86_64JniCallingConvention(bool is_static, bool is_synchronized, const char* shorty); |
Dmitry Petrochenko | fca8220 | 2014-03-21 11:21:37 +0700 | [diff] [blame] | 52 | ~X86_64JniCallingConvention() 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; |
Vladimir Marko | 3224838 | 2016-05-19 10:37:24 +0100 | [diff] [blame] | 60 | ArrayRef<const ManagedRegister> CalleeSaveRegisters() const OVERRIDE; |
Dmitry Petrochenko | fca8220 | 2014-03-21 11:21:37 +0700 | [diff] [blame] | 61 | ManagedRegister ReturnScratchRegister() const OVERRIDE; |
| 62 | uint32_t CoreSpillMask() const OVERRIDE; |
Serguei Katkov | c380191 | 2014-07-08 17:21:53 +0700 | [diff] [blame] | 63 | uint32_t FpSpillMask() const OVERRIDE; |
Dmitry Petrochenko | fca8220 | 2014-03-21 11:21:37 +0700 | [diff] [blame] | 64 | bool IsCurrentParamInRegister() OVERRIDE; |
| 65 | bool IsCurrentParamOnStack() OVERRIDE; |
| 66 | ManagedRegister CurrentParamRegister() OVERRIDE; |
| 67 | FrameOffset CurrentParamStackOffset() OVERRIDE; |
| 68 | |
Andreas Gampe | d110432 | 2014-05-01 14:38:56 -0700 | [diff] [blame] | 69 | // x86-64 needs to extend small return types. |
| 70 | bool RequiresSmallResultTypeExtension() const OVERRIDE { |
| 71 | return true; |
| 72 | } |
| 73 | |
Dmitry Petrochenko | fca8220 | 2014-03-21 11:21:37 +0700 | [diff] [blame] | 74 | protected: |
| 75 | size_t NumberOfOutgoingStackArgs() OVERRIDE; |
| 76 | |
| 77 | private: |
Dmitry Petrochenko | fca8220 | 2014-03-21 11:21:37 +0700 | [diff] [blame] | 78 | DISALLOW_COPY_AND_ASSIGN(X86_64JniCallingConvention); |
| 79 | }; |
| 80 | |
| 81 | } // namespace x86_64 |
| 82 | } // namespace art |
| 83 | |
| 84 | #endif // ART_COMPILER_JNI_QUICK_X86_64_CALLING_CONVENTION_X86_64_H_ |