Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/ilgen/J9ByteCodeIterator.cpp
6000 views
1
/*******************************************************************************
2
* Copyright (c) 2000, 2022 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
23
#include "ilgen/J9ByteCodeIterator.hpp"
24
#include "compile/Compilation.hpp"
25
#include "compile/Method.hpp"
26
#include "env/VMJ9.h"
27
#include "ras/Debug.hpp"
28
#include "env/IO.hpp"
29
30
void
31
TR_J9ByteCodeIterator::initialize(TR_ResolvedJ9Method * method, TR_J9VMBase * fe)
32
{
33
_fe = fe;
34
_code = method->bytecodeStart();
35
_bcIndex = -1;
36
}
37
38
int32_t
39
TR_J9ByteCodeIterator::nextSwitchValue(int32_t & bcIndex)
40
{
41
int32_t value = *(int32_t *)&_code[bcIndex];
42
bcIndex += 4;
43
return value;
44
}
45
46
void
47
TR_J9ByteCodeIterator::stepOverVariableSizeBC()
48
{
49
if (_bc == J9BCwide)
50
convertOpCodeToByteCodeEnum(++_bcIndex) == J9BCiinc ? _bcIndex += 5 : _bcIndex += 3;
51
else if (_bc == J9BClookupswitch)
52
{
53
_bcIndex = defaultTargetIndex() + 4;
54
int32_t tableSize = nextSwitchValue(_bcIndex);
55
_bcIndex += (8 * tableSize);
56
}
57
else
58
{
59
TR_ASSERT(_bc == J9BCtableswitch, "invalid 0 size for a byte code");
60
_bcIndex = defaultTargetIndex() + 4;
61
int32_t low = nextSwitchValue(_bcIndex);
62
int32_t high = nextSwitchValue(_bcIndex);
63
_bcIndex += (4 * (high - low + 1));
64
}
65
}
66
67
bool
68
TR_J9ByteCodeIterator::isThisChanged()
69
{
70
for (TR_J9ByteCode bc = first(); bc != J9BCunknown; bc = next())
71
{
72
switch (bc)
73
{
74
case J9BCistore0:
75
case J9BClstore0:
76
case J9BCfstore0:
77
case J9BCdstore0:
78
case J9BCastore0:
79
return true;
80
case J9BCistore:
81
case J9BClstore:
82
case J9BCfstore:
83
case J9BCdstore:
84
case J9BCastore:
85
case J9BCistorew:
86
case J9BClstorew:
87
case J9BCfstorew:
88
case J9BCdstorew:
89
case J9BCastorew:
90
if (nextByte() == 0)
91
return true;
92
default:
93
//nothing to do here
94
break;
95
}
96
}
97
return false;
98
}
99
100
int32_t
101
TR_J9ByteCodeIterator::findFloatingPointInstruction()
102
{
103
bool isVolatile, isPrivate;
104
TR::DataType type = TR::NoType;
105
uint32_t offset;
106
void * staticAddress;
107
for (TR_J9ByteCode bc = first(); bc != J9BCunknown; bc = next())
108
switch (bc)
109
{
110
case J9BCfconst0: case J9BCfconst1: case J9BCfconst2:
111
case J9BCdconst0: case J9BCdconst1:
112
case J9BCldc2dw:
113
case J9BCfload: case J9BCdload:
114
case J9BCfload0: case J9BCfload1: case J9BCfload2: case J9BCfload3:
115
case J9BCdload0: case J9BCdload1: case J9BCdload2: case J9BCdload3:
116
case J9BCfaload: case J9BCdaload:
117
case J9BCfloadw: case J9BCdloadw:
118
case J9BCfstore: case J9BCdstore:
119
case J9BCfstorew: case J9BCdstorew:
120
case J9BCfstore0: case J9BCfstore1: case J9BCfstore2: case J9BCfstore3:
121
case J9BCdstore0: case J9BCdstore1: case J9BCdstore2: case J9BCdstore3:
122
case J9BCfastore: case J9BCdastore:
123
case J9BCfadd: case J9BCdadd:
124
case J9BCfsub: case J9BCdsub:
125
case J9BCfmul: case J9BCdmul:
126
case J9BCfdiv: case J9BCddiv:
127
case J9BCfrem: case J9BCdrem:
128
case J9BCfneg: case J9BCdneg:
129
case J9BCi2f: case J9BCi2d:
130
case J9BCl2f: case J9BCl2d: case J9BCf2i: case J9BCf2l: case J9BCf2d:
131
case J9BCd2i: case J9BCd2l: case J9BCd2f:
132
case J9BCfcmpl: case J9BCfcmpg: case J9BCdcmpl: case J9BCdcmpg:
133
return bcIndex();
134
case J9BCldc:
135
if (method()->getLDCType(nextByte()) == TR::Float)
136
return bcIndex();
137
break;
138
case J9BCldcw:
139
if (method()->getLDCType(next2Bytes()) == TR::Float)
140
return bcIndex();
141
break;
142
case J9BCgetfield: case J9BCputfield:
143
{
144
method()->fieldAttributes(_compilation, next2Bytes(), &offset, &type, &isVolatile, NULL, &isPrivate, (bc == J9BCputfield), NULL, false);
145
if (type == TR::Float || type == TR::Double)
146
return bcIndex();
147
break;
148
}
149
case J9BCgetstatic: case J9BCputstatic:
150
method()->staticAttributes(_compilation, next2Bytes(), &staticAddress, &type, &isVolatile, NULL, &isPrivate, (bc == J9BCputstatic), NULL, false);
151
if (type == TR::Float || type == TR::Double)
152
return bcIndex();
153
break;
154
case J9BCinvokestatic: case J9BCinvokevirtual: case J9BCinvokespecial: case J9BCinvokeinterface:
155
case J9BCinvokedynamic: case J9BCinvokehandle: case J9BCinvokehandlegeneric:
156
case J9BCinvokestaticsplit: case J9BCinvokespecialsplit:
157
{
158
int32_t index = next2Bytes();
159
if (bc == J9BCinvokestaticsplit)
160
index = index | J9_STATIC_SPLIT_TABLE_INDEX_FLAG;
161
if (bc == J9BCinvokespecialsplit)
162
index = index | J9_SPECIAL_SPLIT_TABLE_INDEX_FLAG;
163
164
TR_J9VMBase *fej9 = (TR_J9VMBase *)_fe;
165
TR::Method *thisMethod = fej9->createMethod(_trMemory, method()->containingClass(), index);
166
167
// check return type
168
type = thisMethod->returnType();
169
if (type == TR::Float || type == TR::Double)
170
return bcIndex();
171
172
// check parameter types - in case an arg is only ldc'ed
173
int32_t argNum, elems = thisMethod->numberOfExplicitParameters();
174
for(argNum=0;argNum<elems;argNum++)
175
{
176
TR::DataType type = thisMethod->parmType(argNum);
177
if (type == TR::Float || type == TR::Double)
178
return bcIndex();
179
}
180
break;
181
}
182
default:
183
break;
184
}
185
return -1;
186
}
187
188
void
189
TR_J9ByteCodeIterator::printByteCodePrologue()
190
{
191
trfprintf(comp()->getOutFile(), "\n"
192
" +------------- Byte Code Index\n"
193
" | +-------------------- OpCode\n"
194
" | | +------------- First Field\n"
195
" | | | +------------- Branch Target\n"
196
" | | | | +------- Const Pool Index\n"
197
" | | | | | +------------- Constant\n"
198
" | | | | | |\n"
199
" V V V V V V\n");
200
}
201
202
void
203
TR_J9ByteCodeIterator::printByteCodeEpilogue()
204
{
205
trfprintf(comp()->getOutFile(), "\n\n"); comp()->getDebug()->printByteCodeAnnotations();
206
}
207
208
void
209
TR_J9ByteCodeIterator::printFirst(int32_t i)
210
{
211
trfprintf(comp()->getOutFile(), "%5i", i);
212
}
213
214
void
215
TR_J9ByteCodeIterator::printCPIndex(int32_t i)
216
{
217
trfprintf(comp()->getOutFile(), "%13s%5i", "", i);
218
}
219
220
void
221
TR_J9ByteCodeIterator::printConstant(int32_t i)
222
{
223
trfprintf(comp()->getOutFile(), "%11s%12i ", "", i);
224
}
225
226
void
227
TR_J9ByteCodeIterator::printConstant(double d)
228
{
229
trfprintf(comp()->getOutFile(), "%11s%12e ", "", d);
230
}
231
232
void
233
TR_J9ByteCodeIterator::printFirstAndConstant(int32_t i, int32_t j)
234
{
235
trfprintf(comp()->getOutFile(), "%5i%6s%12i ", i, "", j);
236
}
237
238
void
239
TR_J9ByteCodeIterator::printJumpIndex(int32_t offset)
240
{
241
trfprintf(comp()->getOutFile(), "%5i,%5d,%11s ", offset, offset + bcIndex(), "");
242
}
243
244
void
245
TR_J9ByteCodeIterator::printByteCode()
246
{
247
uint8_t opcode = nextByte(0);
248
249
trfprintf(comp()->getOutFile(), "\n %6i, %-15s ", bcIndex(), ((TR_J9VMBase *)fe())->getByteCodeName(opcode));
250
251
TR_J9ByteCode bc = convertOpCodeToByteCodeEnum(opcode);
252
switch (bc)
253
{
254
case J9BCbipush:
255
printConstant(nextByteSigned());
256
break;
257
258
case J9BCsipush:
259
printConstant(next2BytesSigned());
260
break;
261
262
case J9BCiload: case J9BClload: case J9BCfload: case J9BCdload: case J9BCaload:
263
case J9BCistore: case J9BClstore: case J9BCfstore: case J9BCdstore: case J9BCastore:
264
printFirst(nextByte());
265
break;
266
267
case J9BCiinc:
268
printFirstAndConstant(nextByte(), nextByteSigned(2));
269
break;
270
271
case J9BCinvokevirtual:
272
case J9BCinvokespecial:
273
case J9BCinvokestatic:
274
case J9BCinvokeinterface:
275
case J9BCinvokedynamic: // Could eventually need next3bytes
276
case J9BCinvokehandle:
277
case J9BCinvokehandlegeneric:
278
case J9BCinvokespecialsplit:
279
case J9BCinvokestaticsplit:
280
printFirst(next2Bytes());
281
break;
282
283
case J9BCgetstatic: case J9BCgetfield: case J9BCputstatic: case J9BCputfield:
284
case J9BCcheckcast: case J9BCinstanceof:
285
case J9BCnew: case J9BCanewarray:
286
case J9BCaconst_init: case J9BCwithfield:
287
printCPIndex(next2Bytes());
288
break;
289
290
case J9BCnewarray:
291
printCPIndex(nextByte());
292
break;
293
294
case J9BCmultianewarray:
295
printCPIndex(next2Bytes());
296
printConstant(nextByte(3));
297
break;
298
299
case J9BCifeq: case J9BCifne: case J9BCiflt: case J9BCifge: case J9BCifgt: case J9BCifle: case J9BCifnull: case J9BCifnonnull:
300
case J9BCificmpeq: case J9BCificmpne: case J9BCificmplt: case J9BCificmpge: case J9BCificmpgt: case J9BCificmple: case J9BCifacmpeq: case J9BCifacmpne:
301
case J9BCgoto:
302
printJumpIndex(next2BytesSigned());
303
break;
304
305
case J9BCgotow:
306
printJumpIndex(next4BytesSigned());
307
break;
308
default:
309
break;
310
}
311
}
312
313
const TR_J9ByteCode TR_J9ByteCodeIterator::_opCodeToByteCodeEnum[] =
314
{
315
/* 0 */ J9BCnop,
316
/* 1 */ J9BCaconstnull, J9BCiconstm1,
317
/* 3 */ J9BCiconst0, J9BCiconst1, J9BCiconst2, J9BCiconst3, J9BCiconst4, J9BCiconst5,
318
/* 9 */ J9BClconst0, J9BClconst1,
319
/* 11 */ J9BCfconst0, J9BCfconst1, J9BCfconst2,
320
/* 14 */ J9BCdconst0, J9BCdconst1,
321
/* 16 */ J9BCbipush, J9BCsipush,
322
/* 18 */ J9BCldc, J9BCldcw, J9BCldc2lw,
323
/* 21 */ J9BCiload, J9BClload, J9BCfload, J9BCdload, J9BCaload,
324
/* 26 */ J9BCiload0, J9BCiload1, J9BCiload2, J9BCiload3,
325
/* 30 */ J9BClload0, J9BClload1, J9BClload2, J9BClload3,
326
/* 34 */ J9BCfload0, J9BCfload1, J9BCfload2, J9BCfload3,
327
/* 38 */ J9BCdload0, J9BCdload1, J9BCdload2, J9BCdload3,
328
/* 42 */ J9BCaload0, J9BCaload1, J9BCaload2, J9BCaload3,
329
/* 46 */ J9BCiaload, J9BClaload, J9BCfaload, J9BCdaload, J9BCaaload, J9BCbaload, J9BCcaload, J9BCsaload,
330
/* 54 */ J9BCistore, J9BClstore, J9BCfstore, J9BCdstore, J9BCastore,
331
/* 59 */ J9BCistore0, J9BCistore1, J9BCistore2, J9BCistore3,
332
/* 63 */ J9BClstore0, J9BClstore1, J9BClstore2, J9BClstore3,
333
/* 67 */ J9BCfstore0, J9BCfstore1, J9BCfstore2, J9BCfstore3,
334
/* 71 */ J9BCdstore0, J9BCdstore1, J9BCdstore2, J9BCdstore3,
335
/* 75 */ J9BCastore0, J9BCastore1, J9BCastore2, J9BCastore3,
336
/* 79 */ J9BCiastore, J9BClastore, J9BCfastore, J9BCdastore, J9BCaastore, J9BCbastore, J9BCcastore, J9BCsastore,
337
/* 87 */ J9BCpop, J9BCpop2,
338
/* 89 */ J9BCdup, J9BCdupx1, J9BCdupx2, J9BCdup2, J9BCdup2x1, J9BCdup2x2,
339
/* 95 */ J9BCswap,
340
/* 96 */ J9BCiadd, J9BCladd, J9BCfadd, J9BCdadd,
341
/* 100 */ J9BCisub, J9BClsub, J9BCfsub, J9BCdsub,
342
/* 104 */ J9BCimul, J9BClmul, J9BCfmul, J9BCdmul,
343
/* 108 */ J9BCidiv, J9BCldiv, J9BCfdiv, J9BCddiv,
344
/* 112 */ J9BCirem, J9BClrem, J9BCfrem, J9BCdrem,
345
/* 116 */ J9BCineg, J9BClneg, J9BCfneg, J9BCdneg,
346
/* 120 */ J9BCishl, J9BClshl, J9BCishr, J9BClshr, J9BCiushr, J9BClushr,
347
/* 126 */ J9BCiand, J9BCland,
348
/* 128 */ J9BCior, J9BClor, J9BCixor, J9BClxor,
349
/* 132 */ J9BCiinc,
350
/* 133 */ J9BCi2l, J9BCi2f, J9BCi2d,
351
/* 136 */ J9BCl2i, J9BCl2f, J9BCl2d,
352
/* 139 */ J9BCf2i, J9BCf2l, J9BCf2d,
353
/* 142 */ J9BCd2i, J9BCd2l, J9BCd2f,
354
/* 145 */ J9BCi2b, J9BCi2c, J9BCi2s,
355
/* 148 */ J9BClcmp, J9BCfcmpl, J9BCfcmpg, J9BCdcmpl, J9BCdcmpg,
356
/* 153 */ J9BCifeq, J9BCifne, J9BCiflt, J9BCifge, J9BCifgt, J9BCifle,
357
/* 159 */ J9BCificmpeq, J9BCificmpne, J9BCificmplt, J9BCificmpge, J9BCificmpgt, J9BCificmple, J9BCifacmpeq, J9BCifacmpne,
358
/* 167 */ J9BCgoto, J9BCunknown, J9BCunknown,
359
/* 170 */ J9BCtableswitch, J9BClookupswitch,
360
/* 172 */ J9BCgenericReturn, J9BCgenericReturn, J9BCgenericReturn,
361
/* 175 */ J9BCgenericReturn, J9BCgenericReturn, J9BCgenericReturn,
362
/* 178 */ J9BCgetstatic, J9BCputstatic, J9BCgetfield, J9BCputfield,
363
/* 182 */ J9BCinvokevirtual, J9BCinvokespecial, J9BCinvokestatic, J9BCinvokeinterface, J9BCinvokedynamic,
364
/* 187 */ J9BCnew, J9BCnewarray, J9BCanewarray,
365
/* 190 */ J9BCarraylength,
366
/* 191 */ J9BCathrow,
367
/* 192 */ J9BCcheckcast,
368
/* 193 */ J9BCinstanceof,
369
/* 194 */ J9BCmonitorenter, J9BCmonitorexit,
370
/* 196 */ J9BCunknown,
371
/* 197 */ J9BCmultianewarray,
372
/* 198 */ J9BCifnull, J9BCifnonnull,
373
/* 200 */ J9BCgotow, J9BCunknown,
374
/* 202 */ J9BCbreakpoint,
375
/* 203 */ J9BCaconst_init,
376
/* 204 */ J9BCwithfield,
377
/* 205 */ J9BCunknown, J9BCunknown, J9BCunknown, J9BCunknown,
378
/* 209 */ J9BCunknown, J9BCunknown, J9BCunknown, J9BCunknown,
379
/* 213 */ J9BCiincw, J9BCunknown,
380
/* 215 - JBaload0getfield */ J9BCaload0,
381
/* 216 - JBnewdup */ J9BCnew,
382
/* 217 */ J9BCiloadw, J9BClloadw, J9BCfloadw, J9BCdloadw, J9BCaloadw,
383
/* 222 */ J9BCistorew, J9BClstorew, J9BCfstorew, J9BCdstorew, J9BCastorew,
384
/* 227 */ J9BCunknown,
385
/* 228 */ J9BCgenericReturn, J9BCgenericReturn, J9BCunknown, J9BCinvokeinterface2,
386
/* 232 */ J9BCinvokehandle, J9BCinvokehandlegeneric,
387
/* 234 */ J9BCinvokestaticsplit, J9BCinvokespecialsplit,
388
/* 236 */ J9BCReturnC, J9BCReturnS, J9BCReturnB, J9BCReturnZ,
389
/* 240 */ J9BCunknown, J9BCunknown, J9BCunknown, J9BCunknown,
390
/* 244 */ J9BCunknown, J9BCunknown, J9BCunknown, J9BCunknown, J9BCunknown,
391
/* 249 */ J9BCldc2dw,
392
/* 250 */ J9BCunknown, J9BCunknown, J9BCunknown, J9BCunknown, J9BCunknown, J9BCunknown
393
};
394
395
const uint8_t TR_J9ByteCodeIterator::_byteCodeFlags[] =
396
{
397
// FLAGS | SIZE,
398
0x01, // J9BCnop
399
0x01, // J9BCaconstnull
400
0x01, // J9BCiconstm1
401
0x01, // J9BCiconst0
402
0x01, // J9BCiconst1
403
0x01, // J9BCiconst2
404
0x01, // J9BCiconst3
405
0x01, // J9BCiconst4
406
0x01, // J9BCiconst5
407
0x01, // J9BClconst0
408
0x01, // J9BClconst1
409
0x01, // J9BCfconst0
410
0x01, // J9BCfconst1
411
0x01, // J9BCfconst2
412
0x01, // J9BCdconst0
413
0x01, // J9BCdconst1
414
0x02, // J9BCbipush
415
0x03, // J9BCsipush
416
0x02, // J9BCldc
417
0x03, // J9BCldcw
418
0x03, // J9BCldc2lw
419
0x03, // J9BCldc2dw
420
0x02, // J9BCiload
421
0x02, // J9BClload
422
0x02, // J9BCfload
423
0x02, // J9BCdload
424
0x02, // J9BCaload
425
0x01, // J9BCiload0
426
0x01, // J9BCiload1
427
0x01, // J9BCiload2
428
0x01, // J9BCiload3
429
0x01, // J9BClload0
430
0x01, // J9BClload1
431
0x01, // J9BClload2
432
0x01, // J9BClload3
433
0x01, // J9BCfload0
434
0x01, // J9BCfload1
435
0x01, // J9BCfload2
436
0x01, // J9BCfload3
437
0x01, // J9BCdload0
438
0x01, // J9BCdload1
439
0x01, // J9BCdload2
440
0x01, // J9BCdload3
441
0x01, // J9BCaload0
442
0x01, // J9BCaload1
443
0x01, // J9BCaload2
444
0x01, // J9BCaload3
445
0x01, // J9BCiaload
446
0x01, // J9BClaload
447
0x01, // J9BCfaload
448
0x01, // J9BCdaload
449
0x01, // J9BCaaload
450
0x01, // J9BCbaload
451
0x01, // J9BCcaload
452
0x01, // J9BCsaload
453
0x03, // J9BCiloadw
454
0x03, // J9BClloadw
455
0x03, // J9BCfloadw
456
0x03, // J9BCdloadw
457
0x03, // J9BCaloadw
458
0x02, // J9BCistore
459
0x02, // J9BClstore
460
0x02, // J9BCfstore
461
0x02, // J9BCdstore
462
0x02, // J9BCastore
463
0x03, // J9BCistorew
464
0x03, // J9BClstorew
465
0x03, // J9BCfstorew
466
0x03, // J9BCdstorew
467
0x03, // J9BCastorew
468
0x01, // J9BCistore0
469
0x01, // J9BCistore1
470
0x01, // J9BCistore2
471
0x01, // J9BCistore3
472
0x01, // J9BClstore0
473
0x01, // J9BClstore1
474
0x01, // J9BClstore2
475
0x01, // J9BClstore3
476
0x01, // J9BCfstore0
477
0x01, // J9BCfstore1
478
0x01, // J9BCfstore2
479
0x01, // J9BCfstore3
480
0x01, // J9BCdstore0
481
0x01, // J9BCdstore1
482
0x01, // J9BCdstore2
483
0x01, // J9BCdstore3
484
0x01, // J9BCastore0
485
0x01, // J9BCastore1
486
0x01, // J9BCastore2
487
0x01, // J9BCastore3
488
0x01, // J9BCiastore
489
0x01, // J9BClastore
490
0x01, // J9BCfastore
491
0x01, // J9BCdastore
492
0x01, // J9BCaastore
493
0x01, // J9BCbastore
494
0x01, // J9BCcastore
495
0x01, // J9BCsastore
496
0x01, // J9BCpop
497
0x01, // J9BCpop2
498
0x01, // J9BCdup
499
0x01, // J9BCdupx1
500
0x01, // J9BCdupx2
501
0x01, // J9BCdup2
502
0x01, // J9BCdup2x1
503
0x01, // J9BCdup2x2
504
0x01, // J9BCswap
505
0x01, // J9BCiadd
506
0x01, // J9BCladd
507
0x01, // J9BCfadd
508
0x01, // J9BCdadd
509
0x01, // J9BCisub
510
0x01, // J9BClsub
511
0x01, // J9BCfsub
512
0x01, // J9BCdsub
513
0x01, // J9BCimul
514
0x01, // J9BClmul
515
0x01, // J9BCfmul
516
0x01, // J9BCdmul
517
0x01, // J9BCidiv
518
0x01, // J9BCldiv
519
0x01, // J9BCfdiv
520
0x01, // J9BCddiv
521
0x01, // J9BCirem
522
0x01, // J9BClrem
523
0x01, // J9BCfrem
524
0x01, // J9BCdrem
525
0x01, // J9BCineg
526
0x01, // J9BClneg
527
0x01, // J9BCfneg
528
0x01, // J9BCdneg
529
0x01, // J9BCishl
530
0x01, // J9BClshl
531
0x01, // J9BCishr
532
0x01, // J9BClshr
533
0x01, // J9BCiushr
534
0x01, // J9BClushr
535
0x01, // J9BCiand
536
0x01, // J9BCland
537
0x01, // J9BCior
538
0x01, // J9BClor
539
0x01, // J9BCixor
540
0x01, // J9BClxor
541
0x03, // J9BCiinc
542
0x05, // J9BCiincw
543
0x01, // J9BCi2l
544
0x01, // J9BCi2f
545
0x01, // J9BCi2d
546
0x01, // J9BCl2i
547
0x01, // J9BCl2f
548
0x01, // J9BCl2d
549
0x01, // J9BCf2i
550
0x01, // J9BCf2l
551
0x01, // J9BCf2d
552
0x01, // J9BCd2i
553
0x01, // J9BCd2l
554
0x01, // J9BCd2f
555
0x01, // J9BCi2b
556
0x01, // J9BCi2c
557
0x01, // J9BCi2s
558
0x01, // J9BClcmp
559
0x01, // J9BCfcmpl
560
0x01, // J9BCfcmpg
561
0x01, // J9BCdcmpl
562
0x01, // J9BCdcmpg
563
TwoByteRelativeBranch | 0x03, // J9BCifeq
564
TwoByteRelativeBranch | 0x03, // J9BCifne
565
TwoByteRelativeBranch | 0x03, // J9BCiflt
566
TwoByteRelativeBranch | 0x03, // J9BCifge
567
TwoByteRelativeBranch | 0x03, // J9BCifgt
568
TwoByteRelativeBranch | 0x03, // J9BCifle
569
TwoByteRelativeBranch | 0x03, // J9BCificmpeq
570
TwoByteRelativeBranch | 0x03, // J9BCificmpne
571
TwoByteRelativeBranch | 0x03, // J9BCificmplt
572
TwoByteRelativeBranch | 0x03, // J9BCificmpge
573
TwoByteRelativeBranch | 0x03, // J9BCificmpgt
574
TwoByteRelativeBranch | 0x03, // J9BCificmple
575
TwoByteRelativeBranch | 0x03, // J9BCifacmpeq
576
TwoByteRelativeBranch | 0x03, // J9BCifacmpne
577
TwoByteRelativeBranch | 0x03, // J9BCifnull
578
TwoByteRelativeBranch | 0x03, // J9BCifnonnull
579
TwoByteRelativeBranch | 0x03, // J9BCgoto
580
FourByteRelativeBranch | 0x05, // J9BCgotow
581
0x00, // J9BCtableswitch
582
0x00, // J9BClookupswitch
583
0x01, // J9BCgenericReturn
584
0x03, // J9BCgetstatic
585
0x03, // J9BCputstatic
586
0x03, // J9BCgetfield
587
0x03, // J9BCputfield
588
0x03, // J9BCinvokevirtual
589
0x03, // J9BCinvokespecial
590
0x03, // J9BCinvokestatic
591
0x03, // J9BCinvokeinterface
592
0x03, // J9BCinvokedynamic
593
0x03, // J9BCinvokehandle
594
0x03, // J9BCinvokehandlegeneric
595
0x03, // J9BCinvokespecialsplit
596
0x01, // J9BCReturnC
597
0x01, // J9BCReturnS
598
0x01, // J9BCReturnB
599
0x01, // J9BCReturnZ
600
0x03, // J9BCinvokestaticsplit
601
0x01, // J9BCinvokeinterface2
602
0x03, // J9BCnew
603
0x02, // J9BCnewarray
604
0x03, // J9BCanewarray
605
0x04, // J9BCmultianewarray
606
0x01, // J9BCarraylength
607
0x01, // J9BCathrow
608
0x03, // J9BCcheckcast
609
0x03, // J9BCinstanceof
610
0x01, // J9BCmonitorenter
611
0x01, // J9BCmonitorexit
612
0x00, // J9BCwide
613
0x01, // J9BCasyncCheck --- TODO: Is this the right size?
614
0x03, // J9BCaconst_init
615
0x03, // J9BCwithfield
616
0x01, // J9BCbreakpoint --- TODO: Is this the right size?
617
0x01, // BCunknown
618
};
619
620
const uint8_t TR_J9ByteCodeIterator::_estimatedCodeSize[] =
621
{
622
0, // J9BCnop
623
1, // J9BCaconstnull
624
1, // J9BCiconstm1
625
1, // J9BCiconst0
626
1, // J9BCiconst1
627
1, // J9BCiconst2
628
1, // J9BCiconst3
629
1, // J9BCiconst4
630
1, // J9BCiconst5
631
2, // J9BClconst0
632
2, // J9BClconst1
633
1, // J9BCfconst0
634
1, // J9BCfconst1
635
2, // J9BCfconst2
636
1, // J9BCdconst0
637
1, // J9BCdconst1
638
1, // J9BCbipush
639
1, // J9BCsipush
640
1, // J9BCldc
641
1, // J9BCldcw
642
2, // J9BCldc2lw
643
2, // J9BCldc2dw
644
1, // J9BCiload
645
2, // J9BClload
646
1, // J9BCfload
647
1, // J9BCdload
648
1, // J9BCaload
649
1, // J9BCiload0
650
1, // J9BCiload1
651
1, // J9BCiload2
652
1, // J9BCiload3
653
2, // J9BClload0
654
2, // J9BClload1
655
2, // J9BClload2
656
2, // J9BClload3
657
1, // J9BCfload0
658
1, // J9BCfload1
659
1, // J9BCfload2
660
1, // J9BCfload3
661
1, // J9BCdload0
662
1, // J9BCdload1
663
1, // J9BCdload2
664
1, // J9BCdload3
665
1, // J9BCaload0
666
1, // J9BCaload1
667
1, // J9BCaload2
668
1, // J9BCaload3
669
5, // J9BCiaload
670
6, // J9BClaload
671
5, // J9BCfaload
672
5, // J9BCdaload
673
5, // J9BCaaload
674
5, // J9BCbaload
675
5, // J9BCcaload
676
5, // J9BCsaload
677
1, // J9BCiloadw
678
2, // J9BClloadw
679
1, // J9BCfloadw
680
1, // J9BCdloadw
681
1, // J9BCaloadw
682
1, // J9BCistore
683
2, // J9BClstore
684
1, // J9BCfstore
685
1, // J9BCdstore
686
1, // J9BCastore
687
1, // J9BCistorew
688
2, // J9BClstorew
689
1, // J9BCfstorew
690
1, // J9BCdstorew
691
1, // J9BCastorew
692
1, // J9BCistore0
693
1, // J9BCistore1
694
1, // J9BCistore2
695
1, // J9BCistore3
696
2, // J9BClstore0
697
2, // J9BClstore1
698
2, // J9BClstore2
699
2, // J9BClstore3
700
1, // J9BCfstore0
701
1, // J9BCfstore1
702
1, // J9BCfstore2
703
1, // J9BCfstore3
704
1, // J9BCdstore0
705
1, // J9BCdstore1
706
1, // J9BCdstore2
707
1, // J9BCdstore3
708
1, // J9BCastore0
709
1, // J9BCastore1
710
1, // J9BCastore2
711
1, // J9BCastore3
712
5, // J9BCiastore
713
6, // J9BClastore
714
5, // J9BCfastore
715
5, // J9BCdastore
716
5, // J9BCaastore
717
5, // J9BCbastore
718
5, // J9BCcastore
719
5, // J9BCsastore
720
0, // J9BCpop
721
0, // J9BCpop2
722
0, // J9BCdup
723
0, // J9BCdupx1
724
0, // J9BCdupx2
725
0, // J9BCdup2
726
0, // J9BCdup2x1
727
0, // J9BCdup2x2
728
0, // J9BCswap
729
1, // J9BCiadd
730
2, // J9BCladd
731
1, // J9BCfadd
732
1, // J9BCdadd
733
1, // J9BCisub
734
2, // J9BClsub
735
1, // J9BCfsub
736
1, // J9BCdsub
737
1, // J9BCimul
738
2, // J9BClmul
739
1, // J9BCfmul
740
1, // J9BCdmul
741
1, // J9BCidiv
742
2, // J9BCldiv
743
3, // J9BCfdiv
744
3, // J9BCddiv
745
1, // J9BCirem
746
2, // J9BClrem
747
3, // J9BCfrem
748
3, // J9BCdrem
749
1, // J9BCineg
750
2, // J9BClneg
751
1, // J9BCfneg
752
1, // J9BCdneg
753
1, // J9BCishl
754
2, // J9BClshl
755
1, // J9BCishr
756
2, // J9BClshr
757
1, // J9BCiushr
758
2, // J9BClushr
759
1, // J9BCiand
760
2, // J9BCland
761
1, // J9BCior
762
2, // J9BClor
763
1, // J9BCixor
764
2, // J9BClxor
765
3, // J9BCiinc
766
3, // J9BCiincw
767
2, // J9BCi2l
768
2, // J9BCi2f
769
2, // J9BCi2d
770
1, // J9BCl2i
771
2, // J9BCl2f
772
2, // J9BCl2d
773
4, // J9BCf2i
774
4, // J9BCf2l
775
1, // J9BCf2d
776
4, // J9BCd2i
777
4, // J9BCd2l
778
2, // J9BCd2f
779
1, // J9BCi2b
780
1, // J9BCi2c
781
1, // J9BCi2s
782
8, // J9BClcmp
783
5, // J9BCfcmpl
784
5, // J9BCfcmpg
785
5, // J9BCdcmpl
786
5, // J9BCdcmpg
787
1, // J9BCifeq
788
1, // J9BCifne
789
1, // J9BCiflt
790
1, // J9BCifge
791
1, // J9BCifgt
792
1, // J9BCifle
793
2, // J9BCificmpeq
794
2, // J9BCificmpne
795
2, // J9BCificmplt
796
2, // J9BCificmpge
797
2, // J9BCificmpgt
798
2, // J9BCificmple
799
2, // J9BCifacmpeq
800
2, // J9BCifacmpne
801
2, // J9BCifnull
802
2, // J9BCifnonnull
803
1, // J9BCgoto
804
1, // J9BCgotow
805
10, // J9BCtableswitch
806
10, // J9BClookupswitch
807
25, // J9BCgenericReturn
808
1, // J9BCgetstatic
809
1, // J9BCputstatic
810
1, // J9BCgetfield
811
1, // J9BCputfield
812
6, // J9BCinvokevirtual
813
6, // J9BCinvokespecial
814
4, // J9BCinvokestatic
815
11, // J9BCinvokeinterface
816
20, // J9BCinvokedynamic
817
20, // J9BCinvokehandle
818
30, // J9BCinvokehandlegeneric
819
6, // J9BCinvokespecialsplit
820
25, // J9BCReturnC
821
25, // J9BCReturnS
822
25, // J9BCReturnB
823
25, // J9BCReturnZ
824
4, // J9BCinvokestaticsplit
825
0, // J9BCinvokeinterface2
826
1, // J9BCnew
827
1, // J9BCnewarray
828
1, // J9BCanewarray
829
1, // J9BCmultianewarray
830
2, // J9BCarraylength
831
1, // J9BCathrow
832
5, // J9BCcheckcast
833
5, // J9BCinstanceof
834
25, // J9BCmonitorenter
835
25, // J9BCmonitorexit
836
0, // J9BCwide
837
0, // J9BCasyncCheck
838
1, // J9BCaconst_init
839
1, // J9BCwithfield
840
0, // J9BCunknown
841
};
842
843
// == != < >= > <=
844
TR::ILOpCodes TR_J9ByteCodeIterator::_lcmpOps[] = { TR::iflcmpeq, TR::iflcmpne, TR::iflcmplt, TR::iflcmpge, TR::iflcmpgt, TR::iflcmple };
845
TR::ILOpCodes TR_J9ByteCodeIterator::_fcmplOps[] = { TR::iffcmpeq, TR::iffcmpneu, TR::iffcmpltu, TR::iffcmpge, TR::iffcmpgt, TR::iffcmpleu };
846
TR::ILOpCodes TR_J9ByteCodeIterator::_fcmpgOps[] = { TR::iffcmpeq, TR::iffcmpneu, TR::iffcmplt, TR::iffcmpgeu, TR::iffcmpgtu, TR::iffcmple };
847
TR::ILOpCodes TR_J9ByteCodeIterator::_dcmplOps[] = { TR::ifdcmpeq, TR::ifdcmpneu, TR::ifdcmpltu, TR::ifdcmpge, TR::ifdcmpgt, TR::ifdcmpleu };
848
TR::ILOpCodes TR_J9ByteCodeIterator::_dcmpgOps[] = { TR::ifdcmpeq, TR::ifdcmpneu, TR::ifdcmplt, TR::ifdcmpgeu, TR::ifdcmpgtu, TR::ifdcmple };
849
850
851