jvm-ti-sys 0.0.0

Rust definitions corresponding to jvmti.h
Documentation
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
#![doc(html_root_url = "https://docs.rs/jvm-ti-sys/0.0.0")]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![warn(missing_debug_implementations)]
#![warn(rust_2018_idioms)]
#![no_std]

use core::ffi::c_char;
use core::ffi::c_uchar;
use core::ffi::c_uint;
use core::ffi::c_void;

use jni_sys::jboolean;
use jni_sys::jchar;
use jni_sys::jclass;
use jni_sys::jdouble;
use jni_sys::jfieldID;
use jni_sys::jfloat;
use jni_sys::jint;
use jni_sys::jlong;
use jni_sys::jmethodID;
use jni_sys::jobject;
use jni_sys::jvalue;
use jni_sys::JNIEnv;
use jni_sys::JNINativeInterface_;
use jni_sys::JavaVM;
use jni_sys_macros::jni_to_union;

pub type enum_t = c_uint;

pub const JVMTI_VERSION_1: enum_t = 0x30010000;
pub const JVMTI_VERSION_1_0: enum_t = 0x30010000;
pub const JVMTI_VERSION_1_1: enum_t = 0x30010100;
pub const JVMTI_VERSION_1_2: enum_t = 0x30010200;
pub const JVMTI_VERSION_9: enum_t = 0x30090000;
pub const JVMTI_VERSION_11: enum_t = 0x300B0000;
pub const JVMTI_VERSION_19: enum_t = 0x30130000;
pub const JVMTI_VERSION_21: enum_t = 0x30150000;
pub const JVMTI_VERSION_25: enum_t = 0x30190000;

pub type Agent_OnLoad =
    unsafe extern "C" fn(vm: *mut JavaVM, options: *mut c_char, reserved: *mut c_void) -> jint;
pub type Agent_OnAttach =
    unsafe extern "C" fn(vm: *mut JavaVM, options: *mut c_char, reserved: *mut c_void) -> jint;
pub type Agent_OnUnload = unsafe extern "C" fn(vm: *mut JavaVM);

pub type jvmtiEnv = *const jvmtiInterface_1_;
pub type jthread = jobject;
pub type jthreadGroup = jobject;
pub type jlocation = jlong;
#[derive(Debug)]
pub enum _jrawMonitorID {}
pub type jrawMonitorID = *mut _jrawMonitorID;
pub type jniNativeInterface = JNINativeInterface_;

pub const JVMTI_THREAD_STATE_ALIVE: enum_t = 0x0001;
pub const JVMTI_THREAD_STATE_TERMINATED: enum_t = 0x0002;
pub const JVMTI_THREAD_STATE_RUNNABLE: enum_t = 0x0004;
pub const JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER: enum_t = 0x0400;
pub const JVMTI_THREAD_STATE_WAITING: enum_t = 0x0080;
pub const JVMTI_THREAD_STATE_WAITING_INDEFINITELY: enum_t = 0x0010;
pub const JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT: enum_t = 0x0020;
pub const JVMTI_THREAD_STATE_SLEEPING: enum_t = 0x0040;
pub const JVMTI_THREAD_STATE_IN_OBJECT_WAIT: enum_t = 0x0100;
pub const JVMTI_THREAD_STATE_PARKED: enum_t = 0x0200;
pub const JVMTI_THREAD_STATE_SUSPENDED: enum_t = 0x100000;
pub const JVMTI_THREAD_STATE_INTERRUPTED: enum_t = 0x200000;
pub const JVMTI_THREAD_STATE_IN_NATIVE: enum_t = 0x400000;
pub const JVMTI_THREAD_STATE_VENDOR_1: enum_t = 0x10000000;
pub const JVMTI_THREAD_STATE_VENDOR_2: enum_t = 0x20000000;
pub const JVMTI_THREAD_STATE_VENDOR_3: enum_t = 0x40000000;

pub const JVMTI_JAVA_LANG_THREAD_STATE_MASK: enum_t = JVMTI_THREAD_STATE_TERMINATED
    | JVMTI_THREAD_STATE_ALIVE
    | JVMTI_THREAD_STATE_RUNNABLE
    | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER
    | JVMTI_THREAD_STATE_WAITING
    | JVMTI_THREAD_STATE_WAITING_INDEFINITELY
    | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT;
pub const JVMTI_JAVA_LANG_THREAD_STATE_NEW: enum_t = 0;
pub const JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED: enum_t = JVMTI_THREAD_STATE_TERMINATED;
pub const JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE: enum_t =
    JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE;
pub const JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED: enum_t =
    JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER;
pub const JVMTI_JAVA_LANG_THREAD_STATE_WAITING: enum_t =
    JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY;
pub const JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING: enum_t =
    JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT;

pub const JVMTI_THREAD_MIN_PRIORITY: enum_t = 1;
pub const JVMTI_THREAD_NORM_PRIORITY: enum_t = 5;
pub const JVMTI_THREAD_MAX_PRIORITY: enum_t = 10;

pub const JVMTI_HEAP_FILTER_TAGGED: enum_t = 0x4;
pub const JVMTI_HEAP_FILTER_UNTAGGED: enum_t = 0x8;
pub const JVMTI_HEAP_FILTER_CLASS_TAGGED: enum_t = 0x10;
pub const JVMTI_HEAP_FILTER_CLASS_UNTAGGED: enum_t = 0x20;

pub const JVMTI_VISIT_OBJECTS: enum_t = 0x100;
pub const JVMTI_VISIT_ABORT: enum_t = 0x8000;

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiHeapReferenceKind(pub enum_t);

