@@ -524,12 +524,12 @@ private int calculateInstanceDumpRecordSize(Instance instance) {
524
524
Assert .that (cd != null , "can not get class data for " + klass .getName ().asString () + klass .getAddress ());
525
525
}
526
526
List <Field > fields = cd .fields ;
527
- return ( int ) BYTE_SIZE + ( int ) OBJ_ID_SIZE * 2 + ( int ) INT_SIZE * 2 + getSizeForFields (fields );
527
+ return BYTE_SIZE + OBJ_ID_SIZE * 2 + INT_SIZE * 2 + getSizeForFields (fields );
528
528
}
529
529
530
530
private int calculateClassDumpRecordSize (Klass k ) {
531
531
// tag + javaMirror + DUMMY_STACK_TRACE_ID + super
532
- int size = ( int ) BYTE_SIZE + ( int ) INT_SIZE + ( int ) OBJ_ID_SIZE * 2 ;
532
+ int size = BYTE_SIZE + INT_SIZE + OBJ_ID_SIZE * 2 ;
533
533
if (k instanceof InstanceKlass ik ) {
534
534
List <Field > fields = getInstanceFields (ik );
535
535
List <Field > declaredFields = ik .getImmediateFields ();
@@ -592,7 +592,7 @@ private int calculateObjectArrayDumpRecordSize(ObjArray array) {
592
592
private int calculatePrimitiveArrayDumpRecordSize (TypeArray array ) throws IOException {
593
593
int headerSize = getArrayHeaderSize (false );
594
594
TypeArrayKlass tak = (TypeArrayKlass ) array .getKlass ();
595
- final int type = ( int ) tak .getElementType ();
595
+ final int type = tak .getElementType ();
596
596
final String typeName = tak .getElementTypeName ();
597
597
final long typeSize = getSizeForType (type );
598
598
final int length = calculateArrayMaxLength (array .getLength (),
@@ -654,7 +654,7 @@ private void fillInHeapRecordLength() throws IOException {
654
654
}
655
655
656
656
// get the size in bytes for the requested type
657
- private long getSizeForType (int type ) throws IOException {
657
+ private int getSizeForType (int type ) throws IOException {
658
658
switch (type ) {
659
659
case TypeArrayKlass .T_BOOLEAN :
660
660
return BOOLEAN_SIZE ;
@@ -680,8 +680,8 @@ private long getSizeForType(int type) throws IOException {
680
680
681
681
private int getArrayHeaderSize (boolean isObjectAarray ) {
682
682
return isObjectAarray ?
683
- (( int ) BYTE_SIZE + 2 * ( int ) INT_SIZE + 2 * ( int ) OBJ_ID_SIZE ):
684
- (2 * ( int ) BYTE_SIZE + 2 * ( int ) INT_SIZE + ( int ) OBJ_ID_SIZE );
683
+ (BYTE_SIZE + 2 * INT_SIZE + 2 * OBJ_ID_SIZE ):
684
+ (2 * BYTE_SIZE + 2 * INT_SIZE + OBJ_ID_SIZE );
685
685
}
686
686
687
687
// Check if we need to truncate an array.
@@ -817,7 +817,7 @@ private void writeClassDumpRecord(Klass k) throws IOException {
817
817
818
818
private void dumpStackTraces () throws IOException {
819
819
// write a HPROF_TRACE record without any frames to be referenced as object alloc sites
820
- writeHeader (HPROF_TRACE , 3 * ( int ) INT_SIZE );
820
+ writeHeader (HPROF_TRACE , 3 * INT_SIZE );
821
821
out .writeInt (DUMMY_STACK_TRACE_ID );
822
822
out .writeInt (0 ); // thread number
823
823
out .writeInt (0 ); // frame count
@@ -848,7 +848,7 @@ private void dumpStackTraces() throws IOException {
848
848
}
849
849
850
850
// write HPROF_TRACE record for one thread
851
- writeHeader (HPROF_TRACE , 3 * ( int ) INT_SIZE + depth * ( int ) VM . getVM (). getOopSize () );
851
+ writeHeader (HPROF_TRACE , 3 * INT_SIZE + depth * OBJ_ID_SIZE );
852
852
int stackSerialNum = numThreads + DUMMY_STACK_TRACE_ID ;
853
853
out .writeInt (stackSerialNum ); // stack trace serial number
854
854
out .writeInt (numThreads ); // thread serial number
@@ -872,7 +872,7 @@ private void dumpStackFrame(int frameSN, int classSN, Method m, int bci) throws
872
872
writeSymbol (m .getSignature ()); // method's signature
873
873
writeSymbol (m .getMethodHolder ().getSourceFileName ()); // source file name
874
874
// Then write FRAME descriptor
875
- writeHeader (HPROF_FRAME , 4 * ( int ) VM . getVM (). getOopSize () + 2 * ( int ) INT_SIZE );
875
+ writeHeader (HPROF_FRAME , 4 * OBJ_ID_SIZE + 2 * INT_SIZE );
876
876
writeObjectID (frameSN ); // frame serial number
877
877
writeSymbolID (m .getName ()); // method's name
878
878
writeSymbolID (m .getSignature ()); // method's signature
@@ -882,7 +882,7 @@ private void dumpStackFrame(int frameSN, int classSN, Method m, int bci) throws
882
882
}
883
883
884
884
protected void writeJavaThread (JavaThread jt , int index ) throws IOException {
885
- int size = ( int ) BYTE_SIZE + ( int ) OBJ_ID_SIZE + ( int ) INT_SIZE * 2 ;
885
+ int size = BYTE_SIZE + OBJ_ID_SIZE + INT_SIZE * 2 ;
886
886
writeHeapRecordPrologue (size );
887
887
out .writeByte ((byte ) HPROF_GC_ROOT_THREAD_OBJ );
888
888
writeObjectID (jt .getThreadObj ());
@@ -904,7 +904,7 @@ public void visitAddress(Address handleAddr) {
904
904
Oop oop = objectHeap .newOop (oopHandle );
905
905
// exclude JNI handles hotspot internal objects
906
906
if (oop != null && isJavaVisible (oop )) {
907
- int size = ( int ) BYTE_SIZE + ( int ) OBJ_ID_SIZE + ( int ) INT_SIZE * 2 ;
907
+ int size = BYTE_SIZE + OBJ_ID_SIZE + INT_SIZE * 2 ;
908
908
writeHeapRecordPrologue (size );
909
909
out .writeByte ((byte ) HPROF_GC_ROOT_JNI_LOCAL );
910
910
writeObjectID (oop );
@@ -932,7 +932,7 @@ protected void writeGlobalJNIHandle(Address handleAddr) throws IOException {
932
932
Oop oop = objectHeap .newOop (oopHandle );
933
933
// exclude JNI handles of hotspot internal objects
934
934
if (oop != null && isJavaVisible (oop )) {
935
- int size = ( int ) BYTE_SIZE + ( int ) OBJ_ID_SIZE * 2 ;
935
+ int size = BYTE_SIZE + OBJ_ID_SIZE * 2 ;
936
936
writeHeapRecordPrologue (size );
937
937
out .writeByte ((byte ) HPROF_GC_ROOT_JNI_GLOBAL );
938
938
writeObjectID (oop );
@@ -961,7 +961,7 @@ protected void writeObjectArray(ObjArray array) throws IOException {
961
961
protected void writePrimitiveArray (TypeArray array ) throws IOException {
962
962
int headerSize = getArrayHeaderSize (false );
963
963
TypeArrayKlass tak = (TypeArrayKlass ) array .getKlass ();
964
- final int type = ( int ) tak .getElementType ();
964
+ final int type = tak .getElementType ();
965
965
final String typeName = tak .getElementTypeName ();
966
966
final long typeSize = getSizeForType (type );
967
967
final int length = calculateArrayMaxLength (array .getLength (),
@@ -1390,14 +1390,14 @@ private static byte[] genByteArrayFromInt(int value) {
1390
1390
private long DOUBLE_BASE_OFFSET ;
1391
1391
private long OBJECT_BASE_OFFSET ;
1392
1392
1393
- private long BOOLEAN_SIZE ;
1394
- private long BYTE_SIZE ;
1395
- private long CHAR_SIZE ;
1396
- private long SHORT_SIZE ;
1397
- private long INT_SIZE ;
1398
- private long LONG_SIZE ;
1399
- private long FLOAT_SIZE ;
1400
- private long DOUBLE_SIZE ;
1393
+ private int BOOLEAN_SIZE ;
1394
+ private int BYTE_SIZE ;
1395
+ private int CHAR_SIZE ;
1396
+ private int SHORT_SIZE ;
1397
+ private int INT_SIZE ;
1398
+ private int LONG_SIZE ;
1399
+ private int FLOAT_SIZE ;
1400
+ private int DOUBLE_SIZE ;
1401
1401
1402
1402
private static class ClassData {
1403
1403
int instSize ;
1 commit comments
openjdk-notifier[bot] commentedon Jun 30, 2022
Review
Issues