-
Notifications
You must be signed in to change notification settings - Fork 751
/
Copy pathjavadump.cpp
6155 lines (5354 loc) · 236 KB
/
javadump.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 2003
*
* 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
*******************************************************************************/
/* Includes */
#if defined(AIXPPC)
#include <sys/time.h>
#endif /* defined(AIXPPC) */
#include <string.h>
#include <stdlib.h>
#if defined(WIN32)
#include <malloc.h>
#elif defined(LINUX) || defined(AIXPPC)
#include <alloca.h>
#elif defined(J9ZOS390)
#include <stdlib.h>
#endif
#include "rasdump_internal.h"
#include "j2sever.h"
#include "HeapIteratorAPI.h"
#include "j9dmpnls.h"
#include "omrlinkedlist.h"
#include "j9protos.h"
#include "TextFileStream.hpp"
#include "rommeth.h"
#include "j9dump.h"
#include "omrthread.h"
#include "avl_api.h"
#include "shcflags.h"
#include "j9port.h"
#include "sharedconsts.h"
#include "omrgcconsts.h"
#include "omr.h"
#include "omrutilbase.h"
#include "j9version.h"
#include "vendor_version.h"
#include "jvminit.h"
#include "zip_api.h"
#include <limits.h>
#include "ute.h"
#include "ut_j9dmp.h"
#include "omrformatconsts.h"
#if defined(J9VM_ENV_DATA64)
#define SEGMENT_HEADER "NULL segment start alloc end type size\n"
#else
#define SEGMENT_HEADER "NULL segment start alloc end type size\n"
#endif
/* Format specifiers for printing memory quantities. */
#define FORMAT_SIZE_DECIMAL "%*zu"
#define FORMAT_SIZE_HEX "0x%.*zX"
#define HIST_TYPE_GC 1
#define HIST_TYPE_CT 2
/* Safety margin for stack allocation of AVL tree for thread walk */
#define STACK_SAFETY_MARGIN 25000
/* Callback Function prototypes */
UDATA writeFrameCallBack (J9VMThread* vmThread, J9StackWalkState* state);
UDATA writeExceptionFrameCallBack (J9VMThread* vmThread, void* userData, UDATA bytecodeOffset, J9ROMClass* romClass, J9ROMMethod* romMethod, J9UTF8* sourceFile, UDATA lineNumber, J9ClassLoader* classLoader, J9Class* ramClass);
void writeLoaderCallBack (void* classLoader, void* userData);
void writeLibrariesCallBack (void* classLoader, void* userData);
void writeClassesCallBack (void* classLoader, void* userData);
static UDATA outerMemCategoryCallBack (U_32 categoryCode, const char * categoryName, UDATA liveBytes, UDATA liveAllocations, BOOLEAN isRoot, U_32 parentCategoryCode, OMRMemCategoryWalkState * state);
static UDATA innerMemCategoryCallBack (U_32 categoryCode, const char * categoryName, UDATA liveBytes, UDATA liveAllocations, BOOLEAN isRoot, U_32 parentCategoryCode, OMRMemCategoryWalkState * state);
/* Function prototypes */
static jvmtiIterationControl heapIteratorCallback (J9JavaVM* vm, J9MM_IterateHeapDescriptor* heapDescriptor, void* userData);
static jvmtiIterationControl spaceIteratorCallback (J9JavaVM* vm, J9MM_IterateSpaceDescriptor* spaceDescriptor, void* userData);
static jvmtiIterationControl regionIteratorCallback (J9JavaVM* vm, J9MM_IterateRegionDescriptor* regionDescription, void* userData);
static UDATA getObjectMonitorCount(J9JavaVM *vm);
static UDATA getAllocatedVMThreadCount (J9JavaVM *vm);
/* sig_protect functions and handlers */
extern "C" {
UDATA protectedWriteSection (struct J9PortLibrary *, void *);
UDATA handlerWriteSection (struct J9PortLibrary *, U_32, void *, void *);
UDATA protectedStartDoWithSignal (struct J9PortLibrary *, void *);
UDATA protectedStartDo (struct J9PortLibrary *, void *);
UDATA protectedNextDo (struct J9PortLibrary *, void *);
UDATA protectedWalkJavaStack (struct J9PortLibrary *, void *);
UDATA protectedGetVMThreadName (struct J9PortLibrary *, void *);
UDATA protectedGetVMThreadObjectState (struct J9PortLibrary *, void *);
UDATA protectedGetVMThreadRawState (struct J9PortLibrary *, void *);
UDATA handlerJavaThreadWalk (struct J9PortLibrary *, U_32, void *, void *);
UDATA handlerNativeThreadWalk (struct J9PortLibrary *, U_32, void *, void *);
UDATA handlerGetVMThreadName (struct J9PortLibrary *, U_32, void *, void *);
UDATA handlerGetVMThreadObjectState (struct J9PortLibrary *, U_32, void *, void *);
UDATA handlerGetVMThreadRawState (struct J9PortLibrary *, U_32, void *, void *);
UDATA protectedWriteGCHistoryLines (struct J9PortLibrary *, void *);
UDATA protectedIterateStackTrace (struct J9PortLibrary *, void *);
UDATA protectedWriteThreadBlockers (struct J9PortLibrary *, void *);
UDATA protectedGetOwnedObjectMonitors (struct J9PortLibrary *, void *);
UDATA protectedWriteJavaLangThreadInfo (struct J9PortLibrary *, void *);
UDATA protectedWriteThreadsWithNativeStacks (struct J9PortLibrary *, void *);
UDATA protectedWriteThreadsJavaOnly (struct J9PortLibrary *, void *);
UDATA protectedWriteThreadsUsageSummary (struct J9PortLibrary *, void *);
UDATA handlerWriteThreadBlockers (struct J9PortLibrary *, U_32, void *, void *);
UDATA handlerGetThreadsUsageInfo (struct J9PortLibrary *, U_32, void *, void *);
UDATA handlerGetOwnedObjectMonitors (struct J9PortLibrary *, U_32, void *, void *);
UDATA handlerIterateStackTrace (struct J9PortLibrary *, U_32, void *, void *);
UDATA handlerWriteJavaLangThreadInfo(struct J9PortLibrary *, U_32, void *, void *);
UDATA handlerWriteStacks (struct J9PortLibrary *, U_32, void *, void *);
/* associated structures for passing arguments are below the JavaCoreDumpWriter declaration */
}
static IDATA vmthread_comparator(struct J9AVLTree *tree, struct J9AVLTreeNode *insertNode, struct J9AVLTreeNode *walkNode);
static IDATA vmthread_locator(struct J9AVLTree *tree, UDATA tid, struct J9AVLTreeNode *walkNode);
/* Functions used by hash table prototypes */
static UDATA lockHashFunction(void* key, void* user);
static UDATA lockHashEqualFunction(void* left, void* right, void* user);
static UDATA rasDumpPreemptLock = 0;
typedef struct regioniterationblock {
bool _newIteration;
const void *_regionStart;
UDATA _regionSize;
} regioniterationblock;
typedef struct vmthread_avl_node {
J9AVLTreeNode node;
J9VMThread *vmthread;
j9object_t lockObject;
J9VMThread *lockOwner;
UDATA vmThreadState;
UDATA javaThreadState;
UDATA javaPriority;
} vmthread_avl_node;
typedef struct blocked_thread_record {
omrthread_monitor_t monitor;
J9VMThread *waitingThread;
UDATA waitingThreadState;
} blocked_thread_record;
typedef struct memcategory_max_indexes {
U_32 omrMaxIndex;
U_32 languageMaxIndex;
} memcategory_max_indexes;
typedef struct memcategory_total {
U_32 *category_bitmask;
UDATA liveBytes;
UDATA liveAllocations;
U_32 codeToMatch;
BOOLEAN codeMatched;
} memcategory_total;
typedef struct memcategory_data_frame {
U_32 category;
UDATA liveBytes;
UDATA liveAllocations;
} memcategory_data_frame;
/* Macros for working with the category_bitmask in the memcategory_total structure.
* The range of category codes is not contiguous, so we have to map entries from
* the end of the range (unknown & port library) onto the end of the entries from
* the start of the range.
*/
#define MAP_CATEGORY_TO_BITMASK_ENTRY(category) (((category) > OMRMEM_LANGUAGE_CATEGORY_LIMIT) ? ((writer->_MaxCategoryBits - 1) - (OMRMEM_OMR_CATEGORY_INDEX_FROM_CODE(category))) : (category))
#define CATEGORY_WORD_INDEX(category) (MAP_CATEGORY_TO_BITMASK_ENTRY(category) / 32)
#define CATEGORY_WORD_MASK(category) (1 << (MAP_CATEGORY_TO_BITMASK_ENTRY(category) % 32))
#define CATEGORY_IS_ANCESTOR(total, category) ((total)->category_bitmask[CATEGORY_WORD_INDEX(category)] & CATEGORY_WORD_MASK(category))
#define SET_CATEGORY_AS_ANCESTOR(total, category) ((total)->category_bitmask[CATEGORY_WORD_INDEX(category)] |= CATEGORY_WORD_MASK(category))
static const UDATA syncEventsMask =
J9RAS_DUMP_ON_CLASS_LOAD |
J9RAS_DUMP_ON_CLASS_UNLOAD |
J9RAS_DUMP_ON_EXCEPTION_THROW |
J9RAS_DUMP_ON_EXCEPTION_CATCH |
J9RAS_DUMP_ON_THREAD_START |
J9RAS_DUMP_ON_THREAD_END |
J9RAS_DUMP_ON_THREAD_BLOCKED |
J9RAS_DUMP_ON_EXCEPTION_DESCRIBE |
J9RAS_DUMP_ON_OBJECT_ALLOCATION |
J9RAS_DUMP_ON_SLOW_EXCLUSIVE_ENTER |
J9RAS_DUMP_ON_EXCEPTION_SYSTHROW |
J9RAS_DUMP_ON_TRACE_ASSERT |
J9RAS_DUMP_ON_USER_REQUEST;
/**************************************************************************************************/
/* */
/* Class for writing java core dump files */
/* */
/**************************************************************************************************/
class JavaCoreDumpWriter
{
public :
/* Constructor */
JavaCoreDumpWriter(const char* fileName, J9RASdumpContext* context, J9RASdumpAgent *agent);
/* Destructor */
~JavaCoreDumpWriter();
private :
/* Prevent use of the copy constructor and assignment operator */
JavaCoreDumpWriter(const JavaCoreDumpWriter& source);
JavaCoreDumpWriter& operator=(const JavaCoreDumpWriter& source);
/* Allow the callback functions access */
friend UDATA writeFrameCallBack (J9VMThread* vmThread, J9StackWalkState* state);
friend UDATA writeExceptionFrameCallBack (J9VMThread* vmThread, void* userData, UDATA bytecodeOffset, J9ROMClass* romClass, J9ROMMethod* romMethod, J9UTF8* sourceFile, UDATA lineNumber, J9ClassLoader* classLoader, J9Class* ramClass);
friend void writeLoaderCallBack (void* classLoader, void* userData);
friend void writeLibrariesCallBack (void* classLoader, void* userData);
friend void writeClassesCallBack (void* classLoader, void* userData);
friend UDATA outerMemCategoryCallBack (U_32 categoryCode, const char * categoryName, UDATA liveBytes, UDATA liveAllocations, BOOLEAN isRoot, U_32 parentCategoryCode, OMRMemCategoryWalkState * state);
friend UDATA innerMemCategoryCallBack (U_32 categoryCode, const char * categoryName, UDATA liveBytes, UDATA liveAllocations, BOOLEAN isRoot, U_32 parentCategoryCode, OMRMemCategoryWalkState * state);
friend jvmtiIterationControl heapIteratorCallback (J9JavaVM* vm, J9MM_IterateHeapDescriptor* heapDescriptor, void* userData);
friend jvmtiIterationControl spaceIteratorCallback (J9JavaVM* vm, J9MM_IterateSpaceDescriptor* spaceDescriptor, void* userData);
friend jvmtiIterationControl regionIteratorCallback (J9JavaVM* vm, J9MM_IterateRegionDescriptor* regionDescription, void* userData);
/* sig_protect wrappers functions and handlers */
friend UDATA protectedWriteSection (struct J9PortLibrary *, void *);
friend UDATA handlerWriteSection (struct J9PortLibrary *, U_32, void *, void *);
friend UDATA handlerJavaThreadWalk (struct J9PortLibrary *, U_32, void *, void *);
friend UDATA protectedWalkJavaStack (struct J9PortLibrary *, void *);
friend UDATA protectedWriteGCHistoryLines (struct J9PortLibrary *, void *);
friend UDATA protectedIterateStackTrace (struct J9PortLibrary *, void *);
friend UDATA protectedWriteThreadBlockers (struct J9PortLibrary *, void *);
friend UDATA protectedGetOwnedObjectMonitors (struct J9PortLibrary *, void *);
friend UDATA protectedWriteJavaLangThreadInfo(struct J9PortLibrary *, void *);
friend UDATA protectedWriteThreadsWithNativeStacks(J9PortLibrary*, void*);
friend UDATA protectedWriteThreadsJavaOnly(J9PortLibrary*, void*);
friend UDATA protectedWriteThreadsUsageSummary(J9PortLibrary*, void*);
friend UDATA handlerWriteThreadBlockers (struct J9PortLibrary *, U_32, void *, void *);
friend UDATA handlerGetThreadsUsageInfo (struct J9PortLibrary *, U_32, void *, void *);
friend UDATA handlerGetOwnedObjectMonitors(struct J9PortLibrary *, U_32, void *, void *);
friend UDATA handlerIterateStackTrace (struct J9PortLibrary *, U_32, void *, void *);
friend UDATA handlerWriteJavaLangThreadInfo(struct J9PortLibrary *, U_32, void *, void *);
friend UDATA handlerWriteStacks(struct J9PortLibrary *, U_32, void *, void *);
/* Allow the functions used by hash tables access */
friend UDATA lockHashFunction(void* key, void* user);
friend UDATA lockHashEqualFunction(void* left, void* right, void* user);
/* Directed node in lock graph */
struct DeadLockGraphNode {
J9VMThread *thread;
DeadLockGraphNode *next;
J9ThreadAbstractMonitor *lock;
j9object_t lockObject;
UDATA cycle;
};
/* Internal convenience method for testing the context */
bool avoidLocks(void);
/* Internal methods for writing the first level sections */
void writeHeader(void);
void writeTitleSection(void);
void writeProcessorSection(void);
void writeEnvironmentSection(void);
void writeEnvUserArgsHelper(J9VMInitArgs* vmArgs);
void writeMemorySection(void);
void writeMemoryCountersSection(void);
void writeMonitorSection(void);
void writeThreadSection(void);
void writeClassSection(void);
#if defined(OMR_OPT_CUDA)
void writeCudaSection(void);
#endif /* defined(OMR_OPT_CUDA) */
/* OMR_OPT_HOOKDUMP */
void writeHookSection(void);
#if defined(J9VM_OPT_SHARED_CLASSES)
void writeSharedClassIPCInfo(const char* textStart, const char* textEnd, IDATA id, UDATA padToLength);
void writeSharedClassLockInfo(const char* lockName, IDATA lockSemid, void* lockTID);
void writeSharedClassSection(void);
void writeSharedClassSectionTopLayerStatsHelper(J9SharedClassJavacoreDataDescriptor* javacoreData, bool multiLayerStats);
void writeSharedClassSectionTopLayerStatsSummaryHelper(J9SharedClassJavacoreDataDescriptor* javacoreData);
void writeSharedClassSectionAllLayersStatsHelper(J9SharedClassJavacoreDataDescriptor* javacoreData);
#endif
void writeTrailer(void);
/* Internal methods for writing the nested sections */
void writeVMRuntimeState (U_32 vmRuntimeState);
void writeExceptionDetail (j9object_t* exceptionRef);
void writeGPCategory (void *gpInfo, const char* prefix, U_32 category);
void writeGPValue (const char* prefix, const char* name, U_32 kind, void* value);
void writeJitMethod (J9VMThread* vmThread);
void writeSegments (J9MemorySegmentList* list, BOOLEAN isCodeCacheSegment);
void writeTraceHistory (U_32 type);
void writeGCHistoryLines (UtThreadData** thr, UtTracePointIterator* iterator, const char* typePrefix);
void writeDeadLocks (void);
void findThreadCycle (J9VMThread* vmThread, J9HashTable* deadlocks);
void writeDeadlockNode (DeadLockGraphNode* node, int count);
void writeMonitorObject (J9ThreadMonitor* monitor, j9object_t obj, blocked_thread_record *threadStore);
void writeMonitor (J9ThreadMonitor* monitor);
void writeSystemMonitor (J9ThreadMonitor* monitor);
void writeObject (j9object_t obj);
void writeThread (J9VMThread* vmThread, J9PlatformThread *nativeThread, UDATA vmstate, UDATA javaState, UDATA javaPriority, j9object_t lockObject, J9VMThread *lockOwnerThread);
void writeThreadName (J9VMThread* vmThread);
void writeThreadBlockers (J9VMThread* vmThread, UDATA vmstate, j9object_t lockObject, J9VMThread *lockOwnerThread);
UDATA writeFrame (J9StackWalkState* state);
UDATA writeExceptionFrame (void *userData, J9ROMClass* romClass, J9ROMMethod* romMethod, J9UTF8* sourceFile, UDATA lineNumber);
void writeLoader (J9ClassLoader* classLoader);
void writeLibraries (J9ClassLoader* classLoader);
void writeClasses (J9ClassLoader* classLoader);
void writeEventDrivenTitle (void);
void writeUserRequestedTitle (void);
void writeNativeAllocator (const char * name, U_32 depth, BOOLEAN isRoot, UDATA liveBytes, UDATA liveAllocations);
IDATA getOwnedObjectMonitors (J9VMThread* vmThread, J9ObjectMonitorInfo* monitorInfos);
void writeJavaLangThreadInfo (J9VMThread* vmThread);
void writeCPUinfo (void);
#if defined(LINUX)
void writeCgroupMetrics(void);
#endif
void writeThreadsWithNativeStacks(void);
void writeThreadsJavaOnly(void);
void writeThreadTime (const char * timerName, I_64 nanoTime);
void writeThreadsUsageSummary (void);
void writeHookInfo (struct OMRHookInfo4Dump *hookInfo);
void writeHookInterface (struct J9HookInterface **hookInterface);
/* Other internal methods */
j9object_t getClassLoaderObject(J9ClassLoader* loader);
UDATA createPadding(const char* str, UDATA fieldWidth, char padChar, char* buffer);
void writeThreadState(UDATA threadState);
/* Declared data */
/* NB : The initialization order is significant */
J9RASdumpContext* _Context;
J9JavaVM* _VirtualMachine;
J9PortLibrary* _PortLibrary;
const char* _FileName;
TextFileStream _OutputStream;
bool _FileMode;
bool _Error;
bool _AvoidLocks;
bool _PreemptLocked;
bool _ThreadsWalkStarted;
J9RASdumpAgent * _Agent;
memcategory_data_frame* _CategoryStack;
U_32 _CategoryStackTop;
const char * _SpaceDescriptorName;
U_32 _TotalCategories;
U_32 _MaxCategoryBits;
UDATA _AllocatedVMThreadCount;
int64_t _DumpStart;
/* Static declared data */
static const unsigned int _MaximumExceptionNameLength;
static const U_32 _MaximumFormattedTracePointLength;
static const unsigned int _MaximumCommandLineLength;
static const unsigned int _MaximumTimeStampLength;
static const unsigned int _MaximumGPValueLength;
static const unsigned int _MaximumJavaStackDepth;
static const int _MaximumGCHistoryLines;
static const int _MaximumMonitorInfosPerThread;
};
/* Static declared data instantiation */
const unsigned int JavaCoreDumpWriter::_MaximumExceptionNameLength(128);
const unsigned int JavaCoreDumpWriter::_MaximumFormattedTracePointLength(512);
const unsigned int JavaCoreDumpWriter::_MaximumCommandLineLength(512);
const unsigned int JavaCoreDumpWriter::_MaximumTimeStampLength(30);
const unsigned int JavaCoreDumpWriter::_MaximumGPValueLength(512);
const unsigned int JavaCoreDumpWriter::_MaximumJavaStackDepth(100000);
const int JavaCoreDumpWriter::_MaximumGCHistoryLines(2000);
const int JavaCoreDumpWriter::_MaximumMonitorInfosPerThread(32);
class sectionClosure {
private:
sectionClosure() {}
public:
void (JavaCoreDumpWriter::*sectionFunction)(void);
JavaCoreDumpWriter *jcw;
sectionClosure(void (JavaCoreDumpWriter::*func)(void), JavaCoreDumpWriter *writer) :
sectionFunction(func),
jcw(writer)
{}
void invoke(void) {
(jcw->*sectionFunction)();
}
};
struct walkClosure {
J9Heap *heap;
void *gpInfo;
JavaCoreDumpWriter *jcw;
/* used for both J9ThreadWalkState and J9StackWalkState */
void *state;
};
#define CALL_PROTECT(section, retVal) \
do { \
sectionClosure closure(&JavaCoreDumpWriter::section, this); \
UDATA sink = 0; \
(retVal) = j9sig_protect(protectedWriteSection, &closure, handlerWriteSection, this, J9PORT_SIG_FLAG_SIGALLSYNC | J9PORT_SIG_FLAG_MAY_RETURN, &sink) || (retVal); \
} while (0)
/**************************************************************************************************/
/* */
/* JavaCoreDumpWriter::JavaCoreDumpWriter() method implementation */
/* */
/**************************************************************************************************/
JavaCoreDumpWriter::JavaCoreDumpWriter(
const char* fileName,
J9RASdumpContext* context,
J9RASdumpAgent* agent
) :
_Context(context),
_VirtualMachine(_Context->javaVM),
_PortLibrary(_VirtualMachine->portLibrary),
_FileName(fileName),
_OutputStream(_PortLibrary),
_FileMode(false),
_Error(false),
_AvoidLocks(false),
_PreemptLocked(false),
_ThreadsWalkStarted(false),
_Agent(agent),
_TotalCategories(0),
_MaxCategoryBits(0)
{
PORT_ACCESS_FROM_PORT(_PortLibrary);
bool bufferWrites = false;
_AllocatedVMThreadCount = getAllocatedVMThreadCount(_VirtualMachine);
/* Determine whether getting further locks should be avoided
* There is a small timing window where we can crash close to
* startup and the vmThreadListMutex is NULL.
* Failing to check for NULL leads to a endless spin.*/
if (NULL == _VirtualMachine->vmThreadListMutex) {
_AvoidLocks = true;
} else if (omrthread_monitor_try_enter(_VirtualMachine->vmThreadListMutex)) {
/* Failed to get lock so avoid asking for further ones if it's a GPF or abort */
_AvoidLocks = J9_ARE_ANY_BITS_SET(_Context->eventFlags, J9RAS_DUMP_ON_GP_FAULT | J9RAS_DUMP_ON_ABORT_SIGNAL);
} else {
/* Got the lock so release it */
omrthread_monitor_exit(_VirtualMachine->vmThreadListMutex);
_AvoidLocks = false;
}
/* Write a message to standard error saying we are about to write a dump file */
reportDumpRequest(_PortLibrary, _Context, "Java", _FileName);
/* don't buffer if we don't have the locks (incl exclusive) or it's a GP. */
bufferWrites = !_AvoidLocks
&& J9_ARE_NO_BITS_SET(_Context->eventFlags, J9RAS_DUMP_ON_GP_FAULT | J9RAS_DUMP_ON_ABORT_SIGNAL)
&& J9_ARE_ALL_BITS_SET(_Agent->prepState, J9RAS_DUMP_GOT_EXCLUSIVE_VM_ACCESS);
/* It's a single file so open it */
_OutputStream.open(_FileName, bufferWrites);
/* Write the sections, these return void so we throw away the per section return value.
* We consolidate the return values for all of the sections so we know after we finish
* if any of them failed.
*/
CALL_PROTECT(writeTitleSection, _Error);
CALL_PROTECT(writeProcessorSection, _Error);
CALL_PROTECT(writeEnvironmentSection, _Error);
CALL_PROTECT(writeMemoryCountersSection, _Error);
CALL_PROTECT(writeMemorySection, _Error);
/* The monitor section is crash prone as objects mutate under it.
* Lock ordering imposed by the lock inflation path means that we have to get the monitorTableMutex ahead of the
* thread lock as we will attempt to get it again for uninflated locks when calling getVMThreadRawState while looking
* for waiting threads on any given monitor
*/
omrthread_monitor_enter(_VirtualMachine->monitorTableMutex);
omrthread_t self = omrthread_self();
if (!omrthread_lib_try_lock(self)) {
/* got both locks so we shouldn't deadlock getting thread state */
CALL_PROTECT(writeMonitorSection, _Error);
omrthread_lib_unlock(self);
} else {
/* Write the section header */
_OutputStream.writeCharacters(
"0SECTION LOCKS subcomponent dump routine\n"
"NULL ===============================\n"
"1LKMONPOOLDUMP Monitor Pool Dump unavailable [locked]\n"
"1LKREGMONDUMP JVM System Monitor Dump unavailable [locked]\n"
"NULL ------------------------------------------------------------------------\n");
}
omrthread_monitor_exit(_VirtualMachine->monitorTableMutex);
/* If request=preempt (for native stack collection) we attempt to acquire the mutex and note if we got it */
if (J9_ARE_ANY_BITS_SET(_Agent->requestMask, J9RAS_DUMP_DO_PREEMPT_THREADS)) {
if (compareAndSwapUDATA(&rasDumpPreemptLock, 0, 1) == 0) {
_PreemptLocked = true; /* we got the lock */
}
}
CALL_PROTECT(writeThreadSection, _Error);
if (_PreemptLocked) {
compareAndSwapUDATA(&rasDumpPreemptLock, 1, 0);
_PreemptLocked = false;
}
#if defined(OMR_OPT_CUDA)
CALL_PROTECT(writeCudaSection, _Error);
#endif /* defined(OMR_OPT_CUDA) */
/* OMR_OPT_HOOKDUMP */
CALL_PROTECT(writeHookSection, _Error);
#if defined(J9VM_OPT_SHARED_CLASSES)
CALL_PROTECT(writeSharedClassSection, _Error);
#endif
CALL_PROTECT(writeClassSection, _Error);
CALL_PROTECT(writeTrailer, _Error);
/* Record the status of the operation */
_FileMode = _FileMode || _OutputStream.isOpen();
_Error = _Error || _OutputStream.isError();
/* Close the file */
_OutputStream.close();
/* Write a message to standard error saying we have written a dump file */
if (_Error) {
j9nls_printf(PORTLIB, J9NLS_ERROR | J9NLS_STDERR, J9NLS_DMP_ERROR_IN_DUMP_STR, "Java", _FileName);
Trc_dump_reportDumpError_Event2("Java", _FileName);
} else if (_FileMode) {
j9nls_printf(PORTLIB, J9NLS_INFO | J9NLS_STDERR, J9NLS_DMP_WRITTEN_DUMP_STR, "Java", _FileName);
Trc_dump_reportDumpEnd_Event2("Java", _FileName);
} else {
j9nls_printf(PORTLIB, J9NLS_INFO | J9NLS_STDERR, J9NLS_DMP_NO_CREATE, _FileName);
Trc_dump_reportDumpEnd_Event2("Java", "stderr");
}
}
/**************************************************************************************************/
/* */
/* JavaCoreDumpWriter::~JavaCoreDumpWriter() method implementation */
/* */
/**************************************************************************************************/
JavaCoreDumpWriter::~JavaCoreDumpWriter()
{
/* Nothing to do currently */
}
/**************************************************************************************************/
/* */
/* JavaCoreDumpWriter::avoidLocks() method implementation */
/* */
/**************************************************************************************************/
bool
JavaCoreDumpWriter::avoidLocks(void)
{
return _AvoidLocks;
}
/**************************************************************************************************/
/* */
/* JavaCoreDumpWriter::writeHeader() method implementation */
/* */
/**************************************************************************************************/
void
JavaCoreDumpWriter::writeHeader(void)
{
_OutputStream.writeCharacters(
"NULL ------------------------------------------------------------------------\n"
);
}
static const char TIMESTAMP_FORMAT[] = "%Y/%m/%d at %H:%M:%S";
/**************************************************************************************************/
/* */
/* JavaCoreDumpWriter::writeTitleSection() method implementation */
/* */
/**************************************************************************************************/
void
JavaCoreDumpWriter::writeTitleSection(void)
{
/* Write the section header */
_OutputStream.writeCharacters(
"0SECTION TITLE subcomponent dump routine\n"
"NULL ===============================\n"
);
PORT_ACCESS_FROM_JAVAVM(_VirtualMachine);
OMRPORT_ACCESS_FROM_J9PORT(PORTLIB);
char cset[64];
IDATA getCSet = j9file_get_text_encoding(cset, sizeof(cset));
_OutputStream.writeCharacters("1TICHARSET ");
_OutputStream.writeCharacters((0 == getCSet) ? cset : "[not available]");
_OutputStream.writeCharacters("\n");
if (J9RAS_DUMP_ON_USER_REQUEST == _Context->eventFlags) {
writeUserRequestedTitle();
} else {
writeEventDrivenTitle();
}
/* write the date and time that the dump was generated */
char timeStamp[_MaximumTimeStampLength + 1];
int64_t now = j9time_current_time_millis();
_DumpStart = now;
omrstr_ftime_ex(timeStamp, _MaximumTimeStampLength, TIMESTAMP_FORMAT, now, OMRSTR_FTIME_FLAG_UTC);
timeStamp[_MaximumTimeStampLength] = '\0';
_OutputStream.writeCharacters("1TIDATETIMEUTC Date: ");
_OutputStream.writeCharacters(timeStamp);
_OutputStream.writeInteger(now % 1000, ":%03d"); /* add the milliseconds */
_OutputStream.writeCharacters(" (UTC)\n");
{
RasDumpGlobalStorage *dump_storage = (RasDumpGlobalStorage *)_VirtualMachine->j9rasdumpGlobalStorage;
struct J9StringTokens *stringTokens = (struct J9StringTokens *)dump_storage->dumpLabelTokens;
/* lock access to the tokens */
omrthread_monitor_enter(dump_storage->dumpLabelTokensMutex);
j9str_set_time_tokens(stringTokens, now);
/* release access to the tokens */
omrthread_monitor_exit(dump_storage->dumpLabelTokensMutex);
}
omrstr_ftime_ex(timeStamp, _MaximumTimeStampLength, TIMESTAMP_FORMAT, now, OMRSTR_FTIME_FLAG_LOCAL);
timeStamp[_MaximumTimeStampLength] = '\0';
_OutputStream.writeCharacters("1TIDATETIME Date: ");
_OutputStream.writeCharacters(timeStamp);
_OutputStream.writeInteger(now % 1000, ":%03d"); /* add the milliseconds */
_OutputStream.writeCharacters("\n");
int32_t zoneSecondsEast = 0;
char zoneName[32];
_OutputStream.writeCharacters("1TITIMEZONE Timezone: ");
if (0 != omrstr_current_time_zone(&zoneSecondsEast, zoneName, sizeof(zoneName))) {
_OutputStream.writeCharacters("(unavailable)");
} else {
_OutputStream.writeCharacters("UTC");
if (0 != zoneSecondsEast) {
const char *format = (zoneSecondsEast > 0) ? "+%d" : "-%d";
uint32_t offset = ((uint32_t)((zoneSecondsEast > 0) ? zoneSecondsEast : -zoneSecondsEast)) / 60;
uint32_t hours = offset / 60;
uint32_t minutes = offset % 60;
_OutputStream.writeInteger(hours, format);
if (0 != minutes) {
_OutputStream.writeInteger(minutes, ":%02d");
}
}
if ('\0' != *zoneName) {
_OutputStream.writeCharacters(" (");
_OutputStream.writeCharacters(zoneName);
_OutputStream.writeCharacters(")");
}
}
_OutputStream.writeCharacters("\n");
_OutputStream.writeCharacters("1TINANOTIME System nanotime: ");
_OutputStream.writeInteger64(j9time_nano_time(), "%llu");
_OutputStream.writeCharacters("\n");
/* Write the file name */
_OutputStream.writeCharacters("1TIFILENAME Javacore filename: ");
_OutputStream.writeCharacters(_FileName);
_OutputStream.writeCharacters("\n");
/* Record whether this is exclusive or not */
_OutputStream.writeCharacters("1TIREQFLAGS Request Flags: ");
_OutputStream.writeInteger(_Agent->requestMask);
if (0 != _Agent->requestMask) {
const char *prefix = " (";
if (J9_ARE_ALL_BITS_SET(_Agent->requestMask, J9RAS_DUMP_DO_EXCLUSIVE_VM_ACCESS)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("exclusive");
prefix = "+";
}
if (J9_ARE_ALL_BITS_SET(_Agent->requestMask, J9RAS_DUMP_DO_COMPACT_HEAP)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("compact");
prefix = "+";
}
if (J9_ARE_ALL_BITS_SET(_Agent->requestMask, J9RAS_DUMP_DO_PREPARE_HEAP_FOR_WALK)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("prepwalk");
prefix = "+";
}
if (J9_ARE_ALL_BITS_SET(_Agent->requestMask, J9RAS_DUMP_DO_SUSPEND_OTHER_DUMPS)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("serial");
prefix = "+";
}
if (J9_ARE_ALL_BITS_SET(_Agent->requestMask, J9RAS_DUMP_DO_ATTACH_THREAD)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("attach");
prefix = "+";
}
if (J9_ARE_ALL_BITS_SET(_Agent->requestMask, J9RAS_DUMP_DO_MULTIPLE_HEAPS)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("multiple");
prefix = "+";
}
if (J9_ARE_ALL_BITS_SET(_Agent->requestMask, J9RAS_DUMP_DO_PREEMPT_THREADS)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("preempt");
prefix = "+";
}
if (' ' != *prefix) {
_OutputStream.writeCharacters(")");
}
}
_OutputStream.writeCharacters("\n");
_OutputStream.writeCharacters("1TIPREPSTATE Prep State: ");
_OutputStream.writeInteger(_Agent->prepState);
if (0 != _Agent->prepState) {
const char *prefix = " (";
if (J9_ARE_ALL_BITS_SET(_Agent->prepState, J9RAS_DUMP_GOT_LOCK)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("rasdump_lock");
prefix = "+";
}
if (J9_ARE_ALL_BITS_SET(_Agent->prepState, J9RAS_DUMP_GOT_VM_ACCESS)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("vm_access");
prefix = "+";
}
if (J9_ARE_ALL_BITS_SET(_Agent->prepState, J9RAS_DUMP_GOT_EXCLUSIVE_VM_ACCESS)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("exclusive_vm_access");
prefix = "+";
}
if (J9_ARE_ALL_BITS_SET(_Agent->prepState, J9RAS_DUMP_HEAP_COMPACTED)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("heap_compacted");
prefix = "+";
}
if (J9_ARE_ALL_BITS_SET(_Agent->prepState, J9RAS_DUMP_HEAP_PREPARED)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("heap_prepared");
prefix = "+";
}
if (J9_ARE_ALL_BITS_SET(_Agent->prepState, J9RAS_DUMP_ATTACHED_THREAD)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("attached_thread");
prefix = "+";
}
if (J9_ARE_ALL_BITS_SET(_Agent->prepState, J9RAS_DUMP_PREEMPT_THREADS)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("preempt_threads");
prefix = "+";
}
if (J9_ARE_ALL_BITS_SET(_Agent->prepState, J9RAS_DUMP_TRACE_DISABLED)) {
_OutputStream.writeCharacters(prefix);
_OutputStream.writeCharacters("trace_disabled");
prefix = "+";
}
if (' ' != *prefix) {
_OutputStream.writeCharacters(")");
}
}
_OutputStream.writeCharacters("\n");
if (J9_ARE_NO_BITS_SET(_Agent->prepState, J9RAS_DUMP_GOT_EXCLUSIVE_VM_ACCESS)) {
_OutputStream.writeCharacters("1TIPREPINFO Exclusive VM access not taken: data may not be consistent across javacore sections\n");
}
/* Write the section trailer */
_OutputStream.writeCharacters("NULL ------------------------------------------------------------------------\n");
}
/**************************************************************************************************/
/* */
/* JavaCoreDumpWriter::writeEventDrivenTitle() method implementation */
/* */
/**************************************************************************************************/
void
JavaCoreDumpWriter::writeEventDrivenTitle(void)
{
/* Write the dump event description */
_OutputStream.writeCharacters("1TISIGINFO Dump Event \"");
_OutputStream.writeCharacters(mapDumpEvent(_Context->eventFlags));
_OutputStream.writeCharacters("\" (");
_OutputStream.writeInteger(_Context->eventFlags, "%08zX");
_OutputStream.writeCharacters(")");
/* Write the event data */
J9RASdumpEventData* eventData = _Context->eventData;
if (NULL != eventData) {
_OutputStream.writeCharacters(" Detail \"");
_OutputStream.writeCharacters(eventData->detailData, eventData->detailLength);
_OutputStream.writeCharacters("\"");
writeExceptionDetail((j9object_t*)eventData->exceptionRef);
}
_OutputStream.writeCharacters(" received\n");
}
/**************************************************************************************************/
/* */
/* JavaCoreDumpWriter::writeUserRequestedTitle() method implementation */
/* */
/**************************************************************************************************/
void
JavaCoreDumpWriter::writeUserRequestedTitle(void)
{
/* Write the dump event description */
_OutputStream.writeCharacters("1TISIGINFO Dump Requested By User (");
_OutputStream.writeInteger(_Context->eventFlags, "%08zX");
_OutputStream.writeCharacters(")");
/* Write the event data */
J9RASdumpEventData* eventData = _Context->eventData;
if (NULL != eventData) {
_OutputStream.writeCharacters(" Through ");
_OutputStream.writeCharacters(eventData->detailData, eventData->detailLength);
}
_OutputStream.writeCharacters("\n");
}
/**************************************************************************************************/
/* */
/* JavaCoreDumpWriter::writeProcessorSection() method implementation */
/* */
/**************************************************************************************************/
void
JavaCoreDumpWriter::writeProcessorSection(void)
{
PORT_ACCESS_FROM_JAVAVM(_VirtualMachine);
/* Write the section header */
_OutputStream.writeCharacters(
"0SECTION GPINFO subcomponent dump routine\n"
"NULL ================================\n"
);
/* Write the operating system description */
J9RAS* j9ras = _VirtualMachine->j9ras;
const char* osName = (char*)(j9ras->osname);
const char* osVersion = (char*)(j9ras->osversion);
const char* osArchitecture = (char*)(j9ras->osarch);
int numberOfCpus = j9ras->cpus;
/* Write the operating system description */
_OutputStream.writeCharacters("2XHOSLEVEL OS Level : ");
_OutputStream.writeCharacters(osName);
_OutputStream.writeCharacters(" ");
_OutputStream.writeCharacters(osVersion);
_OutputStream.writeCharacters("\n");
/* Write the processor description */
_OutputStream.writeCharacters("2XHCPUS Processors -\n");
_OutputStream.writeCharacters("3XHCPUARCH Architecture : ");
_OutputStream.writeCharacters(osArchitecture);
_OutputStream.writeCharacters("\n");
_OutputStream.writeCharacters("3XHNUMCPUS How Many : ");
_OutputStream.writeInteger(numberOfCpus, "%i");
_OutputStream.writeCharacters("\n");
/* Write the NUMA support description */
_OutputStream.writeCharacters("3XHNUMASUP ");
if (j9port_control(J9PORT_CTLDATA_VMEM_NUMA_IN_USE, 0)) {
_OutputStream.writeCharacters("NUMA support enabled");
} else {
_OutputStream.writeCharacters("NUMA is either not supported or has been disabled by user");
}
_OutputStream.writeCharacters("\n");
/* Write the processor registers */
J9VMThread* vmThread = _Context->onThread;
if ((NULL != vmThread) && (NULL != vmThread->gpInfo)) {
_OutputStream.writeCharacters("NULL\n");
writeGPCategory(vmThread->gpInfo, "1XHEXCPCODE ", J9PORT_SIG_SIGNAL);
_OutputStream.writeCharacters("NULL\n");
writeGPCategory(vmThread->gpInfo, "1XHEXCPMODULE ", J9PORT_SIG_MODULE);
_OutputStream.writeCharacters("NULL\n");
_OutputStream.writeCharacters("1XHREGISTERS Registers:\n");
writeGPCategory(vmThread->gpInfo, "2XHREGISTER ", J9PORT_SIG_GPR);
writeGPCategory(vmThread->gpInfo, "2XHREGISTER ", J9PORT_SIG_FPR);
writeGPCategory(vmThread->gpInfo, "2XHREGISTER ", J9PORT_SIG_VR);
writeGPCategory(vmThread->gpInfo, "2XHREGISTER ", J9PORT_SIG_CONTROL);
writeJitMethod(vmThread);
_OutputStream.writeCharacters("NULL\n");
_OutputStream.writeCharacters("1XHFLAGS VM flags:");
_OutputStream.writeVPrintf("%.*zX", sizeof(void *) * 2, vmThread->omrVMThread->vmState);
_OutputStream.writeCharacters("\n");
} else {
_OutputStream.writeCharacters(
"NULL\n"
"1XHERROR2 Register dump section only produced for SIGSEGV, SIGILL or SIGFPE.\n"
);
}
/* Write the section trailer */
_OutputStream.writeCharacters(
"NULL\n"
"NULL ------------------------------------------------------------------------\n"
);
}
/**************************************************************************************************/
/* */
/* JavaCoreDumpWriter::writeEnvironmentSection() method implementation */
/* */
/**************************************************************************************************/
void
JavaCoreDumpWriter::writeEnvironmentSection(void)
{
/* Write the section header */
_OutputStream.writeCharacters(
"0SECTION ENVINFO subcomponent dump routine\n"
"NULL =================================\n"
);
/* Write the Java version data */
if (NULL != _VirtualMachine->j9ras->serviceLevel) {
_OutputStream.writeCharacters("1CIJAVAVERSION ");
_OutputStream.writeCharacters(_VirtualMachine->j9ras->serviceLevel);
_OutputStream.writeCharacters("\n");
}
/* Write the VM build data */
_OutputStream.writeCharacters("1CIVMVERSION ");
_OutputStream.writeCharacters(EsBuildVersionString);
_OutputStream.writeCharacters("\n");
#if defined(OPENJ9_TAG)
/* Write the OpenJ9 tag when it has a value */
if (strlen(OPENJ9_TAG) > 0) {
_OutputStream.writeCharacters("1CIJ9VMTAG " OPENJ9_TAG "\n");
}
#endif
/* Write the VM version data */
_OutputStream.writeCharacters("1CIJ9VMVERSION ");
_OutputStream.writeCharacters(_VirtualMachine->internalVMFunctions->getJ9VMVersionString(_VirtualMachine));
_OutputStream.writeCharacters("\n");
/* Write the JIT runtime flags and version */
#ifdef J9VM_INTERP_NATIVE_SUPPORT
_OutputStream.writeCharacters("1CIJITVERSION ");
J9JITConfig *jitConfig = _VirtualMachine->jitConfig;
if (NULL != jitConfig) {
if (NULL != jitConfig->jitLevelName) {
_OutputStream.writeCharacters(jitConfig->jitLevelName);
}
} else {
_OutputStream.writeCharacters("unavailable (JIT disabled)");
}
_OutputStream.writeCharacters("\n");
#endif
/* Write the OMR version data */