-
Notifications
You must be signed in to change notification settings - Fork 747
/
Copy pathjvmtiExtensionMechanism.c
4189 lines (3581 loc) · 133 KB
/
jvmtiExtensionMechanism.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*******************************************************************************
* Copyright IBM Corp. and others 1991
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] https://openjdk.org/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
*******************************************************************************/
#include <string.h>
#include <stdarg.h>
#include "omrcfg.h"
#include "jvmtiHelpers.h"
#include "jvmtinls.h"
#include "jvmti_internal.h"
#include "monhelp.h"
#include "VerboseGCInterface.h"
#include "omr.h"
#include <limits.h>
#include "ute.h"
typedef struct J9JVMTIExtensionFunctionInfo {
jvmtiExtensionFunction func;
const char* id;
U_32 descriptionModule;
U_32 descriptionNum;
jint param_count;
const jvmtiParamInfo * params;
jint error_count;
const jvmtiError * errors;
} J9JVMTIExtensionFunctionInfo;
typedef struct J9JVMTIExtensionEventInfo {
jint extension_event_index;
const char* id;
U_32 descriptionModule;
U_32 descriptionNum;
jint param_count;
const jvmtiParamInfo * params;
} J9JVMTIExtensionEventInfo;
static jvmtiError copyErrors (jvmtiEnv* env, jvmtiError** dest, const jvmtiError* source, jint count);
static jvmtiError copyString (jvmtiEnv* env, char** dest, const char* source);
static void freeExtensionFunctionInfo (jvmtiEnv* env, jvmtiExtensionFunctionInfo* info);
static jvmtiError copyParam (jvmtiEnv* env, jvmtiParamInfo* dest, const jvmtiParamInfo* source);
static jvmtiError copyParams (jvmtiEnv* env, jvmtiParamInfo** dest, const jvmtiParamInfo* source, jint count);
static jvmtiError JNICALL jvmtiJlmDump (jvmtiEnv* env, ...);
static jvmtiError JNICALL jvmtiDumpSet (jvmtiEnv* jvmti_env, ...);
static jvmtiError JNICALL jvmtiTraceSet (jvmtiEnv* jvmti_env, ...);
static jvmtiError JNICALL jvmtiResetVmDump (jvmtiEnv* jvmti_env, ...);
static jvmtiError JNICALL jvmtiQueryVmDump(jvmtiEnv* jvmti_env, ...);
static jvmtiError copyExtensionFunctionInfo (jvmtiEnv* env, jvmtiExtensionFunctionInfo* dest, const J9JVMTIExtensionFunctionInfo* source);
static jvmtiError JNICALL jvmtiJlmSet (jvmtiEnv* env, ...);
static jvmtiError copyExtensionEventInfo (jvmtiEnv* env, jvmtiExtensionEventInfo* dest, const J9JVMTIExtensionEventInfo* source);
static void freeExtensionEventInfo (jvmtiEnv* env, jvmtiExtensionEventInfo* info);
static jvmtiError JNICALL jvmtiTriggerVmDump (jvmtiEnv* jvmti_env, ...);
static jvmtiError JNICALL jvmtiGetOSThreadID(jvmtiEnv* jvmti_env, ...);
static jvmtiError JNICALL jvmtiGetStackTraceExtended(jvmtiEnv *env, ...);
static jvmtiError JNICALL jvmtiGetAllStackTracesExtended(jvmtiEnv *env, ...);
static jvmtiError JNICALL jvmtiGetThreadListStackTracesExtended(jvmtiEnv *env, ...);
static jvmtiError jvmtiInternalGetStackTraceExtended(jvmtiEnv *env, J9JVMTIStackTraceType type, J9VMThread *currentThread, J9VMThread *targetThread, j9object_t threadObject, jint start_depth, UDATA max_frame_count, jvmtiFrameInfo *frame_buffer, jint *count_ptr);
static UDATA jvmtiInternalGetStackTraceIteratorExtended(J9VMThread * currentThread, J9StackWalkState * walkState);
static jvmtiError JNICALL jvmtiGetHeapFreeMemory(jvmtiEnv* jvmti_env, ...);
static jvmtiError JNICALL jvmtiGetHeapTotalMemory(jvmtiEnv* jvmti_env, ...);
static jvmtiError JNICALL jvmtiIterateSharedCaches(jvmtiEnv* env, ...);
static jvmtiError JNICALL jvmtiDestroySharedCache(jvmtiEnv *env, ...);
static jvmtiError JNICALL jvmtiRemoveAllTags(jvmtiEnv* env, ...);
static jvmtiError JNICALL jvmtiRegisterTraceSubscriber(jvmtiEnv *env, ...);
static jvmtiError JNICALL jvmtiDeregisterTraceSubscriber(jvmtiEnv *env, ...);
static jvmtiError JNICALL jvmtiFlushTraceData(jvmtiEnv *env, ...);
static jvmtiError JNICALL jvmtiGetTraceMetadata(jvmtiEnv *env, ...);
static jvmtiError JNICALL jvmtiGetMethodAndClassNames(jvmtiEnv *env, ...);
static jvmtiError JNICALL jvmtiQueryVmLogOptions(jvmtiEnv* jvmti_env, ...);
static jvmtiError JNICALL jvmtiSetVmLogOptions(jvmtiEnv* jvmti_env, ...);
static jvmtiError JNICALL jvmtiJlmDumpStats (jvmtiEnv* env, ...);
static jvmtiError jvmtiJlmDumpHelper(jvmtiEnv* env, void ** dump_info, jint dump_format);
static U_32 indexFromCategoryCode( UDATA categories_mapping_size, U_32 cc );
static UDATA jvmtiGetMemoryCategoriesCallback (U_32 categoryCode, const char * categoryName, UDATA liveBytes, UDATA liveAllocations, BOOLEAN isRoot, U_32 parentCategoryCode, OMRMemCategoryWalkState * state);
static UDATA jvmtiCountMemoryCategoriesCallback (U_32 categoryCode, const char * categoryName, UDATA liveBytes, UDATA liveAllocations, BOOLEAN isRoot, U_32 parentCategoryCode, OMRMemCategoryWalkState * state);
static UDATA jvmtiCalculateSlotsForCategoriesMappingCallback(U_32 categoryCode, const char *categoryName, UDATA liveBytes, UDATA liveAllocations, BOOLEAN isRoot, U_32 parentCategoryCode, OMRMemCategoryWalkState *state);
static void fillInChildAndSiblingCategories(jvmtiMemoryCategory * categories_buffer, jint written_count);
static void fillInCategoryDeepCounters(jvmtiMemoryCategory * category);
static jvmtiError JNICALL jvmtiGetMemoryCategories(jvmtiEnv* env, ...);
static jvmtiError JNICALL jvmtiRegisterVerboseGCSubscriber(jvmtiEnv *env, ...);
static jvmtiError JNICALL jvmtiDeregisterVerboseGCSubscriber(jvmtiEnv *env, ...);
static jvmtiError JNICALL jvmtiGetJ9vmThread(jvmtiEnv *env, ...);
static jvmtiError JNICALL jvmtiGetJ9method(jvmtiEnv *env, ...);
static jvmtiError JNICALL jvmtiRegisterTracePointSubscriber(jvmtiEnv *env, ...);
static jvmtiError JNICALL jvmtiDeregisterTracePointSubscriber(jvmtiEnv *env, ...);
#if JAVA_SPEC_VERSION >= 19
static jvmtiError JNICALL jvmtiGetVirtualThread(jvmtiEnv* jvmti_env, ...);
static jvmtiError JNICALL jvmtiGetCarrierThread(jvmtiEnv* jvmti_env, ...);
#endif /* JAVA_SPEC_VERSION >= 19 */
#if defined(J9VM_OPT_CRIU_SUPPORT)
static jvmtiError JNICALL jvmtiAddDebugThreadToCheckpointState(jvmtiEnv *jvmti_env, ...);
static jvmtiError JNICALL jvmtiRemoveDebugThreadFromCheckpointState(jvmtiEnv *jvmti_env, ...);
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
/*
* Struct to encapsulate the details of a verbose GC subscriber
*/
typedef struct VerboseGCSubscriberData {
jvmtiVerboseGCSubscriber subscriber;
jvmtiVerboseGCAlarm alarm;
jvmtiEnv* env;
void* userData;
} VerboseGCSubscriberData;
static void unhookVerboseGCOutput(J9JavaVM* vm, VerboseGCSubscriberData* subscriberData);
static void hookVerboseGCOutput(J9HookInterface **hook, UDATA eventNum, void *eventData, void *userData);
/*
* Parameter lists for extended functions and events
*/
/* (jvmtiEnv *jvmti_env, jmethodID method) */
static const jvmtiParamInfo jvmtiCompilingStart_params[] = {
{ "method", JVMTI_KIND_IN, JVMTI_TYPE_JMETHODID, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, jmethodID method) */
static const jvmtiParamInfo jvmtiCompilingEnd_params[] = {
{ "method", JVMTI_KIND_IN, JVMTI_TYPE_JMETHODID, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, jobject object, jclass object_klass, jlong size) */
static const jvmtiParamInfo jvmtiInstrumentableObjectAlloc_params[] = {
{ "jni_env", JVMTI_KIND_IN_PTR, JVMTI_TYPE_JNIENV, JNI_FALSE },
{ "thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE },
{ "object", JVMTI_KIND_IN, JVMTI_TYPE_JOBJECT, JNI_FALSE },
{ "object_klass", JVMTI_KIND_IN, JVMTI_TYPE_JCLASS, JNI_FALSE },
{ "size", JVMTI_KIND_IN, JVMTI_TYPE_JLONG, JNI_FALSE }
};
static const jvmtiParamInfo jvmtiGetOSThreadID_params[] = {
{ "thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_TRUE },
{ "threadid_ptr", JVMTI_KIND_OUT, JVMTI_TYPE_JLONG, JNI_FALSE },
};
/* (jvmtiEnv *jvmti_env, jint option) */
static const jvmtiParamInfo jvmtiTraceSet_params[] = {
{ "option", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, const char* option) */
static const jvmtiParamInfo jvmtiDumpSet_params[] = {
{ "option", JVMTI_KIND_IN_BUF, JVMTI_TYPE_CCHAR, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, jint option) */
static const jvmtiParamInfo jvmtiJlmSet_params[] = {
{ "option", JVMTI_KIND_IN_PTR, JVMTI_TYPE_JINT, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, ** JlmDump) */
static const jvmtiParamInfo jvmtiJlmDump_params[] = {
{ "jlm_dump_ptr", JVMTI_KIND_ALLOC_BUF, JVMTI_TYPE_CVOID, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, const char* option) */
static const jvmtiParamInfo jvmtiTriggerVmDump_params[] = {
{ "option", JVMTI_KIND_IN_BUF, JVMTI_TYPE_CCHAR, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, jint option) */
static const jvmtiParamInfo jvmtiVmDumpStart_params[] = {
{ "label", JVMTI_KIND_IN_BUF, JVMTI_TYPE_CCHAR, JNI_FALSE },
{ "event", JVMTI_KIND_IN_BUF, JVMTI_TYPE_CCHAR, JNI_FALSE },
{ "detail", JVMTI_KIND_IN_BUF, JVMTI_TYPE_CCHAR, JNI_TRUE }
};
/* (jvmtiEnv *jvmti_env, jint option) */
static const jvmtiParamInfo jvmtiVmDumpEnd_params[] = {
{ "label", JVMTI_KIND_IN_BUF, JVMTI_TYPE_CCHAR, JNI_FALSE },
{ "event", JVMTI_KIND_IN_BUF, JVMTI_TYPE_CCHAR, JNI_FALSE },
{ "detail", JVMTI_KIND_IN_BUF, JVMTI_TYPE_CCHAR, JNI_TRUE }
};
/* (jvmtiEnv *jvmti_env, jthread thread, jint start_depth, jint max_frame_count, void* frame_buffer, jint* count_ptr ) */
static const jvmtiParamInfo jvmtiGetStackTraceExtended_params[] = {
{ "type", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE },
{ "start_depth", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "max_frame_count", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "frame_buffer", JVMTI_KIND_OUT_BUF, JVMTI_TYPE_CVOID, JNI_FALSE },
{ "count_ptr", JVMTI_KIND_OUT, JVMTI_TYPE_JINT, JNI_FALSE },
};
/* (jvmtiEnv *jvmti_env, jint max_frame_count, void** stack_info_ptr, jint* thread_count_ptr ) */
static const jvmtiParamInfo jvmtiGetAllStackTracesExtended_params[] = {
{ "type", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "max_frame_count", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "stack_info_ptr", JVMTI_KIND_ALLOC_BUF, JVMTI_TYPE_CVOID, JNI_FALSE },
{ "thread_count_ptr", JVMTI_KIND_OUT, JVMTI_TYPE_JINT, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, jint thread_count, jthread* thread_list, jint max_frame_count, void** stack_info_ptr) */
static const jvmtiParamInfo jvmtiGetThreadListStackTracesExtended_params[] = {
{ "type", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "thread_count", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "thread_list", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE },
{ "max_frame_count", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "stack_info_ptr", JVMTI_KIND_ALLOC_BUF, JVMTI_TYPE_CVOID, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, jlong *heapFree_ptr) */
static const jvmtiParamInfo jvmtiGetHeapFreeMemory_params[] = {
{ "heapFree_ptr", JVMTI_KIND_OUT, JVMTI_TYPE_JLONG, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, jlong *heapTotal_ptr) */
static const jvmtiParamInfo jvmtiGetHeapTotalMemory_params[] = {
{ "heapTotal_ptr", JVMTI_KIND_OUT, JVMTI_TYPE_JLONG, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, jint version, const char *cacheDir, jboolean useCommandLineValues, jvmtiIterateSharedCachesCallback *callback, void *user_data) */
static const jvmtiParamInfo jvmtiIterateSharedCaches_params[] = {
{ "version", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "cacheDir", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CCHAR, JNI_TRUE },
{ "flags", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "useCommandLineValues", JVMTI_KIND_IN, JVMTI_TYPE_JBOOLEAN, JNI_FALSE },
{ "callback", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_FALSE },
{ "user_data", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_TRUE }
};
/* (jvmtiEnv *jvmti_env, const char *cacheDir, char *name, jint persistence, jboolean useCommandLineValues) */
static const jvmtiParamInfo jvmtiDestroySharedCache_params[] = {
{ "cacheDir", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CCHAR, JNI_TRUE },
{ "name", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CCHAR, JNI_TRUE },
{ "persistence", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "useCommandLineValues", JVMTI_KIND_IN, JVMTI_TYPE_JBOOLEAN, JNI_FALSE },
{ "internalErrorCode", JVMTI_KIND_OUT, JVMTI_TYPE_JINT, JNI_TRUE }
};
/* (jvmtiEnv *jvmti_env, char *description, jvmtiTraceSubscriber *subscriber, jvmtiTraceAlarm *alarm, void *userData, void **subscriptionID) */
static const jvmtiParamInfo jvmtiRegisterTraceSubscriber_params[] = {
{ "description", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CCHAR, JNI_FALSE },
{ "subscriber", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_FALSE },
{ "alarm", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_TRUE },
{ "user_data", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_TRUE },
{ "subscription_id", JVMTI_KIND_OUT, JVMTI_TYPE_CVOID, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, jvmtiTraceSubscriber *subscriber, void (*alarm)(void)) */
static const jvmtiParamInfo jvmtiDeregisterTraceSubscriber_params[] = {
{ "subscription_id", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, jvmtiTraceSubscriber *subscriber, void (*alarm)(void)) */
static const jvmtiParamInfo jvmtiGetTraceMetadata_params[] = {
{ "data", JVMTI_KIND_OUT, JVMTI_TYPE_CVOID, JNI_FALSE },
{ "length", JVMTI_KIND_OUT, JVMTI_TYPE_JINT, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, void * ramMethods, jint ramMethodCount, jvmtiExtensionRamMethodData * ramMethodDataDescriptors,
jchar * ramMethodStrings, jint * ramMethodDataDescriptorsCount) */
static const jvmtiParamInfo jvmtiGetMethodAndClassNames_params[] = {
{ "ramMethods", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_FALSE },
{ "ramMethodCount", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "ramMethodDataDescriptors", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CCHAR, JNI_FALSE },
{ "ramMethodStrings", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CCHAR, JNI_FALSE },
{ "ramMethodStringsSize", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "ramMethodDataDescriptorsCount", JVMTI_KIND_IN_PTR, JVMTI_TYPE_JINT, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, jobject object, jint buffer_size, void* options_buffer, jint* data_size_ptr) */
static const jvmtiParamInfo jvmtiQueryVmLogOptions_params[] = {
{ "buffer_size", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "options_buffer", JVMTI_KIND_OUT_BUF, JVMTI_TYPE_CVOID, JNI_FALSE },
{ "data_size_ptr", JVMTI_KIND_OUT, JVMTI_TYPE_JINT, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, void *options_buffer) */
static const jvmtiParamInfo jvmtiSetVmLogOptions_params[] = {
{ "options_buffer", JVMTI_KIND_IN_BUF, JVMTI_TYPE_CCHAR, JNI_FALSE }
};
/* (jvmtiEnv * jvmti_env, ** dump_info, jint dump_format) */
static const jvmtiParamInfo jvmtiJlmDumpStats_params[] = {
{ "dump_info", JVMTI_KIND_ALLOC_BUF, JVMTI_TYPE_CVOID, JNI_FALSE },
{ "dump_format", JVMTI_KIND_IN_BUF, JVMTI_TYPE_JINT, JNI_FALSE }
};
/* (jvmtiEnv* env, jint version, jint max_categories, jvmtiMemoryCategory * categories_buffer, jint * written_count_ptr, jint * total_categories_ptr) */
static const jvmtiParamInfo jvmtiGetMemoryCategories_params[] = {
{ "version", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "max_categories", JVMTI_KIND_IN, JVMTI_TYPE_JINT, JNI_FALSE },
{ "categories_buffer", JVMTI_KIND_OUT_BUF, JVMTI_TYPE_CCHAR, JNI_TRUE },
{ "written_count_ptr", JVMTI_KIND_OUT, JVMTI_TYPE_JINT, JNI_TRUE },
{ "total_categories_ptr", JVMTI_KIND_OUT, JVMTI_TYPE_JINT, JNI_TRUE }
};
/* (jvmtiEnv *env, char *description, jvmtiVerboseGCSubscriber subscriber, jvmtiVerboseGCAlarm alarm, void *userData, void **subscriptionID) */
static const jvmtiParamInfo jvmtiRegisterVerboseGCSubscriber_params[] = {
{ "description", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CCHAR, JNI_FALSE },
{ "subscriber", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_FALSE },
{ "alarm", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_TRUE },
{ "user_data", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_TRUE },
{ "subscription_id", JVMTI_KIND_OUT, JVMTI_TYPE_CVOID, JNI_FALSE }
};
/* (jvmtiEnv *env, void *subscriptionID) */
static const jvmtiParamInfo jvmtiDeregisterVerboseGCSubscriber_params[] = {
{ "subscription_id", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_FALSE }
};
static const jvmtiParamInfo jvmtiGetJ9vmThread_params[] = {
{ "thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_TRUE },
{ "vmThreadPtr", JVMTI_KIND_OUT, JVMTI_TYPE_CVOID, JNI_TRUE }
};
static const jvmtiParamInfo jvmtiGetJ9method_params[] = {
{ "mid", JVMTI_KIND_IN, JVMTI_TYPE_JMETHODID, JNI_TRUE },
{ "j9MethodPtr", JVMTI_KIND_OUT, JVMTI_TYPE_CVOID, JNI_TRUE }
};
/* (jvmtiEnv *env, char *description, jvmtiTraceSubscriber subscriber, jvmtiTraceAlarm alarm, void *userData, void **subscriptionID) */
static const jvmtiParamInfo jvmtiRegisterTracePointSubscriber_params[] = {
{ "description", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CCHAR, JNI_FALSE },
{ "subscriber", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_FALSE },
{ "alarm", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_FALSE },
{ "userData", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_TRUE },
{ "subscriptionID", JVMTI_KIND_OUT, JVMTI_TYPE_CVOID, JNI_FALSE }
};
/* (jvmtiEnv *env, void *subscriptionID) */
static const jvmtiParamInfo jvmtiDeregisterTracepointSubscriber_params[] = {
{ "subscriptionID", JVMTI_KIND_IN_PTR, JVMTI_TYPE_CVOID, JNI_FALSE }
};
#if JAVA_SPEC_VERSION >= 19
/* (jvmtiEnv *jvmti_env, jthread thread) */
static const jvmtiParamInfo jvmtiVirtualThreadMount_params[] = {
{ "jni_env", JVMTI_KIND_IN_PTR, JVMTI_TYPE_JNIENV, JNI_FALSE },
{ "thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE }
};
static const jvmtiParamInfo jvmtiVirtualThreadUnmount_params[] = {
{ "jni_env", JVMTI_KIND_IN_PTR, JVMTI_TYPE_JNIENV, JNI_FALSE },
{ "thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE }
};
/* (jvmtiEnv *jvmti_env, jthread thread) */
static const jvmtiParamInfo jvmtiVirtualThreadDestroy_params[] = {
{ "jni_env", JVMTI_KIND_IN_PTR, JVMTI_TYPE_JNIENV, JNI_FALSE },
{ "thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE }
};
#endif /* JAVA_SPEC_VERSION >= 19 */
#if JAVA_SPEC_VERSION >= 19
/* (jvmtiEnv *jvmti_env, jthread carrier_thread, jthread *virtual_thread_ptr) */
static const jvmtiParamInfo jvmtiGetVirtualThread_params[] = {
{ "carrier_thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE },
{ "virtual_thread_ptr", JVMTI_KIND_OUT, JVMTI_TYPE_JTHREAD, JNI_FALSE },
};
/* (jvmtiEnv *jvmti_env, jthread virtual_thread, jthread *carrier_thread_ptr) */
static const jvmtiParamInfo jvmtiGetCarrierThread_params[] = {
{ "virtual_thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE },
{ "carrier_thread_ptr", JVMTI_KIND_OUT, JVMTI_TYPE_JTHREAD, JNI_FALSE },
};
#endif /* JAVA_SPEC_VERSION >= 19 */
#if defined(J9VM_OPT_CRIU_SUPPORT)
/* (jvmtiEnv *jvmti_env, jthread thread) */
static const jvmtiParamInfo jvmtiVMCheckpoint_params[] = {
{ "jni_env", JVMTI_KIND_IN_PTR, JVMTI_TYPE_JNIENV, JNI_FALSE },
{ "thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE },
};
/* (jvmtiEnv *jvmti_env, jthread thread) */
static const jvmtiParamInfo jvmtiVMRestore_params[] = {
{ "jni_env", JVMTI_KIND_IN_PTR, JVMTI_TYPE_JNIENV, JNI_FALSE },
{ "thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE },
};
/* (jvmtiEnv *jvmti_env, jthread thread) */
static const jvmtiParamInfo jvmtiAddDebugThreadToCheckpointState_params[] = {
{ "jni_env", JVMTI_KIND_IN_PTR, JVMTI_TYPE_JNIENV, JNI_FALSE },
{ "thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE },
};
/* (jvmtiEnv *jvmti_env, jthread thread) */
static const jvmtiParamInfo jvmtiRemoveDebugThreadFromCheckpointState_params[] = {
{ "jni_env", JVMTI_KIND_IN_PTR, JVMTI_TYPE_JNIENV, JNI_FALSE },
{ "thread", JVMTI_KIND_IN, JVMTI_TYPE_JTHREAD, JNI_FALSE },
};
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
/*
* Error lists for extended functions
*/
static const jvmtiError nullPointer_errors[] = {
JVMTI_ERROR_NULL_POINTER
};
static const jvmtiError notAvailable_errors[] = {
JVMTI_ERROR_NOT_AVAILABLE
};
static const jvmtiError ras_errors[] = {
JVMTI_ERROR_NULL_POINTER,
JVMTI_ERROR_OUT_OF_MEMORY,
JVMTI_ERROR_INVALID_ENVIRONMENT,
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_INTERNAL,
JVMTI_ERROR_NOT_AVAILABLE,
JVMTI_ERROR_ILLEGAL_ARGUMENT
};
static const jvmtiError jlm_set_errors[] = {
JVMTI_ERROR_NULL_POINTER,
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_INTERNAL,
JVMTI_ERROR_NOT_AVAILABLE
};
static const jvmtiError jlm_dump_errors[] = {
JVMTI_ERROR_NULL_POINTER,
JVMTI_ERROR_OUT_OF_MEMORY,
JVMTI_ERROR_INVALID_ENVIRONMENT,
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_INTERNAL,
JVMTI_ERROR_NOT_AVAILABLE,
JVMTI_ERROR_ILLEGAL_ARGUMENT
};
static const jvmtiError get_os_thread_id_errors[] = {
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_INVALID_THREAD,
JVMTI_ERROR_THREAD_NOT_ALIVE,
JVMTI_ERROR_NULL_POINTER
};
static const jvmtiError jvmtiGetStack_errors[] = {
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_INVALID_THREAD,
JVMTI_ERROR_THREAD_NOT_ALIVE,
JVMTI_ERROR_NULL_POINTER,
JVMTI_ERROR_ILLEGAL_ARGUMENT,
JVMTI_ERROR_OUT_OF_MEMORY
};
static const jvmtiError jvmtiIterateSharedCaches_errors[] = {
JVMTI_ERROR_NULL_POINTER,
JVMTI_ERROR_OUT_OF_MEMORY,
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_INTERNAL,
JVMTI_ERROR_NOT_AVAILABLE,
JVMTI_ERROR_UNSUPPORTED_VERSION,
JVMTI_ERROR_ILLEGAL_ARGUMENT,
JVMTI_ERROR_INVALID_ENVIRONMENT
};
static const jvmtiError jvmtiDestroySharedCache_errors[] = {
JVMTI_ERROR_OUT_OF_MEMORY,
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_INTERNAL,
JVMTI_ERROR_NOT_AVAILABLE,
JVMTI_ERROR_ILLEGAL_ARGUMENT,
JVMTI_ERROR_INVALID_ENVIRONMENT
};
static const jvmtiError jvmtiRegisterTraceSubscriber_errors[] = {
JVMTI_ERROR_NULL_POINTER,
JVMTI_ERROR_OUT_OF_MEMORY,
JVMTI_ERROR_INVALID_ENVIRONMENT,
JVMTI_ERROR_WRONG_PHASE
};
static const jvmtiError jvmtiDeregisterTraceSubscriber_errors[] = {
JVMTI_ERROR_NULL_POINTER,
JVMTI_ERROR_OUT_OF_MEMORY,
JVMTI_ERROR_INVALID_ENVIRONMENT,
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_ILLEGAL_ARGUMENT,
JVMTI_ERROR_NOT_AVAILABLE
};
static const jvmtiError jvmtiFlushTraceData_errors[] = {
JVMTI_ERROR_OUT_OF_MEMORY,
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_INVALID_ENVIRONMENT
};
static const jvmtiError jvmtiGetTraceMetadata_errors[] = {
JVMTI_ERROR_NULL_POINTER,
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_INVALID_ENVIRONMENT
};
static const jvmtiError jvmtiGetMemoryCategories_errors[] = {
JVMTI_ERROR_UNSUPPORTED_VERSION,
JVMTI_ERROR_ILLEGAL_ARGUMENT,
JVMTI_ERROR_INVALID_ENVIRONMENT,
JVMTI_ERROR_OUT_OF_MEMORY
};
static const jvmtiError jvmtiRegisterVerboseGCSubscriber_errors[] = {
JVMTI_ERROR_NULL_POINTER,
JVMTI_ERROR_OUT_OF_MEMORY,
JVMTI_ERROR_INVALID_ENVIRONMENT,
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_INTERNAL
};
static const jvmtiError jvmtiDeregisterVerboseGCSubscriber_errors[] = {
JVMTI_ERROR_NULL_POINTER,
JVMTI_ERROR_OUT_OF_MEMORY,
JVMTI_ERROR_INVALID_ENVIRONMENT,
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_NOT_AVAILABLE
};
static const jvmtiError jvmtiGet_j9vmthread_errors[] = {
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_INVALID_THREAD,
JVMTI_ERROR_THREAD_NOT_ALIVE,
JVMTI_ERROR_NULL_POINTER
};
static const jvmtiError jvmtiGet_j9method_errors[] = {
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_NOT_AVAILABLE,
JVMTI_ERROR_NULL_POINTER
};
static const jvmtiError jvmtiRegisterTracePointSubscriber_errors[] = {
JVMTI_ERROR_NULL_POINTER,
JVMTI_ERROR_OUT_OF_MEMORY,
JVMTI_ERROR_INVALID_ENVIRONMENT,
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_INTERNAL
};
static const jvmtiError jvmtiDeregisterTracePointSubscriber_errors[] = {
JVMTI_ERROR_NULL_POINTER,
JVMTI_ERROR_OUT_OF_MEMORY,
JVMTI_ERROR_INVALID_ENVIRONMENT,
JVMTI_ERROR_WRONG_PHASE,
JVMTI_ERROR_NOT_AVAILABLE,
JVMTI_ERROR_INTERNAL
};
#if JAVA_SPEC_VERSION >= 19
static const jvmtiError get_virtual_thread_errors[] = {
JVMTI_ERROR_INVALID_THREAD,
JVMTI_ERROR_MUST_POSSESS_CAPABILITY
};
static const jvmtiError get_carrier_thread_errors[] = {
JVMTI_ERROR_INVALID_THREAD,
JVMTI_ERROR_MUST_POSSESS_CAPABILITY
};
#endif /* JAVA_SPEC_VERSION >= 19 */
#if defined(J9VM_OPT_CRIU_SUPPORT)
static const jvmtiError jvmtiAddDebugThreadToCheckpointState_errors[] = {
JVMTI_ERROR_OUT_OF_MEMORY,
};
static const jvmtiError jvmtiRemoveDebugThreadFromCheckpointState_errors[] = {
JVMTI_ERROR_INVALID_THREAD,
};
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
#define SIZE_AND_TABLE(table) (sizeof(table) / sizeof(table[0])) , (table)
#define EMPTY_SIZE_AND_TABLE 0, NULL
/*
* The extension function table
*/
static const J9JVMTIExtensionFunctionInfo J9JVMTIExtensionFunctionInfoTable[] = {
{
(jvmtiExtensionFunction) jvmtiTraceSet,
COM_IBM_SET_VM_TRACE,
J9NLS_JVMTI_COM_IBM_JVM_TRACE_SET_DESCRIPTION,
SIZE_AND_TABLE(jvmtiTraceSet_params),
SIZE_AND_TABLE(ras_errors)
},
{
(jvmtiExtensionFunction) jvmtiDumpSet,
COM_IBM_SET_VM_DUMP,
J9NLS_JVMTI_COM_IBM_JVM_DUMP_SET_DESCRIPTION,
SIZE_AND_TABLE(jvmtiDumpSet_params),
SIZE_AND_TABLE(ras_errors)
},
{
(jvmtiExtensionFunction) jvmtiJlmSet,
COM_IBM_SET_VM_JLM,
J9NLS_JVMTI_COM_IBM_JVM_JLM_SET_DESCRIPTION,
SIZE_AND_TABLE(jvmtiJlmSet_params),
SIZE_AND_TABLE(jlm_set_errors)
},
{
(jvmtiExtensionFunction) jvmtiJlmDump,
COM_IBM_SET_VM_JLM_DUMP,
J9NLS_JVMTI_COM_IBM_JVM_JLM_DUMP_DESCRIPTION,
SIZE_AND_TABLE(jvmtiJlmDump_params),
SIZE_AND_TABLE(jlm_dump_errors)
},
{
(jvmtiExtensionFunction) jvmtiTriggerVmDump,
COM_IBM_TRIGGER_VM_DUMP,
J9NLS_JVMTI_COM_IBM_JVM_TRIGGER_VM_DUMP_DESCRIPTION,
SIZE_AND_TABLE(jvmtiTriggerVmDump_params),
SIZE_AND_TABLE(ras_errors)
},
{
(jvmtiExtensionFunction) jvmtiGetOSThreadID,
COM_IBM_GET_OS_THREAD_ID,
J9NLS_JVMTI_COM_IBM_GET_OS_THREAD_ID,
SIZE_AND_TABLE(jvmtiGetOSThreadID_params),
SIZE_AND_TABLE(get_os_thread_id_errors)
},
{
(jvmtiExtensionFunction) jvmtiGetStackTraceExtended,
COM_IBM_GET_STACK_TRACE_EXTENDED,
J9NLS_JVMTI_COM_IBM_GET_STACK_TRACE_EXTENDED_DESCRIPTION,
SIZE_AND_TABLE(jvmtiGetStackTraceExtended_params),
SIZE_AND_TABLE(jvmtiGetStack_errors)
},
{
(jvmtiExtensionFunction) jvmtiGetAllStackTracesExtended,
COM_IBM_GET_ALL_STACK_TRACES_EXTENDED,
J9NLS_JVMTI_COM_IBM_GET_ALL_STACK_TRACES_EXTENDED_DESCRIPTION,
SIZE_AND_TABLE(jvmtiGetAllStackTracesExtended_params),
SIZE_AND_TABLE(jvmtiGetStack_errors)
},
{
(jvmtiExtensionFunction) jvmtiGetThreadListStackTracesExtended,
COM_IBM_GET_THREAD_LIST_STACK_TRACES_EXTENDED,
J9NLS_JVMTI_COM_IBM_GET_THREAD_LIST_STACK_TRACES_EXTENDED_DESCRIPTION,
SIZE_AND_TABLE(jvmtiGetThreadListStackTracesExtended_params),
SIZE_AND_TABLE(jvmtiGetStack_errors)
},
{
(jvmtiExtensionFunction) jvmtiResetVmDump,
COM_IBM_RESET_VM_DUMP,
J9NLS_JVMTI_COM_IBM_JVM_RESET_VM_DUMP_DESCRIPTION,
0, NULL,
SIZE_AND_TABLE(ras_errors)
},
{
(jvmtiExtensionFunction) jvmtiGetHeapFreeMemory,
COM_IBM_GET_HEAP_FREE_MEMORY,
J9NLS_JVMTI_COM_IBM_GET_HEAP_FREE_MEMORY_DESCRIPTION,
SIZE_AND_TABLE(jvmtiGetHeapFreeMemory_params),
SIZE_AND_TABLE(nullPointer_errors)
},
{
(jvmtiExtensionFunction) jvmtiGetHeapTotalMemory,
COM_IBM_GET_HEAP_TOTAL_MEMORY,
J9NLS_JVMTI_COM_IBM_GET_HEAP_TOTAL_MEMORY_DESCRIPTION,
SIZE_AND_TABLE(jvmtiGetHeapTotalMemory_params),
SIZE_AND_TABLE(nullPointer_errors)
},
{
(jvmtiExtensionFunction) jvmtiIterateSharedCaches,
COM_IBM_ITERATE_SHARED_CACHES,
J9NLS_JVMTI_COM_IBM_JVM_ITERATE_SHARED_CACHES_DESCRIPTION,
SIZE_AND_TABLE(jvmtiIterateSharedCaches_params),
SIZE_AND_TABLE(jvmtiIterateSharedCaches_errors)
},
{
(jvmtiExtensionFunction) jvmtiDestroySharedCache,
COM_IBM_DESTROY_SHARED_CACHE,
J9NLS_JVMTI_COM_IBM_JVM_DESTROY_SHARED_CACHE_DESCRIPTION,
SIZE_AND_TABLE(jvmtiDestroySharedCache_params),
SIZE_AND_TABLE(jvmtiDestroySharedCache_errors)
},
{
(jvmtiExtensionFunction) jvmtiRemoveAllTags,
COM_IBM_REMOVE_ALL_TAGS,
J9NLS_JVMTI_COM_IBM_REMOVE_ALL_TAGS,
0, NULL,
SIZE_AND_TABLE(notAvailable_errors)
},
{
(jvmtiExtensionFunction) jvmtiRegisterTraceSubscriber,
COM_IBM_REGISTER_TRACE_SUBSCRIBER,
J9NLS_JVMTI_COM_IBM_JVM_REGISTER_TRACE_SUBSCRIBER_DESCRIPTION,
SIZE_AND_TABLE(jvmtiRegisterTraceSubscriber_params),
SIZE_AND_TABLE(jvmtiRegisterTraceSubscriber_errors)
},
{
(jvmtiExtensionFunction) jvmtiDeregisterTraceSubscriber,
COM_IBM_DEREGISTER_TRACE_SUBSCRIBER,
J9NLS_JVMTI_COM_IBM_JVM_DEREGISTER_TRACE_SUBSCRIBER_DESCRIPTION,
SIZE_AND_TABLE(jvmtiDeregisterTraceSubscriber_params),
SIZE_AND_TABLE(jvmtiDeregisterTraceSubscriber_errors)
},
{
(jvmtiExtensionFunction) jvmtiFlushTraceData,
COM_IBM_FLUSH_TRACE_DATA,
J9NLS_JVMTI_COM_IBM_JVM_FLUSH_TRACE_DATA_DESCRIPTION,
0, NULL,
SIZE_AND_TABLE(jvmtiFlushTraceData_errors)
},
{
(jvmtiExtensionFunction) jvmtiGetTraceMetadata,
COM_IBM_GET_TRACE_METADATA,
J9NLS_JVMTI_COM_IBM_JVM_GET_TRACE_METADATA_DESCRIPTION,
SIZE_AND_TABLE(jvmtiGetTraceMetadata_params),
SIZE_AND_TABLE(jvmtiGetTraceMetadata_errors)
},
{
(jvmtiExtensionFunction) jvmtiGetMethodAndClassNames,
COM_IBM_GET_METHOD_AND_CLASS_NAMES,
J9NLS_JVMTI_COM_IBM_GET_METHOD_AND_CLASS_NAMES,
SIZE_AND_TABLE(jvmtiGetMethodAndClassNames_params),
SIZE_AND_TABLE(jvmtiFlushTraceData_errors)
},
{
(jvmtiExtensionFunction) jvmtiQueryVmDump,
COM_IBM_QUERY_VM_DUMP,
J9NLS_JVMTI_COM_IBM_QUERY_VM_DUMP,
0, NULL,
SIZE_AND_TABLE(ras_errors)
},
{
(jvmtiExtensionFunction) jvmtiQueryVmLogOptions,
COM_IBM_QUERY_VM_LOG_OPTIONS,
J9NLS_JVMTI_COM_IBM_QUERY_VM_LOG_OPTIONS,
SIZE_AND_TABLE(jvmtiQueryVmLogOptions_params),
SIZE_AND_TABLE(ras_errors)
},
{
(jvmtiExtensionFunction) jvmtiSetVmLogOptions,
COM_IBM_SET_VM_LOG_OPTIONS,
J9NLS_JVMTI_COM_IBM_SET_VM_LOG_OPTIONS,
SIZE_AND_TABLE(jvmtiSetVmLogOptions_params),
SIZE_AND_TABLE(ras_errors)
},
{
(jvmtiExtensionFunction) jvmtiJlmDumpStats,
COM_IBM_JLM_DUMP_STATS,
J9NLS_JVMTI_COM_IBM_JLM_STATS_DUMP_DESCRIPTION,
SIZE_AND_TABLE(jvmtiJlmDumpStats_params),
SIZE_AND_TABLE(jlm_dump_errors)
},
{
(jvmtiExtensionFunction) jvmtiGetMemoryCategories,
COM_IBM_GET_MEMORY_CATEGORIES,
J9NLS_JVMTI_COM_IBM_GET_MEMORY_CATEGORIES_DESCRIPTION,
SIZE_AND_TABLE(jvmtiGetMemoryCategories_params),
SIZE_AND_TABLE(jvmtiGetMemoryCategories_errors)
},
{
(jvmtiExtensionFunction) jvmtiRegisterVerboseGCSubscriber,
COM_IBM_REGISTER_VERBOSEGC_SUBSCRIBER,
J9NLS_JVMTI_COM_IBM_JVM_REGISTER_VERBOSEGC_SUBSCRIBER_DESCRIPTION,
SIZE_AND_TABLE(jvmtiRegisterVerboseGCSubscriber_params),
SIZE_AND_TABLE(jvmtiRegisterVerboseGCSubscriber_errors)
},
{
(jvmtiExtensionFunction) jvmtiDeregisterVerboseGCSubscriber,
COM_IBM_DEREGISTER_VERBOSEGC_SUBSCRIBER,
J9NLS_JVMTI_COM_IBM_JVM_DEREGISTER_VERBOSEGC_SUBSCRIBER_DESCRIPTION,
SIZE_AND_TABLE(jvmtiDeregisterVerboseGCSubscriber_params),
SIZE_AND_TABLE(jvmtiDeregisterVerboseGCSubscriber_errors)
},
{
(jvmtiExtensionFunction) jvmtiGetJ9vmThread,
COM_IBM_GET_J9VMTHREAD,
J9NLS_JVMTI_COM_IBM_GET_J9VMTHREAD,
SIZE_AND_TABLE(jvmtiGetJ9vmThread_params),
SIZE_AND_TABLE(jvmtiGet_j9vmthread_errors)
},
{
(jvmtiExtensionFunction) jvmtiGetJ9method,
COM_IBM_GET_J9METHOD,
J9NLS_JVMTI_COM_IBM_GET_J9METHOD,
SIZE_AND_TABLE(jvmtiGetJ9method_params),
SIZE_AND_TABLE(jvmtiGet_j9method_errors)
},
{
(jvmtiExtensionFunction) jvmtiRegisterTracePointSubscriber,
COM_IBM_REGISTER_TRACEPOINT_SUBSCRIBER,
J9NLS_JVMTI_COM_IBM_JVM_REGISTER_TRACEPOINT_SUBSCRIBER_DESCRIPTION,
SIZE_AND_TABLE(jvmtiRegisterTracePointSubscriber_params),
SIZE_AND_TABLE(jvmtiRegisterTracePointSubscriber_errors)
},
{
(jvmtiExtensionFunction) jvmtiDeregisterTracePointSubscriber,
COM_IBM_DEREGISTER_TRACEPOINT_SUBSCRIBER,
J9NLS_JVMTI_COM_IBM_JVM_DEREGISTER_TRACEPOINT_SUBSCRIBER_DESCRIPTION,
SIZE_AND_TABLE(jvmtiDeregisterTracepointSubscriber_params),
SIZE_AND_TABLE(jvmtiDeregisterTracePointSubscriber_errors)
},
#if JAVA_SPEC_VERSION >= 19
{
(jvmtiExtensionFunction)jvmtiGetVirtualThread,
COM_SUN_HOTSPOT_FUNCTIONS_GET_VIRTUAL_THREAD,
J9NLS_JVMTI_COM_SUN_HOTSPOT_FUNCTIONS_GET_VIRTUAL_THREAD,
SIZE_AND_TABLE(jvmtiGetVirtualThread_params),
SIZE_AND_TABLE(get_virtual_thread_errors)
},
{
(jvmtiExtensionFunction)jvmtiGetCarrierThread,
COM_SUN_HOTSPOT_FUNCTIONS_GET_CARRIER_THREAD,
J9NLS_JVMTI_COM_SUN_HOTSPOT_FUNCTIONS_GET_CARRIER_THREAD,
SIZE_AND_TABLE(jvmtiGetCarrierThread_params),
SIZE_AND_TABLE(get_carrier_thread_errors)
},
#endif /* JAVA_SPEC_VERSION >= 19 */
#if defined(J9VM_OPT_CRIU_SUPPORT)
{
(jvmtiExtensionFunction) jvmtiAddDebugThreadToCheckpointState,
OPENJ9_FUNCTION_ADD_DEBUG_THREAD,
J9NLS_J9JVMTI_OPENJ9_FUNCTION_ADD_DEBUG_THREAD,
SIZE_AND_TABLE(jvmtiAddDebugThreadToCheckpointState_params),
SIZE_AND_TABLE(jvmtiAddDebugThreadToCheckpointState_errors),
},
{
(jvmtiExtensionFunction) jvmtiRemoveDebugThreadFromCheckpointState,
OPENJ9_FUNCTION_REMOVE_DEBUG_THREAD,
J9NLS_J9JVMTI_OPENJ9_FUNCTION_REMOVE_DEBUG_THREAD,
SIZE_AND_TABLE(jvmtiRemoveDebugThreadFromCheckpointState_params),
SIZE_AND_TABLE(jvmtiRemoveDebugThreadFromCheckpointState_errors),
},
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
};
#define NUM_EXTENSION_FUNCTIONS (sizeof(J9JVMTIExtensionFunctionInfoTable) / sizeof(J9JVMTIExtensionFunctionInfoTable[0]))
/*
* The extension event table
*/
static const J9JVMTIExtensionEventInfo J9JVMTIExtensionEventInfoTable[] = {
{
J9JVMTI_EVENT_COM_IBM_COMPILING_START,
COM_IBM_COMPILING_START,
J9NLS_JVMTI_COM_IBM_COMPILING_START_DESCRIPTION,
SIZE_AND_TABLE(jvmtiCompilingStart_params),
},
{
J9JVMTI_EVENT_COM_IBM_COMPILING_END,
COM_IBM_COMPILING_END,
J9NLS_JVMTI_COM_IBM_COMPILING_END_DESCRIPTION,
SIZE_AND_TABLE(jvmtiCompilingEnd_params),
},
{
J9JVMTI_EVENT_COM_IBM_INSTRUMENTABLE_OBJECT_ALLOC,
COM_IBM_INSTRUMENTABLE_OBJECT_ALLOC,
J9NLS_JVMTI_COM_IBM_INSTRUMENTABLE_OBJET_ALLOC,
SIZE_AND_TABLE(jvmtiInstrumentableObjectAlloc_params),
},
{
J9JVMTI_EVENT_COM_IBM_VM_DUMP_START,
COM_IBM_VM_DUMP_START,
J9NLS_JVMTI_COM_IBM_VM_DUMP_START,
SIZE_AND_TABLE(jvmtiVmDumpStart_params),
},
{
J9JVMTI_EVENT_COM_IBM_VM_DUMP_END,
COM_IBM_VM_DUMP_END,
J9NLS_JVMTI_COM_IBM_VM_DUMP_END,
SIZE_AND_TABLE(jvmtiVmDumpEnd_params),
},
{
J9JVMTI_EVENT_COM_IBM_GARBAGE_COLLECTION_CYCLE_START,
COM_IBM_GARBAGE_COLLECTION_CYCLE_START,
J9NLS_JVMTI_COM_IBM_GARBAGE_COLLECTION_CYCLE_START_DESCRIPTION,
EMPTY_SIZE_AND_TABLE,
},
{
J9JVMTI_EVENT_COM_IBM_GARBAGE_COLLECTION_CYCLE_FINISH,
COM_IBM_GARBAGE_COLLECTION_CYCLE_FINISH,
J9NLS_JVMTI_COM_IBM_GARBAGE_COLLECTION_CYCLE_FINISH_DESCRIPTION,
EMPTY_SIZE_AND_TABLE,
},
#if JAVA_SPEC_VERSION >= 19
{
J9JVMTI_EVENT_COM_SUN_HOTSPOT_EVENTS_VIRTUAL_THREAD_MOUNT,
COM_SUN_HOTSPOT_EVENTS_VIRTUAL_THREAD_MOUNT,
J9NLS_JVMTI_COM_SUN_HOTSPOT_EVENTS_VIRTUAL_THREAD_MOUNT,
SIZE_AND_TABLE(jvmtiVirtualThreadMount_params),
},
{
J9JVMTI_EVENT_COM_SUN_HOTSPOT_EVENTS_VIRTUAL_THREAD_UNMOUNT,
COM_SUN_HOTSPOT_EVENTS_VIRTUAL_THREAD_UNMOUNT,
J9NLS_JVMTI_COM_SUN_HOTSPOT_EVENTS_VIRTUAL_THREAD_UNMOUNT,
SIZE_AND_TABLE(jvmtiVirtualThreadUnmount_params),
},
{
J9JVMTI_EVENT_COM_SUN_HOTSPOT_EVENTS_VIRTUAL_THREAD_DESTROY,
COM_SUN_HOTSPOT_EVENTS_VIRTUAL_THREAD_DESTROY,
J9NLS_JVMTI_COM_SUN_HOTSPOT_EVENTS_VIRTUAL_THREAD_DESTROY,
SIZE_AND_TABLE(jvmtiVirtualThreadDestroy_params),
},
#endif /* JAVA_SPEC_VERSION >= 19 */
#if defined(J9VM_OPT_CRIU_SUPPORT)
{
J9JVMTI_EVENT_OPENJ9_VM_CHECKPOINT,
OPENJ9_EVENT_VM_CHECKPOINT,
J9NLS_J9JVMTI_EVENT_OPENJ9_VM_CHECKPOINT,
SIZE_AND_TABLE(jvmtiVMCheckpoint_params),
},
{
J9JVMTI_EVENT_OPENJ9_VM_RESTORE,
OPENJ9_EVENT_VM_RESTORE,
J9NLS_J9JVMTI_EVENT_OPENJ9_VM_RESTORE,
SIZE_AND_TABLE(jvmtiVMRestore_params),
},
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
};
#define NUM_EXTENSION_EVENTS (sizeof(J9JVMTIExtensionEventInfoTable) / sizeof(J9JVMTIExtensionEventInfoTable[0]))
jvmtiError JNICALL
jvmtiGetExtensionFunctions(jvmtiEnv* env,
jint* extension_count_ptr,
jvmtiExtensionFunctionInfo** extensions)
{
unsigned char* mem;
jvmtiError rc = JVMTI_ERROR_NONE;
PORT_ACCESS_FROM_JVMTI(env);
jint rv_extension_count = 0;
jvmtiExtensionFunctionInfo *rv_extensions = NULL;
Trc_JVMTI_jvmtiGetExtensionFunctions_Entry(env, extension_count_ptr, extensions);
ENSURE_PHASE_ONLOAD_OR_LIVE(env);
ENSURE_NON_NULL(extension_count_ptr);
ENSURE_NON_NULL(extensions);
mem = j9mem_allocate_memory(sizeof(**extensions) * NUM_EXTENSION_FUNCTIONS, J9MEM_CATEGORY_JVMTI_ALLOCATE);
if (mem == NULL) {
rc = JVMTI_ERROR_OUT_OF_MEMORY;
} else {
J9JVMTIExtensionFunctionInfo* source = GLOBAL_TABLE(J9JVMTIExtensionFunctionInfoTable);
jvmtiExtensionFunctionInfo* dest = (jvmtiExtensionFunctionInfo*)mem;
jint i;
memset(dest, 0, sizeof(**extensions) * NUM_EXTENSION_FUNCTIONS);
for (i = 0; i < NUM_EXTENSION_FUNCTIONS; i++, dest++, source++) {
rc = copyExtensionFunctionInfo(env, dest, source);
if (rc != JVMTI_ERROR_NONE) {
/* error -- clean up the memory we've already allocated */
for (; i >= 0; i--, dest--) {
freeExtensionFunctionInfo(env, dest);
}
j9mem_free_memory(mem);
goto done;
}
}
rv_extension_count = NUM_EXTENSION_FUNCTIONS;
rv_extensions = (jvmtiExtensionFunctionInfo*)mem;
}
done:
if (NULL != extension_count_ptr) {
*extension_count_ptr = rv_extension_count;
}
if (NULL != extensions) {
*extensions = rv_extensions;
}
TRACE_JVMTI_RETURN(jvmtiGetExtensionFunctions);
}
jvmtiError JNICALL
jvmtiGetExtensionEvents(jvmtiEnv* env,
jint* extension_count_ptr,
jvmtiExtensionEventInfo** extensions)
{