impl jvmtiHeapReferenceKind {
    pub const JVMTI_HEAP_REFERENCE_CLASS: Self = Self(1);
    pub const JVMTI_HEAP_REFERENCE_FIELD: Self = Self(2);
    pub const JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT: Self = Self(3);
    pub const JVMTI_HEAP_REFERENCE_CLASS_LOADER: Self = Self(4);
    pub const JVMTI_HEAP_REFERENCE_SIGNERS: Self = Self(5);
    pub const JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN: Self = Self(6);
    pub const JVMTI_HEAP_REFERENCE_INTERFACE: Self = Self(7);
    pub const JVMTI_HEAP_REFERENCE_STATIC_FIELD: Self = Self(8);
    pub const JVMTI_HEAP_REFERENCE_CONSTANT_POOL: Self = Self(9);
    pub const JVMTI_HEAP_REFERENCE_SUPERCLASS: Self = Self(10);
    pub const JVMTI_HEAP_REFERENCE_JNI_GLOBAL: Self = Self(21);
    pub const JVMTI_HEAP_REFERENCE_SYSTEM_CLASS: Self = Self(22);
    pub const JVMTI_HEAP_REFERENCE_MONITOR: Self = Self(23);
    pub const JVMTI_HEAP_REFERENCE_STACK_LOCAL: Self = Self(24);
    pub const JVMTI_HEAP_REFERENCE_JNI_LOCAL: Self = Self(25);
    pub const JVMTI_HEAP_REFERENCE_THREAD: Self = Self(26);
    pub const JVMTI_HEAP_REFERENCE_OTHER: Self = Self(27);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiPrimitiveType(pub enum_t);

impl jvmtiPrimitiveType {
    pub const JVMTI_PRIMITIVE_TYPE_BOOLEAN: Self = Self(90);
    pub const JVMTI_PRIMITIVE_TYPE_BYTE: Self = Self(66);
    pub const JVMTI_PRIMITIVE_TYPE_CHAR: Self = Self(67);
    pub const JVMTI_PRIMITIVE_TYPE_SHORT: Self = Self(83);
    pub const JVMTI_PRIMITIVE_TYPE_INT: Self = Self(73);
    pub const JVMTI_PRIMITIVE_TYPE_LONG: Self = Self(74);
    pub const JVMTI_PRIMITIVE_TYPE_FLOAT: Self = Self(70);
    pub const JVMTI_PRIMITIVE_TYPE_DOUBLE: Self = Self(68);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiHeapObjectFilter(pub enum_t);

impl jvmtiHeapObjectFilter {
    pub const JVMTI_HEAP_OBJECT_TAGGED: Self = Self(1);
    pub const JVMTI_HEAP_OBJECT_UNTAGGED: Self = Self(2);
    pub const JVMTI_HEAP_OBJECT_EITHER: Self = Self(3);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiHeapRootKind(pub enum_t);

impl jvmtiHeapRootKind {
    pub const JVMTI_HEAP_ROOT_JNI_GLOBAL: Self = Self(1);
    pub const JVMTI_HEAP_ROOT_SYSTEM_CLASS: Self = Self(2);
    pub const JVMTI_HEAP_ROOT_MONITOR: Self = Self(3);
    pub const JVMTI_HEAP_ROOT_STACK_LOCAL: Self = Self(4);
    pub const JVMTI_HEAP_ROOT_JNI_LOCAL: Self = Self(5);
    pub const JVMTI_HEAP_ROOT_THREAD: Self = Self(6);
    pub const JVMTI_HEAP_ROOT_OTHER: Self = Self(7);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiObjectReferenceKind(pub enum_t);

impl jvmtiObjectReferenceKind {
    pub const JVMTI_REFERENCE_CLASS: Self = Self(1);
    pub const JVMTI_REFERENCE_FIELD: Self = Self(2);
    pub const JVMTI_REFERENCE_ARRAY_ELEMENT: Self = Self(3);
    pub const JVMTI_REFERENCE_CLASS_LOADER: Self = Self(4);
    pub const JVMTI_REFERENCE_SIGNERS: Self = Self(5);
    pub const JVMTI_REFERENCE_PROTECTION_DOMAIN: Self = Self(6);
    pub const JVMTI_REFERENCE_INTERFACE: Self = Self(7);
    pub const JVMTI_REFERENCE_STATIC_FIELD: Self = Self(8);
    pub const JVMTI_REFERENCE_CONSTANT_POOL: Self = Self(9);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiIterationControl(pub enum_t);

impl jvmtiIterationControl {
    pub const JVMTI_ITERATION_CONTINUE: Self = Self(1);
    pub const JVMTI_ITERATION_IGNORE: Self = Self(2);
    pub const JVMTI_ITERATION_ABORT: Self = Self(0);
}

pub const JVMTI_CLASS_STATUS_VERIFIED: enum_t = 1;
pub const JVMTI_CLASS_STATUS_PREPARED: enum_t = 2;
pub const JVMTI_CLASS_STATUS_INITIALIZED: enum_t = 4;
pub const JVMTI_CLASS_STATUS_ERROR: enum_t = 8;
pub const JVMTI_CLASS_STATUS_ARRAY: enum_t = 16;
pub const JVMTI_CLASS_STATUS_PRIMITIVE: enum_t = 32;

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiEventMode(pub enum_t);

impl jvmtiEventMode {
    pub const JVMTI_ENABLE: Self = Self(1);
    pub const JVMTI_DISABLE: Self = Self(0);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiParamTypes(pub enum_t);

impl jvmtiParamTypes {
    pub const JVMTI_TYPE_JBYTE: Self = Self(101);
    pub const JVMTI_TYPE_JCHAR: Self = Self(102);
    pub const JVMTI_TYPE_JSHORT: Self = Self(103);
    pub const JVMTI_TYPE_JINT: Self = Self(104);
    pub const JVMTI_TYPE_JLONG: Self = Self(105);
    pub const JVMTI_TYPE_JFLOAT: Self = Self(106);
    pub const JVMTI_TYPE_JDOUBLE: Self = Self(107);
    pub const JVMTI_TYPE_JBOOLEAN: Self = Self(108);
    pub const JVMTI_TYPE_JOBJECT: Self = Self(109);
    pub const JVMTI_TYPE_JTHREAD: Self = Self(110);
    pub const JVMTI_TYPE_JCLASS: Self = Self(111);
    pub const JVMTI_TYPE_JVALUE: Self = Self(112);
    pub const JVMTI_TYPE_JFIELDID: Self = Self(113);
    pub const JVMTI_TYPE_JMETHODID: Self = Self(114);
    pub const JVMTI_TYPE_CCHAR: Self = Self(115);
    pub const JVMTI_TYPE_CVOID: Self = Self(116);
    pub const JVMTI_TYPE_JNIENV: Self = Self(117);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiParamKind(pub enum_t);

impl jvmtiParamKind {
    pub const JVMTI_KIND_IN: Self = Self(91);
    pub const JVMTI_KIND_IN_PTR: Self = Self(92);
    pub const JVMTI_KIND_IN_BUF: Self = Self(93);
    pub const JVMTI_KIND_ALLOC_BUF: Self = Self(94);
    pub const JVMTI_KIND_ALLOC_ALLOC_BUF: Self = Self(95);
    pub const JVMTI_KIND_OUT: Self = Self(96);
    pub const JVMTI_KIND_OUT_BUF: Self = Self(97);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiTimerKind(pub enum_t);

impl jvmtiTimerKind {
    pub const JVMTI_TIMER_USER_CPU: Self = Self(30);
    pub const JVMTI_TIMER_TOTAL_CPU: Self = Self(31);
    pub const JVMTI_TIMER_ELAPSED: Self = Self(32);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiPhase(pub enum_t);

impl jvmtiPhase {
    pub const JVMTI_PHASE_ONLOAD: Self = Self(1);
    pub const JVMTI_PHASE_PRIMORDIAL: Self = Self(2);
    pub const JVMTI_PHASE_START: Self = Self(6);
    pub const JVMTI_PHASE_LIVE: Self = Self(4);
    pub const JVMTI_PHASE_DEAD: Self = Self(8);
}

pub const JVMTI_VERSION_INTERFACE_JNI: enum_t = 0x00000000;
pub const JVMTI_VERSION_INTERFACE_JVMTI: enum_t = 0x30000000;

pub const JVMTI_VERSION_MASK_INTERFACE_TYPE: enum_t = 0x70000000;
pub const JVMTI_VERSION_MASK_MAJOR: enum_t = 0x0FFF0000;
pub const JVMTI_VERSION_MASK_MINOR: enum_t = 0x0000FF00;
pub const JVMTI_VERSION_MASK_MICRO: enum_t = 0x000000FF;

pub const JVMTI_VERSION_SHIFT_MAJOR: enum_t = 16;
pub const JVMTI_VERSION_SHIFT_MINOR: enum_t = 8;
pub const JVMTI_VERSION_SHIFT_MICRO: enum_t = 0;

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiVerboseFlag(pub enum_t);

impl jvmtiVerboseFlag {
    pub const JVMTI_VERBOSE_OTHER: Self = Self(0);
    pub const JVMTI_VERBOSE_GC: Self = Self(1);
    pub const JVMTI_VERBOSE_CLASS: Self = Self(2);
    pub const JVMTI_VERBOSE_JNI: Self = Self(4);
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiJlocationFormat(pub enum_t);

impl jvmtiJlocationFormat {
    pub const JVMTI_JLOCATION_JVMBCI: Self = Self(1);
    pub const JVMTI_JLOCATION_MACHINEPC: Self = Self(2);
    pub const JVMTI_JLOCATION_OTHER: Self = Self(0);
}

pub const JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR: enum_t = 0x0001;
pub const JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP: enum_t = 0x0002;
pub const JVMTI_RESOURCE_EXHAUSTED_THREADS: enum_t = 0x0004;

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiError(pub enum_t);

impl jvmtiError {
    pub const JVMTI_ERROR_NONE: Self = Self(0);
    pub const JVMTI_ERROR_INVALID_THREAD: Self = Self(10);
    pub const JVMTI_ERROR_INVALID_THREAD_GROUP: Self = Self(11);
    pub const JVMTI_ERROR_INVALID_PRIORITY: Self = Self(12);
    pub const JVMTI_ERROR_THREAD_NOT_SUSPENDED: Self = Self(13);
    pub const JVMTI_ERROR_THREAD_SUSPENDED: Self = Self(14);
    pub const JVMTI_ERROR_THREAD_NOT_ALIVE: Self = Self(15);
    pub const JVMTI_ERROR_INVALID_OBJECT: Self = Self(20);
    pub const JVMTI_ERROR_INVALID_CLASS: Self = Self(21);
    pub const JVMTI_ERROR_CLASS_NOT_PREPARED: Self = Self(22);
    pub const JVMTI_ERROR_INVALID_METHODID: Self = Self(23);
    pub const JVMTI_ERROR_INVALID_LOCATION: Self = Self(24);
    pub const JVMTI_ERROR_INVALID_FIELDID: Self = Self(25);
    pub const JVMTI_ERROR_INVALID_MODULE: Self = Self(26);
    pub const JVMTI_ERROR_NO_MORE_FRAMES: Self = Self(31);
    pub const JVMTI_ERROR_OPAQUE_FRAME: Self = Self(32);
    pub const JVMTI_ERROR_TYPE_MISMATCH: Self = Self(34);
    pub const JVMTI_ERROR_INVALID_SLOT: Self = Self(35);
    pub const JVMTI_ERROR_DUPLICATE: Self = Self(40);
    pub const JVMTI_ERROR_NOT_FOUND: Self = Self(41);
    pub const JVMTI_ERROR_INVALID_MONITOR: Self = Self(50);
    pub const JVMTI_ERROR_NOT_MONITOR_OWNER: Self = Self(51);
    pub const JVMTI_ERROR_INTERRUPT: Self = Self(52);
    pub const JVMTI_ERROR_INVALID_CLASS_FORMAT: Self = Self(60);
    pub const JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION: Self = Self(61);
    pub const JVMTI_ERROR_FAILS_VERIFICATION: Self = Self(62);
    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED: Self = Self(63);
    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED: Self = Self(64);
    pub const JVMTI_ERROR_INVALID_TYPESTATE: Self = Self(65);
    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED: Self = Self(66);
    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED: Self = Self(67);
    pub const JVMTI_ERROR_UNSUPPORTED_VERSION: Self = Self(68);
    pub const JVMTI_ERROR_NAMES_DONT_MATCH: Self = Self(69);
    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED: Self = Self(70);
    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED: Self = Self(71);
    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED: Self = Self(72);
    pub const JVMTI_ERROR_UNSUPPORTED_OPERATION: Self = Self(73);
    pub const JVMTI_ERROR_UNMODIFIABLE_CLASS: Self = Self(79);
    pub const JVMTI_ERROR_UNMODIFIABLE_MODULE: Self = Self(80);
    pub const JVMTI_ERROR_NOT_AVAILABLE: Self = Self(98);
    pub const JVMTI_ERROR_MUST_POSSESS_CAPABILITY: Self = Self(99);
    pub const JVMTI_ERROR_NULL_POINTER: Self = Self(100);
    pub const JVMTI_ERROR_ABSENT_INFORMATION: Self = Self(101);
    pub const JVMTI_ERROR_INVALID_EVENT_TYPE: Self = Self(102);
    pub const JVMTI_ERROR_ILLEGAL_ARGUMENT: Self = Self(103);
    pub const JVMTI_ERROR_NATIVE_METHOD: Self = Self(104);
    pub const JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED: Self = Self(106);
    pub const JVMTI_ERROR_OUT_OF_MEMORY: Self = Self(110);
    pub const JVMTI_ERROR_ACCESS_DENIED: Self = Self(111);
    pub const JVMTI_ERROR_WRONG_PHASE: Self = Self(112);
    pub const JVMTI_ERROR_INTERNAL: Self = Self(113);
    pub const JVMTI_ERROR_UNATTACHED_THREAD: Self = Self(115);
    pub const JVMTI_ERROR_INVALID_ENVIRONMENT: Self = Self(116);
    pub const JVMTI_ERROR_MAX: Self = Self::JVMTI_ERROR_INVALID_ENVIRONMENT;
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct jvmtiEvent(pub enum_t);

impl jvmtiEvent {
    pub const JVMTI_MIN_EVENT_TYPE_VAL: Self = Self::JVMTI_EVENT_VM_INIT;
    pub const JVMTI_EVENT_VM_INIT: Self = Self(50);
    pub const JVMTI_EVENT_VM_DEATH: Self = Self(51);
    pub const JVMTI_EVENT_THREAD_START: Self = Self(52);
    pub const JVMTI_EVENT_THREAD_END: Self = Self(53);
    pub const JVMTI_EVENT_CLASS_FILE_LOAD_HOOK: Self = Self(54);
    pub const JVMTI_EVENT_CLASS_LOAD: Self = Self(55);
    pub const JVMTI_EVENT_CLASS_PREPARE: Self = Self(56);
    pub const JVMTI_EVENT_VM_START: Self = Self(57);
    pub const JVMTI_EVENT_EXCEPTION: Self = Self(58);
    pub const JVMTI_EVENT_EXCEPTION_CATCH: Self = Self(59);
    pub const JVMTI_EVENT_SINGLE_STEP: Self = Self(60);
    pub const JVMTI_EVENT_FRAME_POP: Self = Self(61);
    pub const JVMTI_EVENT_BREAKPOINT: Self = Self(62);
    pub const JVMTI_EVENT_FIELD_ACCESS: Self = Self(63);
    pub const JVMTI_EVENT_FIELD_MODIFICATION: Self = Self(64);
    pub const JVMTI_EVENT_METHOD_ENTRY: Self = Self(65);
    pub const JVMTI_EVENT_METHOD_EXIT: Self = Self(66);
    pub const JVMTI_EVENT_NATIVE_METHOD_BIND: Self = Self(67);
    pub const JVMTI_EVENT_COMPILED_METHOD_LOAD: Self = Self(68);
    pub const JVMTI_EVENT_COMPILED_METHOD_UNLOAD: Self = Self(69);
    pub const JVMTI_EVENT_DYNAMIC_CODE_GENERATED: Self = Self(70);
    pub const JVMTI_EVENT_DATA_DUMP_REQUEST: Self = Self(71);
    pub const JVMTI_EVENT_MONITOR_WAIT: Self = Self(73);
    pub const JVMTI_EVENT_MONITOR_WAITED: Self = Self(74);
    pub const JVMTI_EVENT_MONITOR_CONTENDED_ENTER: Self = Self(75);
    pub const JVMTI_EVENT_MONITOR_CONTENDED_ENTERED: Self = Self(76);
    pub const JVMTI_EVENT_RESOURCE_EXHAUSTED: Self = Self(80);
    pub const JVMTI_EVENT_GARBAGE_COLLECTION_START: Self = Self(81);
    pub const JVMTI_EVENT_GARBAGE_COLLECTION_FINISH: Self = Self(82);
    pub const JVMTI_EVENT_OBJECT_FREE: Self = Self(83);
    pub const JVMTI_EVENT_VM_OBJECT_ALLOC: Self = Self(84);
    pub const JVMTI_EVENT_SAMPLED_OBJECT_ALLOC: Self = Self(86);
    pub const JVMTI_EVENT_VIRTUAL_THREAD_START: Self = Self(87);
    pub const JVMTI_EVENT_VIRTUAL_THREAD_END: Self = Self(88);
    pub const JVMTI_MAX_EVENT_TYPE_VAL: Self = Self::JVMTI_EVENT_VIRTUAL_THREAD_END;
}

pub type jvmtiStartFunction =
    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv, arg: *mut c_void)>;

pub type jvmtiHeapIterationCallback = Option<
    unsafe extern "C" fn(
        class_tag: jlong,
        size: jlong,
        tag_ptr: *mut jlong,
        length: jint,
        user_data: *mut c_void,
    ) -> jint,
>;

pub type jvmtiHeapReferenceCallback = Option<
    unsafe extern "C" fn(
        reference_kind: jvmtiHeapReferenceKind,
        reference_info: *const jvmtiHeapReferenceInfo,
        class_tag: jlong,
        referrer_class_tag: jlong,
        size: jlong,
        tag_ptr: *mut jlong,
        referrer_tag_ptr: *mut jlong,
        length: jint,
        user_data: *mut c_void,
    ) -> jint,
>;

pub type jvmtiPrimitiveFieldCallback = Option<
    unsafe extern "C" fn(
        kind: jvmtiHeapReferenceKind,
        info: *const jvmtiHeapReferenceInfo,
        object_class_tag: jlong,
        object_tag_ptr: *mut jlong,
        value: jvalue,
        value_type: jvmtiPrimitiveType,
        user_data: *mut c_void,
    ) -> jint,
>;

pub type jvmtiArrayPrimitiveValueCallback = Option<
    unsafe extern "C" fn(
        class_tag: jlong,
        size: jlong,
        tag_ptr: *mut jlong,
        element_count: jint,
        element_type: jvmtiPrimitiveType,
        elements: *const c_void,
        user_data: *mut c_void,
    ) -> jint,
>;

pub type jvmtiStringPrimitiveValueCallback = Option<
    unsafe extern "C" fn(
        class_tag: jlong,
        size: jlong,
        tag_ptr: *mut jlong,
        value: *const jchar,
        value_length: jint,
        user_data: *mut c_void,
    ) -> jint,
>;

pub type jvmtiReservedCallback = Option<unsafe extern "C" fn() -> jint>;

pub type jvmtiHeapObjectCallback = Option<
    unsafe extern "C" fn(
        class_tag: jlong,
        size: jlong,
        tag_ptr: *mut jlong,
        user_data: *mut c_void,
    ) -> jvmtiIterationControl,
>;

pub type jvmtiHeapRootCallback = Option<
    unsafe extern "C" fn(
        root_kind: jvmtiHeapRootKind,
        class_tag: jlong,
        size: jlong,
        tag_ptr: *mut jlong,
        user_data: *mut c_void,
    ) -> jvmtiIterationControl,
>;

pub type jvmtiStackReferenceCallback = Option<
    unsafe extern "C" fn(
        root_kind: jvmtiHeapRootKind,
        class_tag: jlong,
        size: jlong,
        tag_ptr: *mut jlong,
        thread_tag: jlong,
        depth: jint,
        method: jmethodID,
        slot: jint,
        user_data: *mut c_void,
    ) -> jvmtiIterationControl,
>;

pub type jvmtiObjectReferenceCallback = Option<
    unsafe extern "C" fn(
        reference_kind: jvmtiObjectReferenceKind,
        class_tag: jlong,
        size: jlong,
        tag_ptr: *mut jlong,
        referrer_tag: jlong,
        referrer_index: jint,
        user_data: *mut c_void,
    ) -> jvmtiIterationControl,
>;

pub type jvmtiExtensionFunction =
    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, ...) -> jvmtiError>;

pub type jvmtiExtensionEvent = Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, ...)>;

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiThreadInfo {
    pub name: *mut c_char,
    pub priority: jint,
    pub is_daemon: jboolean,
    pub thread_group: jthreadGroup,
    pub context_class_loader: jobject,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiMonitorStackDepthInfo {
    pub monitor: jobject,
    pub stack_depth: jint,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiThreadGroupInfo {
    pub parent: jthreadGroup,
    pub name: *mut c_char,
    pub max_priority: jint,
    pub is_daemon: jboolean,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiFrameInfo {
    pub method: jmethodID,
    pub location: jlocation,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiStackInfo {
    pub thread: jthread,
    pub state: jint,
    pub frame_buffer: *mut jvmtiFrameInfo,
    pub frame_count: jint,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiHeapReferenceInfoField {
    pub index: jint,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiHeapReferenceInfoArray {
    pub index: jint,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiHeapReferenceInfoConstantPool {
    pub index: jint,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiHeapReferenceInfoStackLocal {
    pub thread_tag: jlong,
    pub thread_id: jlong,
    pub depth: jint,
    pub method: jmethodID,
    pub location: jlocation,
    pub slot: jint,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiHeapReferenceInfoJniLocal {
    pub thread_tag: jlong,
    pub thread_id: jlong,
    pub depth: jint,
    pub method: jmethodID,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiHeapReferenceInfoReserved {
    pub reserved1: jlong,
    pub reserved2: jlong,
    pub reserved3: jlong,
    pub reserved4: jlong,
    pub reserved5: jlong,
    pub reserved6: jlong,
    pub reserved7: jlong,
    pub reserved8: jlong,
}

#[repr(C)]
#[derive(Copy, Clone)]
pub union jvmtiHeapReferenceInfo {
    pub field: jvmtiHeapReferenceInfoField,
    pub array: jvmtiHeapReferenceInfoArray,
    pub constant_pool: jvmtiHeapReferenceInfoConstantPool,
    pub stack_local: jvmtiHeapReferenceInfoStackLocal,
    pub jni_local: jvmtiHeapReferenceInfoJniLocal,
    pub other: jvmtiHeapReferenceInfoReserved,
}

impl core::fmt::Debug for jvmtiHeapReferenceInfo {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        f.write_str(core::any::type_name::<Self>())
    }
}

#[repr(C)]
#[derive(Default, Debug, Copy, Clone)]
pub struct jvmtiHeapCallbacks {
    pub heap_iteration_callback: jvmtiHeapIterationCallback,
    pub heap_reference_callback: jvmtiHeapReferenceCallback,
    pub primitive_field_callback: jvmtiPrimitiveFieldCallback,
    pub array_primitive_value_callback: jvmtiArrayPrimitiveValueCallback,
    pub string_primitive_value_callback: jvmtiStringPrimitiveValueCallback,
    pub reserved5: jvmtiReservedCallback,
    pub reserved6: jvmtiReservedCallback,
    pub reserved7: jvmtiReservedCallback,
    pub reserved8: jvmtiReservedCallback,
    pub reserved9: jvmtiReservedCallback,
    pub reserved10: jvmtiReservedCallback,
    pub reserved11: jvmtiReservedCallback,
    pub reserved12: jvmtiReservedCallback,
    pub reserved13: jvmtiReservedCallback,
    pub reserved14: jvmtiReservedCallback,
    pub reserved15: jvmtiReservedCallback,
}

impl jvmtiHeapCallbacks {
    #[inline(always)]
    pub const fn new() -> Self {
        Self {
            heap_iteration_callback: None,
            heap_reference_callback: None,
            primitive_field_callback: None,
            array_primitive_value_callback: None,
            string_primitive_value_callback: None,
            reserved5: None,
            reserved6: None,
            reserved7: None,
            reserved8: None,
            reserved9: None,
            reserved10: None,
            reserved11: None,
            reserved12: None,
            reserved13: None,
            reserved14: None,
            reserved15: None,
        }
    }
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiClassDefinition {
    pub klass: jclass,
    pub class_byte_count: jint,
    pub class_bytes: *const c_uchar,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiMonitorUsage {
    pub owner: jthread,
    pub entry_count: jint,
    pub waiter_count: jint,
    pub waiters: *mut jthread,
    pub notify_waiter_count: jint,
    pub notify_waiters: *mut jthread,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiLineNumberEntry {
    pub start_location: jlocation,
    pub line_number: jint,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiLocalVariableEntry {
    pub start_location: jlocation,
    pub length: jint,
    pub name: *mut c_char,
    pub signature: *mut c_char,
    pub generic_signature: *mut c_char,
    pub slot: jint,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiParamInfo {
    pub name: *mut c_char,
    pub kind: jvmtiParamKind,
    pub base_type: jvmtiParamTypes,
    pub null_ok: jboolean,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiExtensionFunctionInfo {
    pub func: jvmtiExtensionFunction,
    pub id: *mut c_char,
    pub short_description: *mut c_char,
    pub param_count: jint,
    pub params: *mut jvmtiParamInfo,
    pub error_count: jint,
    pub errors: *mut jvmtiError,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiExtensionEventInfo {
    pub extension_event_index: jint,
    pub id: *mut c_char,
    pub short_description: *mut c_char,
    pub param_count: jint,
    pub params: *mut jvmtiParamInfo,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiTimerInfo {
    pub max_value: jlong,
    pub may_skip_forward: jboolean,
    pub may_skip_backward: jboolean,
    pub kind: jvmtiTimerKind,
    pub reserved1: jlong,
    pub reserved2: jlong,
}

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiAddrLocationMap {
    pub start_address: *const c_void,
    pub location: jlocation,
}

#[repr(C)]
#[repr(align(4))]
#[derive(Default, Copy, Clone)]
pub struct jvmtiCapabilities {
    pub inner: [u8; 16],
}

// bit twiddling
mod capabilities;

pub type jvmtiEventReserved = Option<unsafe extern "C" fn()>;

pub type jvmtiEventBreakpoint = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        method: jmethodID,
        location: jlocation,
    ),
>;

pub type jvmtiEventClassFileLoadHook = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        class_being_redefined: jclass,
        loader: jobject,
        name: *const c_char,
        protection_domain: jobject,
        class_data_len: jint,
        class_data: *const c_uchar,
        new_class_data_len: *mut jint,
        new_class_data: *mut *mut c_uchar,
    ),
>;

pub type jvmtiEventClassLoad = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        klass: jclass,
    ),
>;

pub type jvmtiEventClassPrepare = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        klass: jclass,
    ),
>;

pub type jvmtiEventCompiledMethodLoad = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        method: jmethodID,
        code_size: jint,
        code_addr: *const c_void,
        map_length: jint,
        map: *const jvmtiAddrLocationMap,
        compile_info: *const c_void,
    ),
>;

pub type jvmtiEventCompiledMethodUnload = Option<
    unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, method: jmethodID, code_addr: *const c_void),
>;

pub type jvmtiEventDataDumpRequest = Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv)>;

pub type jvmtiEventDynamicCodeGenerated = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        name: *const c_char,
        address: *const c_void,
        length: jint,
    ),
>;

pub type jvmtiEventException = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        method: jmethodID,
        location: jlocation,
        exception: jobject,
        catch_method: jmethodID,
        catch_location: jlocation,
    ),
>;

pub type jvmtiEventExceptionCatch = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        method: jmethodID,
        location: jlocation,
        exception: jobject,
    ),
>;

pub type jvmtiEventFieldAccess = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        method: jmethodID,
        location: jlocation,
        field_klass: jclass,
        object: jobject,
        field: jfieldID,
    ),
>;

pub type jvmtiEventFieldModification = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        method: jmethodID,
        location: jlocation,
        field_klass: jclass,
        object: jobject,
        field: jfieldID,
        signature_type: c_char,
        new_value: jvalue,
    ),
>;

pub type jvmtiEventFramePop = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        method: jmethodID,
        was_popped_by_exception: jboolean,
    ),
>;

pub type jvmtiEventGarbageCollectionFinish = Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv)>;

pub type jvmtiEventGarbageCollectionStart = Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv)>;

pub type jvmtiEventMethodEntry = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        method: jmethodID,
    ),
>;

pub type jvmtiEventMethodExit = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        method: jmethodID,
        was_popped_by_exception: jboolean,
        return_value: jvalue,
    ),
>;

pub type jvmtiEventMonitorContendedEnter = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        object: jobject,
    ),
>;

pub type jvmtiEventMonitorContendedEntered = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        object: jobject,
    ),
>;

pub type jvmtiEventMonitorWait = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        object: jobject,
        timeout: jlong,
    ),
>;

pub type jvmtiEventMonitorWaited = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        object: jobject,
        timed_out: jboolean,
    ),
>;

pub type jvmtiEventNativeMethodBind = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        method: jmethodID,
        address: *mut c_void,
        new_address_ptr: *mut *mut c_void,
    ),
>;

pub type jvmtiEventObjectFree = Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, tag: jlong)>;

pub type jvmtiEventResourceExhausted = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        flags: jint,
        reserved: *const c_void,
        description: *const c_char,
    ),
>;

pub type jvmtiEventSampledObjectAlloc = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        object: jobject,
        object_klass: jclass,
        size: jlong,
    ),
