-
Notifications
You must be signed in to change notification settings - Fork 738
/
Copy pathHookedByTheJit.cpp
7058 lines (6150 loc) · 316 KB
/
HookedByTheJit.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 (c) 2000, 2018 IBM Corp. and others
*
* 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] http://openjdk.java.net/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
*******************************************************************************/
#include <algorithm>
#include <limits.h>
#include <stdarg.h>
#include "bcnames.h"
#include "jithash.h"
#include "jitprotos.h"
#include "j9.h"
#include "j9cfg.h"
#include "j9modron.h"
#include "j9nonbuilder.h"
#include "mmhook.h"
#include "mmomrhook.h"
#include "vmaccess.h"
#include "codegen/CodeGenerator.hpp"
#include "compile/CompilationTypes.hpp"
#include "compile/ResolvedMethod.hpp"
#include "control/OptimizationPlan.hpp"
#include "control/OptionsUtil.hpp"
#include "control/Recompilation.hpp"
#include "control/RecompilationInfo.hpp"
#include "control/CompilationController.hpp"
#include "env/ClassLoaderTable.hpp"
#include "env/CompilerEnv.hpp"
#include "env/IO.hpp"
#include "env/J2IThunk.hpp"
#include "env/PersistentCHTable.hpp"
#include "env/PersistentInfo.hpp"
#include "env/jittypes.h"
#include "env/ClassTableCriticalSection.hpp"
#include "env/VMAccessCriticalSection.hpp"
#include "env/VMJ9.h"
#include "il/DataTypes.hpp"
#include "ilgen/IlGeneratorMethodDetails_inlines.hpp"
#include "infra/Monitor.hpp"
#include "infra/MonitorTable.hpp"
#include "infra/CriticalSection.hpp"
#include "optimizer/DebuggingCounters.hpp"
#include "optimizer/JProfilingBlock.hpp"
#include "runtime/CodeCacheManager.hpp"
#include "runtime/HookHelpers.hpp"
#include "runtime/MethodMetaData.h"
#include "runtime/RelocationRuntime.hpp"
#include "runtime/asmprotos.h"
#include "runtime/codertinit.hpp"
#include "control/MethodToBeCompiled.hpp"
#include "control/CompilationRuntime.hpp"
#include "control/CompilationThread.hpp"
#include "env/VMJ9.h"
#include "env/j9method.h"
#include "env/ut_j9jit.h"
#include "ilgen/J9ByteCodeIlGenerator.hpp"
#include "ilgen/J9ByteCodeIterator.hpp"
#include "runtime/IProfiler.hpp"
#include "runtime/HWProfiler.hpp"
#include "runtime/LMGuardedStorage.hpp"
#include "env/SystemSegmentProvider.hpp"
extern "C" {
struct J9JavaVM;
}
#if defined(J9ZOS390) && defined(TR_TARGET_32BIT)
#include <stdlib.h>
#define PSAAOLD 0x224 ///< offset of current ASCB in prefixed save area (located at address 0x0)
#define ASCBLDA 0x30 ///< offst of LDA field in ASCB
#define LDASTRTA 0x3c ///< offset of user region start in LDA
#define LDASIZA 0x40 ///< offset of maximum user region size in LDA
#define LDAESTRA 0x4c ///< offset of extended user region start in LDA
#define LDAESIZA 0x50 ///< offset of maximum extended user region size in LDA
#define LDACRGTP 0x98 ///< offset of user region top in LDA
#define LDAERGTP 0x9c ///< offset of extended user region top in LDA
struct LDA {
uint32_t padding1[15]; ///< Padding
void * strta; ///< User Region Start
uint32_t siza; ///< Max size of the User Region
uint32_t padding2[2]; ///< Padding
void * estra; ///< Extended User Region Start
uint32_t esiza; ///< Max size of the Extended User Region
uint32_t padding3[17]; ///< Padding
void * crgtp; ///< User Region Top
void * ergtp; ///< Extended User Region Top
};
#endif
#define STACK_WALK_DEPTH 16
// struct to remember a method for JIT dump
typedef struct TR_MethodToBeCompiledForDump {
J9Method *_method;
void *_oldStartPC;
TR_Hotness _optLevel;
} TR_MethodToBeCompiledForDump;
#ifdef J9VM_JIT_RUNTIME_INSTRUMENTATION
// extern until function is added to oti/jitprotos.h
extern "C" void shutdownJITRuntimeInstrumentation(J9JavaVM *vm);
#endif
/* 1) Regular hooks
* These fire when a normal condition occurs.
* Ie: In the case of the "jitHookInitializeSendTarget" hook,
* the VM triggers the event as its initializing the send targets for a class.
* This is part of the normal code flow.
*/
/* 2) Async hooks
* These fire when requested by an outside thread.
* The thread requesting the async event has each thread/requested thread stop at
* its next safepoint to acknowledge the event.
* The interrupted thread runs the handler and then continues its execution.
*/
void
cgOnClassUnloading(void *loaderPtr)
{
#if defined(TR_TARGET_POWER) && defined(TR_HOST_POWER) && defined(TR_TARGET_64BIT)
if (TR::Compiler->target.cpu.isPower())
TR::CodeGenerator::ppcCGOnClassUnloading(loaderPtr);
#endif
}
extern TR::Monitor *memoryAllocMonitor;
extern TR::Monitor *assumptionTableMutex;
extern volatile bool shutdownSamplerThread;
#if defined(AOTRT_DLL)
#if defined(J9VM_GC_DYNAMIC_CLASS_UNLOADING)
extern void rtHookClassUnload(J9HookInterface * *, UDATA , void *, void *);
extern void rtHookClassLoaderUnload(J9HookInterface * *, UDATA , void *, void *);
#endif
#endif
#ifdef FIXUP_UNALIGNED
#ifdef J9VM_ENV_LITTLE_ENDIAN
#define BC_OP_U16(bcPtr) (((*(((uint8_t*)(bcPtr))+1))<<8) + (*((uint8_t*)(bcPtr))))
#else
#define BC_OP_U16(bcPtr) (((*((uint8_t*)(bcPtr)))<<8) + (*(((uint8_t*)(bcPtr))+1)))
#endif
#else
#define BC_OP_U16(bcPtr) (*((uint16_t*)(bcPtr)))
#endif
TR::OptionSet *findOptionSet(J9Method *method, bool isAOT)
{
TR::OptionSet *optionSet = NULL;
J9ROMMethod * romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(method);
J9UTF8 *className;
J9UTF8 *name;
J9UTF8 *signature;
getClassNameSignatureFromMethod(method, className, name, signature);
char *methodSignature;
char arr[1024];
int32_t len = J9UTF8_LENGTH(className) + J9UTF8_LENGTH(name) + J9UTF8_LENGTH(signature) + 3;
if (len < 1024)
methodSignature = arr;
else
methodSignature = (char *) TR_Memory::jitPersistentAlloc(len);
if (methodSignature)
{
sprintf(methodSignature, "%.*s.%.*s%.*s", J9UTF8_LENGTH(className), utf8Data(className), J9UTF8_LENGTH(name), utf8Data(name), J9UTF8_LENGTH(signature), utf8Data(signature));
TR_FilterBST * filter = 0;
if (TR::Options::getDebug() && TR::Options::getDebug()->getCompilationFilters())
TR::Options::getDebug()->methodSigCanBeCompiled(methodSignature, filter, TR_Method::J9);
int32_t index = filter ? filter->getOptionSet() : 0;
int32_t lineNum = filter ? filter->getLineNumber() : 0;
bool hasBackwardBranches = (J9ROMMETHOD_HAS_BACKWARDS_BRANCHES(romMethod) ? true : false);
optionSet = TR::Options::findOptionSet(index, lineNum, methodSignature, TR::Options::getInitialHotnessLevel(hasBackwardBranches), isAOT);
if (len >= 1024)
TR_Memory::jitPersistentFree(methodSignature);
}
return optionSet;
}
static void reportHook(J9VMThread *curThread, char *name, char *format=NULL, ...)
{
J9JITConfig * jitConfig = curThread->javaVM->jitConfig;
TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig);
if ( TR::Options::getCmdLineOptions()->getVerboseOption(TR_VerboseHooks)
|| TR::Options::getCmdLineOptions()->getVerboseOption(TR_VerboseHookDetails))
{
TR_VerboseLog::vlogAcquire();
TR_VerboseLog::writeLine(TR_Vlog_HK,"%x hook %s vmThread=%p ", (int)(intptr_t)curThread, name, curThread);
if (format)
{
va_list args;
va_start(args, format);
j9jit_vprintf(jitConfig, format, args);
va_end(args);
}
TR_VerboseLog::vlogRelease();
}
}
static void reportHookFinished(J9VMThread *curThread, char *name, char *format=NULL, ...)
{
J9JITConfig * jitConfig = curThread->javaVM->jitConfig;
TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig);
if (TR::Options::getCmdLineOptions()->getVerboseOption(TR_VerboseHookDetails))
{
TR_VerboseLog::vlogAcquire();
TR_VerboseLog::writeLine(TR_Vlog_HD,"%x finished ", (int)(intptr_t)curThread);
if (format)
{
va_list args;
va_start(args, format);
j9jit_vprintf(jitConfig, format, args);
va_end(args);
}
TR_VerboseLog::vlogRelease();
}
}
static void reportHookDetail(J9VMThread *curThread, char *name, char *format, ...)
{
J9JITConfig * jitConfig = curThread->javaVM->jitConfig;
TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig);
if (TR::Options::getCmdLineOptions()->getVerboseOption(TR_VerboseHookDetails))
{
TR_VerboseLog::vlogAcquire();
TR_VerboseLog::writeLine(TR_Vlog_HD," %x: ", (int)(intptr_t)curThread);
va_list args;
va_start(args, format);
j9jit_vprintf(jitConfig, format, args);
va_end(args);
TR_VerboseLog::vlogRelease();
}
}
extern "C" {
extern void freeJITConfig(J9JITConfig *);
extern void stopSamplingThread(J9JITConfig *);
extern void getOutOfIdleStates(TR::CompilationInfo::TR_SamplerStates expectedState, TR::CompilationInfo *compInfo, const char* reason);
extern void getOutOfIdleStatesUnlocked(TR::CompilationInfo::TR_SamplerStates expectedState, TR::CompilationInfo *compInfo, const char* reason);
//***************************************************************************************
// Hooked by the JIT
//***************************************************************************************
int32_t encodeCount(int32_t count)
{
return (count == -1) ? 0 : (count << 1) + 1;
}
int32_t getCount(J9ROMMethod *romMethod, TR::Options *optionsJIT, TR::Options *optionsAOT)
{
int32_t count;
if (J9ROMMETHOD_HAS_BACKWARDS_BRANCHES(romMethod))
{
count = std::min(optionsJIT->getInitialBCount(), optionsAOT->getInitialBCount());
}
else
{
count = std::min(optionsJIT->getInitialCount(), optionsAOT->getInitialCount());
if (TR::Options::_smallMethodBytecodeSizeThreshold > 0)
{
uint32_t methodSize = TR::CompilationInfo::getMethodBytecodeSize(romMethod);
if ((int32_t)methodSize <= TR::Options::_smallMethodBytecodeSizeThreshold)
{
count = count << 3;
}
}
}
return count;
}
bool sharedCacheContainsProfilingInfoForMethod(J9VMThread *vmThread, TR::CompilationInfo *compInfo, J9Method *method)
{
J9SharedClassConfig * scConfig = compInfo->getJITConfig()->javaVM->sharedClassConfig;
if(!scConfig)
return false;
unsigned char storeBuffer[1000];
uint32_t bufferLength=1000;
J9SharedDataDescriptor descriptor;
descriptor.address = storeBuffer;
descriptor.length = bufferLength;
descriptor.type = J9SHR_ATTACHED_DATA_TYPE_JITPROFILE;
descriptor.flags = J9SHR_ATTACHED_DATA_NO_FLAGS;
J9ROMMethod * romMethod = (J9ROMMethod*)J9_ROM_METHOD_FROM_RAM_METHOD((J9Method *)method);
IDATA dataIsCorrupt;
TR_IPBCDataStorageHeader *store = (TR_IPBCDataStorageHeader *)scConfig->findAttachedData(vmThread, romMethod, &descriptor, &dataIsCorrupt);
if (!store)
return false;
if (store != (TR_IPBCDataStorageHeader *)descriptor.address) // a stronger check, as found can be error value
return false;
return true;
}
/// This is a helper function used by jitHookInitializeSendTarget().
/// This function calculates for the hash value for methods using method names.
/// The hash value will be eventually added to variable `count` in `jitHookInitializeSendTarget()` under some conditions.
/// The formula for the hash value is:
///
/// hashValue[0] = HASH_INIT_VALUE;
/// hashValue[i+1] = hashValue[i] * HASH_BASE_VALUE + name[i];
/// hashValue[length(name)] will be used as the hash value
static uint32_t initializeSendTargetHelperFuncHashValueForSpreading(J9Method* method)
{
// extract class name, method name, and signature
J9ROMMethod * romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(method);
J9UTF8 *className;
J9UTF8 *name;
J9UTF8 *signature;
getClassNameSignatureFromMethod(method, className, name, signature);
char *classNameChar = utf8Data(className);
char *nameChar = utf8Data(name);
char *signatureChar = utf8Data(signature);
// set the base and initial value for the hash value
// const uint32_t HASH_BASE_VALUE = 33;
const uint32_t HASH_INIT_VALUE = 5381;
// get options
TR::Options * optionsJIT = TR::Options::getJITCmdLineOptions();
TR::Options * optionsAOT = TR::Options::getAOTCmdLineOptions();
// extract the CAP of the hash value
uint32_t hashValueCap;
if (J9ROMMETHOD_HAS_BACKWARDS_BRANCHES(romMethod))
hashValueCap = std::max(optionsJIT->getMaxSpreadCountLoopy(), optionsAOT->getMaxSpreadCountLoopy());
else
hashValueCap = std::max(optionsJIT->getMaxSpreadCountLoopless(), optionsAOT->getMaxSpreadCountLoopless());
// compute the hash value
uint32_t hashValue = HASH_INIT_VALUE;
for (uint32_t i = 0; i < J9UTF8_LENGTH(className); i++)
hashValue = (hashValue << 5) + hashValue + classNameChar[i];
for (uint32_t i = 0; i < J9UTF8_LENGTH(name); i++)
hashValue = (hashValue << 5) + hashValue + nameChar[i];
for (uint32_t i = 0; i < J9UTF8_LENGTH(signature); i++)
hashValue = (hashValue << 5) + hashValue + signatureChar[i];
hashValue = hashValue % hashValueCap;
return hashValue;
}
static void jitHookInitializeSendTarget(J9HookInterface * * hook, UDATA eventNum, void * eventData, void * userData)
{
J9VMInitializeSendTargetEvent * event = (J9VMInitializeSendTargetEvent *)eventData;
J9Method * method = event->method;
J9ROMMethod * romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(method);
// Allow native and abstract methods to be initialized by the interpreter
if (romMethod->modifiers & (J9AccAbstract | J9AccNative))
{
TR::CompilationInfo::setInitialInvocationCountUnsynchronized(method,0);
return;
}
J9VMThread * vmThread = event->currentThread;
J9JITConfig* jitConfig = vmThread->javaVM->jitConfig;
TR::CompilationInfo * compInfo = TR::CompilationInfo::get(jitConfig);
if ((jitConfig->runtimeFlags & J9JIT_DEFER_JIT) != 0)
return; // No need to set counts in this mode
TR_J9VMBase * fe = TR_J9VMBase::get(jitConfig, vmThread);
TR::Options * optionsJIT = TR::Options::getJITCmdLineOptions();
TR::Options * optionsAOT = TR::Options::getAOTCmdLineOptions();
method->methodRunAddress = jitGetCountingSendTarget(vmThread, method);
if (TR::Options::getJITCmdLineOptions()->anOptionSetContainsACountValue())
{
TR::OptionSet * optionSet = findOptionSet(method, false);
if (optionSet)
optionsJIT = optionSet->getOptions();
}
if (TR::Options::getAOTCmdLineOptions()->anOptionSetContainsACountValue())
{
TR::OptionSet * optionSet = findOptionSet(method, true);
if (optionSet)
optionsAOT = optionSet->getOptions();
}
int32_t count = -1; // means we didn't set the value yet
// compile BigDecimal methods containing DFP stubs right away
// we want to encode an initial count of 0 for those methods
//
if (!optionsJIT->getOption(TR_DisableDFP) && !optionsAOT->getOption(TR_DisableDFP)
&& (TR::Compiler->target.cpu.supportsDecimalFloatingPoint()
#ifdef TR_TARGET_S390
|| TR::Compiler->target.cpu.getS390SupportsDFP()
#endif
)
&& TR_J9MethodBase::isBigDecimalMethod(method)
)
{
count = 0;
}
else
{
J9ROMClass *declaringClazz = J9_CLASS_FROM_METHOD(method)->romClass;
J9UTF8 * className = J9ROMCLASS_CLASSNAME(declaringClazz);
J9UTF8 * name = J9ROMMETHOD_NAME(romMethod);
if (J9UTF8_LENGTH(className) == 36
&& J9UTF8_LENGTH(name) == 21
&& 0==memcmp(utf8Data(className), "com/ibm/rmi/io/FastPathForCollocated", 36)
&& 0==memcmp(utf8Data(J9ROMMETHOD_GET_NAME(declaringClazz, romMethod)), "isVMDeepCopySupported", 21)
)
{
count = 0;
}
else if (J9UTF8_LENGTH(className) == 39
&& J9UTF8_LENGTH(name) == 9
&& 0 == memcmp(utf8Data(className), "java/util/concurrent/ThreadPoolExecutor", 39)
&& 0 == memcmp(utf8Data(J9ROMMETHOD_GET_NAME(declaringClazz, romMethod)), "runWorker", 9)
)
{
count = 0;
}
else if (TR::Options::sharedClassCache())
{
#if defined(J9VM_INTERP_AOT_COMPILE_SUPPORT) && defined(J9VM_OPT_SHARED_CLASSES) && (defined(TR_HOST_X86) || defined(TR_HOST_POWER) || defined(TR_HOST_S390) || defined(TR_HOST_ARM))
if (compInfo->reloRuntime()->isRomClassForMethodInSharedCache(method, jitConfig->javaVM))
{
PORT_ACCESS_FROM_JAVAVM(jitConfig->javaVM);
I_64 sharedQueryTime = 0;
if (optionsAOT->getOption(TR_EnableSharedCacheTiming))
sharedQueryTime = j9time_hires_clock(); // may not be good for SMP
if (jitConfig->javaVM->sharedClassConfig->existsCachedCodeForROMMethod(vmThread, romMethod))
{
int32_t scount = optionsAOT->getInitialSCount();
uint16_t newScount = 0;
#if defined(HINTS_IN_SHAREDCACHE_OBJECT)
if ((TR_J9SharedCache *)(((TR_J9VMBase *) fe)->sharedCache())->isHint(method, TR_HintFailedValidation, &newScount))
#else
if (((TR_J9VMBase *) fe)->isSharedCacheHint(method, TR_HintFailedValidation, &newScount))
#endif
{
if ((scount == TR_QUICKSTART_INITIAL_SCOUNT) || (scount == TR_INITIAL_SCOUNT))
{ // If scount is not user specified (coarse way due to info being lost from options parsing)
// TODO: Is casting the best thing to do here?
scount= std::min(getCount(romMethod, optionsJIT, optionsAOT), static_cast<int32_t>(newScount) ); // Find what would've been normal count for this method and
// make sure new scount isn't larger than that
if (optionsAOT->getVerboseOption(TR_VerboseSCHints) || optionsJIT->getVerboseOption(TR_VerboseSCHints))
TR_VerboseLog::writeLineLocked(TR_Vlog_SCHINTS,"Found hint in sc, increase scount to: %d, wanted scount: %d", scount, newScount);
}
}
count = scount;
compInfo->incrementNumMethodsFoundInSharedCache();
}
// AOT Body not in SCC, so scount was not set
else if (!TR::Options::getCountsAreProvidedByUser())
{
// Because C-interpreter is slower we need to rely more on jitted code
// This means compiling more, but we have to be carefull
// Let's use some smaller than normal counts, but only if
// 1) Quickstart - because we don't risk losing iprofiling info
// 2) GracePeriod - because we want to limit the number of 'extra'
// compilations and short apps are affected more
// 3) Bootstrap - same as above, plus if these methods get into the
// SCC I would rather have non-app specific methods
// 4) Cold run - we want to avoid extra compilations in warm runs
// The danger is that very small applications that don't even get to AOT 200 methods
// may think that the runs are always cold
if (TR::Options::getCmdLineOptions()->getOption(TR_LowerCountsForAotCold) &&
compInfo->isWarmSCC() == TR_no &&
compInfo->getPersistentInfo()->getElapsedTime() <= (uint64_t)compInfo->getPersistentInfo()->getClassLoadingPhaseGracePeriod() &&
TR::Options::isQuickstartDetected() &&
fe->isClassLibraryMethod((TR_OpaqueMethodBlock *)method)) // is this an expensive call here?
{
// TODO: modify the function that reads a specified count such that
// if the user specifies a count or bcount on the command line that is obeyed
// and we don't try the following line
count = J9ROMMETHOD_HAS_BACKWARDS_BRANCHES(romMethod) ?
std::min(optionsJIT->getInitialColdRunBCount(), optionsAOT->getInitialColdRunBCount()) :
std::min(optionsJIT->getInitialColdRunCount(), optionsAOT->getInitialColdRunCount());
}
// Increase counts for methods from non-bootstrap classes to improve throughput
else if (TR::Options::getCmdLineOptions()->getOption(TR_IncreaseCountsForNonBootstrapMethods))
{
if (!fe->isClassLibraryMethod((TR_OpaqueMethodBlock *)method))
count = J9ROMMETHOD_HAS_BACKWARDS_BRANCHES(romMethod) ? TR_DEFAULT_INITIAL_BCOUNT : TR_DEFAULT_INITIAL_COUNT;
}
// We may lower or increase the counts based on TR_HintMethodCompiledDuringStartup
if (count == -1 && // Not yet changed
jitConfig->javaVM->phase != J9VM_PHASE_NOT_STARTUP &&
(TR_HintMethodCompiledDuringStartup & TR::Options::getAOTCmdLineOptions()->getEnableSCHintFlags()))
{
#if defined(HINTS_IN_SHAREDCACHE_OBJECT)
bool wasCompiledDuringStartup = (TR_J9SharedCache *)(fe->sharedCache())->isHint(method, TR_HintMethodCompiledDuringStartup);
#else
bool wasCompiledDuringStartup = fe->isSharedCacheHint(method, TR_HintMethodCompiledDuringStartup);
#endif
if (wasCompiledDuringStartup)
{
// Lower the counts for any method that doesn't have an AOT body,
// but we know it has been compiled in previous runs.
if (TR::Options::getCmdLineOptions()->getOption(TR_ReduceCountsForMethodsCompiledDuringStartup))
count = TR::Options::getCountForMethodsCompiledDuringStartup();
}
else // method was not compiled during startup
{
if (TR::Options::getCmdLineOptions()->getOption(TR_IncreaseCountsForMethodsCompiledOutsideStartup) &&
TR::Options::startupTimeMatters() == TR_maybe) // For TR_no the counts are already high, for TR_yes we cannot get in here
count = J9ROMMETHOD_HAS_BACKWARDS_BRANCHES(romMethod) ? TR_DEFAULT_INITIAL_BCOUNT : TR_DEFAULT_INITIAL_COUNT;
}
}
}
if (optionsAOT->getOption(TR_EnableSharedCacheTiming))
{
sharedQueryTime = j9time_hires_delta(sharedQueryTime, j9time_hires_clock(), J9PORT_TIME_DELTA_IN_MICROSECONDS);
compInfo->setAotQueryTime(compInfo->getAotQueryTime() + (UDATA)sharedQueryTime);
}
}
else // ROM class not in shared class cache
{
#if !defined(J9ZOS390) // Do not change the counts on zos at the moment since the
// shared cache capacity is higher on this platform and by
// increasing counts we could end up significantly impacting startup
if (TR::Options::getCmdLineOptions()->getOption(TR_UseHigherCountsForNonSCCMethods))
count = J9ROMMETHOD_HAS_BACKWARDS_BRANCHES(romMethod) ? TR_DEFAULT_INITIAL_BCOUNT : TR_DEFAULT_INITIAL_COUNT;
#endif // !J9ZOS390
}
#endif // defined(J9VM_INTERP_AOT_COMPILE_SUPPORT) && defined(J9VM_OPT_SHARED_CLASSES) && (defined(TR_HOST_X86) || defined(TR_HOST_POWER) || defined(TR_HOST_S390) || defined(TR_HOST_ARM))
} // if (TR::Options::sharedClassCache())
if (count == -1) // count didn't change yet
{
if (!TR::Options::getCountsAreProvidedByUser() &&
fe->isClassLibraryMethod((TR_OpaqueMethodBlock *)method))
count = J9ROMMETHOD_HAS_BACKWARDS_BRANCHES(romMethod) ? TR::Options::getCountForLoopyBootstrapMethods() : TR::Options::getCountForLooplessBootstrapMethods();
if (count == -1)
count = getCount(romMethod, optionsJIT, optionsAOT);
// If add-spreading-invocation mode is enabled, add a hash value (hashed from method name) to count
if (optionsAOT->getOption(TR_EnableCompilationSpreading) || optionsJIT->getOption(TR_EnableCompilationSpreading))
{
count += initializeSendTargetHelperFuncHashValueForSpreading(method);
}
else if (TR::Options::getCmdLineOptions()->getOption(TR_EnableEarlyCompilationDuringIdleCpu))
{
// Set only a fraction of a count to accelerate compilations
if (count > 20)
count = count * TR::Options::_countPercentageForEarlyCompilation / 100;
// TODO: disable this mechanism after an hour or so to conserve idle time
}
}
}
// Option to display chosen counts to track possible bugs
if (optionsJIT->getVerboseOption(TR_VerboseCounts))
{
char buffer[500];
fe->printTruncatedSignature(buffer, 500, (TR_OpaqueMethodBlock *) method);
TR_VerboseLog::writeLineLocked(TR_Vlog_PERF, "Setting count=%d for %s", count, buffer);
}
TR::CompilationInfo::setInitialInvocationCountUnsynchronized(method,count);
if (TR::Options::getJITCmdLineOptions()->getOption(TR_DumpInitialMethodNamesAndCounts) || TR::Options::getAOTCmdLineOptions()->getOption(TR_DumpInitialMethodNamesAndCounts))
{
bool containsInfo = sharedCacheContainsProfilingInfoForMethod(vmThread, compInfo, method);
char buf[3072];
J9UTF8 * className = J9ROMCLASS_CLASSNAME(J9_CLASS_FROM_METHOD(method)->romClass);
J9UTF8 * name = J9ROMMETHOD_NAME(J9_ROM_METHOD_FROM_RAM_METHOD(method));
J9UTF8 * signature = J9ROMMETHOD_SIGNATURE(J9_ROM_METHOD_FROM_RAM_METHOD(method));
int32_t sigLen = sprintf(buf, "%.*s.%.*s%.*s", className->length, utf8Data(className), name->length, utf8Data(name), signature->length, utf8Data(signature));
printf("Initial: Signature %s Count %d isLoopy %d isAOT %d is in SCC %d SCCContainsProfilingInfo %d \n",buf,TR::CompilationInfo::getInvocationCount(method),J9ROMMETHOD_HAS_BACKWARDS_BRANCHES(romMethod),
TR::Options::sharedClassCache() ? jitConfig->javaVM->sharedClassConfig->existsCachedCodeForROMMethod(vmThread, romMethod) : 0,
TR::Options::sharedClassCache() ? compInfo->isRomClassForMethodInSharedCache(method, jitConfig->javaVM) : 0,containsInfo) ; fflush(stdout);
}
}
#if defined(J9VM_INTERP_PROFILING_BYTECODES)
static int32_t interpreterProfilingState = IPROFILING_STATE_OFF;
static int32_t interpreterProfilingRecordsCount = 0; // reset when state changes to IPROFILING_STATE_GOING_OFF
static int32_t interpreterProfilingJITSamples = 0;
static int32_t interpreterProfilingINTSamples = 0;
static int32_t interpreterProfilingMonitoringWindow = 0;
static bool interpreterProfilingWasOnAtStartup = false;
/**
* J9 VM hook, called when the profiling bytecode buffer is full.
*/
static void jitHookBytecodeProfiling(J9HookInterface * * hook, UDATA eventNum, void * eventData, void * userData);
static void turnOnInterpreterProfiling(J9JavaVM* javaVM, TR::CompilationInfo * compInfo)
{
if (interpreterProfilingState == IPROFILING_STATE_OFF)
{
TR_J9VMBase * vmj9 = (TR_J9VMBase *)(TR_J9VMBase::get(javaVM->jitConfig, 0));
TR_IProfiler *iProfiler = vmj9->getIProfiler();
if (iProfiler->getProfilerMemoryFootprint() >= TR::Options::_iProfilerMemoryConsumptionLimit)
return;
J9HookInterface ** hook = javaVM->internalVMFunctions->getVMHookInterface(javaVM);
interpreterProfilingRecordsCount = 0;
interpreterProfilingState = IPROFILING_STATE_ON;
interpreterProfilingJITSamples = 0;
PORT_ACCESS_FROM_JAVAVM(javaVM);
if ((*hook)->J9HookRegisterWithCallSite(hook, J9HOOK_VM_PROFILING_BYTECODE_BUFFER_FULL, jitHookBytecodeProfiling, OMR_GET_CALLSITE(), NULL))
{
j9tty_printf(PORTLIB, "Error: Unable to install J9HOOK_VM_PROFILING_BYTECODE_BUFFER_FULL listener\n");
return;
}
else
{
if (TR::Options::getCmdLineOptions()->getOption(TR_VerboseInterpreterProfiling))
{
TR_VerboseLog::writeLineLocked(TR_Vlog_IPROFILER,"t=%6u IProfiler reactivated...", (uint32_t)compInfo->getPersistentInfo()->getElapsedTime());
}
}
}
}
#endif
#if defined(J9VM_JIT_DYNAMIC_LOOP_TRANSFER)
static TR_YesNoMaybe shouldInitiateDLT(J9DLTInformationBlock *dltInfo, int32_t idx, bool *bcRepeats, int32_t *hitCnt)
{
static int32_t triggerCount = -1;
if (triggerCount == -1)
{
static char *envTrigger = feGetEnv("TR_DLTcount");
if (envTrigger == NULL)
{
triggerCount = 3;
}
else
triggerCount = atoi(envTrigger);
}
*bcRepeats = false;
*hitCnt = -1; // -1 means unknown
if (triggerCount <= 1)
return TR_yes;
J9Method *currentMethod = dltInfo->methods[idx];
int32_t hitCount=0, loopCnt=0, bcIdx = dltInfo->bcIndex[idx];
idx = (idx==0)?(J9DLT_HISTORY_SIZE-1):(idx-1);
while (loopCnt < J9DLT_HISTORY_SIZE-1)
{
loopCnt++;
if (dltInfo->methods[idx] == currentMethod)
{
if (dltInfo->bcIndex[idx] >= bcIdx)
*bcRepeats = true;
hitCount++;
}
idx = (idx==0)?(J9DLT_HISTORY_SIZE-1):(idx-1);
if (loopCnt==triggerCount-1 && hitCount==triggerCount-1)
return TR_maybe;
}
*hitCnt = hitCount;
if (hitCount>=triggerCount)
return TR_maybe;
if(!TR::Options::getCmdLineOptions()->getOption(TR_DisableFastDLTOnLongRunningInterpreter) && TR::CompilationInfo::isCompiled(currentMethod))
{
TR_PersistentJittedBodyInfo *bodyInfo = TR::Recompilation::getJittedBodyInfoFromPC(currentMethod->extra);
if (bodyInfo && bodyInfo->isLongRunningInterpreted())
return TR_yes;
}
return TR_no;
}
void *jitLookupDLT(J9VMThread *currentThread, J9Method *method, UDATA bcIndex)
{
J9JITConfig * jitConfig = currentThread->javaVM->jitConfig;
if (!jitConfig)
return 0;
TR::CompilationInfo *compInfo = TR::CompilationInfo::get(jitConfig);
void *dltEntry = compInfo->searchForDLTRecord(method, bcIndex);
if (!dltEntry)
return 0;
J9DLTInformationBlock *dltBlock = &(currentThread->dltBlock);
dltBlock->dltSP = (uintptrj_t)CONVERT_TO_RELATIVE_STACK_OFFSET(currentThread, currentThread->sp);
dltBlock->dltEntry = dltEntry;
return (void *)1;
}
static UDATA dltTestIterator(J9VMThread * currentThread, J9StackWalkState * walkState)
{
switch(walkState->framesWalked)
{
case 1 :
if (((UDATA) walkState->pc <= J9SF_MAX_SPECIAL_FRAME_TYPE) || (walkState->pc == walkState->walkThread->javaVM->callInReturnPC))
return J9_STACKWALK_KEEP_ITERATING;
if (walkState->jitInfo!=NULL)
return J9_STACKWALK_STOP_ITERATING;
walkState->userData1 = (void *)1;
return J9_STACKWALK_STOP_ITERATING;
break;
case 2 :
if (((UDATA) walkState->pc <= J9SF_MAX_SPECIAL_FRAME_TYPE) || (walkState->pc == walkState->walkThread->javaVM->callInReturnPC))
return J9_STACKWALK_STOP_ITERATING;
if (walkState->jitInfo!=NULL)
return J9_STACKWALK_STOP_ITERATING;
// We can stop at this point: candidate for sync transfer
walkState->userData1 = (void *)2;
return J9_STACKWALK_STOP_ITERATING;
break;
case 3 : // unused currently
if (walkState->jitInfo!=NULL || ((UDATA) walkState->pc <= J9SF_MAX_SPECIAL_FRAME_TYPE) ||
(walkState->pc == walkState->walkThread->javaVM->callInReturnPC) || (*walkState->bp & J9SF_A0_INVISIBLE_TAG))
return J9_STACKWALK_STOP_ITERATING;
break;
}
return J9_STACKWALK_KEEP_ITERATING;
}
static void emptyJitGCMapCheck(J9VMThread * currentThread, J9StackWalkState * walkState, j9object_t * objectSlot, const void * stackLocation)
{
return;
}
static void jitGCMapCheck(J9VMThread* vmThread, IDATA handlerKey, void* userData)
{
J9StackWalkState walkState;
walkState.flags = J9_STACKWALK_ITERATE_O_SLOTS | J9_STACKWALK_ITERATE_HIDDEN_JIT_FRAMES | J9_STACKWALK_CHECK_I_SLOTS_FOR_OBJECTS;
walkState.objectSlotWalkFunction = emptyJitGCMapCheck;
walkState.maxFrames = 2;
walkState.walkThread = vmThread;
walkState.userData1=0;
static char *verbose = feGetEnv("TR_GCMapCheckVerbose");
if (verbose)
walkState.userData1 = (void*)((uintptrj_t) walkState.userData1 | 1);
static char *local = feGetEnv("TR_GCMapCheckLocalScavenge");
if (local)
walkState.userData1 = (void*)((uintptrj_t) walkState.userData1 | 2);
static char *global = feGetEnv("TR_GCMapCheckGlobalScavenge");
if (global)
walkState.userData1 = (void*)((uintptrj_t) walkState.userData1 | 4);
vmThread->javaVM->walkStackFrames(vmThread, &walkState);
return;
}
void DLTLogic(J9VMThread* vmThread, TR::CompilationInfo *compInfo)
{
#define SIG_SZ 150
char sig[SIG_SZ];
if (!TR::Options::canJITCompile() ||
TR::Options::getCmdLineOptions()->getOption(TR_FullSpeedDebug) ||
TR::Options::getCmdLineOptions()->getOption(TR_DisableDynamicLoopTransfer) )
return;
if (TR::Options::_compilationDelayTime > 0 && // feature enabled
TR::Options::_compilationDelayTime > compInfo->getPersistentInfo()->getElapsedTime())
return;
J9StackWalkState walkState;
walkState.maxFrames = 3;
walkState.userData1 = 0;
walkState.walkThread = vmThread;
walkState.frameWalkFunction = dltTestIterator;
walkState.flags = J9_STACKWALK_ITERATE_FRAMES | J9_STACKWALK_COUNT_SPECIFIED | J9_STACKWALK_SKIP_INLINES;
vmThread->javaVM->walkStackFrames(vmThread, &walkState);
uint8_t * startPC = 0;
if (walkState.userData1 == 0)
startPC = (uint8_t *)-1;
J9DLTInformationBlock *dltBlock = &(vmThread->dltBlock);
int32_t idx = dltBlock->cursor + 1;
J9ROMMethod *romMethod = NULL;
bool bcRepeats;
if (startPC!=(uint8_t *)-1 && walkState.method!=0)
romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(walkState.method);
idx = (idx==J9DLT_HISTORY_SIZE) ? 0 : idx;
dltBlock->cursor = idx;
if (startPC ||
walkState.method==0 ||
(romMethod->modifiers & J9AccNative) ||
((intptrj_t)(walkState.method->constantPool) & J9_STARTPC_JNI_NATIVE) ||
!J9ROMMETHOD_HAS_BACKWARDS_BRANCHES(romMethod) ||
TR::CompilationInfo::getJ9MethodVMExtra(walkState.method)==J9_JIT_NEVER_TRANSLATE ||
(J9CLASS_FLAGS(J9_CLASS_FROM_METHOD(walkState.method)) & J9_JAVA_CLASS_HOT_SWAPPED_OUT) ||
walkState.bytecodePCOffset<=0) // FIXME: Deal with loop back on entry later
{
dltBlock->methods[idx] = 0;
return;
}
else if (TR::CompilationInfo::isCompiled(walkState.method))
{
TR_PersistentJittedBodyInfo *bodyInfo = TR::Recompilation::getJittedBodyInfoFromPC(walkState.method->extra);
if (bodyInfo && bodyInfo->getMethodInfo()->hasFailedDLTCompRetrials())
{
dltBlock->methods[idx] = 0;
return;
}
}
// Check whether we need a DLT compilation
bool doPerformDLT = false;
dltBlock->methods[idx] = walkState.method;
dltBlock->bcIndex[idx] = walkState.bytecodePCOffset;
TR_J9ByteCode bc = TR_J9ByteCodeIterator::convertOpCodeToByteCodeEnum(J9_BYTECODE_START_FROM_ROM_METHOD(romMethod)[walkState.bytecodePCOffset]);
if ((walkState.unwindSP - walkState.walkSP) == 0 && bc != J9BCinvokevirtual &&
bc != J9BCinvokespecial && bc != J9BCinvokestatic && bc != J9BCinvokeinterface &&
bc != J9BCinvokedynamic && bc != J9BCinvokehandle && bc != J9BCinvokehandlegeneric &&
bc != J9BCinvokespecialsplit && bc != J9BCinvokestaticsplit)
{
int32_t numHitsInDLTBuffer = -1;
TR_YesNoMaybe answer = shouldInitiateDLT(dltBlock, idx, &bcRepeats, &numHitsInDLTBuffer);
if (answer == TR_maybe)
{
// Perform another test
if (compInfo->getDLT_HT())
{
// If numHitsInDLTBuffer was not computed by shouldInitiateDLT do it now
if (numHitsInDLTBuffer == -1)
{
// Search again for number of hits
int32_t i = 0;
for (numHitsInDLTBuffer = 0; i < J9DLT_HISTORY_SIZE; i++)
if (dltBlock->methods[i] == walkState.method)
numHitsInDLTBuffer++;
}
// Check the DLT_HT
doPerformDLT = compInfo->getDLT_HT()->shouldIssueDLTCompilation(walkState.method, numHitsInDLTBuffer);
}
else // DLT_HT is not allocated, so just issue the DLT request
{
doPerformDLT = true;
}
}
}
if (doPerformDLT)
{
int32_t bcIndex = walkState.bytecodePCOffset;
J9JITConfig * jitConfig = vmThread->javaVM->jitConfig;
TR_J9VMBase * vm = TR_J9VMBase::get(jitConfig, vmThread);
static char *enableDebugDLT = feGetEnv("TR_DebugDLT");
bool dltMostOnce = false;
int32_t enableDLTidx = -1;
int32_t disableDLTidx = -1;
int32_t dltOptLevel = -1;
if (enableDebugDLT!=NULL)
{
TR::OptionSet *optionSet = findOptionSet(walkState.method, false);
TR::Options *options = optionSet ? optionSet->getOptions() : NULL;
enableDLTidx = options ? options->getEnableDLTBytecodeIndex() : -1;
disableDLTidx = options ? options->getDisableDLTBytecodeIndex() : -1;
if (enableDLTidx != -1)
{
J9ROMMethod * romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(walkState.method);
bcIndex = enableDLTidx;
if (enableDLTidx >= (J9_BYTECODE_END_FROM_ROM_METHOD(romMethod)) - (J9_BYTECODE_START_FROM_ROM_METHOD(romMethod)))
return;
dltBlock->bcIndex[idx] = enableDLTidx;
}
if (disableDLTidx != -1 && disableDLTidx == bcIndex) return;
dltMostOnce = options ? options->getOption(TR_DLTMostOnce) :
TR::Options::getCmdLineOptions()->getOption(TR_DLTMostOnce);
dltOptLevel = options ? options->getDLTOptLevel() :
TR::Options::getCmdLineOptions()->getDLTOptLevel();
}
// This setup is for matching dltEntry to the right transfer point. It can be an issue only
// in rare situations where Java code is executed for asyncEvents, leading to recursive DLT.
dltBlock->dltSP = (uintptrj_t)CONVERT_TO_RELATIVE_STACK_OFFSET(vmThread, vmThread->sp);
dltBlock->dltEntry = compInfo->searchForDLTRecord(dltBlock->methods[idx], bcIndex);
if (dltBlock->dltEntry != NULL)
return;
static char *TR_DLTmostOnce = feGetEnv("TR_DLTmostOnce");
if (TR_DLTmostOnce != NULL || dltMostOnce)
{
if (compInfo->searchForDLTRecord(dltBlock->methods[idx], -1))
return;
}
static char *TR_DLTforcedHot = feGetEnv("TR_DLTforcedHot");
static char *TR_DLTforcedCold = feGetEnv("TR_DLTforcedCold"); // Usage error: set both
TR_OptimizationPlan *plan = NULL;
TR_CompilationErrorCode eCode;
bool queued = false;
// TODO: add an event for the controller to decide what to do
TR_Hotness optLevel = warm;
// decide if we are going to compile this method to hot
if (dltOptLevel != -1)
{
optLevel = (TR_Hotness)dltOptLevel;
}
else if (TR_DLTforcedHot!=NULL)
{
optLevel = hot;
}
else if (TR_DLTforcedCold != NULL)
{
optLevel = cold;
}
else
{
bool systemClass = vm->isClassLibraryMethod((TR_OpaqueMethodBlock*)walkState.method);
if (systemClass)
{
optLevel = cold;
//return;
}
else // userClass
{
// DLTs cannot be very important for large apps, so use cold compilations
if (compInfo->getPersistentInfo()->getNumLoadedClasses() >= TR::Options::_bigAppThreshold)
{
optLevel = cold;
}
else
{
bool classLoadPhase = compInfo->getPersistentInfo()->isClassLoadingPhase();
if (bcRepeats)
{
if (!classLoadPhase)
optLevel = hot;
}
else
{
if (classLoadPhase)
optLevel = cold;
}
}
}
}
plan = TR_OptimizationPlan::alloc(optLevel);