-
Notifications
You must be signed in to change notification settings - Fork 728
/
BytecodeInterpreter.hpp
11706 lines (10972 loc) · 403 KB
/
BytecodeInterpreter.hpp
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*******************************************************************************
* Copyright IBM Corp. and others 1991
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] https://openjdk.org/legal/assembly-exception.html
*
* 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
*******************************************************************************/
#if !defined(BYTECODEINTERPRETER_HPP_)
#define BYTECODEINTERPRETER_HPP_
#include "j9.h"
#include "j9cfg.h"
#include "j9protos.h"
#include "j9consts.h"
#include "j9vmnls.h"
#include "j9jclnls.h"
#include "j9bcvnls.h"
#include "bcnames.h"
#include "rommeth.h"
#include "stackwalk.h"
#include "ut_j9vm.h"
#include "util_api.h"
#include "vm_internal.h"
#include "jni.h"
#define FFI_BUILDING /* Needed on Windows to link libffi statically */
#include "ffi.h"
#include "jitregmap.h"
#include "j2sever.h"
#include "vmaccess.h"
#include "objhelp.h"
#include "ArrayCopyHelpers.hpp"
#include "AtomicSupport.hpp"
#include "BytecodeAction.hpp"
#if defined(J9VM_OPT_CRIU_SUPPORT)
#include "CRIUHelpers.hpp"
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
#if defined(J9VM_OPT_METHOD_HANDLE)
#include "MHInterpreter.hpp"
#endif /* defined(J9VM_OPT_METHOD_HANDLE) */
#include "ObjectAccessBarrierAPI.hpp"
#include "ObjectHash.hpp"
#include "ValueTypeHelpers.hpp"
#include "VMHelpers.hpp"
#include "VMAccess.hpp"
#include "ObjectAllocationAPI.hpp"
#include "OutOfLineINL.hpp"
#include "UnsafeAPI.hpp"
#include "ObjectMonitor.hpp"
#include "JITInterface.hpp"
#if JAVA_SPEC_VERSION >= 16
#include "LayoutFFITypeHelpers.hpp"
#endif /* JAVA_SPEC_VERSION >= 16 */
#if 0
#define DEBUG_MUST_HAVE_VM_ACCESS(vmThread) Assert_VM_mustHaveVMAccess(vmThread)
#else
#define DEBUG_MUST_HAVE_VM_ACCESS(vmThread)
#endif
#define DO_INTERPRETER_PROFILING
#if defined(DEBUG_VERSION)
#define DO_HOOKS
#define DO_SINGLE_STEP
#endif /* DEBUG_VERSION */
typedef enum {
VM_NO,
VM_YES,
VM_MAYBE
} VM_YesNoMaybe;
#define LOCAL_PC
#define LOCAL_SP
#if defined(LOCAL_CURRENT_THREAD)
#define CURRENT_THREAD J9VMThread * &_currentThread
#define CURRENT_THREAD_PARAM _currentThread
#endif
#if defined(LOCAL_ARG0EA)
#define ARG0EA UDATA * &_arg0EA
#define ARG0EA_PARAM _arg0EA
#endif
#if defined(LOCAL_SP)
#define SP UDATA * &_sp
#define SP_PARAM _sp
#endif
#if defined(LOCAL_PC)
#define PC U_8 * &_pc
#define PC_PARAM _pc
#endif
#if defined(LOCAL_LITERALS)
#define LITERALS J9Method * &_literals
#define LITERALS_PARAM _literals
#endif
#define REGISTER_ARGS_LIST SP, PC
#define REGISTER_ARGS SP_PARAM, PC_PARAM
#if defined(DEBUG_VERSION)
#define DEBUG_UPDATE_VMSTRUCT() updateVMStruct(REGISTER_ARGS)
#else
#define DEBUG_UPDATE_VMSTRUCT()
#endif
#if defined(J9VM_PORT_ZOS_CEEHDLRSUPPORT)
extern "C" {
extern void CEEJNIWrapper(J9VMThread *currentThread);
}
#endif /* J9VM_PORT_ZOS_CEEHDLRSUPPORT */
#if JAVA_SPEC_VERSION >= 16
extern "C" {
extern void
#if FFI_NATIVE_RAW_API
ffiCallWithSetJmpForUpcall(J9VMThread *currentThread, ffi_cif *cif, void *function, UDATA *returnStorage, void **values, ffi_raw *values_raw);
#else /* FFI_NATIVE_RAW_API */
ffiCallWithSetJmpForUpcall(J9VMThread *currentThread, ffi_cif *cif, void *function, UDATA *returnStorage, void **values);
#endif /* FFI_NATIVE_RAW_API */
}
#endif /* JAVA_SPEC_VERSION >= 16 */
class INTERPRETER_CLASS
{
/*
* Data members
*/
private:
J9JavaVM * const _vm;
#if !defined(LOCAL_CURRENT_THREAD)
J9VMThread * const _currentThread;
#endif
#if !defined(LOCAL_ARG0EA)
UDATA *_arg0EA;
#endif
#if !defined(LOCAL_SP)
UDATA *_sp;
#endif
#if !defined(LOCAL_PC)
U_8 *_pc;
#endif
#if !defined(LOCAL_LITERALS)
J9Method *_literals;
#endif
UDATA _nextAction;
J9Method *_sendMethod;
#if defined(DO_SINGLE_STEP)
bool _skipSingleStep;
#endif
MM_ObjectAllocationAPI _objectAllocate;
MM_ObjectAccessBarrierAPI _objectAccessBarrier;
protected:
public:
/*
* Function members
*/
private:
#if defined(J9VM_OPT_METHOD_HANDLE)
/**
* Run a methodHandle using the MethodHandle interpreter/
* @param methodHandle[in] The MethodHandle to run
* @return the next action to take.
*/
VMINLINE VM_BytecodeAction
interpretMethodHandle(REGISTER_ARGS_LIST, j9object_t methodHandle)
{
updateVMStruct(REGISTER_ARGS);
VM_MHInterpreter mhInterpreter(_currentThread, &_objectAllocate, &_objectAccessBarrier);
VM_BytecodeAction next = mhInterpreter.dispatchLoop(methodHandle);
VMStructHasBeenUpdated(REGISTER_ARGS);
return next;
}
/**
* Modify the MH.invocationCount so that invocations from the interpreter don't
* actually modify the counts or affect CustomThunk compilation.
* Shareable thunk compilation is based on the ThunkTuple counting.
* Shareable thunks then modify the MH.invocationCount on each invocation. We
* only want invocations from jitted code to drive CustomThunk compilation so the
* interpreter needs to preemptively negate the modification to the invocationCount.
*
* @param methodHandle[in] The MethodHandle to modify the count on
*/
VMINLINE void
modifyMethodHandleCountForI2J(REGISTER_ARGS_LIST, j9object_t methodHandle)
{
/* Decrement the MH.invocationCount as the shareableThunks increment it. We only want
* invocations from compiled code to be counted.
*/
I_32 count = J9VMJAVALANGINVOKEMETHODHANDLE_INVOCATIONCOUNT(_currentThread, methodHandle);
J9VMJAVALANGINVOKEMETHODHANDLE_SET_INVOCATIONCOUNT(_currentThread, methodHandle, count - 1);
}
#endif /* defined(J9VM_OPT_METHOD_HANDLE) */
#if defined(DO_SINGLE_STEP)
void VMINLINE
skipNextSingleStep()
{
if (J9_EVENT_IS_HOOKED(_vm->hookInterface, J9HOOK_VM_SINGLE_STEP)) {
_skipSingleStep = true;
}
}
VM_BytecodeAction VMINLINE
singleStep(REGISTER_ARGS_LIST)
{
VM_BytecodeAction rc = FALL_THROUGH;
if (J9_EVENT_IS_HOOKED(_vm->hookInterface, J9HOOK_VM_SINGLE_STEP)) {
if (_skipSingleStep) {
_skipSingleStep = false;
} else {
updateVMStruct(REGISTER_ARGS);
ALWAYS_TRIGGER_J9HOOK_VM_SINGLE_STEP(_vm->hookInterface, _currentThread, _literals, _pc - _literals->bytecodes);
VMStructHasBeenUpdated(REGISTER_ARGS);
if (JBbreakpoint == *_pc) {
rc = GOTO_EXECUTE_BREAKPOINTED_BYTECODE;
} else if (immediateAsyncPending()) {
rc = GOTO_ASYNC_CHECK;
}
}
}
return rc;
}
#endif
/* Profiling records:
*
* J9ProfilingBytecodeRecord
* U_8* _pc;
* J9ProfilingBytecodeBranchRecord
* U_8 taken;
* J9ProfilingBytecodeCastRecord
* J9Class *instanceClass;
* J9ProfilingBytecodeSwitchRecord
* U_32 index;
* J9ProfilingBytecodeMethodEnterExitRecord (_pc == 0 for enter, 1 for exit, 2 for exit due to throw)
* J9Method *method;
* J9ProfilingBytecodeInvokeRecord
* J9Class *receiverClass;
* J9Method *callingMethod;
* J9Method *targetMethod;
* J9ProfilingBytecodeCallingMethodRecord
* J9Method *callingMethod;
*/
VMINLINE U_8*
startProfilingRecord(REGISTER_ARGS_LIST, UDATA dataSize)
{
#if defined(DO_INTERPRETER_PROFILING)
retry:
U_8 *profilingCursor = NULL;
if (J9_EVENT_IS_HOOKED(_vm->hookInterface, J9HOOK_VM_PROFILING_BYTECODE_BUFFER_FULL)) {
IDATA count = (IDATA)(UDATA)_literals->extra;
if ((count > 0) && (count <= (IDATA)_currentThread->maxProfilingCount)) {
#if defined(DEBUG_VERSION)
/* Do not profile breakpointed methods because the pc points to memory
* which will go away when the breakpoint is removed.
*/
if (!methodIsBreakpointed(_literals))
#endif /* DEBUG_VERSION */
{
U_8 *nextRecord = _currentThread->profilingBufferCursor;
profilingCursor = nextRecord;
nextRecord += (sizeof(U_8*) + dataSize);
if (nextRecord >= _currentThread->profilingBufferEnd) {
updateVMStruct(REGISTER_ARGS);
flushBytecodeProfilingData(_currentThread);
goto retry;
} else {
_currentThread->profilingBufferCursor = nextRecord;
*(U_8**)profilingCursor = _pc;
profilingCursor += sizeof(U_8*);
}
}
}
}
return profilingCursor;
#else
return NULL;
#endif
}
VMINLINE void
profileCallingMethod(REGISTER_ARGS_LIST)
{
U_8 *profilingCursor = startProfilingRecord(REGISTER_ARGS, sizeof(J9Method*));
if (NULL != profilingCursor) {
*(J9Method**)profilingCursor = _literals;
}
}
VMINLINE void
profileInvokeReceiver(REGISTER_ARGS_LIST, J9Class *clazz, J9Method *callingMethod, J9Method *targetMethod)
{
U_8 *profilingCursor = startProfilingRecord(REGISTER_ARGS, sizeof(J9Class*) + 2*sizeof(J9Method*));
if (NULL != profilingCursor) {
#if defined(J9VM_ARCH_ARM) && !defined(J9VM_ENV_DATA64)
/* ARMv8 does not support store multiple to unaligned addresses, and unfortunately GCC
* generates a store multiple for the normal version of these three assignments.
* To avoid the store multiple instructions, we can replace the assignments with
* inline assembly code.
*/
asm (
"str %[clazz], [%[cursor], #0]\n\t"
"str %[method], [%[cursor], #4]\n\t"
"str %[target], [%[cursor], #8]\n\t"
: // No outputs
:[cursor] "r" (profilingCursor),
[clazz] "r" (clazz),
[method] "r" (callingMethod),
[target] "r" (targetMethod)
);
#else /* defined(J9VM_ARCH_ARM) && !defined(J9VM_ENV_DATA64) */
*(J9Class**)profilingCursor = clazz;
profilingCursor += sizeof(J9Class*);
*(J9Method**)profilingCursor = callingMethod;
profilingCursor += sizeof(J9Method*);
*(J9Method**)profilingCursor = targetMethod;
#endif /* defined(J9VM_ARCH_ARM) && !defined(J9VM_ENV_DATA64) */
}
}
VMINLINE void
profileCast(REGISTER_ARGS_LIST, J9Class *clazz)
{
U_8 *profilingCursor = startProfilingRecord(REGISTER_ARGS, sizeof(J9Class*));
if (NULL != profilingCursor) {
*(J9Class**)profilingCursor = clazz;
}
}
VMINLINE void
profileSwitch(REGISTER_ARGS_LIST, I_32 index)
{
U_8 *profilingCursor = startProfilingRecord(REGISTER_ARGS, sizeof(I_32));
if (NULL != profilingCursor) {
*(I_32*)profilingCursor = index;
}
}
VMINLINE void
updateVMStruct(REGISTER_ARGS_LIST)
{
J9VMThread *const thread = _currentThread;
thread->arg0EA = _arg0EA;
thread->sp = _sp;
thread->pc = _pc;
thread->literals = _literals;
}
VMINLINE void
VMStructHasBeenUpdated(REGISTER_ARGS_LIST)
{
J9VMThread const *const thread = _currentThread;
_arg0EA = thread->arg0EA;
_sp = thread->sp;
_pc = thread->pc;
_literals = thread->literals;
}
VMINLINE UDATA*
buildSpecialStackFrame(REGISTER_ARGS_LIST, UDATA type, UDATA flags, bool visible)
{
*--_sp = (UDATA)_arg0EA | (visible ? 0 : J9SF_A0_INVISIBLE_TAG);
UDATA *bp = _sp;
*--_sp = (UDATA)_pc;
*--_sp = (UDATA)_literals;
*--_sp = (flags);
_pc = (U_8*)(type);
_literals = NULL;
return bp;
}
VMINLINE void
buildGenericSpecialStackFrame(REGISTER_ARGS_LIST, UDATA flags)
{
_arg0EA = buildSpecialStackFrame(REGISTER_ARGS, J9SF_FRAME_TYPE_GENERIC_SPECIAL, flags, false);
}
VMINLINE UDATA*
buildMethodFrame(REGISTER_ARGS_LIST, J9Method *method, UDATA flags)
{
UDATA *bp = buildSpecialStackFrame(REGISTER_ARGS, J9SF_FRAME_TYPE_METHOD, flags, false);
*--_sp = (UDATA)method;
_arg0EA = bp + J9_ROM_METHOD_FROM_RAM_METHOD(method)->argCount;
return bp;
}
VMINLINE UDATA
jitStackFrameFlags(REGISTER_ARGS_LIST, UDATA constantFlags)
{
UDATA flags = _currentThread->jitStackFrameFlags;
_currentThread->jitStackFrameFlags = 0;
return flags | constantFlags;
}
VMINLINE void
restoreGenericSpecialStackFrame(REGISTER_ARGS_LIST)
{
_sp = _arg0EA + 1;
_literals = (J9Method*)(_sp[-3]);
_pc = (U_8*)(_sp[-2]);
_arg0EA = (UDATA*)(_sp[-1] & ~(UDATA)J9SF_A0_INVISIBLE_TAG);
}
VMINLINE void
restoreSpecialStackFrameLeavingArgs(REGISTER_ARGS_LIST, UDATA *bp)
{
_sp = bp + 1;
_literals = (J9Method*)(bp[-2]);
_pc = (U_8*)(bp[-1]);
_arg0EA = (UDATA*)(bp[0] & ~(UDATA)J9SF_A0_INVISIBLE_TAG);
}
VMINLINE void
restoreSpecialStackFrameAndDrop(REGISTER_ARGS_LIST, UDATA *bp)
{
_sp = _arg0EA + 1;
_literals = (J9Method*)(bp[-2]);
_pc = (U_8*)(bp[-1]);
_arg0EA = (UDATA*)(bp[0] & ~(UDATA)J9SF_A0_INVISIBLE_TAG);
}
VMINLINE UDATA*
buildInternalNativeStackFrame(REGISTER_ARGS_LIST)
{
UDATA *bp = buildSpecialStackFrame(REGISTER_ARGS, J9SF_FRAME_TYPE_NATIVE_METHOD, jitStackFrameFlags(REGISTER_ARGS, 0), true);
*--_sp = (UDATA)_sendMethod;
_arg0EA = bp + J9_ROM_METHOD_FROM_RAM_METHOD(_sendMethod)->argCount;
return bp;
}
VMINLINE void
buildJITResolveFrame(REGISTER_ARGS_LIST)
{
updateVMStruct(REGISTER_ARGS);
VM_VMHelpers::buildJITResolveFrameWithPC(_currentThread, J9_SSF_JIT_RESOLVE, _currentThread->tempSlot, 0, _literals);
VMStructHasBeenUpdated(REGISTER_ARGS);
}
VMINLINE void
restoreInternalNativeStackFrame(REGISTER_ARGS_LIST)
{
J9SFNativeMethodFrame *nativeMethodFrame = (J9SFNativeMethodFrame*)_sp;
_currentThread->jitStackFrameFlags = nativeMethodFrame->specialFrameFlags & J9_SSF_JIT_NATIVE_TRANSITION_FRAME;
restoreSpecialStackFrameLeavingArgs(REGISTER_ARGS, ((UDATA*)(nativeMethodFrame + 1)) - 1);
}
VMINLINE J9SFJNINativeMethodFrame*
recordJNIReturn(REGISTER_ARGS_LIST, UDATA *bp)
{
J9SFJNINativeMethodFrame *frame = ((J9SFJNINativeMethodFrame*)(bp + 1)) - 1;
UDATA flags = frame->specialFrameFlags;
if (flags & J9_SSF_JNI_REFS_REDIRECTED) {
freeStacks(_currentThread, bp);
}
if (flags & J9_SSF_CALL_OUT_FRAME_ALLOC) {
jniPopFrame(_currentThread, JNIFRAME_TYPE_INTERNAL);
}
return frame;
}
/**
* Unwind a J9SFMethodTypeFrame from the stack.
*
* @param frame[in] A pointer to the J9SFMethodTypeFrame
* @param spPriorToFrameBuild[in] The stack pointer prior to building the frame.
*/
VMINLINE void
restoreMethodTypeFrame(REGISTER_ARGS_LIST, J9SFMethodTypeFrame *frame, UDATA *spPriorToFrameBuild)
{
_literals = frame->savedCP;
_pc = frame->savedPC;
_arg0EA = UNTAGGED_A0(frame);
_sp = spPriorToFrameBuild;
}
VMINLINE UDATA*
bpForCurrentBytecodedMethod(REGISTER_ARGS_LIST)
{
J9ROMMethod *romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(_literals);
UDATA localCount = romMethod->argCount + romMethod->tempCount;
if (romMethod->modifiers & J9AccSynchronized) {
localCount += 1;
}
if (J9ROMMETHOD_IS_NON_EMPTY_OBJECT_CONSTRUCTOR(romMethod)) {
localCount += 1;
}
return _arg0EA - localCount;
}
VMINLINE void
pushObjectInSpecialFrame(REGISTER_ARGS_LIST, j9object_t object)
{
_sp -= 1;
_literals = (J9Method*)((UDATA)_literals + sizeof(object));
*(j9object_t*)_sp = object;
}
VMINLINE j9object_t
popObjectInSpecialFrame(REGISTER_ARGS_LIST)
{
j9object_t object = *(j9object_t*)_sp;
_sp += 1;
_literals = (J9Method*)((UDATA)_literals - sizeof(object));
return object;
}
VMINLINE VM_BytecodeAction
i2jTransition(REGISTER_ARGS_LIST)
{
VM_BytecodeAction rc = RUN_METHOD_INTERPRETED;
J9ROMMethod *romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(_sendMethod);
void* const jitStartAddress = _sendMethod->extra;
if (startAddressIsCompiled((UDATA)jitStartAddress)) {
/* If we are single stepping, or about to run a breakpointed method, fall back to the interpreter.
* Check FSD enabled first, to minimize the number of extra instructions in the normal execution path
* and because the breakpoint bit is re-used by Z/OS as the offload bit for native methods. Natives are
* not currently compiled when FSD is enabled - if they ever are, a check will need to be added here.
*/
J9JITConfig *jitConfig = _vm->jitConfig;
if (jitConfig->fsdEnabled) {
if (!methodCanBeRunCompiled(_sendMethod)) {
goto done;
}
}
/* If we got here straight from JIT, jump directly to the method - do not follow the interpreter path */
if (0 != _currentThread->jitStackFrameFlags) {
_currentThread->jitStackFrameFlags = 0;
rc = promotedMethodOnTransitionFromJIT(REGISTER_ARGS, (void*)_literals, jitStartAddress);
goto done;
}
/* Run the compiled code */
rc = jitTransition(REGISTER_ARGS, romMethod->argCount, jitStartAddress);
}
done:
return rc;
}
VMINLINE VM_BytecodeAction
i2jMHTransition(REGISTER_ARGS_LIST)
{
#if defined(J9VM_OPT_METHOD_HANDLE)
/* VMThread->tempSlot will hold the MethodHandle.
* VMThread->floatTemp1 will hold the compiledEntryPoint
*/
void* const jitStartAddress = _currentThread->floatTemp1;
j9object_t methodHandle = (j9object_t)_currentThread->tempSlot;
j9object_t methodType = J9VMJAVALANGINVOKEMETHODHANDLE_TYPE(_currentThread, methodHandle);
/* Currently FSD should be disabling compilation of MethodHandles */
J9JITConfig *jitConfig = _vm->jitConfig;
Assert_VM_false(jitConfig->fsdEnabled);
/* Add one to MethodType->argSlots to account for the MethodHandle receiver */
return jitTransition(REGISTER_ARGS, J9VMJAVALANGINVOKEMETHODTYPE_ARGSLOTS(_currentThread, methodType) + 1, jitStartAddress);
#else /* defined(J9VM_OPT_METHOD_HANDLE) */
Assert_VM_unreachable();
return EXECUTE_BYTECODE;
#endif /* defined(J9VM_OPT_METHOD_HANDLE) */
}
VMINLINE VM_BytecodeAction
j2iTransition(REGISTER_ARGS_LIST)
{
VM_JITInterface::disableRuntimeInstrumentation(_currentThread);
VM_BytecodeAction rc = GOTO_RUN_METHOD;
void* const jitReturnAddress = VM_JITInterface::fetchJITReturnAddress(_currentThread, _sp);
J9ROMMethod* const romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(_sendMethod);
void* const exitPoint = j2iReturnPoint(J9ROMMETHOD_SIGNATURE(romMethod));
if (J9_ARE_ANY_BITS_SET(romMethod->modifiers, J9AccNative | J9AccAbstract)) {
_literals = (J9Method*)jitReturnAddress;
_pc = nativeReturnBytecodePC(REGISTER_ARGS, romMethod);
#if defined(J9SW_NEEDS_JIT_2_INTERP_CALLEE_ARG_POP)
/* Variable frame */
_arg0EA = NULL;
#else /* J9SW_NEEDS_JIT_2_INTERP_CALLEE_ARG_POP */
/* Fixed frame - remember the SP so it can be reset upon return from the native */
_arg0EA = _sp;
#endif /* J9SW_NEEDS_JIT_2_INTERP_CALLEE_ARG_POP */
/* Set the flag indicating that the caller was the JIT */
_currentThread->jitStackFrameFlags = J9_SSF_JIT_NATIVE_TRANSITION_FRAME;
/* If a stop request has been posted, handle it instead of running the native */
if (J9_ARE_ANY_BITS_SET(_currentThread->publicFlags, J9_PUBLIC_FLAGS_STOP)) {
buildMethodFrame(REGISTER_ARGS, _sendMethod, jitStackFrameFlags(REGISTER_ARGS, 0));
_currentThread->currentException = _currentThread->stopThrowable;
_currentThread->stopThrowable = NULL;
VM_VMAccess::clearPublicFlagsNoMutex(_currentThread, J9_PUBLIC_FLAGS_STOP);
omrthread_clear_priority_interrupted();
rc = GOTO_THROW_CURRENT_EXCEPTION;
}
} else {
bool decompileOccurred = false;
_pc = (U_8*)jitReturnAddress;
UDATA preCount = 0;
UDATA postCount = 0;
UDATA result = 0;
do {
preCount = (UDATA)_sendMethod->extra;
postCount = preCount - _currentThread->jitCountDelta;
if (J9_ARE_NO_BITS_SET(preCount, J9_STARTPC_NOT_TRANSLATED)) {
/* Already compiled */
break;
}
if ((IDATA)preCount < 0) {
/* This method should not be translated (already enqueued, already failed, etc) */
break;
}
if ((IDATA)postCount < 0) {
/* Attempt to compile the method */
_arg0EA = _sp;
_literals = (J9Method*)_pc;
UDATA *bp = buildMethodFrame(REGISTER_ARGS, _sendMethod, J9_SSF_JIT_NATIVE_TRANSITION_FRAME);
updateVMStruct(REGISTER_ARGS);
/* this call cannot change bp as no java code is run */
UDATA oldState = VM_VMHelpers::setVMState(_currentThread, J9VMSTATE_JIT);
J9JITConfig *jitConfig = _vm->jitConfig;
jitConfig->entryPoint(jitConfig, _currentThread, _sendMethod, 0);
VM_VMHelpers::setVMState(_currentThread, oldState);
VMStructHasBeenUpdated(REGISTER_ARGS);
restoreSpecialStackFrameLeavingArgs(REGISTER_ARGS, bp);
if (MASK_PC(_pc) != MASK_PC(_literals)) {
decompileOccurred = true;
_pc = (U_8*)_literals;
}
/* If the method is now compiled, run it compiled, otherwise run it bytecoded */
UDATA const jitStartAddress = (UDATA)_sendMethod->extra;
if (startAddressIsCompiled(jitStartAddress)) {
if (methodCanBeRunCompiled(_sendMethod)) {
if (decompileOccurred) {
/* The return address is not currently on the stack. It will be pushed into the
* next stack slot.
*/
_currentThread->decompilationStack->pcAddress = (U_8**)(_sp - 1);
}
rc = promotedMethodOnTransitionFromJIT(REGISTER_ARGS, (void*)_pc, (void*)jitStartAddress);
goto done;
}
}
break;
}
result = VM_AtomicSupport::lockCompareExchange((UDATA*)&_sendMethod->extra, preCount, postCount);
/* If count updates, run method interpreted, else loop around and try again */
} while (result != preCount);
/* Run the method interpreted */
_currentThread->jitStackFrameFlags = 0;
{
UDATA stackUse = VM_VMHelpers::calculateStackUse(romMethod, sizeof(J9SFJ2IFrame));
UDATA *checkSP = _sp - stackUse;
if ((checkSP > _sp) || VM_VMHelpers::shouldGrowForSP(_currentThread, checkSP)) {
checkSP -= (sizeof(J9SFMethodFrame) / sizeof(UDATA));
UDATA currentUsed = (UDATA)_currentThread->stackObject->end - (UDATA)checkSP;
UDATA maxStackSize = _vm->stackSize;
_arg0EA = _sp;
_literals = (J9Method*)_pc;
buildMethodFrame(REGISTER_ARGS, _sendMethod, J9_SSF_JIT_NATIVE_TRANSITION_FRAME);
updateVMStruct(REGISTER_ARGS);
if (currentUsed > maxStackSize) {
throwStackOverflow:
if (J9_ARE_ANY_BITS_SET(_currentThread->privateFlags, J9_PRIVATE_FLAGS_STACK_OVERFLOW)) {
// vmStruct already up-to-date in all paths to here
fatalRecursiveStackOverflow(_currentThread);
}
setCurrentExceptionUTF(_currentThread, J9VMCONSTANTPOOL_JAVALANGSTACKOVERFLOWERROR, NULL);
VMStructHasBeenUpdated(REGISTER_ARGS);
rc = GOTO_THROW_CURRENT_EXCEPTION;
goto done;
}
currentUsed += _vm->stackSizeIncrement;
if (currentUsed > maxStackSize) {
currentUsed = maxStackSize;
}
if (0 != growJavaStack(_currentThread, currentUsed)) {
goto throwStackOverflow;
}
VMStructHasBeenUpdated(REGISTER_ARGS);
UDATA *bp = ((UDATA*)(((J9SFMethodFrame*)_sp) + 1)) - 1;
restoreSpecialStackFrameLeavingArgs(REGISTER_ARGS, bp);
if (MASK_PC(_pc) != MASK_PC(_literals)) {
decompileOccurred = true;
_pc = (U_8*)_literals;
}
}
}
#if defined(J9SW_NEEDS_JIT_2_INTERP_CALLEE_ARG_POP)
/* Variable frame - return SP should pop the arguments */
_arg0EA = _sp + romMethod->argCount;
#else /* J9SW_NEEDS_JIT_2_INTERP_CALLEE_ARG_POP */
/* Fixed frame - remember the SP so it can be reset upon return to the JIT */
_arg0EA = _sp;
#endif /* J9SW_NEEDS_JIT_2_INTERP_CALLEE_ARG_POP */
_literals = (J9Method*)exitPoint;
rc = inlineSendTarget(REGISTER_ARGS, VM_MAYBE, VM_MAYBE, VM_MAYBE, VM_MAYBE, true, decompileOccurred);
}
done:
return rc;
}
VMINLINE VM_BytecodeAction
promotedMethodOnTransitionFromJIT(REGISTER_ARGS_LIST, void *returnAddress, void *jumpAddress)
{
VM_JITInterface::restoreJITReturnAddress(_currentThread, _sp, returnAddress);
_currentThread->tempSlot = (UDATA)jumpAddress;
_nextAction = J9_BCLOOP_LOAD_PRESERVED_AND_BRANCH;
VM_JITInterface::enableRuntimeInstrumentation(_currentThread);
return GOTO_DONE;
}
VMINLINE J9Method*
j2iVirtualMethod(REGISTER_ARGS_LIST, j9object_t receiver, UDATA interfaceVTableIndex)
{
J9Method *method = NULL;
void* const jitReturnAddress = VM_JITInterface::peekJITReturnAddress(_currentThread, _sp);
UDATA jitVTableOffset = VM_JITInterface::jitVTableIndex(jitReturnAddress, interfaceVTableIndex);
if (J9_ARE_ANY_BITS_SET(jitVTableOffset, J9_VTABLE_INDEX_DIRECT_METHOD_FLAG)) {
/* Nestmates: vtable index is really a J9Method to directly invoke */
method = (J9Method*)(jitVTableOffset & ~J9_VTABLE_INDEX_DIRECT_METHOD_FLAG);
} else {
UDATA vTableOffset = sizeof(J9Class) - jitVTableOffset;
J9Class *clazz = J9OBJECT_CLAZZ(_currentThread, receiver);
method = *(J9Method**)((UDATA)clazz + vTableOffset);
}
return method;
}
VMINLINE void
restorePreservedRegistersFromWalkState(REGISTER_ARGS_LIST, J9StackWalkState *walkState)
{
J9VMEntryLocalStorage* const els = _currentThread->entryLocalStorage;
UDATA* const jitGlobalStorageBase = els->jitGlobalStorageBase;
UDATA* const * const preservedBase = (UDATA**)&walkState->registerEAs;
for (UDATA i = 0; i < J9SW_JIT_CALLEE_PRESERVED_SIZE; ++i) {
U_8 const registerNumber = jitCalleeSavedRegisterList[i];
jitGlobalStorageBase[registerNumber] = *(preservedBase[registerNumber]);
}
}
VMINLINE VM_BytecodeAction
retFromNativeHelper(REGISTER_ARGS_LIST, UDATA slots, void *jitReturn)
{
memmove(&_currentThread->returnValue, _sp, slots * sizeof(UDATA));
#if defined(J9SW_NEEDS_JIT_2_INTERP_CALLEE_ARG_POP)
/* Variable frame - drop the return value */
_sp += slots;
#else /* J9SW_NEEDS_JIT_2_INTERP_CALLEE_ARG_POP */
/* Fixed frame - reset sp to it's value when the call occurred */
_sp = _arg0EA;
#endif /* J9SW_NEEDS_JIT_2_INTERP_CALLEE_ARG_POP */
_currentThread->jitStackFrameFlags = 0;
_currentThread->floatTemp1 = (void*)_literals;
_currentThread->tempSlot = (UDATA)jitReturn;
_nextAction = J9_BCLOOP_LOAD_PRESERVED_AND_BRANCH;
return GOTO_DONE;
}
VMINLINE VM_BytecodeAction
fillOSRBuffer(REGISTER_ARGS_LIST, void *osrBlock)
{
_sp = (UDATA*)_currentThread->osrJittedFrameCopy;
_currentThread->osrReturnAddress = _vm->jitConfig->jitFillOSRBufferReturn;
_currentThread->tempSlot = (UDATA)osrBlock;
_nextAction = J9_BCLOOP_LOAD_PRESERVED_AND_BRANCH;
return GOTO_DONE;
}
VMINLINE VM_BytecodeAction
returnFromJIT(REGISTER_ARGS_LIST, UDATA slotCount, bool isConstructor)
{
VM_JITInterface::disableRuntimeInstrumentation(_currentThread);
if (isConstructor) {
VM_AtomicSupport::writeBarrier();
}
J9I2JState *i2jState = &_currentThread->entryLocalStorage->i2jState;
_sp = UNTAG2(i2jState->returnSP, UDATA*) - slotCount;
_arg0EA = i2jState->a0;
_literals= i2jState->literals;
_pc = i2jState->pc + 3;
memmove(_sp, &_currentThread->floatTemp1, sizeof(UDATA) * slotCount);
_currentThread->jitStackFrameFlags = 0;
#if defined(TRACE_TRANSITIONS)
char currentMethodName[1024];
PORT_ACCESS_FROM_JAVAVM(_vm);
getMethodName(PORTLIB, _literals, _pc, currentMethodName);
switch(slotCount) {
case 0:
j9tty_printf(PORTLIB, "<%p> enter: J9_BCLOOP_RETURN_FROM_JIT %s %s\n", _currentThread, currentMethodName, isConstructor ? "ctor" : "void");
break;
case 1:
j9tty_printf(PORTLIB, "<%p> enter: J9_BCLOOP_RETURN_FROM_JIT %s value=0x%zx\n", _currentThread, currentMethodName, *_sp);
break;
case 2:
j9tty_printf(PORTLIB, "<%p> enter: J9_BCLOOP_RETURN_FROM_JIT %s value=0x%llx\n", _currentThread, currentMethodName, *(U_64*)_sp);
break;
default:
Assert_VM_unreachable();
}
#endif /* TRACE_TRANSITIONS */
return EXECUTE_BYTECODE;
}
VMINLINE VM_BytecodeAction
jitTransition(REGISTER_ARGS_LIST, UDATA argCount, void *jitStartAddress)
{
UDATA returnSP = ((UDATA)(_sp + argCount)) | J9_STACK_FLAGS_J2_IFRAME;
/* Align the java stack such that sp is double-slot aligned upon entry to the JIT code */
if (J9_ARE_ANY_BITS_SET((UDATA)_sp, sizeof(UDATA))) {
_sp -= 1;
memmove(_sp, _sp + 1, sizeof(UDATA) * argCount);
}
J9I2JState *i2jState = &_currentThread->entryLocalStorage->i2jState;
i2jState->returnSP = (UDATA*)returnSP;
i2jState->a0 = _arg0EA;
i2jState->literals = _literals;
i2jState->pc = _pc;
U_32 returnTypeIndex = ((U_32*)jitStartAddress)[-1] & 0xF;
void *returnPoint = ((void**)_vm->jitConfig->i2jReturnTable)[returnTypeIndex];
// TODO: not loading receiver for I2J
// TODO: not loading pseudoTOC
return promotedMethodOnTransitionFromJIT(REGISTER_ARGS, returnPoint, jitStartAddress);
}
VMINLINE void*
j2iReturnPoint(J9UTF8 *signature)
{
J9JITConfig* const jitConfig = _vm->jitConfig;
void *returnPoint = jitConfig->jitExitInterpreter1;
U_16 length = J9UTF8_LENGTH(signature);
U_8 *data = J9UTF8_DATA(signature);
U_8 sigChar = data[length - 1];
if ('[' == data[length - 2]) {
goto obj;
}
switch(sigChar) {
case 'V':
returnPoint = jitConfig->jitExitInterpreter0;
break;
case ';':
obj:
/* On 32-bit, object uses the "1" target (already loaded, so just break).
* On 64-bit, object uses the "J" target (fall through)
*/
#if !defined(J9VM_ENV_DATA64)
break;
#endif /* !J9VM_ENV_DATA64 */
case 'J':
returnPoint = jitConfig->jitExitInterpreterJ;
break;
case 'F':
returnPoint = jitConfig->jitExitInterpreterF;
break;
case 'D':
returnPoint = jitConfig->jitExitInterpreterD;
break;
}
return returnPoint;
}
VMINLINE void*
j2iReturnPoint(J9Class *returnType)
{
J9JITConfig* const jitConfig = _vm->jitConfig;
void *returnPoint = jitConfig->jitExitInterpreter1;
J9ROMClass* const romClass = returnType->romClass;
if (J9ROMCLASS_IS_PRIMITIVE_TYPE(romClass)) {
if (returnType == _vm->voidReflectClass) {
returnPoint = jitConfig->jitExitInterpreter0;
} else if (returnType == _vm->longReflectClass) {
returnPoint = jitConfig->jitExitInterpreterJ;
} else if (returnType == _vm->floatReflectClass) {
returnPoint = jitConfig->jitExitInterpreterF;
} else if (returnType == _vm->doubleReflectClass) {
returnPoint = jitConfig->jitExitInterpreterD;
}
} else {
/* On 32-bit, object uses the "1" target (already loaded).
* On 64-bit, object uses the "J" target
*/
#if defined(J9VM_ENV_DATA64)
returnPoint = jitConfig->jitExitInterpreterJ;
#endif /* !J9VM_ENV_DATA64 */
}
return returnPoint;
}
VMINLINE void
fillInJ2IValues(J9SFJ2IFrame* const j2iFrame, void* const exitPoint, void* const jitReturnAddress, UDATA *returnSP)
{
J9VMEntryLocalStorage* const els = _currentThread->entryLocalStorage;
UDATA* const jitGlobalStorageBase = els->jitGlobalStorageBase;
UDATA* const j2iPreservedBase = ((UDATA*)&j2iFrame->previousJ2iFrame) + 1;
j2iFrame->i2jState = els->i2jState;
j2iFrame->previousJ2iFrame = _currentThread->j2iFrame;
for (UDATA i = 0; i < J9SW_JIT_CALLEE_PRESERVED_SIZE; ++i) {
j2iPreservedBase[i] = jitGlobalStorageBase[jitCalleeSavedRegisterList[i]];
}
j2iFrame->specialFrameFlags = J9_SSF_JIT_CALLIN;
j2iFrame->exitPoint = exitPoint;
j2iFrame->returnAddress = (U_8*)jitReturnAddress;
j2iFrame->taggedReturnSP = returnSP;
_currentThread->j2iFrame = (UDATA*)&j2iFrame->taggedReturnSP;
}
VMINLINE void
restoreJ2IValues(J9SFJ2IFrame* const j2iFrame)
{
J9VMEntryLocalStorage* const els = _currentThread->entryLocalStorage;
UDATA* const jitGlobalStorageBase = els->jitGlobalStorageBase;
UDATA* const j2iPreservedBase = ((UDATA*)&j2iFrame->previousJ2iFrame) + 1;
els->i2jState = j2iFrame->i2jState;
_currentThread->j2iFrame = j2iFrame->previousJ2iFrame;
for (UDATA i = 0; i < J9SW_JIT_CALLEE_PRESERVED_SIZE; ++i) {
jitGlobalStorageBase[jitCalleeSavedRegisterList[i]] = j2iPreservedBase[i];
}
}
VMINLINE VM_BytecodeAction
j2iReturn(REGISTER_ARGS_LIST)
{
memmove(&_currentThread->returnValue, _sp, sizeof(U_64));
J9SFJ2IFrame* const j2iFrame = ((J9SFJ2IFrame*)(_currentThread->j2iFrame + 1)) - 1;
restoreJ2IValues(j2iFrame);
_sp = UNTAG2(j2iFrame->taggedReturnSP, UDATA*);
_currentThread->jitStackFrameFlags = 0;
_currentThread->floatTemp1 = (void*)j2iFrame->returnAddress;
_currentThread->tempSlot = (UDATA)j2iFrame->exitPoint;
_nextAction = J9_BCLOOP_LOAD_PRESERVED_AND_BRANCH;
return GOTO_DONE;
}
VMINLINE U_8*
nativeReturnBytecodePC(REGISTER_ARGS_LIST, J9ROMMethod* const romMethod)
{
static const U_8 returnFromNativeBytecodes[][4] = {
{ JBinvokestatic, 0, 0, JBretFromNative0 }, /* void */
{ JBinvokestatic, 0, 0, JBretFromNative1 }, /* boolean */
{ JBinvokestatic, 0, 0, JBretFromNative1 }, /* byte */
{ JBinvokestatic, 0, 0, JBretFromNative1 }, /* char */
{ JBinvokestatic, 0, 0, JBretFromNative1 }, /* short */
{ JBinvokestatic, 0, 0, JBretFromNativeF }, /* float */
{ JBinvokestatic, 0, 0, JBretFromNative1 }, /* int */
{ JBinvokestatic, 0, 0, JBretFromNativeD }, /* double */
{ JBinvokestatic, 0, 0, JBretFromNativeJ }, /* long */
#if defined(J9VM_ENV_DATA64)
{ JBinvokestatic, 0, 0, JBretFromNativeJ }, /* object */
#else /* J9VM_ENV_DATA64 */
{ JBinvokestatic, 0, 0, JBretFromNative1 }, /* object */
#endif /* J9VM_ENV_DATA64 */
};
U_8 *bytecodes = J9_BYTECODE_START_FROM_ROM_METHOD(romMethod);
return (U_8*)returnFromNativeBytecodes[bytecodes[1]];
}
VMINLINE VM_BytecodeAction
j2iInvokeExact(REGISTER_ARGS_LIST, j9object_t methodHandle)
{
#if defined(J9VM_OPT_METHOD_HANDLE)
VM_JITInterface::disableRuntimeInstrumentation(_currentThread);
VM_BytecodeAction rc = GOTO_RUN_METHODHANDLE;
static U_8 const bcReturnFromJ2I[] = { JBinvokestatic, 0, 0, JBreturnFromJ2I };
void* const jitReturnAddress = VM_JITInterface::fetchJITReturnAddress(_currentThread, _sp);
j9object_t methodType = J9VMJAVALANGINVOKEMETHODHANDLE_TYPE(_currentThread, methodHandle);
j9object_t returnType = J9VMJAVALANGINVOKEMETHODTYPE_RTYPE(_currentThread, methodType);
void* const exitPoint = j2iReturnPoint(J9VM_J9CLASS_FROM_HEAPCLASS(_currentThread, returnType));
/* Get the argument count from the MethodHandle */
UDATA argCount = J9VMJAVALANGINVOKEMETHODTYPE_ARGSLOTS(_currentThread, methodType) + 1; /* argSlots does not include the receiver of the invokeExact */
/* Decrement the MH invocationCount if we are going to run jitted as the shareable
* thunks will increment the count. We only want shareableThunks called from the
* JIT to modify the MH invocationCount. We will increment the count later if we
* didn't run the MH compiled.
*/
J9VMJAVALANGINVOKEMETHODHANDLE_SET_INVOCATIONCOUNT(_currentThread, methodHandle, J9VMJAVALANGINVOKEMETHODHANDLE_INVOCATIONCOUNT(_currentThread, methodHandle) - 1);
#if defined(J9SW_NEEDS_JIT_2_INTERP_CALLEE_ARG_POP)
/* Variable frame - return SP should pop the arguments */
UDATA *returnSP = _sp + argCount;
#else /* J9SW_NEEDS_JIT_2_INTERP_CALLEE_ARG_POP */
/* Fixed frame - remember the SP so it can be reset upon return to the JIT */
UDATA *returnSP = _sp;
#endif /* J9SW_NEEDS_JIT_2_INTERP_CALLEE_ARG_POP */
/* Buy the space for the J2I frame and shift the arguments down */
UDATA *spOnEntry = _sp;