>;

pub type jvmtiEventSingleStep = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        method: jmethodID,
        location: jlocation,
    ),
>;

pub type jvmtiEventThreadEnd =
    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv, thread: jthread)>;

pub type jvmtiEventThreadStart =
    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv, thread: jthread)>;

pub type jvmtiEventVirtualThreadEnd = Option<
    unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv, virtual_thread: jthread),
>;

pub type jvmtiEventVirtualThreadStart = Option<
    unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv, virtual_thread: jthread),
>;

pub type jvmtiEventVMDeath =
    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv)>;

pub type jvmtiEventVMInit =
    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv, thread: jthread)>;

pub type jvmtiEventVMObjectAlloc = Option<
    unsafe extern "C" fn(
        jvmti_env: *mut jvmtiEnv,
        jni_env: *mut JNIEnv,
        thread: jthread,
        object: jobject,
        object_klass: jclass,
        size: jlong,
    ),
>;

pub type jvmtiEventVMStart =
    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv)>;

#[repr(C)]
#[derive(Default, Debug, Copy, Clone)]
pub struct jvmtiEventCallbacks {
    pub VMInit: jvmtiEventVMInit,
    pub VMDeath: jvmtiEventVMDeath,
    pub ThreadStart: jvmtiEventThreadStart,
    pub ThreadEnd: jvmtiEventThreadEnd,
    pub ClassFileLoadHook: jvmtiEventClassFileLoadHook,
    pub ClassLoad: jvmtiEventClassLoad,
    pub ClassPrepare: jvmtiEventClassPrepare,
    pub VMStart: jvmtiEventVMStart,
    pub Exception: jvmtiEventException,
    pub ExceptionCatch: jvmtiEventExceptionCatch,
    pub SingleStep: jvmtiEventSingleStep,
    pub FramePop: jvmtiEventFramePop,
    pub Breakpoint: jvmtiEventBreakpoint,
    pub FieldAccess: jvmtiEventFieldAccess,
    pub FieldModification: jvmtiEventFieldModification,
    pub MethodEntry: jvmtiEventMethodEntry,
    pub MethodExit: jvmtiEventMethodExit,
    pub NativeMethodBind: jvmtiEventNativeMethodBind,
    pub CompiledMethodLoad: jvmtiEventCompiledMethodLoad,
    pub CompiledMethodUnload: jvmtiEventCompiledMethodUnload,
    pub DynamicCodeGenerated: jvmtiEventDynamicCodeGenerated,
    pub DataDumpRequest: jvmtiEventDataDumpRequest,
    pub reserved72: jvmtiEventReserved,
    pub MonitorWait: jvmtiEventMonitorWait,
    pub MonitorWaited: jvmtiEventMonitorWaited,
    pub MonitorContendedEnter: jvmtiEventMonitorContendedEnter,
    pub MonitorContendedEntered: jvmtiEventMonitorContendedEntered,
    pub reserved77: jvmtiEventReserved,
    pub reserved78: jvmtiEventReserved,
    pub reserved79: jvmtiEventReserved,
    pub ResourceExhausted: jvmtiEventResourceExhausted,
    pub GarbageCollectionStart: jvmtiEventGarbageCollectionStart,
    pub GarbageCollectionFinish: jvmtiEventGarbageCollectionFinish,
    pub ObjectFree: jvmtiEventObjectFree,
    pub VMObjectAlloc: jvmtiEventVMObjectAlloc,
    pub reserved85: jvmtiEventReserved,
    pub SampledObjectAlloc: jvmtiEventSampledObjectAlloc,
    pub VirtualThreadStart: jvmtiEventVirtualThreadStart,
    pub VirtualThreadEnd: jvmtiEventVirtualThreadEnd,
}

