blob: b98f5057e257299db7eeacabd2c0fc1e70a2bd2d [file] [log] [blame]
Dmitry Petrochenkofca82202014-03-21 11:21:37 +07001/*
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 Gampe542451c2016-07-26 09:02:02 -070020#include "base/enums.h"
Dmitry Petrochenkofca82202014-03-21 11:21:37 +070021#include "jni/quick/calling_convention.h"
22
23namespace art {
24namespace x86_64 {
25
26class X86_64ManagedRuntimeCallingConvention FINAL : public ManagedRuntimeCallingConvention {
27 public:
Roland Levillain3887c462015-08-12 18:15:42 +010028 X86_64ManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty)
Andreas Gampe542451c2016-07-26 09:02:02 -070029 : ManagedRuntimeCallingConvention(is_static,
30 is_synchronized,
31 shorty,
32 PointerSize::k64) {}
Dmitry Petrochenkofca82202014-03-21 11:21:37 +070033 ~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
49class X86_64JniCallingConvention FINAL : public JniCallingConvention {
50 public:
Roland Levillain3887c462015-08-12 18:15:42 +010051 X86_64JniCallingConvention(bool is_static, bool is_synchronized, const char* shorty);
Dmitry Petrochenkofca82202014-03-21 11:21:37 +070052 ~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 Marko32248382016-05-19 10:37:24 +010060 ArrayRef<const ManagedRegister> CalleeSaveRegisters() const OVERRIDE;
Dmitry Petrochenkofca82202014-03-21 11:21:37 +070061 ManagedRegister ReturnScratchRegister() const OVERRIDE;
62 uint32_t CoreSpillMask() const OVERRIDE;
Serguei Katkovc3801912014-07-08 17:21:53 +070063 uint32_t FpSpillMask() const OVERRIDE;
Dmitry Petrochenkofca82202014-03-21 11:21:37 +070064 bool IsCurrentParamInRegister() OVERRIDE;
65 bool IsCurrentParamOnStack() OVERRIDE;
66 ManagedRegister CurrentParamRegister() OVERRIDE;
67 FrameOffset CurrentParamStackOffset() OVERRIDE;
68
Andreas Gamped1104322014-05-01 14:38:56 -070069 // x86-64 needs to extend small return types.
70 bool RequiresSmallResultTypeExtension() const OVERRIDE {
71 return true;
72 }
73
Dmitry Petrochenkofca82202014-03-21 11:21:37 +070074 protected:
75 size_t NumberOfOutgoingStackArgs() OVERRIDE;
76
77 private:
Dmitry Petrochenkofca82202014-03-21 11:21:37 +070078 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_