Skip to content

Commit e205cb0

Browse files
committed
Use symbolName to compare MethodEntrys
1 parent 0b665d3 commit e205cb0

File tree

2 files changed

+4
-48
lines changed

2 files changed

+4
-48
lines changed

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ public MethodEntry ensureMethodEntryForDebugRangeInfo(DebugRangeInfo debugRangeI
355355
ListIterator<MethodEntry> methodIterator = methods.listIterator();
356356
while (methodIterator.hasNext()) {
357357
MethodEntry methodEntry = methodIterator.next();
358-
int comparisonResult = methodEntry.compareTo(methodName, paramSignature, returnTypeName);
358+
int comparisonResult = methodEntry.compareTo(debugRangeInfo.symbolNameForMethod());
359359
if (comparisonResult == 0) {
360360
methodEntry.setInRange(debugInfoBase, debugRangeInfo);
361361
return methodEntry;

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/MethodEntry.java

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -115,33 +115,8 @@ public String getSymbolName() {
115115
return symbolName;
116116
}
117117

118-
public int compareTo(String methodName, String paramSignature, String returnTypeName) {
119-
int nameComparison = memberName.compareTo(methodName);
120-
if (nameComparison != 0) {
121-
return nameComparison;
122-
}
123-
int typeComparison = valueType.getTypeName().compareTo(returnTypeName);
124-
if (typeComparison != 0) {
125-
return typeComparison;
126-
}
127-
String[] paramTypeNames = paramSignature.split((","));
128-
int length;
129-
if (paramSignature.trim().length() == 0) {
130-
length = 0;
131-
} else {
132-
length = paramTypeNames.length;
133-
}
134-
int paramCountComparison = getParamCount() - length;
135-
if (paramCountComparison != 0) {
136-
return paramCountComparison;
137-
}
138-
for (int i = 0; i < getParamCount(); i++) {
139-
int paraComparison = getParamTypeName(i).compareTo(paramTypeNames[i].trim());
140-
if (paraComparison != 0) {
141-
return paraComparison;
142-
}
143-
}
144-
return 0;
118+
public int compareTo(String symbolNameForMethod) {
119+
return symbolName.compareTo(symbolNameForMethod);
145120
}
146121

147122
public boolean isDeoptTarget() {
@@ -150,25 +125,6 @@ public boolean isDeoptTarget() {
150125

151126
@Override
152127
public int compareTo(MethodEntry other) {
153-
assert other != null;
154-
int nameComparison = methodName().compareTo(other.methodName());
155-
if (nameComparison != 0) {
156-
return nameComparison;
157-
}
158-
int typeComparison = valueType.getTypeName().compareTo(other.valueType.getTypeName());
159-
if (typeComparison != 0) {
160-
return typeComparison;
161-
}
162-
int paramCountComparison = getParamCount() - other.getParamCount();
163-
if (paramCountComparison != 0) {
164-
return paramCountComparison;
165-
}
166-
for (int i = 0; i < getParamCount(); i++) {
167-
int paramComparison = getParamTypeName(i).compareTo(other.getParamTypeName(i));
168-
if (paramComparison != 0) {
169-
return paramComparison;
170-
}
171-
}
172-
return 0;
128+
return symbolName.compareTo(other.symbolName);
173129
}
174130
}

0 commit comments

Comments
 (0)