impl jvmtiEventCallbacks {
    #[inline(always)]
    pub const fn new() -> Self {
        Self {
            VMInit: None,
            VMDeath: None,
            ThreadStart: None,
            ThreadEnd: None,
            ClassFileLoadHook: None,
            ClassLoad: None,
            ClassPrepare: None,
            VMStart: None,
            Exception: None,
            ExceptionCatch: None,
            SingleStep: None,
            FramePop: None,
            Breakpoint: None,
            FieldAccess: None,
            FieldModification: None,
            MethodEntry: None,
            MethodExit: None,
            NativeMethodBind: None,
            CompiledMethodLoad: None,
            CompiledMethodUnload: None,
            DynamicCodeGenerated: None,
            DataDumpRequest: None,
            reserved72: None,
            MonitorWait: None,
            MonitorWaited: None,
            MonitorContendedEnter: None,
            MonitorContendedEntered: None,
            reserved77: None,
            reserved78: None,
            reserved79: None,
            ResourceExhausted: None,
            GarbageCollectionStart: None,
            GarbageCollectionFinish: None,
            ObjectFree: None,
            VMObjectAlloc: None,
            reserved85: None,
            SampledObjectAlloc: None,
            VirtualThreadStart: None,
            VirtualThreadEnd: None,
        }
    }
}

