1
1
/*
2
- * Copyright (c) 2000, 2023 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2000, 2024 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -127,6 +127,7 @@ public class VM {
127
127
private ReversePtrs revPtrs ;
128
128
private VMRegImpl vmregImpl ;
129
129
private int reserveForAllocationPrefetch ;
130
+ private int labAlignmentReserve ;
130
131
131
132
// System.getProperties from debuggee VM
132
133
private Properties sysProps ;
@@ -138,12 +139,12 @@ public class VM {
138
139
private Flag [] commandLineFlags ;
139
140
private Map <String , Flag > flagsMap ;
140
141
141
- private static Type intType ;
142
- private static Type uintType ;
143
- private static Type intxType ;
144
- private static Type uintxType ;
145
- private static Type sizetType ;
146
- private static Type uint64tType ;
142
+ private static CIntegerType intType ;
143
+ private static CIntegerType uintType ;
144
+ private static CIntegerType intxType ;
145
+ private static CIntegerType uintxType ;
146
+ private static CIntegerType sizetType ;
147
+ private static CIntegerType uint64tType ;
147
148
private static CIntegerType boolType ;
148
149
private Boolean sharingEnabled ;
149
150
private Boolean compressedOopsEnabled ;
@@ -432,17 +433,29 @@ private VM(TypeDataBase db, JVMDebugger debugger, boolean isBigEndian) {
432
433
vmRelease = CStringUtilities .getString (releaseAddr );
433
434
Address vmInternalInfoAddr = vmVersion .getAddressField ("_s_internal_vm_info_string" ).getValue ();
434
435
vmInternalInfo = CStringUtilities .getString (vmInternalInfoAddr );
435
-
436
- Type threadLocalAllocBuffer = db .lookupType ("ThreadLocalAllocBuffer" );
437
- CIntegerType intType = (CIntegerType ) db .lookupType ("int" );
438
- CIntegerField reserveForAllocationPrefetchField = threadLocalAllocBuffer .getCIntegerField ("_reserve_for_allocation_prefetch" );
439
- reserveForAllocationPrefetch = (int )reserveForAllocationPrefetchField .getCInteger (intType );
440
436
} catch (Exception exp ) {
441
437
throw new RuntimeException ("can't determine target's VM version : " + exp .getMessage ());
442
438
}
443
439
444
440
checkVMVersion (vmRelease );
445
441
442
+ // Initialize common primitive types
443
+ intType = (CIntegerType ) db .lookupType ("int" );
444
+ uintType = (CIntegerType ) db .lookupType ("uint" );
445
+ intxType = (CIntegerType ) db .lookupType ("intx" );
446
+ uintxType = (CIntegerType ) db .lookupType ("uintx" );
447
+ sizetType = (CIntegerType ) db .lookupType ("size_t" );
448
+ uint64tType = (CIntegerType ) db .lookupType ("uint64_t" );
449
+ boolType = (CIntegerType ) db .lookupType ("bool" );
450
+
451
+ Type threadLocalAllocBuffer = db .lookupType ("ThreadLocalAllocBuffer" );
452
+ CIntegerField reserveForAllocationPrefetchField = threadLocalAllocBuffer .getCIntegerField ("_reserve_for_allocation_prefetch" );
453
+ reserveForAllocationPrefetch = (int )reserveForAllocationPrefetchField .getCInteger (intType );
454
+
455
+ Type collectedHeap = db .lookupType ("CollectedHeap" );
456
+ CIntegerField labAlignmentReserveField = collectedHeap .getCIntegerField ("_lab_alignment_reserve" );
457
+ labAlignmentReserve = (int )labAlignmentReserveField .getCInteger (sizetType );
458
+
446
459
invocationEntryBCI = db .lookupIntConstant ("InvocationEntryBci" ).intValue ();
447
460
448
461
// We infer the presence of JVMTI from the presence of the InstanceKlass::_breakpoints field.
@@ -493,14 +506,6 @@ private VM(TypeDataBase db, JVMDebugger debugger, boolean isBigEndian) {
493
506
Flags_WAS_SET_ON_COMMAND_LINE = db .lookupIntConstant ("JVMFlag::WAS_SET_ON_COMMAND_LINE" ).intValue ();
494
507
oopSize = db .lookupIntConstant ("oopSize" ).intValue ();
495
508
496
- intType = db .lookupType ("int" );
497
- uintType = db .lookupType ("uint" );
498
- intxType = db .lookupType ("intx" );
499
- uintxType = db .lookupType ("uintx" );
500
- sizetType = db .lookupType ("size_t" );
501
- uint64tType = db .lookupType ("uint64_t" );
502
- boolType = (CIntegerType ) db .lookupType ("bool" );
503
-
504
509
minObjAlignmentInBytes = getObjectAlignmentInBytes ();
505
510
if ((minObjAlignmentInBytes & (minObjAlignmentInBytes - 1 )) != 0 ) {
506
511
throw new RuntimeException ("Object alignment " + minObjAlignmentInBytes + " is not power of two" );
@@ -929,6 +934,10 @@ public int getReserveForAllocationPrefetch() {
929
934
return reserveForAllocationPrefetch ;
930
935
}
931
936
937
+ public int getLabAlignmentReserve () {
938
+ return labAlignmentReserve ;
939
+ }
940
+
932
941
public boolean isSharingEnabled () {
933
942
if (sharingEnabled == null ) {
934
943
Address address = VM .getVM ().getDebugger ().lookup (null , "UseSharedSpaces" );
0 commit comments