blob: b327898483cbf19c1d3538f14a58dcc39db50e4b [file] [log] [blame]
Brian Carlstrom7940e442013-07-12 13:46:57 -07001/*
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 Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_
18#define ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_
Brian Carlstrom7940e442013-07-12 13:46:57 -070019
Andreas Gampe542451c2016-07-26 09:02:02 -070020#include "base/enums.h"
Brian Carlstrom7940e442013-07-12 13:46:57 -070021#include "jni/quick/calling_convention.h"
22
23namespace art {
24namespace arm {
25
Andreas Gampe542451c2016-07-26 09:02:02 -070026constexpr size_t kFramePointerSize = static_cast<size_t>(PointerSize::k32);
Ian Rogers790a6b72014-04-01 10:36:00 -070027
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010028class ArmManagedRuntimeCallingConvention final : public ManagedRuntimeCallingConvention {
Brian Carlstrom7940e442013-07-12 13:46:57 -070029 public:
30 ArmManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty)
Andreas Gampe542451c2016-07-26 09:02:02 -070031 : ManagedRuntimeCallingConvention(is_static,
32 is_synchronized,
33 shorty,
34 PointerSize::k32) {}
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010035 ~ArmManagedRuntimeCallingConvention() override {}
Brian Carlstrom7940e442013-07-12 13:46:57 -070036 // Calling convention
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010037 ManagedRegister ReturnRegister() override;
38 ManagedRegister InterproceduralScratchRegister() override;
Brian Carlstrom7940e442013-07-12 13:46:57 -070039 // Managed runtime calling convention
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010040 ManagedRegister MethodRegister() override;
41 bool IsCurrentParamInRegister() override;
42 bool IsCurrentParamOnStack() override;
43 ManagedRegister CurrentParamRegister() override;
44 FrameOffset CurrentParamStackOffset() override;
45 const ManagedRegisterEntrySpills& EntrySpills() override;
Brian Carlstrom7940e442013-07-12 13:46:57 -070046
47 private:
Dmitry Petrochenkofca82202014-03-21 11:21:37 +070048 ManagedRegisterEntrySpills entry_spills_;
Brian Carlstrom7940e442013-07-12 13:46:57 -070049
50 DISALLOW_COPY_AND_ASSIGN(ArmManagedRuntimeCallingConvention);
51};
52
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010053class ArmJniCallingConvention final : public JniCallingConvention {
Brian Carlstrom7940e442013-07-12 13:46:57 -070054 public:
Igor Murashkin367f3dd2016-09-01 17:00:24 -070055 ArmJniCallingConvention(bool is_static,
56 bool is_synchronized,
57 bool is_critical_native,
58 const char* shorty);
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010059 ~ArmJniCallingConvention() override {}
Brian Carlstrom7940e442013-07-12 13:46:57 -070060 // Calling convention
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010061 ManagedRegister ReturnRegister() override;
62 ManagedRegister IntReturnRegister() override;
63 ManagedRegister InterproceduralScratchRegister() override;
Brian Carlstrom7940e442013-07-12 13:46:57 -070064 // JNI calling convention
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010065 void Next() override; // Override default behavior for AAPCS
66 size_t FrameSize() override;
67 size_t OutArgSize() override;
68 ArrayRef<const ManagedRegister> CalleeSaveRegisters() const override;
69 ManagedRegister ReturnScratchRegister() const override;
70 uint32_t CoreSpillMask() const override;
71 uint32_t FpSpillMask() const override;
72 bool IsCurrentParamInRegister() override;
73 bool IsCurrentParamOnStack() override;
74 ManagedRegister CurrentParamRegister() override;
75 FrameOffset CurrentParamStackOffset() override;
Brian Carlstrom7940e442013-07-12 13:46:57 -070076
Andreas Gamped1104322014-05-01 14:38:56 -070077 // AAPCS mandates return values are extended.
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010078 bool RequiresSmallResultTypeExtension() const override {
Andreas Gamped1104322014-05-01 14:38:56 -070079 return false;
80 }
81
Brian Carlstrom7940e442013-07-12 13:46:57 -070082 protected:
Roland Levillainbbc6e7e2018-08-24 16:58:47 +010083 size_t NumberOfOutgoingStackArgs() override;
Brian Carlstrom7940e442013-07-12 13:46:57 -070084
85 private:
Brian Carlstrom7940e442013-07-12 13:46:57 -070086 // 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 Carlstromfc0e3212013-07-17 14:40:12 -070095#endif // ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_