#[repr(C)]
#[jni_to_union("JVMTI", "1.0")]
#[non_exhaustive]
#[derive(Debug, Copy, Clone)]
pub struct jvmtiInterface_1_ {
    #[jni_added("reserved")]
    pub reserved1: *mut c_void,
    pub SetEventNotificationMode: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        mode: jvmtiEventMode,
        event_type: jvmtiEvent,
        event_thread: jthread,
        ...
    ) -> jvmtiError,
    #[jni_added("9")]
    pub GetAllModules: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        module_count_ptr: *mut jint,
        modules_ptr: *mut *mut jobject,
    ) -> jvmtiError,
    pub GetAllThreads: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        threads_count_ptr: *mut jint,
        threads_ptr: *mut *mut jthread,
    ) -> jvmtiError,
    pub SuspendThread: unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread) -> jvmtiError,
    pub ResumeThread: unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread) -> jvmtiError,
    pub StopThread:
        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, exception: jobject) -> jvmtiError,
    pub InterruptThread: unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread) -> jvmtiError,
    pub GetThreadInfo: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        info_ptr: *mut jvmtiThreadInfo,
    ) -> jvmtiError,
    pub GetOwnedMonitorInfo: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        owned_monitor_count_ptr: *mut jint,
        owned_monitors_ptr: *mut *mut jobject,
    ) -> jvmtiError,
    pub GetCurrentContendedMonitor: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        monitor_ptr: *mut jobject,
    ) -> jvmtiError,
    pub RunAgentThread: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        proc: jvmtiStartFunction,
        arg: *const c_void,
        priority: jint,
    ) -> jvmtiError,
    pub GetTopThreadGroups: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        group_count_ptr: *mut jint,
        groups_ptr: *mut *mut jthreadGroup,
    ) -> jvmtiError,
    pub GetThreadGroupInfo: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        group: jthreadGroup,
        info_ptr: *mut jvmtiThreadGroupInfo,
    ) -> jvmtiError,
    pub GetThreadGroupChildren: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        group: jthreadGroup,
        thread_count_ptr: *mut jint,
        threads_ptr: *mut *mut jthread,
        group_count_ptr: *mut jint,
        groups_ptr: *mut *mut jthreadGroup,
    ) -> jvmtiError,
    pub GetFrameCount: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        count_ptr: *mut jint,
    ) -> jvmtiError,
    pub GetThreadState: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        thread_state_ptr: *mut jint,
    ) -> jvmtiError,
    #[jni_added("1.1")]
    pub GetCurrentThread:
        unsafe extern "C" fn(env: *mut jvmtiEnv, thread_ptr: *mut jthread) -> jvmtiError,
    pub GetFrameLocation: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        depth: jint,
        method_ptr: *mut jmethodID,
        location_ptr: *mut jlocation,
    ) -> jvmtiError,
    pub NotifyFramePop:
        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, depth: jint) -> jvmtiError,
    pub GetLocalObject: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        depth: jint,
        slot: jint,
        value_ptr: *mut jobject,
    ) -> jvmtiError,
    pub GetLocalInt: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        depth: jint,
        slot: jint,
        value_ptr: *mut jint,
    ) -> jvmtiError,
    pub GetLocalLong: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        depth: jint,
        slot: jint,
        value_ptr: *mut jlong,
    ) -> jvmtiError,
    pub GetLocalFloat: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        depth: jint,
        slot: jint,
        value_ptr: *mut jfloat,
    ) -> jvmtiError,
    pub GetLocalDouble: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        depth: jint,
        slot: jint,
        value_ptr: *mut jdouble,
    ) -> jvmtiError,
    pub SetLocalObject: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        depth: jint,
        slot: jint,
        value: jobject,
    ) -> jvmtiError,
    pub SetLocalInt: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        depth: jint,
        slot: jint,
        value: jint,
    ) -> jvmtiError,
    pub SetLocalLong: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        depth: jint,
        slot: jint,
        value: jlong,
    ) -> jvmtiError,
    pub SetLocalFloat: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        depth: jint,
        slot: jint,
        value: jfloat,
    ) -> jvmtiError,
    pub SetLocalDouble: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        depth: jint,
        slot: jint,
        value: jdouble,
    ) -> jvmtiError,
    pub CreateRawMonitor: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        name: *const c_char,
        monitor_ptr: *mut jrawMonitorID,
    ) -> jvmtiError,
    pub DestroyRawMonitor:
        unsafe extern "C" fn(env: *mut jvmtiEnv, monitor: jrawMonitorID) -> jvmtiError,
    pub RawMonitorEnter:
        unsafe extern "C" fn(env: *mut jvmtiEnv, monitor: jrawMonitorID) -> jvmtiError,
    pub RawMonitorExit:
        unsafe extern "C" fn(env: *mut jvmtiEnv, monitor: jrawMonitorID) -> jvmtiError,
    pub RawMonitorWait: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        monitor: jrawMonitorID,
        millis: jlong,
    ) -> jvmtiError,
    pub RawMonitorNotify:
        unsafe extern "C" fn(env: *mut jvmtiEnv, monitor: jrawMonitorID) -> jvmtiError,
    pub RawMonitorNotifyAll:
        unsafe extern "C" fn(env: *mut jvmtiEnv, monitor: jrawMonitorID) -> jvmtiError,
    pub SetBreakpoint: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        location: jlocation,
    ) -> jvmtiError,
    pub ClearBreakpoint: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        location: jlocation,
    ) -> jvmtiError,
    #[jni_added("9")]
    pub GetNamedModule: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        class_loader: jobject,
        package_name: *const c_char,
        module_ptr: *mut jobject,
    ) -> jvmtiError,
    pub SetFieldAccessWatch:
        unsafe extern "C" fn(env: *mut jvmtiEnv, klass: jclass, field: jfieldID) -> jvmtiError,
    pub ClearFieldAccessWatch:
        unsafe extern "C" fn(env: *mut jvmtiEnv, klass: jclass, field: jfieldID) -> jvmtiError,
    pub SetFieldModificationWatch:
        unsafe extern "C" fn(env: *mut jvmtiEnv, klass: jclass, field: jfieldID) -> jvmtiError,
    pub ClearFieldModificationWatch:
        unsafe extern "C" fn(env: *mut jvmtiEnv, klass: jclass, field: jfieldID) -> jvmtiError,
    #[jni_added("1.1")]
    pub IsModifiableClass: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        is_modifiable_class_ptr: *mut jboolean,
    ) -> jvmtiError,
    pub Allocate: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        size: jlong,
        mem_ptr: *mut *mut c_uchar,
    ) -> jvmtiError,
    pub Deallocate: unsafe extern "C" fn(env: *mut jvmtiEnv, mem: *mut c_uchar) -> jvmtiError,
    pub GetClassSignature: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        signature_ptr: *mut *mut c_char,
        generic_ptr: *mut *mut c_char,
    ) -> jvmtiError,
    pub GetClassStatus: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        status_ptr: *mut jint,
    ) -> jvmtiError,
    pub GetSourceFileName: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        source_name_ptr: *mut *mut c_char,
    ) -> jvmtiError,
    pub GetClassModifiers: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        modifiers_ptr: *mut jint,
    ) -> jvmtiError,
    pub GetClassMethods: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        method_count_ptr: *mut jint,
        methods_ptr: *mut *mut jmethodID,
    ) -> jvmtiError,
    pub GetClassFields: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        field_count_ptr: *mut jint,
        fields_ptr: *mut *mut jfieldID,
    ) -> jvmtiError,
    pub GetImplementedInterfaces: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        interface_count_ptr: *mut jint,
        interfaces_ptr: *mut *mut jclass,
    ) -> jvmtiError,
    pub IsInterface: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        is_interface_ptr: *mut jboolean,
    ) -> jvmtiError,
    pub IsArrayClass: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        is_array_class_ptr: *mut jboolean,
    ) -> jvmtiError,
    pub GetClassLoader: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        classloader_ptr: *mut jobject,
    ) -> jvmtiError,
    pub GetObjectHashCode: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        object: jobject,
        hash_code_ptr: *mut jint,
    ) -> jvmtiError,
    pub GetObjectMonitorUsage: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        object: jobject,
        info_ptr: *mut jvmtiMonitorUsage,
    ) -> jvmtiError,
    pub GetFieldName: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        field: jfieldID,
        name_ptr: *mut *mut c_char,
        signature_ptr: *mut *mut c_char,
        generic_ptr: *mut *mut c_char,
    ) -> jvmtiError,
    pub GetFieldDeclaringClass: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        field: jfieldID,
        declaring_class_ptr: *mut jclass,
    ) -> jvmtiError,
    pub GetFieldModifiers: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        field: jfieldID,
        modifiers_ptr: *mut jint,
    ) -> jvmtiError,
    pub IsFieldSynthetic: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        field: jfieldID,
        is_synthetic_ptr: *mut jboolean,
    ) -> jvmtiError,
    pub GetMethodName: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        name_ptr: *mut *mut c_char,
        signature_ptr: *mut *mut c_char,
        generic_ptr: *mut *mut c_char,
    ) -> jvmtiError,
    pub GetMethodDeclaringClass: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        declaring_class_ptr: *mut jclass,
    ) -> jvmtiError,
    pub GetMethodModifiers: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        modifiers_ptr: *mut jint,
    ) -> jvmtiError,
    #[jni_added("25")]
    pub ClearAllFramePops: unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread) -> jvmtiError,
    pub GetMaxLocals: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        max_ptr: *mut jint,
    ) -> jvmtiError,
    pub GetArgumentsSize: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        size_ptr: *mut jint,
    ) -> jvmtiError,
    pub GetLineNumberTable: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        entry_count_ptr: *mut jint,
        table_ptr: *mut *mut jvmtiLineNumberEntry,
    ) -> jvmtiError,
    pub GetMethodLocation: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        start_location_ptr: *mut jlocation,
        end_location_ptr: *mut jlocation,
    ) -> jvmtiError,
    pub GetLocalVariableTable: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        entry_count_ptr: *mut jint,
        table_ptr: *mut *mut jvmtiLocalVariableEntry,
    ) -> jvmtiError,
    #[jni_added("1.1")]
    pub SetNativeMethodPrefix:
        unsafe extern "C" fn(env: *mut jvmtiEnv, prefix: *const c_char) -> jvmtiError,
    #[jni_added("1.1")]
    pub SetNativeMethodPrefixes: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        prefix_count: jint,
        prefixes: *mut *mut c_char,
    ) -> jvmtiError,
    pub GetBytecodes: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        bytecode_count_ptr: *mut jint,
        bytecodes_ptr: *mut *mut c_uchar,
    ) -> jvmtiError,
    pub IsMethodNative: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        is_native_ptr: *mut jboolean,
    ) -> jvmtiError,
    pub IsMethodSynthetic: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        is_synthetic_ptr: *mut jboolean,
    ) -> jvmtiError,
    pub GetLoadedClasses: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        class_count_ptr: *mut jint,
        classes_ptr: *mut *mut jclass,
    ) -> jvmtiError,
    pub GetClassLoaderClasses: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        initiating_loader: jobject,
        class_count_ptr: *mut jint,
        classes_ptr: *mut *mut jclass,
    ) -> jvmtiError,
    pub PopFrame: unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread) -> jvmtiError,
    #[jni_added("1.1")]
    pub ForceEarlyReturnObject:
        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, value: jobject) -> jvmtiError,
    #[jni_added("1.1")]
    pub ForceEarlyReturnInt:
        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, value: jint) -> jvmtiError,
    #[jni_added("1.1")]
    pub ForceEarlyReturnLong:
        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, value: jlong) -> jvmtiError,
    #[jni_added("1.1")]
    pub ForceEarlyReturnFloat:
        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, value: jfloat) -> jvmtiError,
    #[jni_added("1.1")]
    pub ForceEarlyReturnDouble:
        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, value: jdouble) -> jvmtiError,
    #[jni_added("1.1")]
    pub ForceEarlyReturnVoid:
        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread) -> jvmtiError,
    pub RedefineClasses: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        class_count: jint,
        class_definitions: *const jvmtiClassDefinition,
    ) -> jvmtiError,
    pub GetVersionNumber:
        unsafe extern "C" fn(env: *mut jvmtiEnv, version_ptr: *mut jint) -> jvmtiError,
    pub GetCapabilities: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        capabilities_ptr: *mut jvmtiCapabilities,
    ) -> jvmtiError,
    pub GetSourceDebugExtension: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        source_debug_extension_ptr: *mut *mut c_char,
    ) -> jvmtiError,
    pub IsMethodObsolete: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        method: jmethodID,
        is_obsolete_ptr: *mut jboolean,
    ) -> jvmtiError,
    pub SuspendThreadList: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        request_count: jint,
        request_list: *const jthread,
        results: *mut jvmtiError,
    ) -> jvmtiError,
    pub ResumeThreadList: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        request_count: jint,
        request_list: *const jthread,
        results: *mut jvmtiError,
    ) -> jvmtiError,
    #[jni_added("9")]
    pub AddModuleReads:
        unsafe extern "C" fn(env: *mut jvmtiEnv, module: jobject, to_module: jobject) -> jvmtiError,
    #[jni_added("9")]
    pub AddModuleExports: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        module: jobject,
        pkg_name: *const c_char,
        to_module: jobject,
    ) -> jvmtiError,
    #[jni_added("9")]
    pub AddModuleOpens: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        module: jobject,
        pkg_name: *const c_char,
        to_module: jobject,
    ) -> jvmtiError,
    #[jni_added("9")]
    pub AddModuleUses:
        unsafe extern "C" fn(env: *mut jvmtiEnv, module: jobject, service: jclass) -> jvmtiError,
    #[jni_added("9")]
    pub AddModuleProvides: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        module: jobject,
        service: jclass,
        impl_class: jclass,
    ) -> jvmtiError,
    #[jni_added("9")]
    pub IsModifiableModule: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        module: jobject,
        is_modifiable_module_ptr: *mut jboolean,
    ) -> jvmtiError,
    pub GetAllStackTraces: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        max_frame_count: jint,
        stack_info_ptr: *mut *mut jvmtiStackInfo,
        thread_count_ptr: *mut jint,
    ) -> jvmtiError,
    pub GetThreadListStackTraces: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread_count: jint,
        thread_list: *const jthread,
        max_frame_count: jint,
        stack_info_ptr: *mut *mut jvmtiStackInfo,
    ) -> jvmtiError,
    pub GetThreadLocalStorage: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        data_ptr: *mut *mut c_void,
    ) -> jvmtiError,
    pub SetThreadLocalStorage: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        data: *const c_void,
    ) -> jvmtiError,
    pub GetStackTrace: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        start_depth: jint,
        max_frame_count: jint,
        frame_buffer: *mut jvmtiFrameInfo,
        count_ptr: *mut jint,
    ) -> jvmtiError,
    #[jni_added("reserved")]
    pub reserved105: *mut c_void,
    pub GetTag: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        object: jobject,
        tag_ptr: *mut jlong,
    ) -> jvmtiError,
    pub SetTag: unsafe extern "C" fn(env: *mut jvmtiEnv, object: jobject, tag: jlong) -> jvmtiError,
    pub ForceGarbageCollection: unsafe extern "C" fn(env: *mut jvmtiEnv) -> jvmtiError,
    pub IterateOverObjectsReachableFromObject: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        object: jobject,
        object_reference_callback: jvmtiObjectReferenceCallback,
        user_data: *const c_void,
    ) -> jvmtiError,
    pub IterateOverReachableObjects: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        heap_root_callback: jvmtiHeapRootCallback,
        stack_ref_callback: jvmtiStackReferenceCallback,
        object_ref_callback: jvmtiObjectReferenceCallback,
        user_data: *const c_void,
    ) -> jvmtiError,
    pub IterateOverHeap: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        object_filter: jvmtiHeapObjectFilter,
        heap_object_callback: jvmtiHeapObjectCallback,
        user_data: *const c_void,
    ) -> jvmtiError,
    pub IterateOverInstancesOfClass: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        object_filter: jvmtiHeapObjectFilter,
        heap_object_callback: jvmtiHeapObjectCallback,
        user_data: *const c_void,
    ) -> jvmtiError,
    #[jni_added("reserved")]
    pub reserved113: *mut c_void,
    pub GetObjectsWithTags: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        tag_count: jint,
        tags: *const jlong,
        count_ptr: *mut jint,
        object_result_ptr: *mut *mut jobject,
        tag_result_ptr: *mut *mut jlong,
    ) -> jvmtiError,
    #[jni_added("1.1")]
    pub FollowReferences: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        heap_filter: jint,
        klass: jclass,
        initial_object: jobject,
        callbacks: *const jvmtiHeapCallbacks,
        user_data: *const c_void,
    ) -> jvmtiError,
    #[jni_added("1.1")]
    pub IterateThroughHeap: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        heap_filter: jint,
        klass: jclass,
        callbacks: *const jvmtiHeapCallbacks,
        user_data: *const c_void,
    ) -> jvmtiError,
    #[jni_added("reserved")]
    pub reserved117: *mut c_void,
    #[jni_added("21")]
    pub SuspendAllVirtualThreads: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        except_count: jint,
        except_list: *const jthread,
    ) -> jvmtiError,
    #[jni_added("21")]
    pub ResumeAllVirtualThreads: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        except_count: jint,
        except_list: *const jthread,
    ) -> jvmtiError,
    pub SetJNIFunctionTable: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        function_table: *const jniNativeInterface,
    ) -> jvmtiError,
    pub GetJNIFunctionTable: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        function_table: *mut *mut jniNativeInterface,
    ) -> jvmtiError,
    pub SetEventCallbacks: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        callbacks: *const jvmtiEventCallbacks,
        size_of_callbacks: jint,
    ) -> jvmtiError,
    pub GenerateEvents:
        unsafe extern "C" fn(env: *mut jvmtiEnv, event_type: jvmtiEvent) -> jvmtiError,
    pub GetExtensionFunctions: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        extension_count_ptr: *mut jint,
        extensions: *mut *mut jvmtiExtensionFunctionInfo,
    ) -> jvmtiError,
    pub GetExtensionEvents: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        extension_count_ptr: *mut jint,
        extensions: *mut *mut jvmtiExtensionEventInfo,
    ) -> jvmtiError,
    pub SetExtensionEventCallback: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        extension_event_index: jint,
        callback: jvmtiExtensionEvent,
    ) -> jvmtiError,
    pub DisposeEnvironment: unsafe extern "C" fn(env: *mut jvmtiEnv) -> jvmtiError,
    pub GetErrorName: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        error: jvmtiError,
        name_ptr: *mut *mut c_char,
    ) -> jvmtiError,
    pub GetJLocationFormat: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        format_ptr: *mut jvmtiJlocationFormat,
    ) -> jvmtiError,
    pub GetSystemProperties: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        count_ptr: *mut jint,
        property_ptr: *mut *mut *mut c_char,
    ) -> jvmtiError,
    pub GetSystemProperty: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        property: *const c_char,
        value_ptr: *mut *mut c_char,
    ) -> jvmtiError,
    pub SetSystemProperty: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        property: *const c_char,
        value_ptr: *const c_char,
    ) -> jvmtiError,
    pub GetPhase:
        unsafe extern "C" fn(env: *mut jvmtiEnv, phase_ptr: *mut jvmtiPhase) -> jvmtiError,
    pub GetCurrentThreadCpuTimerInfo:
        unsafe extern "C" fn(env: *mut jvmtiEnv, info_ptr: *mut jvmtiTimerInfo) -> jvmtiError,
    pub GetCurrentThreadCpuTime:
        unsafe extern "C" fn(env: *mut jvmtiEnv, nanos_ptr: *mut jlong) -> jvmtiError,
    pub GetThreadCpuTimerInfo:
        unsafe extern "C" fn(env: *mut jvmtiEnv, info_ptr: *mut jvmtiTimerInfo) -> jvmtiError,
    pub GetThreadCpuTime: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        nanos_ptr: *mut jlong,
    ) -> jvmtiError,
    pub GetTimerInfo:
        unsafe extern "C" fn(env: *mut jvmtiEnv, info_ptr: *mut jvmtiTimerInfo) -> jvmtiError,
    pub GetTime: unsafe extern "C" fn(env: *mut jvmtiEnv, nanos_ptr: *mut jlong) -> jvmtiError,
    pub GetPotentialCapabilities: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        capabilities_ptr: *mut jvmtiCapabilities,
    ) -> jvmtiError,
    #[jni_added("reserved")]
    pub reserved141: *mut c_void,
    pub AddCapabilities: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        capabilities_ptr: *const jvmtiCapabilities,
    ) -> jvmtiError,
    pub RelinquishCapabilities: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        capabilities_ptr: *const jvmtiCapabilities,
    ) -> jvmtiError,
    pub GetAvailableProcessors:
        unsafe extern "C" fn(env: *mut jvmtiEnv, processor_count_ptr: *mut jint) -> jvmtiError,
    #[jni_added("1.1")]
    pub GetClassVersionNumbers: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        minor_version_ptr: *mut jint,
        major_version_ptr: *mut jint,
    ) -> jvmtiError,
    #[jni_added("1.1")]
    pub GetConstantPool: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        klass: jclass,
        constant_pool_count_ptr: *mut jint,
        constant_pool_byte_count_ptr: *mut jint,
        constant_pool_bytes_ptr: *mut *mut c_uchar,
    ) -> jvmtiError,
    pub GetEnvironmentLocalStorage:
        unsafe extern "C" fn(env: *mut jvmtiEnv, data_ptr: *mut *mut c_void) -> jvmtiError,
    pub SetEnvironmentLocalStorage:
        unsafe extern "C" fn(env: *mut jvmtiEnv, data: *const c_void) -> jvmtiError,
    pub AddToBootstrapClassLoaderSearch:
        unsafe extern "C" fn(env: *mut jvmtiEnv, segment: *const c_char) -> jvmtiError,
    pub SetVerboseFlag: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        flag: jvmtiVerboseFlag,
        value: jboolean,
    ) -> jvmtiError,
    #[jni_added("1.1")]
    pub AddToSystemClassLoaderSearch:
        unsafe extern "C" fn(env: *mut jvmtiEnv, segment: *const c_char) -> jvmtiError,
    #[jni_added("1.1")]
    pub RetransformClasses: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        class_count: jint,
        classes: *const jclass,
    ) -> jvmtiError,
    #[jni_added("1.1")]
    pub GetOwnedMonitorStackDepthInfo: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        monitor_info_count_ptr: *mut jint,
        monitor_info_ptr: *mut *mut jvmtiMonitorStackDepthInfo,
    ) -> jvmtiError,
    pub GetObjectSize: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        object: jobject,
        size_ptr: *mut jlong,
    ) -> jvmtiError,
    #[jni_added("1.2")]
    pub GetLocalInstance: unsafe extern "C" fn(
        env: *mut jvmtiEnv,
        thread: jthread,
        depth: jint,
        value_ptr: *mut jobject,
    ) -> jvmtiError,
    #[jni_added("11")]
    pub SetHeapSamplingInterval:
        unsafe extern "C" fn(env: *mut jvmtiEnv, sampling_interval: jint) -> jvmtiError,
}