Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 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 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_ |
| 18 | #define ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 19 | |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 20 | #include "base/enums.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 21 | #include "jni/quick/calling_convention.h" |
| 22 | |
| 23 | namespace art { |
| 24 | namespace arm { |
| 25 | |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 26 | constexpr size_t kFramePointerSize = static_cast<size_t>(PointerSize::k32); |
Ian Rogers | 790a6b7 | 2014-04-01 10:36:00 -0700 | [diff] [blame] | 27 | |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 28 | class ArmManagedRuntimeCallingConvention FINAL : public ManagedRuntimeCallingConvention { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 29 | public: |
| 30 | ArmManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty) |
Andreas Gampe | 542451c | 2016-07-26 09:02:02 -0700 | [diff] [blame] | 31 | : ManagedRuntimeCallingConvention(is_static, |
| 32 | is_synchronized, |
| 33 | shorty, |
| 34 | PointerSize::k32) {} |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 35 | ~ArmManagedRuntimeCallingConvention() OVERRIDE {} |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 36 | // Calling convention |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 37 | ManagedRegister ReturnRegister() OVERRIDE; |
| 38 | ManagedRegister InterproceduralScratchRegister() OVERRIDE; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 39 | // Managed runtime calling convention |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 40 | ManagedRegister MethodRegister() OVERRIDE; |
| 41 | bool IsCurrentParamInRegister() OVERRIDE; |
| 42 | bool IsCurrentParamOnStack() OVERRIDE; |
| 43 | ManagedRegister CurrentParamRegister() OVERRIDE; |
| 44 | FrameOffset CurrentParamStackOffset() OVERRIDE; |
Dmitry Petrochenko | fca8220 | 2014-03-21 11:21:37 +0700 | [diff] [blame] | 45 | const ManagedRegisterEntrySpills& EntrySpills() OVERRIDE; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 46 | |
| 47 | private: |
Dmitry Petrochenko | fca8220 | 2014-03-21 11:21:37 +0700 | [diff] [blame] | 48 | ManagedRegisterEntrySpills entry_spills_; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 49 | |
| 50 | DISALLOW_COPY_AND_ASSIGN(ArmManagedRuntimeCallingConvention); |
| 51 | }; |
| 52 | |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 53 | class ArmJniCallingConvention FINAL : public JniCallingConvention { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 54 | public: |
Igor Murashkin | 367f3dd | 2016-09-01 17:00:24 -0700 | [diff] [blame] | 55 | ArmJniCallingConvention(bool is_static, |
| 56 | bool is_synchronized, |
| 57 | bool is_critical_native, |
| 58 | const char* shorty); |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 59 | ~ArmJniCallingConvention() OVERRIDE {} |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 60 | // Calling convention |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 61 | ManagedRegister ReturnRegister() OVERRIDE; |
| 62 | ManagedRegister IntReturnRegister() OVERRIDE; |
| 63 | ManagedRegister InterproceduralScratchRegister() OVERRIDE; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 64 | // JNI calling convention |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 65 | void Next() OVERRIDE; // Override default behavior for AAPCS |
| 66 | size_t FrameSize() OVERRIDE; |
| 67 | size_t OutArgSize() OVERRIDE; |
Vladimir Marko | 3224838 | 2016-05-19 10:37:24 +0100 | [diff] [blame] | 68 | ArrayRef<const ManagedRegister> CalleeSaveRegisters() const OVERRIDE; |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 69 | ManagedRegister ReturnScratchRegister() const OVERRIDE; |
| 70 | uint32_t CoreSpillMask() const OVERRIDE; |
Sebastien Hertz | 7cde48c | 2015-01-20 16:06:43 +0100 | [diff] [blame] | 71 | uint32_t FpSpillMask() const OVERRIDE; |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 72 | bool IsCurrentParamInRegister() OVERRIDE; |
| 73 | bool IsCurrentParamOnStack() OVERRIDE; |
| 74 | ManagedRegister CurrentParamRegister() OVERRIDE; |
| 75 | FrameOffset CurrentParamStackOffset() OVERRIDE; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 76 | |
Andreas Gampe | d110432 | 2014-05-01 14:38:56 -0700 | [diff] [blame] | 77 | // AAPCS mandates return values are extended. |
| 78 | bool RequiresSmallResultTypeExtension() const OVERRIDE { |
| 79 | return false; |
| 80 | } |
| 81 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 82 | protected: |
Andreas Gampe | 25ff004 | 2014-03-20 08:34:03 -0700 | [diff] [blame] | 83 | size_t NumberOfOutgoingStackArgs() OVERRIDE; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 84 | |
| 85 | private: |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 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 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 95 | #endif // ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_ |