3535import java .util .Map ;
3636
3737import com .oracle .objectfile .debuginfo .DebugInfoProvider .DebugFileInfo ;
38+ import jdk .vm .ci .meta .ResolvedJavaType ;
3839import org .graalvm .compiler .debug .DebugContext ;
3940
4041import com .oracle .objectfile .debuginfo .DebugInfoProvider ;
@@ -103,7 +104,7 @@ public abstract class DebugInfoBase {
103104 /**
104105 * index of already seen classes.
105106 */
106- private Map <String , ClassEntry > primaryClassesIndex = new HashMap <>();
107+ private Map <ResolvedJavaType , ClassEntry > primaryClassesIndex = new HashMap <>();
107108 /**
108109 * Index of files which contain primary or secondary ranges.
109110 */
@@ -238,17 +239,17 @@ public void installDebugInfo(DebugInfoProvider debugInfoProvider) {
238239 */
239240 String fileName = debugCodeInfo .fileName ();
240241 Path filePath = debugCodeInfo .filePath ();
241- String className = TypeEntry . canonicalize ( debugCodeInfo .ownerType () );
242+ ResolvedJavaType ownerType = debugCodeInfo .ownerType ();
242243 String methodName = debugCodeInfo .name ();
243244 int lo = debugCodeInfo .addressLo ();
244245 int hi = debugCodeInfo .addressHi ();
245246 int primaryLine = debugCodeInfo .line ();
246247
247248 /* Search for a method defining this primary range. */
248- ClassEntry classEntry = ensureClassEntry (className );
249+ ClassEntry classEntry = ensureClassEntry (ownerType );
249250 MethodEntry methodEntry = classEntry .ensureMethodEntryForDebugRangeInfo (debugCodeInfo , this , debugContext );
250251 Range primaryRange = new Range (stringTable , methodEntry , lo , hi , primaryLine );
251- debugContext .log (DebugContext .INFO_LEVEL , "PrimaryRange %s.%s %s %s:%d [0x%x, 0x%x]" , className , methodName , filePath , fileName , primaryLine , lo , hi );
252+ debugContext .log (DebugContext .INFO_LEVEL , "PrimaryRange %s.%s %s %s:%d [0x%x, 0x%x]" , ownerType . toJavaName () , methodName , filePath , fileName , primaryLine , lo , hi );
252253 classEntry .indexPrimary (primaryRange , debugCodeInfo .getFrameSizeChanges (), debugCodeInfo .getFrameSize ());
253254 /*
254255 * Record all subranges even if they have no line or file so we at least get a symbol
@@ -349,7 +350,6 @@ ClassEntry lookupClassEntry(String typeName) {
349350 */
350351 @ SuppressWarnings ("try" )
351352 private Range recursivelyAddSubRanges (DebugInfoProvider .DebugLineInfo lineInfo , Range primaryRange , ClassEntry classEntry , DebugContext debugContext ) {
352- /* Don't process the root method, it is already added as the primary range */
353353 if (lineInfo == null ) {
354354 return primaryRange ;
355355 }
@@ -359,38 +359,38 @@ private Range recursivelyAddSubRanges(DebugInfoProvider.DebugLineInfo lineInfo,
359359 * number
360360 */
361361 boolean isInline = lineInfo .getCaller () != null ;
362- assert (isInline || (lineInfo .name ().equals (primaryRange .getMethodName ()) && lineInfo .ownerType ().equals (primaryRange .getClassName ())));
362+ assert (isInline || (lineInfo .name ().equals (primaryRange .getMethodName ()) && TypeEntry . canonicalize ( lineInfo .ownerType (). toJavaName () ).equals (primaryRange .getClassName ())));
363363
364364 Range caller = recursivelyAddSubRanges (lineInfo .getCaller (), primaryRange , classEntry , debugContext );
365365 final String fileName = lineInfo .fileName ();
366366 final Path filePath = lineInfo .filePath ();
367- final String className = TypeEntry . canonicalize ( lineInfo .ownerType () );
367+ final ResolvedJavaType ownerType = lineInfo .ownerType ();
368368 final String methodName = lineInfo .name ();
369369 final int lo = primaryRange .getLo () + lineInfo .addressLo ();
370370 final int hi = primaryRange .getLo () + lineInfo .addressHi ();
371371 final int line = lineInfo .line ();
372- ClassEntry subRangeClassEntry = ensureClassEntry (className );
372+ ClassEntry subRangeClassEntry = ensureClassEntry (ownerType );
373373 MethodEntry subRangeMethodEntry = subRangeClassEntry .ensureMethodEntryForDebugRangeInfo (lineInfo , this , debugContext );
374374 Range subRange = new Range (stringTable , subRangeMethodEntry , lo , hi , line , primaryRange , isInline , caller );
375375 classEntry .indexSubRange (subRange );
376376 try (DebugContext .Scope s = debugContext .scope ("Subranges" )) {
377377 debugContext .log (DebugContext .VERBOSE_LEVEL , "SubRange %s.%s %s %s:%d 0x%x, 0x%x]" ,
378- className , methodName , filePath , fileName , line , lo , hi );
378+ ownerType . toJavaName () , methodName , filePath , fileName , line , lo , hi );
379379 }
380380 return subRange ;
381381 }
382382
383- private ClassEntry ensureClassEntry (String className ) {
383+ private ClassEntry ensureClassEntry (ResolvedJavaType type ) {
384384 /* See if we already have an entry. */
385- ClassEntry classEntry = primaryClassesIndex .get (className );
385+ ClassEntry classEntry = primaryClassesIndex .get (type );
386386 if (classEntry == null ) {
387- TypeEntry typeEntry = typesIndex .get (className );
387+ TypeEntry typeEntry = typesIndex .get (TypeEntry . canonicalize ( type . toJavaName ()) );
388388 assert (typeEntry != null && typeEntry .isClass ());
389389 classEntry = (ClassEntry ) typeEntry ;
390390 primaryClasses .add (classEntry );
391- primaryClassesIndex .put (className , classEntry );
391+ primaryClassesIndex .put (type , classEntry );
392392 }
393- assert (classEntry .getTypeName ().equals (className ));
393+ assert (classEntry .getTypeName ().equals (TypeEntry . canonicalize ( type . toJavaName ()) ));
394394 return classEntry ;
395395 }
396396
0 commit comments