Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/asm/register.hpp
38829 views
1
/*
2
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#ifndef SHARE_VM_ASM_REGISTER_HPP
26
#define SHARE_VM_ASM_REGISTER_HPP
27
28
#include "utilities/top.hpp"
29
30
// Use AbstractRegister as shortcut
31
class AbstractRegisterImpl;
32
typedef AbstractRegisterImpl* AbstractRegister;
33
34
35
// The super class for platform specific registers. Instead of using value objects,
36
// registers are implemented as pointers. Subclassing is used so all registers can
37
// use the debugging suport below. No virtual functions are used for efficiency.
38
// They are canonicalized; i.e., registers are equal if their pointers are equal,
39
// and vice versa. A concrete implementation may just map the register onto 'this'.
40
41
class AbstractRegisterImpl {
42
protected:
43
int value() const { return (int)(intx)this; }
44
};
45
46
47
//
48
// Macros for use in defining Register instances. We'd like to be
49
// able to simply define const instances of the RegisterImpl* for each
50
// of the registers needed on a system in a header file. However many
51
// compilers don't handle this very well and end up producing a
52
// private definition in every file which includes the header file.
53
// Along with the static constructors necessary for initialization it
54
// can consume a significant amount of space in the result library.
55
//
56
// The following macros allow us to declare the instance in a .hpp and
57
// produce an enumeration value which has the same number. Then in a
58
// .cpp the the register instance can be defined using the enumeration
59
// value. This avoids the use of static constructors and multiple
60
// definitions per .cpp. In addition #defines for the register can be
61
// produced so that the constant registers can be inlined. These
62
// macros should not be used inside other macros, because you may get
63
// multiple evaluations of the macros which can give bad results.
64
//
65
// Here are some example uses and expansions. Note that the macro
66
// invocation is terminated with a ;.
67
//
68
// CONSTANT_REGISTER_DECLARATION(Register, G0, 0);
69
//
70
// extern const Register G0 ;
71
// enum { G0_RegisterEnumValue = 0 } ;
72
//
73
// REGISTER_DECLARATION(Register, Gmethod, G5);
74
//
75
// extern const Register Gmethod ;
76
// enum { Gmethod_RegisterEnumValue = G5_RegisterEnumValue } ;
77
//
78
// REGISTER_DEFINITION(Register, G0);
79
//
80
// const Register G0 = ( ( Register ) G0_RegisterEnumValue ) ;
81
//
82
83
#define AS_REGISTER(type,name) ((type)name##_##type##EnumValue)
84
85
#define CONSTANT_REGISTER_DECLARATION(type, name, value) \
86
extern const type name; \
87
enum { name##_##type##EnumValue = (value) }
88
89
#define REGISTER_DECLARATION(type, name, value) \
90
extern const type name; \
91
enum { name##_##type##EnumValue = value##_##type##EnumValue }
92
93
#define REGISTER_DEFINITION(type, name) \
94
const type name = ((type)name##_##type##EnumValue)
95
96
#ifdef TARGET_ARCH_x86
97
# include "register_x86.hpp"
98
#endif
99
#ifdef TARGET_ARCH_sparc
100
# include "register_sparc.hpp"
101
#endif
102
#ifdef TARGET_ARCH_zero
103
# include "register_zero.hpp"
104
#endif
105
#ifdef TARGET_ARCH_arm
106
# include "register_arm.hpp"
107
#endif
108
#ifdef TARGET_ARCH_ppc
109
# include "register_ppc.hpp"
110
#endif
111
#ifdef TARGET_ARCH_aarch32
112
# include "register_aarch32.hpp"
113
#endif
114
#ifdef TARGET_ARCH_aarch64
115
# include "register_aarch64.hpp"
116
#endif
117
118
119
// Debugging support
120
121
inline void assert_different_registers(
122
AbstractRegister a,
123
AbstractRegister b
124
) {
125
assert(
126
a != b,
127
err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT "",
128
p2i(a), p2i(b))
129
);
130
}
131
132
133
inline void assert_different_registers(
134
AbstractRegister a,
135
AbstractRegister b,
136
AbstractRegister c
137
) {
138
assert(
139
a != b && a != c
140
&& b != c,
141
err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
142
", c=" INTPTR_FORMAT "",
143
p2i(a), p2i(b), p2i(c))
144
);
145
}
146
147
148
inline void assert_different_registers(
149
AbstractRegister a,
150
AbstractRegister b,
151
AbstractRegister c,
152
AbstractRegister d
153
) {
154
assert(
155
a != b && a != c && a != d
156
&& b != c && b != d
157
&& c != d,
158
err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
159
", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT "",
160
p2i(a), p2i(b), p2i(c), p2i(d))
161
);
162
}
163
164
165
inline void assert_different_registers(
166
AbstractRegister a,
167
AbstractRegister b,
168
AbstractRegister c,
169
AbstractRegister d,
170
AbstractRegister e
171
) {
172
assert(
173
a != b && a != c && a != d && a != e
174
&& b != c && b != d && b != e
175
&& c != d && c != e
176
&& d != e,
177
err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
178
", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT "",
179
p2i(a), p2i(b), p2i(c), p2i(d), p2i(e))
180
);
181
}
182
183
184
inline void assert_different_registers(
185
AbstractRegister a,
186
AbstractRegister b,
187
AbstractRegister c,
188
AbstractRegister d,
189
AbstractRegister e,
190
AbstractRegister f
191
) {
192
assert(
193
a != b && a != c && a != d && a != e && a != f
194
&& b != c && b != d && b != e && b != f
195
&& c != d && c != e && c != f
196
&& d != e && d != f
197
&& e != f,
198
err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
199
", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
200
", f=" INTPTR_FORMAT "",
201
p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f))
202
);
203
}
204
205
206
inline void assert_different_registers(
207
AbstractRegister a,
208
AbstractRegister b,
209
AbstractRegister c,
210
AbstractRegister d,
211
AbstractRegister e,
212
AbstractRegister f,
213
AbstractRegister g
214
) {
215
assert(
216
a != b && a != c && a != d && a != e && a != f && a != g
217
&& b != c && b != d && b != e && b != f && b != g
218
&& c != d && c != e && c != f && c != g
219
&& d != e && d != f && d != g
220
&& e != f && e != g
221
&& f != g,
222
err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
223
", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
224
", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT "",
225
p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g))
226
);
227
}
228
229
230
inline void assert_different_registers(
231
AbstractRegister a,
232
AbstractRegister b,
233
AbstractRegister c,
234
AbstractRegister d,
235
AbstractRegister e,
236
AbstractRegister f,
237
AbstractRegister g,
238
AbstractRegister h
239
) {
240
assert(
241
a != b && a != c && a != d && a != e && a != f && a != g && a != h
242
&& b != c && b != d && b != e && b != f && b != g && b != h
243
&& c != d && c != e && c != f && c != g && c != h
244
&& d != e && d != f && d != g && d != h
245
&& e != f && e != g && e != h
246
&& f != g && f != h
247
&& g != h,
248
err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
249
", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
250
", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT "",
251
p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h))
252
);
253
}
254
255
256
inline void assert_different_registers(
257
AbstractRegister a,
258
AbstractRegister b,
259
AbstractRegister c,
260
AbstractRegister d,
261
AbstractRegister e,
262
AbstractRegister f,
263
AbstractRegister g,
264
AbstractRegister h,
265
AbstractRegister i
266
) {
267
assert(
268
a != b && a != c && a != d && a != e && a != f && a != g && a != h && a != i
269
&& b != c && b != d && b != e && b != f && b != g && b != h && b != i
270
&& c != d && c != e && c != f && c != g && c != h && c != i
271
&& d != e && d != f && d != g && d != h && d != i
272
&& e != f && e != g && e != h && e != i
273
&& f != g && f != h && f != i
274
&& g != h && g != i
275
&& h != i,
276
err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
277
", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
278
", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT
279
", i=" INTPTR_FORMAT "",
280
p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i))
281
);
282
}
283
284
inline void assert_different_registers(
285
AbstractRegister a,
286
AbstractRegister b,
287
AbstractRegister c,
288
AbstractRegister d,
289
AbstractRegister e,
290
AbstractRegister f,
291
AbstractRegister g,
292
AbstractRegister h,
293
AbstractRegister i,
294
AbstractRegister j
295
) {
296
assert(
297
a != b && a != c && a != d && a != e && a != f && a != g && a != h && a != i && a != j
298
&& b != c && b != d && b != e && b != f && b != g && b != h && b != i && b != j
299
&& c != d && c != e && c != f && c != g && c != h && c != i && c != j
300
&& d != e && d != f && d != g && d != h && d != i && d != j
301
&& e != f && e != g && e != h && e != i && e != j
302
&& f != g && f != h && f != i && f != j
303
&& g != h && g != i && g != j
304
&& h != i && h != j
305
&& i != j,
306
err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
307
", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
308
", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT
309
", i=" INTPTR_FORMAT ", j=" INTPTR_FORMAT "",
310
p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i), p2i(j))
311
);
312
}
313
314
inline void assert_different_registers(
315
AbstractRegister a,
316
AbstractRegister b,
317
AbstractRegister c,
318
AbstractRegister d,
319
AbstractRegister e,
320
AbstractRegister f,
321
AbstractRegister g,
322
AbstractRegister h,
323
AbstractRegister i,
324
AbstractRegister j,
325
AbstractRegister k
326
) {
327
assert(
328
a != b && a != c && a != d && a != e && a != f && a != g && a != h && a != i && a != j && a !=k
329
&& b != c && b != d && b != e && b != f && b != g && b != h && b != i && b != j && b !=k
330
&& c != d && c != e && c != f && c != g && c != h && c != i && c != j && c !=k
331
&& d != e && d != f && d != g && d != h && d != i && d != j && d !=k
332
&& e != f && e != g && e != h && e != i && e != j && e !=k
333
&& f != g && f != h && f != i && f != j && f !=k
334
&& g != h && g != i && g != j && g !=k
335
&& h != i && h != j && h !=k
336
&& i != j && i !=k
337
&& j !=k,
338
err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
339
", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
340
", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT
341
", i=" INTPTR_FORMAT ", j=" INTPTR_FORMAT ", k=" INTPTR_FORMAT "",
342
p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i), p2i(j), p2i(k))
343
);
344
}
345
346
inline void assert_different_registers(
347
AbstractRegister a,
348
AbstractRegister b,
349
AbstractRegister c,
350
AbstractRegister d,
351
AbstractRegister e,
352
AbstractRegister f,
353
AbstractRegister g,
354
AbstractRegister h,
355
AbstractRegister i,
356
AbstractRegister j,
357
AbstractRegister k,
358
AbstractRegister l
359
) {
360
assert(
361
a != b && a != c && a != d && a != e && a != f && a != g && a != h && a != i && a != j && a !=k && a !=l
362
&& b != c && b != d && b != e && b != f && b != g && b != h && b != i && b != j && b !=k && b !=l
363
&& c != d && c != e && c != f && c != g && c != h && c != i && c != j && c !=k && c !=l
364
&& d != e && d != f && d != g && d != h && d != i && d != j && d !=k && d !=l
365
&& e != f && e != g && e != h && e != i && e != j && e !=k && e !=l
366
&& f != g && f != h && f != i && f != j && f !=k && f !=l
367
&& g != h && g != i && g != j && g !=k && g !=l
368
&& h != i && h != j && h !=k && h !=l
369
&& i != j && i !=k && i !=l
370
&& j !=k && j !=l
371
&& k !=l,
372
err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
373
", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
374
", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT
375
", i=" INTPTR_FORMAT ", j=" INTPTR_FORMAT ", k=" INTPTR_FORMAT
376
", l=" INTPTR_FORMAT "",
377
p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i), p2i(j), p2i(k), p2i(l))
378
);
379
}
380
381
#endif // SHARE_VM_ASM_REGISTER_HPP
382
383