Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import com.oracle.objectfile.debuginfo.DebugInfoProvider;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugFrameSizeChange;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugMethodInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugInstanceTypeInfo;
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;
Expand Down Expand Up @@ -56,10 +55,6 @@ public class ClassEntry extends StructureTypeEntry {
* Details of the associated file.
*/
private FileEntry fileEntry;
/**
* Details of methods located in this instance.
*/
protected List<MethodEntry> methods;
/**
* A list recording details of all primary ranges included in this class sorted by ascending
* address range.
Expand Down Expand Up @@ -94,7 +89,6 @@ public ClassEntry(String className, FileEntry fileEntry, int size) {
super(className, size);
this.interfaces = new LinkedList<>();
this.fileEntry = fileEntry;
this.methods = new LinkedList<>();
this.primaryEntries = new LinkedList<>();
this.primaryIndex = new HashMap<>();
this.localFiles = new LinkedList<>();
Expand Down Expand Up @@ -133,8 +127,6 @@ public void addDebugInfo(DebugInfoBase debugInfoBase, DebugTypeInfo debugTypeInf
debugInstanceTypeInfo.interfaces().forEach(interfaceName -> processInterface(interfaceName, debugInfoBase, debugContext));
/* Add details of fields and field types */
debugInstanceTypeInfo.fieldInfoProvider().forEach(debugFieldInfo -> this.processField(debugFieldInfo, debugInfoBase, debugContext));
/* Add details of methods and method types */
debugInstanceTypeInfo.methodInfoProvider().forEach(methodFieldInfo -> this.processMethod(methodFieldInfo, debugInfoBase, debugContext));
}

public void indexPrimary(Range primary, List<DebugFrameSizeChange> frameSizeInfos, int frameSize) {
Expand Down Expand Up @@ -267,36 +259,6 @@ private void processInterface(String interfaceName, DebugInfoBase debugInfoBase,
interfaceClassEntry.addImplementor(this, debugContext);
}

protected void processMethod(DebugMethodInfo debugMethodInfo, DebugInfoBase debugInfoBase, DebugContext debugContext) {
String methodName = debugInfoBase.uniqueDebugString(debugMethodInfo.name());
String resultTypeName = TypeEntry.canonicalize(debugMethodInfo.valueType());
int modifiers = debugMethodInfo.modifiers();
List<String> paramTypes = debugMethodInfo.paramTypes();
List<String> paramNames = debugMethodInfo.paramNames();
assert paramTypes.size() == paramNames.size();
int paramCount = paramTypes.size();
debugContext.log("typename %s adding %s method %s %s(%s)\n",
typeName, memberModifiers(modifiers), resultTypeName, methodName, formatParams(paramTypes, paramNames));
TypeEntry resultType = debugInfoBase.lookupTypeEntry(resultTypeName);
TypeEntry[] paramTypeArray = new TypeEntry[paramCount];
String[] paramNameArray = new String[paramCount];
int idx = 0;
for (String paramTypeName : paramTypes) {
TypeEntry paramType = debugInfoBase.lookupTypeEntry(TypeEntry.canonicalize(paramTypeName));
paramTypeArray[idx++] = paramType;
}
paramNameArray = paramNames.toArray(paramNameArray);
String fileName = debugMethodInfo.fileName();
Path filePath = debugMethodInfo.filePath();
Path cachePath = debugMethodInfo.cachePath();
/*
* n.b. the method file may differ from the owning class file when the method is a
* substitution
*/
FileEntry methodFileEntry = debugInfoBase.ensureFileEntry(fileName, filePath, cachePath);
methods.add(new MethodEntry(methodFileEntry, methodName, this, resultType, paramTypeArray, paramNameArray, modifiers));
}

@Override
protected FieldEntry addField(DebugInfoProvider.DebugFieldInfo debugFieldInfo, DebugInfoBase debugInfoBase, DebugContext debugContext) {
FieldEntry fieldEntry = super.addField(debugFieldInfo, debugInfoBase, debugContext);
Expand Down Expand Up @@ -334,28 +296,4 @@ public boolean isPrimary() {
public ClassEntry getSuperClass() {
return superClass;
}

public Range makePrimaryRange(String methodName, String symbolName, String paramSignature, String returnTypeName, StringTable stringTable, FileEntry primaryFileEntry, int lo,
int hi, int primaryLine,
int modifiers, boolean isDeoptTarget) {
FileEntry fileEntryToUse = primaryFileEntry;
if (fileEntryToUse == null) {
/*
* Search for a matching method to supply the file entry or failing that use the one
* from this class.
*/
for (MethodEntry methodEntry : methods) {
if (methodEntry.match(methodName, paramSignature, returnTypeName)) {
/* maybe the method's file entry */
fileEntryToUse = methodEntry.getFileEntry();
break;
}
}
if (fileEntryToUse == null) {
/* Last chance is the class's file entry. */
fileEntryToUse = this.fileEntry;
}
}
return new Range(this.typeName, methodName, symbolName, paramSignature, returnTypeName, stringTable, fileEntryToUse, lo, hi, primaryLine, modifiers, isDeoptTarget);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ public void installDebugInfo(DebugInfoProvider debugInfoProvider) {
/* Search for a method defining this primary range. */
ClassEntry classEntry = ensureClassEntry(className);
FileEntry fileEntry = ensureFileEntry(fileName, filePath, cachePath);
Range primaryRange = classEntry.makePrimaryRange(methodName, symbolName, paramSignature, returnTypeName, stringTable, fileEntry, lo, hi, primaryLine, modifiers, isDeoptTarget);
if (fileEntry == null) {
fileEntry = classEntry.getFileEntry();
}
Range primaryRange = new Range(classEntry.getTypeName(), methodName, symbolName, paramSignature, returnTypeName, stringTable, fileEntry, lo, hi, primaryLine, modifiers, isDeoptTarget);
debugContext.log(DebugContext.INFO_LEVEL, "PrimaryRange %s.%s %s %s:%d [0x%x, 0x%x]", className, methodName, filePath, fileName, primaryLine, lo, hi);
classEntry.indexPrimary(primaryRange, debugCodeInfo.getFrameSizeChanges(), debugCodeInfo.getFrameSize());
debugCodeInfo.lineInfoProvider().forEach(debugLineInfo -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ interface DebugInstanceTypeInfo extends DebugTypeInfo {

Stream<DebugFieldInfo> fieldInfoProvider();

Stream<DebugMethodInfo> methodInfoProvider();

String superName();

Stream<String> interfaces();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,6 @@ public Stream<DebugFieldInfo> fieldInfoProvider() {
}
}

@Override
public Stream<DebugMethodInfo> methodInfoProvider() {
return Arrays.stream(hostedType.getAllDeclaredMethods()).map(this::createDebugMethodInfo);
}

@Override
public String superName() {
HostedClass superClass = hostedType.getSuperclass();
Expand Down