From 953fd4340f6eb6c578d591be9a0d601daf35ca6d Mon Sep 17 00:00:00 2001 From: aclement Date: Fri, 4 Feb 2005 13:42:54 +0000 Subject: [PATCH] Fix for atrocious incremental compilation performance. --- asm/src/org/aspectj/asm/AsmManager.java | 39 +++++++++++-------- asm/src/org/aspectj/asm/IHierarchy.java | 2 + .../asm/internal/AspectJElementHierarchy.java | 20 ++++++++++ 3 files changed, 44 insertions(+), 17 deletions(-) diff --git a/asm/src/org/aspectj/asm/AsmManager.java b/asm/src/org/aspectj/asm/AsmManager.java index f7c81df06..60645f3b0 100644 --- a/asm/src/org/aspectj/asm/AsmManager.java +++ b/asm/src/org/aspectj/asm/AsmManager.java @@ -41,9 +41,7 @@ public class AsmManager { public static boolean attemptIncrementalModelRepairs = false; // for debugging ... -// static { -// setReporting("c:/model.nfo",true,true,true,true); -// } + // For offline debugging, you can now ask for the AsmManager to @@ -54,7 +52,9 @@ public class AsmManager { private static String dumpFilename = ""; private static boolean reporting = false; - +// static { +// setReporting("c:/model.nfo",true,true,true,true); +// } protected AsmManager() { hierarchy = new AspectJElementHierarchy(); @@ -417,6 +417,11 @@ public class AsmManager { //===================== DELTA PROCESSING CODE ============== start ==========// + // XXX shouldn't be aware of the delimiter + private String getFilename(String hid) { + return hid.substring(0,hid.indexOf("|")); + } + // This code is *SLOW* but it isnt worth fixing until we address the // bugs in binary weaving. public void fixupStructureModel(Writer fw,List filesToBeCompiled,Set files_added,Set files_deleted) throws IOException { @@ -433,7 +438,7 @@ public class AsmManager { Set filesToRemoveFromStructureModel = new HashSet(filesToBeCompiled); filesToRemoveFromStructureModel.addAll(files_deleted); - + Set deletedNodes = new HashSet(); for (Iterator iter = filesToRemoveFromStructureModel.iterator(); iter.hasNext();) { File fileForCompilation = (File) iter.next(); String correctedPath = AsmManager.getDefault().getCanonicalFilePath(fileForCompilation); @@ -444,15 +449,15 @@ public class AsmManager { fw.write("Deleting "+progElem+" node for file "+fileForCompilation+"\n"); } removeNode(progElem); - verifyAssumption( - model.removeFromFileMap(correctedPath.toString()), - "Whilst repairing model, couldn't remove entry for file: "+correctedPath.toString()+" from the filemap"); + deletedNodes.add(getFilename(progElem.getHandleIdentifier())); + if (!model.removeFromFileMap(correctedPath.toString())) + throw new RuntimeException("Whilst repairing model, couldn't remove entry for file: "+correctedPath.toString()+" from the filemap"); modelModified = true; } } if (modelModified) { model.flushTypeMap(); - model.flushHandleMap(); + model.updateHandleMap(deletedNodes); } } @@ -641,26 +646,26 @@ public class AsmManager { */ private void removeNode(IProgramElement progElem) { - StringBuffer flightrecorder = new StringBuffer(); +// StringBuffer flightrecorder = new StringBuffer(); try { - flightrecorder.append("In removeNode, about to chuck away: "+progElem+"\n"); +// flightrecorder.append("In removeNode, about to chuck away: "+progElem+"\n"); verifyAssumption(progElem!=null); boolean deleteOK = false; IProgramElement parent = progElem.getParent(); - flightrecorder.append("Parent of it is "+parent+"\n"); +// flightrecorder.append("Parent of it is "+parent+"\n"); List kids = parent.getChildren(); - flightrecorder.append("Which has "+kids.size()+" kids\n"); +// flightrecorder.append("Which has "+kids.size()+" kids\n"); for (int i =0 ;i