From d52edf94ed7d994931758cb5a7087cbca4f27ef4 Mon Sep 17 00:00:00 2001 From: Andrew Dinn Date: Fri, 14 Apr 2023 10:06:05 +0100 Subject: [PATCH] Respond to review feedback --- .../objectfile/debugentry/ClassEntry.java | 2 +- .../debugentry/CompiledMethodEntry.java | 8 ++++---- .../objectfile/debugentry/DebugInfoBase.java | 11 ----------- .../oracle/objectfile/debugentry/DirEntry.java | 4 ++-- .../objectfile/debugentry/FileEntry.java | 6 +++--- .../debugentry/InterfaceClassEntry.java | 2 +- .../objectfile/debugentry/LoaderEntry.java | 2 +- .../objectfile/debugentry/MemberEntry.java | 2 +- .../objectfile/debugentry/MethodEntry.java | 6 +++--- .../debugentry/PrimitiveTypeEntry.java | 6 +++--- .../objectfile/debugentry/StringEntry.java | 2 +- .../debugentry/StructureTypeEntry.java | 2 +- .../objectfile/debugentry/TypeEntry.java | 4 ++-- .../objectfile/elf/dwarf/DwarfDebugInfo.java | 18 +++++++++--------- .../elf/dwarf/DwarfInfoSectionImpl.java | 2 +- .../objectfile/elf/dwarf/DwarfSectionImpl.java | 4 ++-- 16 files changed, 35 insertions(+), 46 deletions(-) diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java index 389c584ad6c6..dd4a51e8e259 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java @@ -62,7 +62,7 @@ public class ClassEntry extends StructureTypeEntry { /** * Details of the associated file. */ - private FileEntry fileEntry; + private final FileEntry fileEntry; /** * Details of the associated loader. */ diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/CompiledMethodEntry.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/CompiledMethodEntry.java index 8f02ad5ba107..b8d34393677a 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/CompiledMethodEntry.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/CompiledMethodEntry.java @@ -41,19 +41,19 @@ public class CompiledMethodEntry { /** * The primary range detailed by this object. */ - private PrimaryRange primary; + private final PrimaryRange primary; /** * Details of the class owning this range. */ - private ClassEntry classEntry; + private final ClassEntry classEntry; /** * Details of of compiled method frame size changes. */ - private List frameSizeInfos; + private final List frameSizeInfos; /** * Size of compiled method frame. */ - private int frameSize; + private final int frameSize; public CompiledMethodEntry(PrimaryRange primary, List frameSizeInfos, int frameSize, ClassEntry classEntry) { this.primary = primary; diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DebugInfoBase.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DebugInfoBase.java index 575552a609ec..52d11ce818bf 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DebugInfoBase.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DebugInfoBase.java @@ -716,17 +716,6 @@ public boolean isHubClassEntry(ClassEntry classEntry) { return classEntry.getTypeName().equals(DwarfDebugInfo.HUB_TYPE_NAME); } - public int classLayoutAbbrevCode(ClassEntry classEntry) { - if (!useHeapBase & isHubClassEntry(classEntry)) { - /* - * This layout adds special logic to remove tag bits from indirect pointers to this - * type. - */ - return DwarfDebugInfo.DW_ABBREV_CODE_class_layout2; - } - return DwarfDebugInfo.DW_ABBREV_CODE_class_layout1; - } - public ClassEntry getHubClassEntry() { return hubClassEntry; } diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DirEntry.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DirEntry.java index 71b4dde797ce..ddfbf7da5bcd 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DirEntry.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DirEntry.java @@ -36,8 +36,8 @@ * into directory tables once only rather than once per file. */ public class DirEntry { - private Path path; - private int idx; + private final Path path; + private final int idx; public DirEntry(Path path, int idx) { this.path = path; diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/FileEntry.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/FileEntry.java index 9eb99d3a72c2..d14ccf92af4d 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/FileEntry.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/FileEntry.java @@ -30,9 +30,9 @@ * Tracks debug info associated with a Java source file. */ public class FileEntry { - private String fileName; - private DirEntry dirEntry; - private int idx; + private final String fileName; + private final DirEntry dirEntry; + private final int idx; public FileEntry(String fileName, DirEntry dirEntry, int idx) { this.fileName = fileName; diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/InterfaceClassEntry.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/InterfaceClassEntry.java index 1faedc08c870..d939d27513e7 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/InterfaceClassEntry.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/InterfaceClassEntry.java @@ -36,7 +36,7 @@ import java.util.stream.Stream; public class InterfaceClassEntry extends ClassEntry { - private List implementors; + private final List implementors; public InterfaceClassEntry(String className, FileEntry fileEntry, int size) { super(className, fileEntry, size); diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/LoaderEntry.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/LoaderEntry.java index 21822f3b3253..f3390e29e802 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/LoaderEntry.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/LoaderEntry.java @@ -32,7 +32,7 @@ * need to be embedded in debug info that identifies class and method names. */ public class LoaderEntry { - String loaderId; + private final String loaderId; public LoaderEntry(String id) { loaderId = id; diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/MemberEntry.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/MemberEntry.java index f907ad72d936..603e1ddee1f6 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/MemberEntry.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/MemberEntry.java @@ -32,7 +32,7 @@ */ public abstract class MemberEntry { protected FileEntry fileEntry; - protected int line; + protected final int line; protected final String memberName; protected final StructureTypeEntry ownerType; protected final TypeEntry valueType; diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/MethodEntry.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/MethodEntry.java index e5a61b0abf67..a5dd64a23f8f 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/MethodEntry.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/MethodEntry.java @@ -51,9 +51,9 @@ public class MethodEntry extends MemberEntry { static final int INLINED = 1 << 2; static final int IS_OVERRIDE = 1 << 3; static final int IS_CONSTRUCTOR = 1 << 4; - int flags; - int vtableOffset = -1; - final String symbolName; + private int flags; + private final int vtableOffset; + private final String symbolName; public MethodEntry(DebugInfoBase debugInfoBase, DebugMethodInfo debugMethodInfo, FileEntry fileEntry, int line, String methodName, ClassEntry ownerType, diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/PrimitiveTypeEntry.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/PrimitiveTypeEntry.java index be58fb280e9a..5a7d7c69d18f 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/PrimitiveTypeEntry.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/PrimitiveTypeEntry.java @@ -36,9 +36,9 @@ import static com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugPrimitiveTypeInfo.FLAG_SIGNED; public class PrimitiveTypeEntry extends TypeEntry { - char typeChar; - int flags; - int bitCount; + private char typeChar; + private int flags; + private int bitCount; public PrimitiveTypeEntry(String typeName, int size) { super(typeName, size); diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/StringEntry.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/StringEntry.java index b984a63e02d1..01eb6fb9de38 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/StringEntry.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/StringEntry.java @@ -31,7 +31,7 @@ * be located in the debug_string section and, if so, tracks the offset at which it gets written. */ public class StringEntry { - private String string; + private final String string; private int offset; private boolean addToStrSection; diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/StructureTypeEntry.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/StructureTypeEntry.java index b08b8c8038fc..a242db7c3d89 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/StructureTypeEntry.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/StructureTypeEntry.java @@ -43,7 +43,7 @@ public abstract class StructureTypeEntry extends TypeEntry { /** * Details of fields located in this instance. */ - protected List fields; + protected final List fields; public StructureTypeEntry(String typeName, int size) { super(typeName, size); diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/TypeEntry.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/TypeEntry.java index 6c46fa995f04..c2d77a7b3183 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/TypeEntry.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/TypeEntry.java @@ -41,7 +41,7 @@ public abstract class TypeEntry { /** * The name of this type. */ - protected String typeName; + protected final String typeName; /** * The offset of the java.lang.Class instance for this class in the image heap or -1 if no such @@ -52,7 +52,7 @@ public abstract class TypeEntry { /** * The size of an occurrence of this type in bytes. */ - protected int size; + protected final int size; protected TypeEntry(String typeName, int size) { this.typeName = typeName; diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfDebugInfo.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfDebugInfo.java index bf1ecd76b86f..13a6d680d2bd 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfDebugInfo.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfDebugInfo.java @@ -310,22 +310,22 @@ public class DwarfDebugInfo extends DebugInfoBase { */ public static final String HUB_TYPE_NAME = "java.lang.Class"; - private DwarfStrSectionImpl dwarfStrSection; - private DwarfAbbrevSectionImpl dwarfAbbrevSection; - private DwarfInfoSectionImpl dwarfInfoSection; - private DwarfLocSectionImpl dwarfLocSection; - private DwarfARangesSectionImpl dwarfARangesSection; - private DwarfLineSectionImpl dwarfLineSection; - private DwarfFrameSectionImpl dwarfFameSection; + private final DwarfStrSectionImpl dwarfStrSection; + private final DwarfAbbrevSectionImpl dwarfAbbrevSection; + private final DwarfInfoSectionImpl dwarfInfoSection; + private final DwarfLocSectionImpl dwarfLocSection; + private final DwarfARangesSectionImpl dwarfARangesSection; + private final DwarfLineSectionImpl dwarfLineSection; + private final DwarfFrameSectionImpl dwarfFameSection; public final ELFMachine elfMachine; /** * Register used to hold the heap base. */ - private byte heapbaseRegister; + private final byte heapbaseRegister; /** * Register used to hold the current thread. */ - private byte threadRegister; + private final byte threadRegister; /** * A collection of properties associated with each generated type record indexed by type name. diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfInfoSectionImpl.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfInfoSectionImpl.java index 09da31a1d06e..8ea419d2fd80 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfInfoSectionImpl.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfInfoSectionImpl.java @@ -63,7 +63,7 @@ public class DwarfInfoSectionImpl extends DwarfSectionImpl { /** * The name of a special DWARF struct type used to model an object header. */ - public static final String OBJECT_HEADER_STRUCT_NAME = "_objhdr"; + private static final String OBJECT_HEADER_STRUCT_NAME = "_objhdr"; /** * An info header section always contains a fixed number of bytes. diff --git a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfSectionImpl.java b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfSectionImpl.java index ff26a7f8496c..d9a029ee5dc9 100644 --- a/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfSectionImpl.java +++ b/substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfSectionImpl.java @@ -63,7 +63,7 @@ public abstract class DwarfSectionImpl extends BasicProgbitsSectionImpl { // auxiliary class used to track byte array positions protected class Cursor { - int pos; + private int pos; public Cursor() { this(0); @@ -90,7 +90,7 @@ public int get() { } } - protected DwarfDebugInfo dwarfSections; + protected final DwarfDebugInfo dwarfSections; protected boolean debug = false; protected long debugTextBase = 0; protected long debugAddress = 0;