Skip to content

Commit 8e4c43c

Browse files
committed
Respond to Paul's review comments.
1 parent 615bb36 commit 8e4c43c

File tree

1 file changed

+17
-7
lines changed
  • substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry

1 file changed

+17
-7
lines changed

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -734,37 +734,47 @@ private static void collectFilesAndDirs(ClassEntry classEntry) {
734734
EconomicSet<FileEntry> visitedFiles = EconomicSet.create();
735735
EconomicSet<DirEntry> visitedDirs = EconomicSet.create();
736736
// add the class's file and dir
737-
checkInclude(classEntry, classEntry.getFileEntry(), visitedFiles, visitedDirs);
737+
includeOnce(classEntry, classEntry.getFileEntry(), visitedFiles, visitedDirs);
738738
// add files for fields (may differ from class file if we have a substitution)
739739
for (FieldEntry fieldEntry : classEntry.fields) {
740-
checkInclude(classEntry, fieldEntry.getFileEntry(), visitedFiles, visitedDirs);
740+
includeOnce(classEntry, fieldEntry.getFileEntry(), visitedFiles, visitedDirs);
741741
}
742742
// add files for declared methods (may differ from class file if we have a substitution)
743743
for (MethodEntry methodEntry : classEntry.getMethods()) {
744-
checkInclude(classEntry, methodEntry.getFileEntry(), visitedFiles, visitedDirs);
744+
includeOnce(classEntry, methodEntry.getFileEntry(), visitedFiles, visitedDirs);
745745
}
746746
// add files for top level compiled and inline methods
747747
classEntry.compiledEntries().forEachOrdered(compiledMethodEntry -> {
748-
checkInclude(classEntry, compiledMethodEntry.getPrimary().getFileEntry(), visitedFiles, visitedDirs);
748+
includeOnce(classEntry, compiledMethodEntry.getPrimary().getFileEntry(), visitedFiles, visitedDirs);
749749
// we need files for leaf ranges and for inline caller ranges
750750
//
751751
// add leaf range files first because they get searched for linearly
752752
// during line info processing
753753
compiledMethodEntry.leafRangeIterator().forEachRemaining(subRange -> {
754-
checkInclude(classEntry, subRange.getFileEntry(), visitedFiles, visitedDirs);
754+
includeOnce(classEntry, subRange.getFileEntry(), visitedFiles, visitedDirs);
755755
});
756756
// now the non-leaf range files
757757
compiledMethodEntry.topDownRangeIterator().forEachRemaining(subRange -> {
758758
if (!subRange.isLeaf()) {
759-
checkInclude(classEntry, subRange.getFileEntry(), visitedFiles, visitedDirs);
759+
includeOnce(classEntry, subRange.getFileEntry(), visitedFiles, visitedDirs);
760760
}
761761
});
762762
});
763763
// now all files and dirs are known build an index for them
764764
classEntry.buildFileAndDirIndexes();
765765
}
766766

767-
private static void checkInclude(ClassEntry classEntry, FileEntry fileEntry, EconomicSet<FileEntry> visitedFiles, EconomicSet<DirEntry> visitedDirs) {
767+
/**
768+
* Ensure the supplied file entry and associated directory entry are included, but only once, in
769+
* a class entry's file and dir list.
770+
*
771+
* @param classEntry the class entry whose file and dir list may need to be updated
772+
* @param fileEntry a file entry which may need to be added to the class entry's file list or
773+
* whose dir may need adding to the class entry's dir list
774+
* @param visitedFiles a set tracking current file list entries, updated if a file is added
775+
* @param visitedDirs a set tracking current dir list entries, updated if a dir is added
776+
*/
777+
private static void includeOnce(ClassEntry classEntry, FileEntry fileEntry, EconomicSet<FileEntry> visitedFiles, EconomicSet<DirEntry> visitedDirs) {
768778
if (fileEntry != null && !visitedFiles.contains(fileEntry)) {
769779
visitedFiles.add(fileEntry);
770780
classEntry.includeFile(fileEntry);

0 commit comments

Comments
 (0)