-
Notifications
You must be signed in to change notification settings - Fork 738
/
Copy pathJITClientCompilationThread.cpp
3642 lines (3437 loc) · 175 KB
/
JITClientCompilationThread.cpp
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 2019
*
* 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-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
*******************************************************************************/
#include "j9cfg.h"
#include "jitprotos.h"
#include "vmaccess.h"
#include "codegen/CodeGenerator.hpp"
#include "codegen/PicHelpers.hpp"
#include "control/CompilationRuntime.hpp"
#include "control/CompilationThread.hpp"
#include "control/JITServerHelpers.hpp"
#include "control/MethodToBeCompiled.hpp"
#include "env/ClassTableCriticalSection.hpp"
#include "env/J2IThunk.hpp"
#include "env/j9methodServer.hpp"
#include "env/JITServerPersistentCHTable.hpp"
#include "env/JSR292Methods.h"
#include "env/TypeLayout.hpp"
#include "env/ut_j9jit.h"
#include "env/VerboseLog.hpp"
#include "env/VMAccessCriticalSection.hpp"
#include "env/VMJ9.h"
#include "net/ClientStream.hpp"
#include "optimizer/TransformUtil.hpp"
#include "runtime/CodeCache.hpp"
#include "runtime/CodeCacheExceptions.hpp"
#include "runtime/CodeCacheManager.hpp"
#include "runtime/J9VMAccess.hpp"
#include "runtime/JITClientSession.hpp"
#include "runtime/JITServerAOTDeserializer.hpp"
#include "runtime/JITServerIProfiler.hpp"
#include "runtime/RelocationTarget.hpp"
extern TR::Monitor *assumptionTableMutex;
// TODO: This method is copied from runtime/jit_vm/ctsupport.c,
// in the future it's probably better to make that method publicly accessible
static UDATA
findField(J9VMThread *vmStruct, J9ConstantPool *constantPool, UDATA index, BOOLEAN isStatic, J9Class **declaringClass)
{
J9JavaVM *javaVM = vmStruct->javaVM;
J9ROMFieldRef *romRef;
J9ROMClassRef *classRef; /* ROM class of the field */
U_32 classRefCPIndex;
J9UTF8 *classNameUTF;
J9Class *clazz;
UDATA result = 0;
*declaringClass = NULL;
romRef = (J9ROMFieldRef*) &(((J9ROMConstantPoolItem*) constantPool->romConstantPool)[index]);
classRefCPIndex = romRef->classRefCPIndex;
classRef = (J9ROMClassRef*) &(((J9ROMConstantPoolItem*) constantPool->romConstantPool)[classRefCPIndex]);
classNameUTF = J9ROMCLASSREF_NAME(classRef);
clazz = javaVM->internalVMFunctions->internalFindClassUTF8(vmStruct, J9UTF8_DATA(classNameUTF),
J9UTF8_LENGTH(classNameUTF), constantPool->ramClass->classLoader, J9_FINDCLASS_FLAG_EXISTING_ONLY);
if (NULL != clazz)
{
J9ROMNameAndSignature *nameAndSig = J9ROMFIELDREF_NAMEANDSIGNATURE(romRef);
J9UTF8 *signature = J9ROMNAMEANDSIGNATURE_SIGNATURE(nameAndSig);
J9UTF8 *name = J9ROMNAMEANDSIGNATURE_NAME(nameAndSig);
if (!isStatic)
{
UDATA instanceField;
IDATA offset = javaVM->internalVMFunctions->instanceFieldOffset(
vmStruct, clazz, J9UTF8_DATA(name),
J9UTF8_LENGTH(name), J9UTF8_DATA(signature), J9UTF8_LENGTH(signature), declaringClass,
&instanceField, J9_LOOK_NO_JAVA);
if (-1 != offset)
{
result = instanceField;
}
}
else
{
UDATA staticField;
void * addr = javaVM->internalVMFunctions->staticFieldAddress(
vmStruct, clazz, J9UTF8_DATA(name),
J9UTF8_LENGTH(name), J9UTF8_DATA(signature), J9UTF8_LENGTH(signature), declaringClass,
&staticField, J9_LOOK_NO_JAVA, NULL);
if (NULL != addr)
{
result = staticField;
}
}
}
return result;
}
static void
handler_IProfiler_profilingSample(JITServer::ClientStream *client, TR_J9VM *fe, TR::Compilation *comp)
{
auto recv = client->getRecvData<TR_OpaqueMethodBlock*, uint32_t, uintptr_t>();
auto method = std::get<0>(recv);
auto bcIndex = std::get<1>(recv);
auto data = std::get<2>(recv); // data==1 means 'send info for 1 bytecode'; data==0 means 'send info for entire method if possible'
JITClientIProfiler *iProfiler = (JITClientIProfiler *)fe->getIProfiler();
bool isCompiled = TR::CompilationInfo::isCompiled((J9Method*)method);
bool isInProgress = comp->getMethodBeingCompiled()->getPersistentIdentifier() == method;
bool abort = false;
// Used to tell the server if a profiled entry should be stored in persistent or heap memory
bool usePersistentCache = isCompiled || isInProgress;
bool wholeMethodInfo = data == 0;
if (wholeMethodInfo)
{
// Serialize all the information related to this method
abort = iProfiler->serializeAndSendIProfileInfoForMethod(method, comp, client, usePersistentCache, isCompiled);
}
if (!wholeMethodInfo || abort) // Send information just for this entry
{
auto entry = iProfiler->profilingSample(method, bcIndex, comp, data, false);
if (entry && !entry->isInvalid())
{
uint32_t canPersist = entry->canBeSerialized(comp->getPersistentInfo()); // This may lock the entry
if (canPersist == IPBC_ENTRY_CAN_PERSIST)
{
uint32_t bytes = entry->getBytesFootprint();
std::string entryBytes(bytes, '\0');
auto storage = (TR_IPBCDataStorageHeader*)&entryBytes[0];
uintptr_t methodStartAddress = (uintptr_t)TR::Compiler->mtd.bytecodeStart(method);
entry->serialize(methodStartAddress, storage, comp->getPersistentInfo());
client->write(JITServer::MessageType::IProfiler_profilingSample, entryBytes, false, usePersistentCache, isCompiled);
}
else
{
client->write(JITServer::MessageType::IProfiler_profilingSample, std::string(), false, usePersistentCache, isCompiled);
}
// Unlock the entry
if (auto callGraphEntry = entry->asIPBCDataCallGraph())
if (canPersist != IPBC_ENTRY_PERSIST_LOCK && callGraphEntry->isLocked())
callGraphEntry->releaseEntry();
}
else // No valid info for specified bytecode index
{
client->write(JITServer::MessageType::IProfiler_profilingSample, std::string(), false, usePersistentCache, isCompiled);
}
}
}
static bool
handleServerMessage(JITServer::ClientStream *client, TR_J9VM *fe, JITServer::MessageType &response)
{
using JITServer::MessageType;
TR::CompilationInfoPerThread *compInfoPT = fe->_compInfoPT;
J9VMThread *vmThread = compInfoPT->getCompilationThread();
TR_Memory *trMemory = compInfoPT->getCompilation()->trMemory();
TR::Compilation *comp = compInfoPT->getCompilation();
TR::CompilationInfo *compInfo = compInfoPT->getCompilationInfo();
TR_ASSERT(TR::MonitorTable::get()->getClassUnloadMonitorHoldCount(compInfoPT->getCompThreadId()) == 0, "Must not hold classUnloadMonitor");
TR::MonitorTable *table = TR::MonitorTable::get();
TR_ASSERT(table && table->isThreadInSafeMonitorState(vmThread), "Must not hold any monitors when waiting for server");
response = client->read();
// Acquire VM access and check for possible class unloading
acquireVMAccessNoSuspend(vmThread);
// If JVM has unloaded classes inform the server to abort this compilation
uint8_t interruptReason = compInfoPT->compilationShouldBeInterrupted();
if (interruptReason && response != MessageType::jitDumpPrintIL)
{
// Inform the server if compilation is not yet complete
if ((response != MessageType::compilationCode) &&
(response != MessageType::compilationFailure))
client->writeError(JITServer::MessageType::compilationInterrupted, 0 /* placeholder */);
if (TR::Options::isAnyVerboseOptionSet(TR_VerboseJITServer, TR_VerboseCompilationDispatch))
TR_VerboseLog::writeLineLocked(TR_Vlog_FAILURE, "Interrupting remote compilation (interruptReason %u) in handleServerMessage(%s) for %s @ %s",
interruptReason, JITServer::messageNames[response], comp->signature(), comp->getHotnessName());
Trc_JITServerInterruptRemoteCompile(vmThread, interruptReason, JITServer::messageNames[response], comp->signature(), comp->getHotnessName());
comp->failCompilation<TR::CompilationInterrupted>("Compilation interrupted in handleServerMessage");
}
TR::KnownObjectTable *knot = comp->getOrCreateKnownObjectTable();
bool done = false;
switch (response)
{
case MessageType::compilationCode:
case MessageType::compilationFailure:
case MessageType::AOTCache_serializedAOTMethod:
case MessageType::compilationThreadCrashed:
done = true;
break;
case MessageType::jitDumpPrintIL:
{
client->getRecvData<JITServer::Void>();
done = true;
client->write(response, JITServer::Void());
}
break;
case MessageType::getUnloadedClassRangesAndCHTable:
{
uint64_t serverUID = std::get<0>(client->getRecvData<uint64_t>());
uint64_t previousUID = compInfo->getPersistentInfo()->getServerUID();
compInfo->getPersistentInfo()->setServerUID(serverUID);
auto unloadedClasses = comp->getPersistentInfo()->getUnloadedClassAddresses();
std::vector<TR_AddressRange> ranges;
ranges.reserve(unloadedClasses->getNumberOfRanges());
{
OMR::CriticalSection getAddressSetRanges(assumptionTableMutex);
unloadedClasses->getRanges(ranges);
}
// Add the entire CHTable as well
auto table = (JITClientPersistentCHTable *)comp->getPersistentInfo()->getPersistentCHTable();
std::string serializedCHTable = FlatPersistentClassInfo::serializeHierarchy(table);
{
OMR::CriticalSection romClassCache(compInfo->getclassesCachedAtServerMonitor());
compInfo->getclassesCachedAtServer().clear();
}
auto deserializer = compInfo->getJITServerAOTDeserializer();
// Reset AOT deserializer if connected to a new server (cached serialization records are now invalid)
if (deserializer && (previousUID != serverUID))
deserializer->reset();
client->write(response, ranges, unloadedClasses->getMaxRanges(), serializedCHTable);
if ((previousUID != serverUID) && TR::Options::getVerboseOption(TR_VerboseJITServerConns))
{
TR_VerboseLog::writeLineLocked(TR_Vlog_JITServer, "t=%6u Connected to a server (serverUID=%llu)",
(uint32_t)compInfo->getPersistentInfo()->getElapsedTime(),
(unsigned long long)serverUID);
}
}
break;
case MessageType::VM_isClassLibraryClass:
{
bool rv = fe->isClassLibraryClass(std::get<0>(client->getRecvData<TR_OpaqueClassBlock*>()));
client->write(response, rv);
}
break;
case MessageType::VM_isClassLibraryMethod:
{
auto tup = client->getRecvData<TR_OpaqueMethodBlock*, bool>();
bool rv = fe->isClassLibraryMethod(std::get<0>(tup), std::get<1>(tup));
client->write(response, rv);
}
break;
case MessageType::VM_getSystemClassFromClassName:
{
auto recv = client->getRecvData<std::string, bool>();
auto &name = std::get<0>(recv);
bool isVettedForAOT = std::get<1>(recv);
// Always need non-AOT front-end here, since class validation is done on the server
TR_J9VMBase *fej9 = TR_J9VMBase::get(vmThread->javaVM->jitConfig, vmThread);
client->write(response, fej9->getSystemClassFromClassName(name.data(), name.length(), isVettedForAOT));
}
break;
case MessageType::VM_isMethodTracingEnabled:
{
auto method = std::get<0>(client->getRecvData<TR_OpaqueMethodBlock *>());
client->write(response, fe->isMethodTracingEnabled(method));
}
break;
case MessageType::VM_getClassClassPointer:
{
auto clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock*>());
client->write(response, fe->getClassClassPointer(clazz));
}
break;
case MessageType::VM_getClassOfMethod:
{
auto method = std::get<0>(client->getRecvData<TR_OpaqueMethodBlock*>());
client->write(response, fe->getClassOfMethod(method));
}
break;
case MessageType::VM_getClassFromSignature:
{
// Need to get a non-AOT frontend because the AOT frontend also
// performs some class validation which we want to do at the server
TR_J9VMBase *fej9 = TR_J9VMBase::get(vmThread->javaVM->jitConfig, vmThread);
auto recv = client->getRecvData<std::string, TR_OpaqueMethodBlock *, bool>();
auto &sig = std::get<0>(recv);
auto method = std::get<1>(recv);
bool isVettedForAOT = std::get<2>(recv);
auto clazz = fej9->getClassFromSignature(sig.data(), sig.length(), method, isVettedForAOT);
J9ClassLoader *cl = clazz ? reinterpret_cast<J9ClassLoader *>(fej9->getClassLoader(clazz)) : NULL;
J9ClassLoader *methodCL = reinterpret_cast<J9ClassLoader *>(fej9->getClassLoader(fej9->getClassOfMethod(method)));
client->write(response, clazz, cl, methodCL);
}
break;
case MessageType::VM_jitFieldsOrStaticsAreSame:
{
auto recv = client->getRecvData<TR_ResolvedMethod*, int32_t, TR_ResolvedMethod *, int32_t, int32_t>();
TR_ResolvedMethod *method1 = std::get<0>(recv);
int32_t cpIndex1 = std::get<1>(recv);
TR_ResolvedMethod *method2 = std::get<2>(recv);
int32_t cpIndex2 = std::get<3>(recv);
int32_t isStatic = std::get<4>(recv);
bool identical = false;
UDATA f1 = 0, f2 = 0;
J9Class *declaringClass1 = NULL, *declaringClass2 = NULL;
J9ConstantPool *cp1 = (J9ConstantPool *) method1->ramConstantPool();
J9ConstantPool *cp2 = (J9ConstantPool *) method2->ramConstantPool();
f1 = findField(fe->vmThread(), cp1, cpIndex1, isStatic, &declaringClass1);
f2 = findField(fe->vmThread(), cp2, cpIndex2, isStatic, &declaringClass2);
client->write(response, declaringClass1, declaringClass2, f1, f2);
};
break;
case MessageType::VM_compiledAsDLTBefore:
{
auto clazz = std::get<0>(client->getRecvData<TR_ResolvedMethod *>());
client->write(response, fe->compiledAsDLTBefore(clazz));
}
break;
case MessageType::VM_classHasBeenExtended:
{
auto clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock *>());
client->write(response, fe->classHasBeenExtended(clazz));
}
break;
case MessageType::VM_isThunkArchetype:
{
J9Method *method = std::get<0>(client->getRecvData<J9Method *>());
client->write(response, fe->isThunkArchetype(method));
}
break;
case MessageType::VM_printTruncatedSignature:
{
J9Method *method = (J9Method *) std::get<0>(client->getRecvData<TR_OpaqueMethodBlock *>());
J9UTF8 * className;
J9UTF8 * name;
J9UTF8 * signature;
getClassNameSignatureFromMethod(method, className, name, signature);
std::string classNameStr(utf8Data(className), J9UTF8_LENGTH(className));
std::string nameStr(utf8Data(name), J9UTF8_LENGTH(name));
std::string signatureStr(utf8Data(signature), J9UTF8_LENGTH(signature));
client->write(response, classNameStr, nameStr, signatureStr);
}
break;
case MessageType::VM_getStaticHookAddress:
{
int32_t event = std::get<0>(client->getRecvData<int32_t>());
client->write(response, fe->getStaticHookAddress(event));
}
break;
case MessageType::VM_isClassInitialized:
{
TR_OpaqueClassBlock *clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock *>());
client->write(response, fe->isClassInitialized(clazz));
}
break;
case MessageType::VM_getOSRFrameSizeInBytes:
{
TR_OpaqueMethodBlock *method = std::get<0>(client->getRecvData<TR_OpaqueMethodBlock *>());
client->write(response, fe->getOSRFrameSizeInBytes(method));
}
break;
case MessageType::VM_getInitialLockword:
{
TR_OpaqueClassBlock *clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock *>());
client->write(response, fe->getInitialLockword(clazz));
}
break;
case MessageType::VM_JavaStringObject:
{
client->getRecvData<JITServer::Void>();
client->write(response, (TR_OpaqueClassBlock *)J9VMJAVALANGSTRING(vmThread->javaVM));
}
break;
case MessageType::VM_getMethods:
{
TR_OpaqueClassBlock *clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock *>());
client->write(response, fe->getMethods(clazz));
}
break;
case MessageType::VM_getResolvedMethodsAndMirror:
{
TR_OpaqueClassBlock *clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock *>());
uint32_t numMethods = fe->getNumMethods(clazz);
J9Method *methods = (J9Method *) fe->getMethods(clazz);
// Create mirrors and put methodInfo for each method in a vector to be sent to the server
std::vector<TR_ResolvedJ9JITServerMethodInfo> methodsInfo;
methodsInfo.reserve(numMethods);
for (int i = 0; i < numMethods; ++i)
{
TR_ResolvedJ9JITServerMethodInfo methodInfo;
TR_ResolvedJ9JITServerMethod::createResolvedMethodMirror(methodInfo, (TR_OpaqueMethodBlock *) &(methods[i]), 0, 0, fe, trMemory);
methodsInfo.push_back(methodInfo);
}
client->write(response, methods, methodsInfo);
}
break;
case MessageType::VM_getVMInfo:
{
ClientSessionData::VMInfo vmInfo = {};
J9JavaVM * javaVM = vmThread->javaVM;
vmInfo._systemClassLoader = fe->getSystemClassLoader();
vmInfo._processID = fe->getProcessID();
vmInfo._canMethodEnterEventBeHooked = fe->canMethodEnterEventBeHooked();
vmInfo._canMethodExitEventBeHooked = fe->canMethodExitEventBeHooked();
vmInfo._canExceptionEventBeHooked = fe->canExceptionEventBeHooked();
vmInfo._usesDiscontiguousArraylets = TR::Compiler->om.usesDiscontiguousArraylets();
vmInfo._isIProfilerEnabled = fe->getIProfiler();
vmInfo._arrayletLeafLogSize = TR::Compiler->om.arrayletLeafLogSize();
vmInfo._arrayletLeafSize = TR::Compiler->om.arrayletLeafSize();
vmInfo._overflowSafeAllocSize = static_cast<uint64_t>(fe->getOverflowSafeAllocSize());
vmInfo._compressedReferenceShift = TR::Compiler->om.compressedReferenceShift();
vmInfo._j9SharedClassCacheDescriptorList = NULL;
vmInfo._stringCompressionEnabled = fe->isStringCompressionEnabledVM();
vmInfo._hasSharedClassCache = TR::Options::sharedClassCache();
vmInfo._elgibleForPersistIprofileInfo = vmInfo._isIProfilerEnabled ? fe->getIProfiler()->elgibleForPersistIprofileInfo(comp) : false;
vmInfo._reportByteCodeInfoAtCatchBlock = comp->getOptions()->getReportByteCodeInfoAtCatchBlock();
for (int32_t i = 0; i <= 7; i++)
{
vmInfo._arrayTypeClasses[i] = fe->getClassFromNewArrayTypeNonNull(i + 4);
}
vmInfo._byteArrayClass = fe->getByteArrayClass();
vmInfo._isIndexableDataAddrPresent = TR::Compiler->om.isIndexableDataAddrPresent();
vmInfo._contiguousIndexableHeaderSize = TR::Compiler->om.contiguousArrayHeaderSizeInBytes();
vmInfo._discontiguousIndexableHeaderSize = TR::Compiler->om.discontiguousArrayHeaderSizeInBytes();
vmInfo._readBarrierType = TR::Compiler->om.readBarrierType();
vmInfo._writeBarrierType = TR::Compiler->om.writeBarrierType();
vmInfo._compressObjectReferences = TR::Compiler->om.compressObjectReferences();
vmInfo._processorDescription = TR::Compiler->target.cpu.getProcessorDescription();
vmInfo._noTypeInvokeExactThunkHelper = comp->getSymRefTab()->findOrCreateRuntimeHelper(TR_icallVMprJavaSendInvokeExact0)->getMethodAddress();
vmInfo._int64InvokeExactThunkHelper = comp->getSymRefTab()->findOrCreateRuntimeHelper(TR_icallVMprJavaSendInvokeExactJ)->getMethodAddress();
vmInfo._int32InvokeExactThunkHelper = comp->getSymRefTab()->findOrCreateRuntimeHelper(TR_icallVMprJavaSendInvokeExact1)->getMethodAddress();
vmInfo._addressInvokeExactThunkHelper = comp->getSymRefTab()->findOrCreateRuntimeHelper(TR_icallVMprJavaSendInvokeExactL)->getMethodAddress();
vmInfo._floatInvokeExactThunkHelper = comp->getSymRefTab()->findOrCreateRuntimeHelper(TR_icallVMprJavaSendInvokeExactF)->getMethodAddress();
vmInfo._doubleInvokeExactThunkHelper = comp->getSymRefTab()->findOrCreateRuntimeHelper(TR_icallVMprJavaSendInvokeExactD)->getMethodAddress();
vmInfo._interpreterVTableOffset = TR::Compiler->vm.getInterpreterVTableOffset();
vmInfo._maxHeapSizeInBytes = TR::Compiler->vm.maxHeapSizeInBytes();
vmInfo._enableGlobalLockReservation = vmThread->javaVM->enableGlobalLockReservation;
fe->getNurserySpaceBounds(&vmInfo._nurserySpaceBoundsBase, &vmInfo._nurserySpaceBoundsTop);
vmInfo._lowTenureAddress = fe->getLowTenureAddress();
vmInfo._highTenureAddress = fe->getHighTenureAddress();
{
TR::VMAccessCriticalSection getVMInfo(fe);
vmInfo._jlrMethodInvoke = javaVM->jlrMethodInvoke;
#if defined(J9VM_OPT_SIDECAR)
if (javaVM->srMethodAccessor != NULL)
vmInfo._srMethodAccessorClass = (TR_OpaqueClassBlock *) J9VM_J9CLASS_FROM_JCLASS(vmThread, javaVM->srMethodAccessor);
else
vmInfo._srMethodAccessorClass = NULL;
if (javaVM->srConstructorAccessor != NULL)
vmInfo._srConstructorAccessorClass = (TR_OpaqueClassBlock *) J9VM_J9CLASS_FROM_JCLASS(vmThread, javaVM->srConstructorAccessor);
else
vmInfo._srConstructorAccessorClass = NULL;
#endif // J9VM_OPT_SIDECAR
vmInfo._extendedRuntimeFlags2 = javaVM->extendedRuntimeFlags2;
#if defined(J9VM_OPT_OPENJDK_METHODHANDLE)
// These offsets are initialized later on
vmInfo._vmtargetOffset = 0;
vmInfo._vmindexOffset = 0;
#endif /* defined(J9VM_OPT_OPENJDK_METHODHANDLE) */
}
// For multi-layered SCC support
std::vector<ClientSessionData::CacheDescriptor> listOfCacheDescriptors;
if (fe->sharedCache() && fe->sharedCache()->getCacheDescriptorList())
{
// The cache descriptor list is linked last to first and is circular, so last->previous == first.
J9SharedClassCacheDescriptor *head = fe->sharedCache()->getCacheDescriptorList();
J9SharedClassCacheDescriptor *curCache = head;
do
{
ClientSessionData::CacheDescriptor cacheDesc =
{
(uintptr_t)curCache->cacheStartAddress,
curCache->cacheSizeBytes,
(uintptr_t)curCache->romclassStartAddress,
(uintptr_t)curCache->metadataStartAddress
};
listOfCacheDescriptors.push_back(cacheDesc);
curCache = curCache->next;
}
while (curCache != head);
}
#if defined(TR_HOST_POWER)
for (int32_t i = 0; i < TR_numRuntimeHelpers; ++i)
vmInfo._helperAddresses[i] = runtimeHelperValue((TR_RuntimeHelper) i);
#endif
vmInfo._isHotReferenceFieldRequired = TR::Compiler->om.isHotReferenceFieldRequired();
vmInfo._osrGlobalBufferSize = javaVM->osrGlobalBufferSize;
vmInfo._needsMethodTrampolines = TR::CodeCacheManager::instance()->codeCacheConfig().needsMethodTrampolines();
vmInfo._objectAlignmentInBytes = TR::Compiler->om.objectAlignmentInBytes();
vmInfo._isGetImplAndRefersToInliningSupported = fe->isGetImplAndRefersToInliningSupported();
vmInfo._isAllocateZeroedTLHPagesEnabled = fe->tlhHasBeenCleared();
vmInfo._staticObjectAllocateFlags = fe->getStaticObjectFlags();
vmInfo._referenceArrayCopyHelperAddress = fe->getReferenceArrayCopyHelperAddress();
vmInfo._JavaLangObject = (TR_OpaqueClassBlock*)J9VMJAVALANGOBJECT(vmThread->javaVM);
vmInfo._JavaStringObject = (TR_OpaqueClassBlock*)J9VMJAVALANGSTRING(vmThread->javaVM);
vmInfo._useAOTCache = comp->getPersistentInfo()->getJITServerUseAOTCache();
if (vmInfo._useAOTCache)
{
auto header = compInfoPT->reloRuntime()->getStoredAOTHeader(vmThread);
TR_ASSERT_FATAL(header, "Must have valid AOT header stored in SCC by now");
vmInfo._aotHeader = *header;
}
vmInfo._inSnapshotMode = fe->inSnapshotMode();
vmInfo._isSnapshotModeEnabled = fe->isSnapshotModeEnabled();
#if defined(J9VM_OPT_CRIU_SUPPORT)
vmInfo._isNonPortableRestoreMode = javaVM->internalVMFunctions->isNonPortableRestoreMode(vmThread);
#else
vmInfo._isNonPortableRestoreMode = false;
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
client->write(response, vmInfo, listOfCacheDescriptors, comp->getPersistentInfo()->getJITServerAOTCacheName());
}
break;
case MessageType::VM_getObjectClass:
{
TR::VMAccessCriticalSection getObjectClass(fe);
uintptr_t objectPointer = std::get<0>(client->getRecvData<uintptr_t>());
client->write(response, fe->getObjectClass(objectPointer));
}
break;
case MessageType::VM_getObjectClassAt:
{
uintptr_t objectAddress = std::get<0>(client->getRecvData<uintptr_t>());
client->write(response, fe->getObjectClassAt(objectAddress));
}
break;
case MessageType::VM_getObjectClassFromKnownObjectIndex:
{
auto recv = client->getRecvData<TR::KnownObjectTable::Index>();
auto idx = std::get<0>(recv);
client->write(response, fe->getObjectClassFromKnownObjectIndex(comp, idx));
}
break;
case MessageType::VM_stackWalkerMaySkipFrames:
{
client->getRecvData<JITServer::Void>();
client->write(response,
vmThread->javaVM->jlrMethodInvoke,
vmThread->javaVM->srMethodAccessor ? (TR_OpaqueClassBlock *) J9VM_J9CLASS_FROM_JCLASS(vmThread, vmThread->javaVM->srMethodAccessor) : NULL,
vmThread->javaVM->srConstructorAccessor ? (TR_OpaqueClassBlock *) J9VM_J9CLASS_FROM_JCLASS(vmThread, vmThread->javaVM->srConstructorAccessor) : NULL);
}
break;
case MessageType::VM_stackWalkerMaySkipFramesSVM:
{
auto recv = client->getRecvData<TR_OpaqueMethodBlock*, TR_OpaqueClassBlock*>();
TR_OpaqueMethodBlock *method = std::get<0>(recv);
TR_OpaqueClassBlock *clazz = std::get<1>(recv);
client->write(response, fe->stackWalkerMaySkipFrames(method, clazz));
}
break;
case MessageType::VM_getStringUTF8Length:
{
uintptr_t string = std::get<0>(client->getRecvData<uintptr_t>());
{
TR::VMAccessCriticalSection getStringUTF8Length(fe);
client->write(response, fe->getStringUTF8Length(string));
}
}
break;
case MessageType::VM_classInitIsFinished:
{
TR_OpaqueClassBlock *clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock *>());
client->write(response, fe->classInitIsFinished(clazz));
}
break;
case MessageType::VM_getClassFromNewArrayType:
{
int32_t index = std::get<0>(client->getRecvData<int32_t>());
client->write(response, fe->getClassFromNewArrayType(index));
}
break;
case MessageType::VM_getArrayClassFromComponentClass:
{
auto clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock *>());
client->write(response, fe->getArrayClassFromComponentClass(clazz));
}
break;
case MessageType::VM_matchRAMclassFromROMclass:
{
J9ROMClass *clazz = std::get<0>(client->getRecvData<J9ROMClass *>());
client->write(response, fe->matchRAMclassFromROMclass(clazz, comp));
}
break;
case MessageType::VM_getInt32FieldAt:
{
auto recv = client->getRecvData<uintptr_t, uintptr_t>();
uintptr_t objectPointer = std::get<0>(recv);
uintptr_t fieldOffset = std::get<1>(recv);
TR::VMAccessCriticalSection getInt32FieldAt(fe);
client->write(response, fe->getInt32FieldAt(objectPointer, fieldOffset));
}
break;
case MessageType::VM_getInt64FieldAt:
{
auto recv = client->getRecvData<uintptr_t, uintptr_t>();
uintptr_t objectPointer = std::get<0>(recv);
uintptr_t fieldOffset = std::get<1>(recv);
TR::VMAccessCriticalSection getInt64FieldAt(fe);
client->write(response, fe->getInt64FieldAt(objectPointer, fieldOffset));
}
break;
case MessageType::VM_setInt64FieldAt:
{
auto recv = client->getRecvData<uintptr_t, uintptr_t, int64_t>();
uintptr_t objectPointer = std::get<0>(recv);
uintptr_t fieldOffset = std::get<1>(recv);
int64_t newValue = std::get<2>(recv);
fe->setInt64FieldAt(objectPointer, fieldOffset, newValue);
client->write(response, JITServer::Void());
}
break;
case MessageType::VM_compareAndSwapInt64FieldAt:
{
auto recv = client->getRecvData<uintptr_t, uintptr_t, int64_t, int64_t>();
uintptr_t objectPointer = std::get<0>(recv);
uintptr_t fieldOffset = std::get<1>(recv);
int64_t oldValue = std::get<2>(recv);
int64_t newValue = std::get<3>(recv);
client->write(response, fe->compareAndSwapInt64FieldAt(objectPointer, fieldOffset, oldValue, newValue));
}
break;
case MessageType::VM_getArrayLengthInElements:
{
uintptr_t objectPointer = std::get<0>(client->getRecvData<uintptr_t>());
TR::VMAccessCriticalSection getArrayLengthInElements(fe);
client->write(response, fe->getArrayLengthInElements(objectPointer));
}
break;
case MessageType::VM_getClassFromJavaLangClass:
{
uintptr_t objectPointer = std::get<0>(client->getRecvData<uintptr_t>());
client->write(response, fe->getClassFromJavaLangClass(objectPointer));
}
break;
case MessageType::VM_getOffsetOfClassFromJavaLangClassField:
{
client->getRecvData<JITServer::Void>();
client->write(response, fe->getOffsetOfClassFromJavaLangClassField());
}
break;
case MessageType::VM_getIdentityHashSaltPolicy:
{
client->getRecvData<JITServer::Void>();
client->write(response, fe->getIdentityHashSaltPolicy());
}
break;
case MessageType::VM_getOffsetOfJLThreadJ9Thread:
{
client->getRecvData<JITServer::Void>();
client->write(response, fe->getOffsetOfJLThreadJ9Thread());
}
break;
case MessageType::VM_scanReferenceSlotsInClassForOffset:
{
auto recv = client->getRecvData<TR_OpaqueClassBlock *, int32_t>();
TR_OpaqueClassBlock *clazz = std::get<0>(recv);
int32_t offset = std::get<1>(recv);
client->write(response, fe->scanReferenceSlotsInClassForOffset(comp, clazz, offset));
}
break;
case MessageType::VM_findFirstHotFieldTenuredClassOffset:
{
TR_OpaqueClassBlock *clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock *>());
client->write(response, fe->findFirstHotFieldTenuredClassOffset(comp, clazz));
}
break;
case MessageType::VM_getResolvedVirtualMethod:
{
auto recv = client->getRecvData<TR_OpaqueClassBlock *, I_32, bool>();
auto clazz = std::get<0>(recv);
auto offset = std::get<1>(recv);
auto ignoreRTResolve = std::get<2>(recv);
client->write(response, fe->getResolvedVirtualMethod(clazz, offset, ignoreRTResolve));
}
break;
case MessageType::VM_getJ2IThunk:
{
auto recv = client->getRecvData<std::string>();
auto &signature = std::get<0>(recv);
client->write(response, fe->getJ2IThunk((char *)signature.data(), signature.size(), comp));
}
break;
case MessageType::VM_setJ2IThunk:
{
auto recv = client->getRecvData<std::string, std::string>();
auto &signature = std::get<0>(recv);
auto &serializedThunk = std::get<1>(recv);
void *thunkAddress;
if (!comp->compileRelocatableCode())
{
// For non-AOT, copy thunk to code cache and relocate the vm helper address right away
uint8_t *thunkStart = TR_JITServerRelocationRuntime::copyDataToCodeCache(serializedThunk.data(), serializedThunk.size(), fe);
if (!thunkStart)
compInfoPT->getCompilation()->failCompilation<TR::CodeCacheError>("Failed to allocate space in the code cache");
thunkAddress = thunkStart + 8;
void *vmHelper = j9ThunkVMHelperFromSignature(fe->_jitConfig, signature.size(), (char *)signature.data());
compInfoPT->reloRuntime()->reloTarget()->performThunkRelocation(reinterpret_cast<uint8_t *>(thunkAddress), (uintptr_t)vmHelper);
}
else
{
// For AOT, set address to received string, because it will be stored to SCC, so
// no need for code cache allocation
thunkAddress = reinterpret_cast<void *>((char *)serializedThunk.data() + 8);
}
thunkAddress = fe->setJ2IThunk((char *)signature.data(), signature.size(), thunkAddress, comp);
client->write(response, thunkAddress);
}
break;
case MessageType::VM_needsInvokeExactJ2IThunk:
{
auto recv = client->getRecvData<std::string>();
auto &signature = std::get<0>(recv);
TR_MHJ2IThunkTable *thunkTable = comp->getPersistentInfo()->getInvokeExactJ2IThunkTable();
TR_MHJ2IThunk *thunk = thunkTable->findThunk((char *)signature.data(), fe);
client->write(response, thunk == NULL);
}
break;
case MessageType::VM_setInvokeExactJ2IThunk:
{
auto recv = client->getRecvData<std::string>();
auto &serializedThunk = std::get<0>(recv);
// Do not need relocation here, because helper address should have been originally
// fetched from the client.
uint8_t *thunkStart = TR_JITServerRelocationRuntime::copyDataToCodeCache(serializedThunk.data(), serializedThunk.size(), fe);
if (!thunkStart)
compInfoPT->getCompilation()->failCompilation<TR::CodeCacheError>("Failed to allocate space in the code cache");
void *thunkAddress = reinterpret_cast<void *>(thunkStart);
compInfoPT->reloRuntime()->reloTarget()->flushCache(thunkStart, serializedThunk.size());
fe->setInvokeExactJ2IThunk(thunkAddress, comp);
client->write(response, JITServer::Void());
}
break;
case MessageType::VM_getInstanceFieldOffset:
{
auto recv = client->getRecvData<TR_OpaqueClassBlock *, std::string, std::string, uintptr_t>();
TR_OpaqueClassBlock *clazz = std::get<0>(recv);
auto &field = std::get<1>(recv);
auto &sig = std::get<2>(recv);
uintptr_t options = std::get<3>(recv);
client->write(response, fe->getInstanceFieldOffset(clazz, const_cast<char *>(field.data()), field.length(),
const_cast<char *>(sig.data()), sig.length(), options));
}
break;
case MessageType::VM_getJavaLangClassHashCode:
{
TR_OpaqueClassBlock *clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock *>());
bool hashCodeComputed = false;
int32_t hashCode = fe->getJavaLangClassHashCode(comp, clazz, hashCodeComputed);
client->write(response, hashCode, hashCodeComputed);
}
break;
case MessageType::VM_getClassDepthAndFlagsValue:
{
TR_OpaqueClassBlock *clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock *>());
client->write(response, fe->getClassDepthAndFlagsValue(clazz));
}
break;
case MessageType::VM_getMethodFromName:
{
auto recv = client->getRecvData<std::string, std::string, std::string>();
auto &className = std::get<0>(recv);
auto &methodName = std::get<1>(recv);
auto &signature = std::get<2>(recv);
client->write(response, fe->getMethodFromName(const_cast<char *>(className.data()), const_cast<char *>(methodName.data()),
const_cast<char *>(signature.data())));
}
break;
case MessageType::VM_getMethodFromClass:
{
auto recv = client->getRecvData<TR_OpaqueClassBlock *, std::string, std::string, TR_OpaqueClassBlock *>();
TR_OpaqueClassBlock *methodClass = std::get<0>(recv);
auto &methodName = std::get<1>(recv);
auto &signature = std::get<2>(recv);
TR_OpaqueClassBlock *callingClass = std::get<3>(recv);
client->write(response, fe->getMethodFromClass(methodClass, const_cast<char *>(methodName.data()),
const_cast<char *>(signature.data()), callingClass));
}
break;
case MessageType::VM_createMethodHandleArchetypeSpecimen:
{
auto recv = client->getRecvData<uintptr_t*, TR_ResolvedJ9Method *>();
uintptr_t *methodHandleLocation = std::get<0>(recv);
TR_ResolvedJ9Method *owningMethod = std::get<1>(recv);
intptr_t length;
char *thunkableSignature;
{
TR::VMAccessCriticalSection createMethodHandleArchetypeSpecimen(fe);
TR_OpaqueMethodBlock *archetype = fe->lookupMethodHandleThunkArchetype(*methodHandleLocation);
uintptr_t signatureString = fe->getReferenceField(fe->getReferenceField(
*methodHandleLocation,
"thunks", "Ljava/lang/invoke/ThunkTuple;"),
"thunkableSignature", "Ljava/lang/String;");
length = fe->getStringUTF8Length(signatureString);
thunkableSignature = (char*)trMemory->allocateStackMemory(length+1);
fe->getStringUTF8(signatureString, thunkableSignature, length+1);
TR_ResolvedMethod *resolvedMethod = fe->createResolvedMethodWithSignature(
trMemory,
archetype,
NULL,
thunkableSignature,
length,
owningMethod);
resolvedMethod->convertToMethod()->setArchetypeSpecimen();
resolvedMethod->setMethodHandleLocation(methodHandleLocation);
TR_ResolvedJ9JITServerMethodInfo methodInfo;
TR_ResolvedJ9JITServerMethod::packMethodInfo(methodInfo, static_cast<TR_ResolvedJ9Method *>(resolvedMethod), fe);
client->write(response, archetype, std::string(thunkableSignature, length), methodInfo);
}
}
break;
case MessageType::VM_isClassVisible:
{
auto recv = client->getRecvData<TR_OpaqueClassBlock *, TR_OpaqueClassBlock *>();
TR_OpaqueClassBlock *sourceClass = std::get<0>(recv);
TR_OpaqueClassBlock *destClass = std::get<1>(recv);
client->write(response, fe->isClassVisible(sourceClass, destClass));
}
break;
case MessageType::VM_markClassForTenuredAlignment:
{
auto recv = client->getRecvData<TR_OpaqueClassBlock *, uint32_t>();
TR_OpaqueClassBlock *clazz = std::get<0>(recv);
uint32_t alignFromStart = std::get<1>(recv);
fe->markClassForTenuredAlignment(comp, clazz, alignFromStart);
client->write(response, JITServer::Void());
}
break;
case MessageType::VM_reportHotField:
{
auto recv = client->getRecvData<int32_t, J9Class *, uint8_t, uint32_t>();
fe->reportHotField(std::get<0>(recv), std::get<1>(recv), std::get<2>(recv), std::get<3>(recv));
client->write(response, JITServer::Void());
}
break;
case MessageType::VM_getReferenceSlotsInClass:
{
TR_OpaqueClassBlock *clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock *>());
int32_t *start = fe->getReferenceSlotsInClass(comp, clazz);
if (!start)
{
client->write(response, std::string());
}
else
{
int32_t numSlots = 0;
for (; start[numSlots]; ++numSlots);
// Copy the null terminated array into a string
std::string slotsStr((char *)start, (1 + numSlots) * sizeof(int32_t));
client->write(response, slotsStr);
}
}
break;
case MessageType::VM_getMethodSize:
{
TR_OpaqueMethodBlock *method = std::get<0>(client->getRecvData<TR_OpaqueMethodBlock *>());
client->write(response, fe->getMethodSize(method));
}
break;
case MessageType::VM_addressOfFirstClassStatic:
{
TR_OpaqueClassBlock *clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock *>());
client->write(response, fe->addressOfFirstClassStatic(clazz));
}
break;
case MessageType::VM_getStaticFieldAddress:
{
auto recv = client->getRecvData<TR_OpaqueClassBlock *, std::string, std::string>();
TR_OpaqueClassBlock *clazz = std::get<0>(recv);
auto &fieldName = std::get<1>(recv);
auto &sigName = std::get<2>(recv);
client->write(response, fe->getStaticFieldAddress(clazz,
reinterpret_cast<unsigned char *>(const_cast<char *>(fieldName.data())), fieldName.length(),
reinterpret_cast<unsigned char *>(const_cast<char *>(sigName.data())), sigName.length()));
}
break;
case MessageType::VM_getInterpreterVTableSlot:
{
auto recv = client->getRecvData<TR_OpaqueMethodBlock *, TR_OpaqueClassBlock *>();
TR_OpaqueMethodBlock *method = std::get<0>(recv);
TR_OpaqueClassBlock *clazz = std::get<1>(recv);
client->write(response, fe->getInterpreterVTableSlot(method, clazz));
}
break;
case MessageType::VM_revertToInterpreted:
{
TR_OpaqueMethodBlock *method = std::get<0>(client->getRecvData<TR_OpaqueMethodBlock *>());
fe->revertToInterpreted(method);
client->write(response, JITServer::Void());
}
break;
case MessageType::VM_getLocationOfClassLoaderObjectPointer:
{
TR_OpaqueClassBlock *clazz = std::get<0>(client->getRecvData<TR_OpaqueClassBlock *>());
client->write(response, fe->getLocationOfClassLoaderObjectPointer(clazz));
}
break;
case MessageType::VM_getClassFromMethodBlock:
{
TR_OpaqueMethodBlock *method = std::get<0>(client->getRecvData<TR_OpaqueMethodBlock *>());
client->write(response, fe->getClassFromMethodBlock(method));
}
break;
case MessageType::VM_fetchMethodExtendedFlagsPointer:
{
J9Method *method = std::get<0>(client->getRecvData<J9Method *>());
client->write(response, fe->fetchMethodExtendedFlagsPointer(method));
}
break;
case MessageType::VM_stringEquals:
{
auto recv = client->getRecvData<uintptr_t *, uintptr_t *>();
uintptr_t *stringLocation1 = std::get<0>(recv);
uintptr_t *stringLocation2 = std::get<1>(recv);
int32_t result;
bool isEqual = fe->stringEquals(comp, stringLocation1, stringLocation2, result);
client->write(response, result, isEqual);
}
break;
case MessageType::VM_getStringHashCode:
{
uintptr_t *stringLocation = std::get<0>(client->getRecvData<uintptr_t *>());
int32_t result;
bool isGet = fe->getStringHashCode(comp, stringLocation, result);
client->write(response, result, isGet);
}
break;
case MessageType::VM_getLineNumberForMethodAndByteCodeIndex:
{
auto recv = client->getRecvData<TR_OpaqueMethodBlock *, int32_t>();
TR_OpaqueMethodBlock *method = std::get<0>(recv);
int32_t bcIndex = std::get<1>(recv);
client->write(response, fe->getLineNumberForMethodAndByteCodeIndex(method, bcIndex));
}
break;
case MessageType::VM_getObjectNewInstanceImplMethod:
{
client->getRecvData<JITServer::Void>();
client->write(response, fe->getObjectNewInstanceImplMethod());
}
break;
case MessageType::VM_getBytecodePC:
{
TR_OpaqueMethodBlock *method = std::get<0>(client->getRecvData<TR_OpaqueMethodBlock *>());
client->write(response, TR::Compiler->mtd.bytecodeStart(method));
}
break;
case MessageType::VM_getVFTEntry:
{
auto recv = client->getRecvData<TR_OpaqueClassBlock *, int32_t>();
client->write(response, fe->getVFTEntry(std::get<0>(recv), std::get<1>(recv)));
}
break;
case MessageType::VM_isClassArray:
{
auto recv = client->getRecvData<TR_OpaqueClassBlock*>();
auto clazz = std::get<0>(recv);
client->write(response, fe->isClassArray(clazz));
}
break;
case MessageType::VM_instanceOfOrCheckCast:
{
auto recv = client->getRecvData<J9Class*, J9Class*>();
auto clazz1 = std::get<0>(recv);
auto clazz2 = std::get<1>(recv);
client->write(response, fe->instanceOfOrCheckCast(clazz1, clazz2));
}
break;
case MessageType::VM_instanceOfOrCheckCastNoCacheUpdate:
{