forked from facebook/hhvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabi.h
More file actions
162 lines (132 loc) · 4.3 KB
/
abi.h
File metadata and controls
162 lines (132 loc) · 4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2016 Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_JIT_ABI_H
#define incl_HPHP_JIT_ABI_H
#include "hphp/runtime/vm/jit/types.h"
#include "hphp/runtime/vm/jit/abi-regs.h"
#include "hphp/runtime/vm/jit/phys-reg.h"
namespace HPHP { namespace jit {
///////////////////////////////////////////////////////////////////////////////
/*
* Return a suitable ABI for the targeted architecture and `kind'.
*/
const Abi& abi(CodeKind kind = CodeKind::Trace);
///////////////////////////////////////////////////////////////////////////////
// Principal reserved registers.
//
// These registers have special purposes both during and between traces.
/*
* Frame pointer.
*
* When mid-trace, points to the ActRec for the function currently executing.
*/
PhysReg rvmfp();
/*
* Stack pointer.
*
* When mid-trace, points to the top of the eval stack (lowest valid address)
* at the start of the current tracelet.
*/
PhysReg rvmsp();
/*
* RDS base pointer.
*
* Always points to the base of the RDS block for the current request.
*/
PhysReg rvmtl();
/*
* Native stack pointer.
*/
PhysReg rsp();
///////////////////////////////////////////////////////////////////////////////
// Calling convention registers.
/*
* PHP return value registers.
*/
PhysReg rret_data();
PhysReg rret_type();
/*
* Native return value registers.
*/
PhysReg rret(size_t i = 0);
PhysReg rret_simd(size_t i);
PhysReg rret_indirect();
/*
* Native argument registers.
*/
PhysReg rarg(size_t i);
PhysReg rarg_simd(size_t i);
/*
* Number of available argument registers.
*/
size_t num_arg_regs();
size_t num_arg_regs_simd();
/*
* RegSet for a call with `n' arguments.
*/
RegSet arg_regs(size_t n);
RegSet arg_regs_simd(size_t n);
/*
* Service request argument registers.
*/
PhysReg r_svcreq_req();
PhysReg r_svcreq_stub();
PhysReg r_svcreq_sf();
PhysReg r_svcreq_arg(size_t i);
///////////////////////////////////////////////////////////////////////////////
// JIT and TC boundary ABI registers.
//
// These registers should not be used for scratch purposes between tracelets,
// and have to be specially handled if we are returning to the interpreter or
// invoking the translator.
/*
* VM register sets. The other sets are defined relative to these.
*/
RegSet vm_regs_with_sp();
RegSet vm_regs_no_sp();
/*
* Registers that are live between tracelets, in two flavors, depending whether
* we are between tracelets in a resumed function.
*/
inline RegSet cross_trace_regs() { return vm_regs_no_sp(); }
inline RegSet cross_trace_regs_resumed() { return vm_regs_with_sp(); }
/*
* Registers that are live when we reenter the JIT from the TC (e.g., via
* service requests).
*/
inline RegSet leave_trace_regs() { return vm_regs_with_sp(); }
/*
* Registers that are live between the caller and the callee when making a PHP
* function call.
*/
inline RegSet php_call_regs() { return cross_trace_regs(); }
/*
* Registers that are live after a PHP function return.
*
* TODO(#2288359): We don't want this to include rvmsp() eventually.
*/
inline RegSet php_return_regs() {
return vm_regs_with_sp() | rret_data() | rret_type();
}
/*
* Registers that are live on entry to fcallArrayHelper.
*
* TODO(#2288359): We don't want this to include rvmsp() eventually.
*/
inline RegSet fcall_array_regs() { return vm_regs_with_sp(); }
///////////////////////////////////////////////////////////////////////////////
}}
#endif