You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/07/23 17:43:54 UTC

[royale-compiler] 01/02: Revert "Revert "add -diagnostics option to try to find out why compiler is hanging""

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 7a05b9b040990d3a4aba2b83b7faf21e8d29010c
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Jul 23 01:13:51 2018 -0700

    Revert "Revert "add -diagnostics option to try to find out why compiler is hanging""
    
    This reverts commit 090168c5b4e7b83e0700a6b122328b2ca13655d3.
---
 .../config/CompilerDiagnosticsConstants.java       | 43 ++++++++++++++
 .../royale/compiler/config/Configuration.java      | 17 ++++++
 .../royale/compiler/config/Configurator.java       |  7 ++-
 .../java/org/apache/royale/utils/FileUtils.java    |  7 ++-
 .../royale/compiler/clients/MXMLJSCRoyale.java     |  2 +
 .../internal/projects/RoyaleJSProject.java         | 13 ++++
 .../org/apache/royale/compiler/clients/ASC.java    |  5 ++
 .../org/apache/royale/compiler/clients/MXMLC.java  | 12 +++-
 .../royale/compiler/common/NodeReference.java      |  5 ++
 .../internal/definitions/ClassDefinitionBase.java  | 69 ++++++++++++++--------
 .../internal/definitions/DefinitionBase.java       |  5 ++
 .../embedding/transcoders/JPEGTranscoder.java      | 15 ++++-
 .../embedding/transcoders/SoundTranscoder.java     |  8 ++-
 .../embedding/transcoders/TranscoderBase.java      |  5 ++
 .../compiler/internal/graph/SynchronizedGraph.java | 34 +++++++++++
 .../internal/mxml/MXMLManifestManager.java         |  5 ++
 .../compiler/internal/parsing/TokenBase.java       |  5 ++
 .../compiler/internal/parsing/as/ASToken.java      |  5 ++
 .../compiler/internal/parsing/as/BaseASParser.java | 17 ++++++
 .../internal/parsing/mxml/MXMLScopeBuilder.java    |  5 ++
 .../compiler/internal/projects/ConfigManager.java  | 25 ++++++++
 .../compiler/internal/scopes/ASScopeBase.java      |  5 ++
 .../compiler/internal/scopes/ASScopeCache.java     | 41 +++++++++++++
 .../compiler/internal/targets/SWCTarget.java       | 17 ++++++
 .../compiler/internal/tree/as/FunctionNode.java    |  5 ++
 .../royale/compiler/internal/tree/as/NodeBase.java | 12 +++-
 .../compiler/internal/tree/mxml/MXMLFileNode.java  | 22 ++++++-
 .../internal/tree/mxml/MXMLScriptNode.java         |  5 ++
 .../internal/tree/mxml/MXMLTreeBuilder.java        |  5 ++
 .../compiler/internal/units/ASCompilationUnit.java |  5 ++
 .../as/decorators/SymbolDecoratorProvider.java     |  5 ++
 .../org/apache/royale/swf/io/InputBitStream.java   |  8 ++-
 .../org/apache/royale/swf/io/LZMACompressor.java   |  5 ++
 .../org/apache/royale/swf/io/LZMAInputStream.java  |  5 ++
 .../org/apache/royale/swf/io/OutputBitStream.java  |  8 ++-
 .../java/org/apache/royale/utils/ArgumentUtil.java |  6 ++
 .../org/apache/royale/utils/IntMapLRUCache.java    | 28 ++++++++-
 37 files changed, 452 insertions(+), 39 deletions(-)

diff --git a/compiler-common/src/main/java/org/apache/royale/compiler/config/CompilerDiagnosticsConstants.java b/compiler-common/src/main/java/org/apache/royale/compiler/config/CompilerDiagnosticsConstants.java
new file mode 100644
index 0000000..600ddee
--- /dev/null
+++ b/compiler-common/src/main/java/org/apache/royale/compiler/config/CompilerDiagnosticsConstants.java
@@ -0,0 +1,43 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.royale.compiler.config;
+
+/**
+ * Constants for the compiler's diagnostic output.
+ */
+public class CompilerDiagnosticsConstants
+{
+	public static int diagnostics = 0;
+    public static final int NODE_REFERENCES = 1;
+    public static final int COUNTER = 2;
+    public static final int CLASS_DEFINITION_BASE = 4;
+    public static final int SYNCHRONIZED_GRAPH = 8;
+    public static final int ASTOKEN = 16;
+    public static final int CONFIG_MANAGER = 32;
+    public static final int ASSCOPECACHE = 64;
+    public static final int FILE_NODE = 128;
+    public static final int WORKSPACE = 256;
+    public static final int SYMBOL_DECORATOR_PROVIDER = 512;
+    public static final int INT_MAP = 1024;
+    public static final int DA_BYTEARRAY = 2048;
+    public static final int FILE_UTILS = 4096;
+    public static final int ROYALEJSPROJECT = 8192;
+
+}
diff --git a/compiler-common/src/main/java/org/apache/royale/compiler/config/Configuration.java b/compiler-common/src/main/java/org/apache/royale/compiler/config/Configuration.java
index 8c3d8ed..40433c9 100644
--- a/compiler-common/src/main/java/org/apache/royale/compiler/config/Configuration.java
+++ b/compiler-common/src/main/java/org/apache/royale/compiler/config/Configuration.java
@@ -5897,6 +5897,23 @@ public class Configuration
     }
 
     //
+    // 'verbose' option from CommandLineConfiguration
+    //
+
+    private int diagnostics = 0;
+
+    public int getDiagnosticsLevel()
+    {
+        return diagnostics;
+    }
+
+    @Config(hidden = true)
+    public void setDiagnostics(ConfigurationValue cfgval, int b)
+    {
+        diagnostics = b;
+    }
+
+    //
     // 'dump-ast' option from CommandLineConfiguration
     //
 
diff --git a/compiler-common/src/main/java/org/apache/royale/compiler/config/Configurator.java b/compiler-common/src/main/java/org/apache/royale/compiler/config/Configurator.java
index d796371..14aa674 100644
--- a/compiler-common/src/main/java/org/apache/royale/compiler/config/Configurator.java
+++ b/compiler-common/src/main/java/org/apache/royale/compiler/config/Configurator.java
@@ -199,7 +199,12 @@ public class Configurator implements ICompilerSettings, IConfigurator, ICompiler
             @Override
             public IFileSpecification apply(final String path)
             {
-                return workspace.getFileSpecification(path);
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+            		System.out.println("Configurator waiting for lock in toFileSpecifications");
+            	IFileSpecification fs = workspace.getFileSpecification(path);
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+            		System.out.println("Configurator done with lock in toFileSpecifications");
+            	return fs;
             }
         });
     }
diff --git a/compiler-common/src/main/java/org/apache/royale/utils/FileUtils.java b/compiler-common/src/main/java/org/apache/royale/utils/FileUtils.java
index d678c09..824ab6d 100644
--- a/compiler-common/src/main/java/org/apache/royale/utils/FileUtils.java
+++ b/compiler-common/src/main/java/org/apache/royale/utils/FileUtils.java
@@ -25,6 +25,7 @@ import java.net.URISyntaxException;
 import java.util.HashMap;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 
 /**
  * A collection of file related utilities.
@@ -164,7 +165,11 @@ public final class FileUtils
             {
                 baos.write(buffer, 0, num);
             }
-            return baos.getDirectByteArray();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+        		System.out.println("FileUtils waiting for lock in toByteArray");
+            byte[] b = baos.getDirectByteArray();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+        		System.out.println("FileUtils waiting for lock in toByteArray");
         }
         catch (IOException ex)
         {
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java
index c4619f1..4cae1fe 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java
@@ -39,6 +39,7 @@ import org.apache.royale.compiler.clients.problems.ProblemQueryProvider;
 import org.apache.royale.compiler.clients.problems.WorkspaceProblemFormatter;
 import org.apache.royale.compiler.codegen.js.IJSPublisher;
 import org.apache.royale.compiler.codegen.js.IJSWriter;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.config.Configuration;
 import org.apache.royale.compiler.config.ConfigurationBuffer;
 import org.apache.royale.compiler.config.Configurator;
@@ -236,6 +237,7 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider
 
             if (continueCompilation)
             {
+            	CompilerDiagnosticsConstants.diagnostics = config.getDiagnosticsLevel();
                 project.setProblems(problems.getProblems());
                	compile();
                 if (problems.hasFilteredProblems())
diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleJSProject.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleJSProject.java
index 604402b..32fec27 100644
--- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleJSProject.java
+++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/projects/RoyaleJSProject.java
@@ -31,6 +31,7 @@ import java.util.TreeSet;
 import org.apache.royale.compiler.asdoc.royale.ASDocComment;
 import org.apache.royale.compiler.clients.JSConfiguration;
 import org.apache.royale.compiler.common.DependencyType;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.config.Configuration;
 import org.apache.royale.compiler.config.Configurator;
 import org.apache.royale.compiler.css.ICSSMediaQueryCondition;
@@ -131,15 +132,27 @@ public class RoyaleJSProject extends RoyaleProject
         {
             if (from != to)
             {
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ROYALEJSPROJECT) == CompilerDiagnosticsConstants.ROYALEJSPROJECT)
+            		System.out.println("RoyaleJSProject waiting for lock in updateRequiresMap from addDependency");
             	updateRequiresMap(from, to, dt, qname);
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ROYALEJSPROJECT) == CompilerDiagnosticsConstants.ROYALEJSPROJECT)
+            		System.out.println("RoyaleJSProject done with lock in updateRequiresMap from addDependency");
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ROYALEJSPROJECT) == CompilerDiagnosticsConstants.ROYALEJSPROJECT)
+            		System.out.println("RoyaleJSProject waiting for lock in updateJSModulesMap from addDependency");
             	updateJSModulesMap(from, to, dt, qname);
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ROYALEJSPROJECT) == CompilerDiagnosticsConstants.ROYALEJSPROJECT)
+            		System.out.println("RoyaleJSProject done with lock in updateJSModulesMap from addDependency");
             }
         }
         else
         {
             if (from != to)
             {
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ROYALEJSPROJECT) == CompilerDiagnosticsConstants.ROYALEJSPROJECT)
+            		System.out.println("RoyaleJSProject waiting for lock in updateInterfacesMap from addDependency");
             	updateInterfacesMap(from, to, dt, qname);
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ROYALEJSPROJECT) == CompilerDiagnosticsConstants.ROYALEJSPROJECT)
+            		System.out.println("RoyaleJSProject done with lock in updateInterfacesMap from addDependency");
             }
         }
 
diff --git a/compiler/src/main/java/org/apache/royale/compiler/clients/ASC.java b/compiler/src/main/java/org/apache/royale/compiler/clients/ASC.java
index 746d29a..615ce7c 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/clients/ASC.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/clients/ASC.java
@@ -60,6 +60,7 @@ import org.apache.royale.compiler.clients.problems.ProblemPrinter;
 import org.apache.royale.compiler.clients.problems.ProblemQuery;
 import org.apache.royale.compiler.clients.problems.WorkspaceProblemFormatter;
 import org.apache.royale.compiler.common.VersionInfo;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.config.RSLSettings;
 import org.apache.royale.compiler.filespecs.FileSpecification;
 import org.apache.royale.compiler.filespecs.IFileSpecification;
@@ -820,7 +821,11 @@ public class ASC
                         final FileNode fileNode = (FileNode)ast;
                         final ImmutableSet<ICompilerProblem> skeletonProblems = 
                                 ImmutableSet.copyOf(fileNode.getProblems());
+                    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.FILE_NODE) == CompilerDiagnosticsConstants.FILE_NODE)
+                    		System.out.println("ASC waiting for lock in populateFunctionNodes");
                         fileNode.populateFunctionNodes();
+                    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.FILE_NODE) == CompilerDiagnosticsConstants.FILE_NODE)
+                    		System.out.println("ASC done with lock in populateFunctionNodes");
                         final ImmutableSet<ICompilerProblem> allProblems = 
                                 ImmutableSet.copyOf(fileNode.getProblems());
                         
diff --git a/compiler/src/main/java/org/apache/royale/compiler/clients/MXMLC.java b/compiler/src/main/java/org/apache/royale/compiler/clients/MXMLC.java
index 0210105..8af2663 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/clients/MXMLC.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/clients/MXMLC.java
@@ -48,6 +48,7 @@ import org.apache.royale.compiler.clients.problems.ProblemQuery;
 import org.apache.royale.compiler.clients.problems.WorkspaceProblemFormatter;
 import org.apache.royale.compiler.common.VersionInfo;
 import org.apache.royale.compiler.config.CommandLineConfigurator;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.config.Configuration;
 import org.apache.royale.compiler.config.ConfigurationBuffer;
 import org.apache.royale.compiler.config.ConfigurationPathResolver;
@@ -732,7 +733,11 @@ public class MXMLC implements FlexTool
             final IASNode ast = compilationUnit.getSyntaxTreeRequest().get().getAST();
             if (ast != null)
             {
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.FILE_NODE) == CompilerDiagnosticsConstants.FILE_NODE)
+            		System.out.println("MXMLC waiting for lock in populateFunctionNodes");
                 ((IFileNode)ast).populateFunctionNodes();
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.FILE_NODE) == CompilerDiagnosticsConstants.FILE_NODE)
+            		System.out.println("MXMLC done with lock in populateFunctionNodes");
                 astDump.add(ast.toString());
             }
         }
@@ -1022,7 +1027,12 @@ public class MXMLC implements FlexTool
             @Override
             public IFileSpecification apply(final String path)
             {
-                return workspace.getFileSpecification(path);
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+            		System.out.println("MXMLC waiting for lock in toFileSpecifications");
+                IFileSpecification ret = workspace.getFileSpecification(path);
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+            		System.out.println("MXMLC waiting for lock in toFileSpecifications");
+            	return ret;
             }
         });
     }
diff --git a/compiler/src/main/java/org/apache/royale/compiler/common/NodeReference.java b/compiler/src/main/java/org/apache/royale/compiler/common/NodeReference.java
index 5a83923..9144c92 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/common/NodeReference.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/common/NodeReference.java
@@ -19,6 +19,7 @@
 
 package org.apache.royale.compiler.common;
 
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.filespecs.IFileSpecification;
 import org.apache.royale.compiler.internal.scopes.ASFileScope;
 import org.apache.royale.compiler.internal.scopes.ASScope;
@@ -179,6 +180,8 @@ public class NodeReference
             }
             if( fileScope != null) {
 
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.NODE_REFERENCES) == CompilerDiagnosticsConstants.NODE_REFERENCES)
+            		System.out.println("NodeReference getting lock for " + fileSpec.getPath());
                 // Grab the lock
                 synchronized (this)
                 {
@@ -200,6 +203,8 @@ public class NodeReference
                         nodeRef = new WeakReference<IASNode>(node);
                     }
                 }
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.NODE_REFERENCES) == CompilerDiagnosticsConstants.NODE_REFERENCES)
+            		System.out.println("NodeReference done with lock for " + fileSpec.getPath());
             }
         }
         return node;
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinitionBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinitionBase.java
index ce66b7f..e61a283 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinitionBase.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/ClassDefinitionBase.java
@@ -25,6 +25,7 @@ import java.util.*;
 import org.apache.royale.compiler.common.DependencyType;
 import org.apache.royale.compiler.common.RecursionGuard;
 
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.constants.IMetaAttributeConstants;
 import org.apache.royale.compiler.definitions.IClassDefinition;
 import org.apache.royale.compiler.definitions.IDefinition;
@@ -418,7 +419,7 @@ public abstract class ClassDefinitionBase extends TypeDefinitionBase implements
     private ArrayList<IDefinition> implDefinitions = null;
     
     @Override
-    public synchronized boolean isInstanceOf(final ITypeDefinition type, ICompilerProject project)
+    public boolean isInstanceOf(final ITypeDefinition type, ICompilerProject project)
     {
         // A class is considered an instance of itself.
         if (type == this)
@@ -428,17 +429,27 @@ public abstract class ClassDefinitionBase extends TypeDefinitionBase implements
         {
         	if (baseDefinitions == null)
         	{
-        		baseDefinitions = new ArrayList<IDefinition>();
-        		
-	            // We're trying to determine whether this class
-	            // is derived from a specified class ('type').
-	            // Iterate the superclass chain looking for 'type'.
-	            Iterator<IClassDefinition> iter = classIterator(project, false);
-	            while (iter.hasNext())
-	            {
-	                IClassDefinition cls = iter.next();
-	                baseDefinitions.add(cls);
-	            }
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.CLASS_DEFINITION_BASE) == CompilerDiagnosticsConstants.CLASS_DEFINITION_BASE)
+            		System.out.println("ClassDefinitionBase waiting for lock for " + this.getQualifiedName());
+	        	synchronized (this) 
+	        	{
+		        	if (baseDefinitions == null)
+		        	{
+		        		baseDefinitions = new ArrayList<IDefinition>();
+		        		
+			            // We're trying to determine whether this class
+			            // is derived from a specified class ('type').
+			            // Iterate the superclass chain looking for 'type'.
+			            Iterator<IClassDefinition> iter = classIterator(project, false);
+			            while (iter.hasNext())
+			            {
+			                IClassDefinition cls = iter.next();
+			                baseDefinitions.add(cls);
+			            }
+		        	}
+	        	}
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.CLASS_DEFINITION_BASE) == CompilerDiagnosticsConstants.CLASS_DEFINITION_BASE)
+            		System.out.println("ClassDefinitionBase done with lock for " + this.getQualifiedName());
         	}
             return baseDefinitions.contains(type);
         }
@@ -446,18 +457,28 @@ public abstract class ClassDefinitionBase extends TypeDefinitionBase implements
         {
         	if (implDefinitions == null)
         	{
-        		implDefinitions = new ArrayList<IDefinition>();
-        		
-	            // We're trying to determine whether this class
-	            // implements a specified interface ('type').
-	            // Iterate all of the interfaces that this class implements,
-	            // looking for 'type'.
-	            Iterator<IInterfaceDefinition> iter = interfaceIterator(project);
-	            while (iter.hasNext())
-	            {
-	                IInterfaceDefinition intf = iter.next();
-	                implDefinitions.add(intf);
-	            }
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.CLASS_DEFINITION_BASE) == CompilerDiagnosticsConstants.CLASS_DEFINITION_BASE)
+            		System.out.println("ClassDefinitionBase waiting for lock for " + this.getQualifiedName());
+	        	synchronized (this) 
+	        	{
+	            	if (implDefinitions == null)
+	            	{
+		        		implDefinitions = new ArrayList<IDefinition>();
+		        		
+			            // We're trying to determine whether this class
+			            // implements a specified interface ('type').
+			            // Iterate all of the interfaces that this class implements,
+			            // looking for 'type'.
+			            Iterator<IInterfaceDefinition> iter = interfaceIterator(project);
+			            while (iter.hasNext())
+			            {
+			                IInterfaceDefinition intf = iter.next();
+			                implDefinitions.add(intf);
+			            }
+	            	}
+	        	}
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.CLASS_DEFINITION_BASE) == CompilerDiagnosticsConstants.CLASS_DEFINITION_BASE)
+            		System.out.println("ClassDefinitionBase done with lock for " + this.getQualifiedName());
 	        }
             return implDefinitions.contains(type);
         }
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java
index 0626789..de6bdbc 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/definitions/DefinitionBase.java
@@ -36,6 +36,7 @@ import org.apache.royale.compiler.common.ASModifier;
 import org.apache.royale.compiler.common.DependencyType;
 import org.apache.royale.compiler.common.ModifiersSet;
 import org.apache.royale.compiler.common.NodeReference;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.constants.IASLanguageConstants;
 import org.apache.royale.compiler.constants.IMetaAttributeConstants;
 import org.apache.royale.compiler.constants.INamespaceConstants;
@@ -1687,9 +1688,13 @@ public abstract class DefinitionBase implements IDocumentableDefinition, IDefini
      */
     private void countDefinitions()
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.COUNTER) == CompilerDiagnosticsConstants.COUNTER)
+    		System.out.println("DefinitionBase incrementing Counter for " + getClass().getSimpleName());
         Counter counter = Counter.getInstance();
         counter.incrementCount(getClass().getSimpleName());
         counter.incrementCount("definitions");
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.COUNTER) == CompilerDiagnosticsConstants.COUNTER)
+    		System.out.println("DefinitionBase done incrementing Counter for " + getClass().getSimpleName());
     }
     
     //
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/embedding/transcoders/JPEGTranscoder.java b/compiler/src/main/java/org/apache/royale/compiler/internal/embedding/transcoders/JPEGTranscoder.java
index e71ead5..409f303 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/embedding/transcoders/JPEGTranscoder.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/embedding/transcoders/JPEGTranscoder.java
@@ -38,6 +38,7 @@ import javax.imageio.stream.MemoryCacheImageOutputStream;
 import org.apache.commons.io.IOUtils;
 
 import org.apache.royale.compiler.common.ISourceLocation;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.embedding.EmbedAttribute;
 import org.apache.royale.compiler.internal.embedding.EmbedData;
 import org.apache.royale.compiler.internal.workspaces.Workspace;
@@ -173,7 +174,12 @@ public class JPEGTranscoder extends ImageTranscoder
         writer.write(null, ioImage, writeParam);
         writer.dispose();
 
-        return buffer.getDirectByteArray();
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+    		System.out.println("JPEGTranscoder waiting for lock in bufferedImageToJPEG");
+        byte[] b =  buffer.getDirectByteArray();
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+    		System.out.println("JPEGTranscoder waiting for lock in bufferedImageToJPEG");
+    	return b;
     }
 
     private DefineBitsTag buildImage(byte[] imageBytes, byte[] alphaBytes)
@@ -203,7 +209,12 @@ public class JPEGTranscoder extends ImageTranscoder
         {
             IOUtils.closeQuietly(deflaterStream);
         }
-        return out.getDirectByteArray();
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+    		System.out.println("JPEGTranscoder waiting for lock in deflate");
+        byte[] b = out.getDirectByteArray();
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+    		System.out.println("JPEGTranscoder waiting for lock in deflate");
+    	return b;
     }
 
     @Override
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/embedding/transcoders/SoundTranscoder.java b/compiler/src/main/java/org/apache/royale/compiler/internal/embedding/transcoders/SoundTranscoder.java
index 9f9bbdc..128083a 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/embedding/transcoders/SoundTranscoder.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/embedding/transcoders/SoundTranscoder.java
@@ -29,6 +29,7 @@ import java.util.Map;
 import org.apache.commons.io.IOUtils;
 
 import org.apache.royale.compiler.common.ISourceLocation;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.internal.embedding.EmbedData;
 import org.apache.royale.compiler.internal.workspaces.Workspace;
 import org.apache.royale.compiler.problems.EmbedCouldNotDetermineSampleFrameCountProblem;
@@ -253,7 +254,12 @@ public class SoundTranscoder extends TranscoderBase
                     // assert false;
                 }
             }
-            return baos.getDirectByteArray();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+        		System.out.println("SoundTranscoder waiting for lock in readFully");
+            byte[] bb = baos.getDirectByteArray();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+        		System.out.println("SoundTranscoder waiting for lock in readFully");
+        	return bb;
         }
         catch (IOException e)
         {
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/embedding/transcoders/TranscoderBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/embedding/transcoders/TranscoderBase.java
index 0b3d480..caf7a81 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/embedding/transcoders/TranscoderBase.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/embedding/transcoders/TranscoderBase.java
@@ -28,6 +28,7 @@ import java.util.Map;
 import org.apache.commons.io.IOUtils;
 
 import org.apache.royale.compiler.common.ISourceLocation;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.constants.INamespaceConstants;
 import org.apache.royale.compiler.embedding.transcoders.ITranscoder;
 import org.apache.royale.compiler.filespecs.IBinaryFileSpecification;
@@ -194,7 +195,11 @@ public abstract class TranscoderBase implements ITranscoder
         }
         else
         {
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+        		System.out.println("TranscodeBase waiting for lock in getLatestBinaryFileSpecification");
             IBinaryFileSpecification fileSpec = workspace.getLatestBinaryFileSpecification(source);
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+        		System.out.println("TranscodeBase done with lock in getLatestBinaryFileSpecification");
             inStrm = getDataStream(fileSpec, problems);
         }
 
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/graph/SynchronizedGraph.java b/compiler/src/main/java/org/apache/royale/compiler/internal/graph/SynchronizedGraph.java
index 918224a..5e7d6b5 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/graph/SynchronizedGraph.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/graph/SynchronizedGraph.java
@@ -26,6 +26,8 @@ import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
+
 /**
  * Thread safe implementation of IGraph. While the graph will always be in a
  * consistent state, the graph may change between method calls, so clients
@@ -46,6 +48,8 @@ public class SynchronizedGraph<V, E extends IGraphEdge<V>> extends Graph<V, E>
     @Override
     public boolean addVertex(V vertex)
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+    		System.out.println("SynchronizedGraph.addVertex waiting for lock for " + getClass().getSimpleName());
         lock.writeLock().lock();
         try
         {
@@ -54,12 +58,16 @@ public class SynchronizedGraph<V, E extends IGraphEdge<V>> extends Graph<V, E>
         finally
         {
             lock.writeLock().unlock();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+        		System.out.println("SynchronizedGraph.addVertex dpne with lock for " + getClass().getSimpleName());
         }
     }
     
     @Override
     public void removeVertex(V vertex)
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+    		System.out.println("SynchronizedGraph.removeVertex waiting for lock for " + getClass().getSimpleName());
         lock.writeLock().lock();
         try
         {
@@ -68,11 +76,15 @@ public class SynchronizedGraph<V, E extends IGraphEdge<V>> extends Graph<V, E>
         finally
         {
             lock.writeLock().unlock();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+        		System.out.println("SynchronizedGraph.removeVertex dpne with lock for " + getClass().getSimpleName());
         }
     }
 
     public E setEdge(V from, V to, E e)
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+    		System.out.println("SynchronizedGraph.setEdge waiting for lock for " + getClass().getSimpleName());
         lock.writeLock().lock();
         try
         {
@@ -81,12 +93,16 @@ public class SynchronizedGraph<V, E extends IGraphEdge<V>> extends Graph<V, E>
         finally
         {
             lock.writeLock().unlock();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+        		System.out.println("SynchronizedGraph.setEdge dpne with lock for " + getClass().getSimpleName());
         }
     }
     
     @Override
     public E getEdge(V from, V to)
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+    		System.out.println("SynchronizedGraph.getEdge waiting for lock for " + getClass().getSimpleName());
         lock.writeLock().lock();
         try
         {
@@ -95,12 +111,16 @@ public class SynchronizedGraph<V, E extends IGraphEdge<V>> extends Graph<V, E>
         finally
         {
             lock.writeLock().unlock();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+        		System.out.println("SynchronizedGraph.getEdge dpne with lock for " + getClass().getSimpleName());
         }
     }
 
     @Override
     public Set<E> getOutgoingEdges(V vertex)
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+    		System.out.println("SynchronizedGraph.getOutgoingEdges waiting for lock for " + getClass().getSimpleName());
         lock.readLock().lock();
         try
         {
@@ -110,12 +130,16 @@ public class SynchronizedGraph<V, E extends IGraphEdge<V>> extends Graph<V, E>
         finally
         {
             lock.readLock().unlock();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+        		System.out.println("SynchronizedGraph.getOutgoingEdges dpne with lock for " + getClass().getSimpleName());
         }
     }
 
     @Override
     public Set<E> getIncomingEdges(V vertex)
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+    		System.out.println("SynchronizedGraph.getIncomingEdges waiting for lock for " + getClass().getSimpleName());
         lock.readLock().lock();
         try
         {
@@ -125,12 +149,16 @@ public class SynchronizedGraph<V, E extends IGraphEdge<V>> extends Graph<V, E>
         finally
         {
             lock.readLock().unlock();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+        		System.out.println("SynchronizedGraph.getIncomingEdges dpne with lock for " + getClass().getSimpleName());
         }
     }
 
     @Override
     public E removeEdge(E edge)
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+    		System.out.println("SynchronizedGraph.removeEdge waiting for lock for " + getClass().getSimpleName());
         lock.writeLock().lock();
         try
         {
@@ -139,12 +167,16 @@ public class SynchronizedGraph<V, E extends IGraphEdge<V>> extends Graph<V, E>
         finally
         {
             lock.writeLock().unlock();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+        		System.out.println("SynchronizedGraph.removeEdge dpne with lock for " + getClass().getSimpleName());
         }
     }
 
     @Override
     public Set<V> getVertices()
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+    		System.out.println("SynchronizedGraph.getVertices waiting for lock for " + getClass().getSimpleName());
         lock.readLock().lock();
         try
         {
@@ -154,6 +186,8 @@ public class SynchronizedGraph<V, E extends IGraphEdge<V>> extends Graph<V, E>
         finally
         {
             lock.readLock().unlock();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH) == CompilerDiagnosticsConstants.SYNCHRONIZED_GRAPH)
+        		System.out.println("SynchronizedGraph.getVertices dpne with lock for " + getClass().getSimpleName());
         }
     }
     
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/mxml/MXMLManifestManager.java b/compiler/src/main/java/org/apache/royale/compiler/internal/mxml/MXMLManifestManager.java
index cf03e4b..499324f 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/mxml/MXMLManifestManager.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/mxml/MXMLManifestManager.java
@@ -42,6 +42,7 @@ import org.apache.royale.compiler.mxml.IMXMLNamespaceMapping;
 import org.apache.royale.compiler.problems.ICompilerProblem;
 import org.apache.royale.compiler.problems.ManifestProblem;
 import org.apache.royale.compiler.common.XMLName;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.filespecs.IFileSpecification;
 import org.apache.royale.compiler.internal.projects.RoyaleProject;
 import org.apache.royale.swc.ISWCComponent;
@@ -216,7 +217,11 @@ public class MXMLManifestManager implements IMXMLManifestManager
     {
         Document manifestDocument = null;
         
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+    		System.out.println("MXMLManifestManager waiting for lock in addManifest");
         IFileSpecification manifestFileSpec = project.getWorkspace().getFileSpecification(manifestFileName);
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+    		System.out.println("MXMLManifestManager done with lock in addManifest");
         
         try
         {
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/TokenBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/TokenBase.java
index 2548744..08006be 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/TokenBase.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/TokenBase.java
@@ -22,6 +22,7 @@ package org.apache.royale.compiler.internal.parsing;
 import antlr.Token;
 
 import org.apache.royale.compiler.common.ISourceLocation;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.internal.common.Counter;
 import org.apache.royale.compiler.internal.parsing.as.ASTokenTypes;
 import org.apache.royale.compiler.internal.parsing.as.IncludeHandler;
@@ -540,9 +541,13 @@ public abstract class TokenBase extends Token implements ICMToken, ISourceLocati
      */
     private void countTokens()
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.COUNTER) == CompilerDiagnosticsConstants.COUNTER)
+    		System.out.println("TokenBase incrementing counter for " + getClass().getSimpleName());
         Counter counter = Counter.getInstance();
         counter.incrementCount(getClass().getSimpleName());
         counter.incrementCount("tokens");
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.COUNTER) == CompilerDiagnosticsConstants.COUNTER)
+    		System.out.println("TokenBase done incrementing counter for " + getClass().getSimpleName());
     }
 
     @Override
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/ASToken.java b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/ASToken.java
index 5a385e6..52f2040 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/ASToken.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/ASToken.java
@@ -21,6 +21,7 @@ package org.apache.royale.compiler.internal.parsing.as;
 
 import java.lang.reflect.Field;
 
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.internal.parsing.TokenBase;
 import org.apache.royale.compiler.parsing.IASToken;
 import org.apache.royale.compiler.parsing.ICMToken;
@@ -892,7 +893,11 @@ public class ASToken extends TokenBase implements IASToken, ASTokenTypes
     @Override
     protected String getTypeString()
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASTOKEN) == CompilerDiagnosticsConstants.ASTOKEN)
+    		System.out.println("ASToken waiting for lock for " + getSourcePath() + ":" + getLine() + ":" + getColumn());
         initializeTokenNames();
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASTOKEN) == CompilerDiagnosticsConstants.ASTOKEN)
+    		System.out.println("ASToken done with lock for " + getSourcePath() + ":" + getLine() + ":" + getColumn());
         return tokenNames.get(getType());
     }
 
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java
index a4f6a15..aff02fa 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/as/BaseASParser.java
@@ -62,6 +62,7 @@ import org.apache.royale.compiler.asdoc.IASParserASDocDelegate;
 import org.apache.royale.compiler.common.IFileSpecificationGetter;
 import org.apache.royale.compiler.common.ISourceLocation;
 import org.apache.royale.compiler.common.SourceLocation;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.constants.IASKeywordConstants;
 import org.apache.royale.compiler.constants.IASLanguageConstants;
 import org.apache.royale.compiler.constants.IMetaAttributeConstants;
@@ -933,8 +934,12 @@ abstract class BaseASParser extends LLkParser implements IProblemReporter
             if (!new File(sourcePath).isFile())
                 return null;
 
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+        		System.out.println("BaseASParser waiting for lock in tryGetSecondaryReader");
             // try to create a reader from file specification
             final IFileSpecification fileSpec = workspace.getFileSpecification(sourcePath);
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+        		System.out.println("BaseASParser done with lock in tryGetSecondaryReader");
             if (fileSpec != null)
             {
                 try
@@ -1183,7 +1188,11 @@ abstract class BaseASParser extends LLkParser implements IProblemReporter
             final int column,
             final Collection<ICompilerProblem> problems)
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+    		System.out.println("BaseASParser waiting for lock in parseMetadata");
         final long lastModified = workspace.getFileSpecification(sourcePath).getLastModified();
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+    		System.out.println("BaseASParser done with lock in parseMetadata");
         final IFileSpecification fileSpec = new StringFileSpecification(sourcePath, metadataContent, lastModified);
         final IncludeHandler includeHandler = new IncludeHandler(workspace);
         final ASParser parser = new ASParser(workspace, (IRepairingTokenBuffer)null);
@@ -1583,12 +1592,20 @@ abstract class BaseASParser extends LLkParser implements IProblemReporter
         final ICompilerProblem syntaxProblem;
         if (ex instanceof MismatchedTokenException)
         {
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASTOKEN) == CompilerDiagnosticsConstants.ASTOKEN)
+        		System.out.println("BaseASParser waiting for lock for typeToKind");
             final ASTokenKind expectedKind = ASToken.typeToKind(((MismatchedTokenException)ex).expecting);
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASTOKEN) == CompilerDiagnosticsConstants.ASTOKEN)
+        		System.out.println("BaseASParser done with lock for typeToKind");
             syntaxProblem = unexpectedTokenProblem(current, expectedKind);
         }
         else if (endToken != NO_END_TOKEN)
         {
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASTOKEN) == CompilerDiagnosticsConstants.ASTOKEN)
+        		System.out.println("BaseASParser waiting for lock for typeToKind");
             final ASTokenKind expectedKind = ASToken.typeToKind(endToken);
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASTOKEN) == CompilerDiagnosticsConstants.ASTOKEN)
+        		System.out.println("BaseASParser done with lock for typeToKind");
             syntaxProblem = unexpectedTokenProblem(current, expectedKind);
         }
         else
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/mxml/MXMLScopeBuilder.java b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/mxml/MXMLScopeBuilder.java
index 4e452f5..a2af339 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/mxml/MXMLScopeBuilder.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/parsing/mxml/MXMLScopeBuilder.java
@@ -33,6 +33,7 @@ import java.util.List;
 import org.apache.commons.io.IOUtils;
 import org.apache.royale.compiler.common.IFileSpecificationGetter;
 import org.apache.royale.compiler.common.Multiname;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.definitions.IDefinition;
 import org.apache.royale.compiler.definitions.INamespaceDefinition;
 import org.apache.royale.compiler.definitions.metadata.IMetaTag;
@@ -558,7 +559,11 @@ public class MXMLScopeBuilder
                             mxmlTextData.getCompilableTextColumn(), problems);
                     if (metaTagNodes != null)
                     {
+                    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+                    		System.out.println("MXMLScopeBuilder waiting for lock in processMetadataTag");
                         IFileSpecification containingFileSpec = fileScope.getWorkspace().getFileSpecification(fileScope.getContainingPath());
+                    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+                    		System.out.println("MXMLScopeBuilder done with lock in processMetadataTag");
                         IMetaTag[] newMetaTags = metaTagNodes.buildMetaTags(containingFileSpec, currentClassDefinition);
                         if( newMetaTags != null )
                         {
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/ConfigManager.java b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/ConfigManager.java
index bddd7a4..8db455f 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/projects/ConfigManager.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/projects/ConfigManager.java
@@ -27,6 +27,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.constants.IASKeywordConstants;
 import org.apache.royale.compiler.constants.IASLanguageConstants;
 import org.apache.royale.compiler.definitions.IDefinition;
@@ -156,7 +157,13 @@ public final class ConfigManager
         public List<ConfigConstNode> getConfigVariables()
         {
             if(constNodes == null)
+            {
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.CONFIG_MANAGER) == CompilerDiagnosticsConstants.CONFIG_MANAGER)
+            		System.out.println("ConfigManager waiting for lock for loadConfigData");
                 loadConfigData();
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.CONFIG_MANAGER) == CompilerDiagnosticsConstants.CONFIG_MANAGER)
+            		System.out.println("ConfigManager done with lock for loadConfigData");
+            }
             return constNodes;
         }
 
@@ -164,7 +171,13 @@ public final class ConfigManager
         public List<ConfigNamespaceNode> getConfigNamespaces()
         {
             if(configNamespaces == null)
+            {
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.CONFIG_MANAGER) == CompilerDiagnosticsConstants.CONFIG_MANAGER)
+            		System.out.println("ConfigManager waiting for lock for loadConfigData");
                 loadConfigData();
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.CONFIG_MANAGER) == CompilerDiagnosticsConstants.CONFIG_MANAGER)
+            		System.out.println("ConfigManager done with lock for loadConfigData");
+            }
             return configNamespaces;
         }
 
@@ -172,7 +185,13 @@ public final class ConfigManager
         public List<String> getConfigNamespaceNames()
         {
             if(nsNames == null)
+            {
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.CONFIG_MANAGER) == CompilerDiagnosticsConstants.CONFIG_MANAGER)
+            		System.out.println("ConfigManager waiting for lock for loadConfigData");
                 loadConfigData();
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.CONFIG_MANAGER) == CompilerDiagnosticsConstants.CONFIG_MANAGER)
+            		System.out.println("ConfigManager done with lock for loadConfigData");
+            }
             return nsNames;
         }
 
@@ -180,7 +199,13 @@ public final class ConfigManager
         public Collection<ICompilerProblem> getProblems()
         {
             if(problems == null)
+            {
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.CONFIG_MANAGER) == CompilerDiagnosticsConstants.CONFIG_MANAGER)
+            		System.out.println("ConfigManager waiting for lock for loadConfigData");
                 loadConfigData();
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.CONFIG_MANAGER) == CompilerDiagnosticsConstants.CONFIG_MANAGER)
+            		System.out.println("ConfigManager done with lock for loadConfigData");
+            }
             return problems;
         }
 
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/scopes/ASScopeBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/scopes/ASScopeBase.java
index 0817e04..34fa1d6 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/scopes/ASScopeBase.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/scopes/ASScopeBase.java
@@ -25,6 +25,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.definitions.IDefinition;
 import org.apache.royale.compiler.definitions.INamespaceDefinition;
 import org.apache.royale.compiler.definitions.IScopedDefinition;
@@ -512,8 +513,12 @@ public abstract class ASScopeBase implements IASScope
      */
     private void countScopes()
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.COUNTER) == CompilerDiagnosticsConstants.COUNTER)
+    		System.out.println("ASScopeBase incrementing counter for " + getClass().getSimpleName());
         Counter counter = Counter.getInstance();
         counter.incrementCount(getClass().getSimpleName());
         counter.incrementCount("scopes");
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.COUNTER) == CompilerDiagnosticsConstants.COUNTER)
+    		System.out.println("ASScopeBase done incrementing counter for " + getClass().getSimpleName());
     }
 }
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/scopes/ASScopeCache.java b/compiler/src/main/java/org/apache/royale/compiler/internal/scopes/ASScopeCache.java
index 8d9d1d7..fb43722 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/scopes/ASScopeCache.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/scopes/ASScopeCache.java
@@ -20,6 +20,7 @@
 package org.apache.royale.compiler.internal.scopes;
 
 import org.apache.royale.compiler.common.DependencyType;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.constants.IASLanguageConstants;
 import org.apache.royale.compiler.definitions.IDefinition;
 import org.apache.royale.compiler.definitions.IInterfaceDefinition;
@@ -205,6 +206,8 @@ public class ASScopeCache
         ConcurrentMap<String, IDefinition> map = findPropCache != null ? findPropCache.get() : null;
         if (map == null)
         {
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache waiting for lock in getScopeChainMap");
             synchronized (this)
             {
                 // Check again, in case another thread updated the map first
@@ -215,6 +218,8 @@ public class ASScopeCache
                     findPropCache = new SoftReference<ConcurrentMap<String, IDefinition>>(map);
                 }
             }
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache done with lock in getScopeChainMap");
         }
         return map;
     }
@@ -224,6 +229,8 @@ public class ASScopeCache
         ConcurrentMap<QName, IDefinition> map = findPropQualifiedCache != null ? findPropQualifiedCache.get() : null;
         if (map == null)
         {
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache waiting for lock in getQualifiedScopeChainMap");
             synchronized (this)
             {
                 // Check again, in case another thread updated the map first
@@ -234,6 +241,8 @@ public class ASScopeCache
                     findPropQualifiedCache = new SoftReference<ConcurrentMap<QName, IDefinition>>(map);
                 }
             }
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache done with lock in getQualifiedScopeChainMap");
         }
         return map;
     }
@@ -402,6 +411,8 @@ public class ASScopeCache
         ConcurrentMap<String, Set<INamespaceDefinition>> map = namespacesForNameCache != null ? namespacesForNameCache.get() : null;
         if (map == null)
         {
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache waiting for lock in getNamespacesForNameMap");
             synchronized (this)
             {
                 // Check again, in case another thread updated the map first
@@ -412,6 +423,8 @@ public class ASScopeCache
                     namespacesForNameCache = new SoftReference<ConcurrentMap<String, Set<INamespaceDefinition>>>(map);
                 }
             }
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache done with lock in getNamespacesForNameMap");
         }
         return map;
     }
@@ -421,6 +434,8 @@ public class ASScopeCache
         ConcurrentMap<IResolvedQualifiersReference, IDefinition> map = multinameLookupCache != null ? multinameLookupCache.get() : null;
         if (map == null)
         {
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache waiting for lock in getMultinameLookupMap");
             synchronized (this)
             {
                 // Check again, in case another thread updated the map first
@@ -431,6 +446,8 @@ public class ASScopeCache
                     multinameLookupCache = new SoftReference<ConcurrentMap<IResolvedQualifiersReference, IDefinition>>(map);
                 }
             }
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache done with lock in getMultinameLookupMap");
         }
         return map;
     }
@@ -440,6 +457,8 @@ public class ASScopeCache
         ConcurrentMap<IDefinition, Object> map = constValueLookupCache != null ? constValueLookupCache.get() : null;
         if (map == null)
         {
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache waiting for lock in getConstantValueLookupMap");
             synchronized (this)
             {
                 // Check again, in case another thread updated the map first
@@ -450,6 +469,8 @@ public class ASScopeCache
                     constValueLookupCache = new SoftReference<ConcurrentMap<IDefinition, Object>>(map);
                 }
             }
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache done with lock in getConstantValueLookupMap");
         }
         return map;
     }
@@ -459,6 +480,8 @@ public class ASScopeCache
         Set<IASLanguageConstants.BuiltinType> set = builtinTypeDependencyCache != null ? builtinTypeDependencyCache.get() : null;
         if (set == null)
         {
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache waiting for lock in getBuiltinTypeMap");
             synchronized (this)
             {
                 // Check again, in case another thread updated the set first
@@ -469,6 +492,8 @@ public class ASScopeCache
                     builtinTypeDependencyCache = new SoftReference<Set<IASLanguageConstants.BuiltinType>>(set);
                 }
             }
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache done with lock in getBuiltinTypeMap");
         }
         return set;
     }
@@ -494,14 +519,22 @@ public class ASScopeCache
         Boolean valueObject = needsEventDispatcherCache;
         if (valueObject != null)
             return valueObject.booleanValue();
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+    		System.out.println("ASScopeCache waiting for lock in needsEventDispatcher");
         synchronized (this)
         {
             // Check again, in case another thread updated the value first
             valueObject = needsEventDispatcherCache;
             if (valueObject != null)
+            {
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+            		System.out.println("ASScopeCache done with lock in needsEventDispatcher");
                 return valueObject.booleanValue();
+            }
             boolean computedValue = ((ClassDefinitionBase)scope.getDefinition()).computeNeedsEventDispatcher(project);
             needsEventDispatcherCache = computedValue;
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache done with lock in needsEventDispatcher");
             return computedValue;
         }
     }
@@ -516,15 +549,23 @@ public class ASScopeCache
         if( interfs != null )
             return interfs;
 
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+    		System.out.println("ASScopeCache waiting for lock in resolveInterfaces");
         synchronized (this)
         {
             // check again in case another thread updated the value first
             interfs = interfacesCache != null ? interfacesCache.get() : null;
             if( interfs != null )
+            {
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+            		System.out.println("ASScopeCache done with lock in resolveInterfaces");
                 return interfs;
+            }
 
             interfs = ((TypeDefinitionBase)scope.getDefinition()).resolveInterfacesImpl(project);
             interfacesCache = new SoftReference<IInterfaceDefinition[]>(interfs);
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.ASSCOPECACHE) == CompilerDiagnosticsConstants.ASSCOPECACHE)
+        		System.out.println("ASScopeCache done with lock in resolveInterfaces");
             return interfs;
         }
     }
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/targets/SWCTarget.java b/compiler/src/main/java/org/apache/royale/compiler/internal/targets/SWCTarget.java
index 698834a..8088ec9 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/targets/SWCTarget.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/targets/SWCTarget.java
@@ -46,6 +46,7 @@ import org.apache.royale.compiler.common.DependencyTypeSet;
 import org.apache.royale.compiler.common.ISourceLocation;
 import org.apache.royale.compiler.common.VersionInfo;
 import org.apache.royale.compiler.common.XMLName;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.constants.IMetaAttributeConstants;
 import org.apache.royale.compiler.definitions.IClassDefinition;
 import org.apache.royale.compiler.definitions.IDefinition;
@@ -344,7 +345,11 @@ public class SWCTarget extends Target implements ISWCTarget
             IOUtils.copy(fileInputStream, buffer);
             IOUtils.closeQuietly(buffer);
             IOUtils.closeQuietly(fileInputStream);
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+        		System.out.println("SWCTarget waiting for lock in getContents");
             contents = buffer.getDirectByteArray();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+        		System.out.println("SWCTarget waiting for lock in getContents");
         }
         catch (IOException e)
         {
@@ -862,7 +867,11 @@ public class SWCTarget extends Target implements ISWCTarget
                 for (File file : files)
                 {
                     String path = file.getAbsolutePath();
+                	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+                		System.out.println("SWCTarget waiting for lock in getLatestBinaryFileSpecification");
                     IBinaryFileSpecification fileSpec = project.getWorkspace().getLatestBinaryFileSpecification(path);
+                	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+                		System.out.println("SWCTarget done with lock in getLatestBinaryFileSpecification");
 
                     if (filename != null && fileSpec != null)
                     {
@@ -876,7 +885,11 @@ public class SWCTarget extends Target implements ISWCTarget
             else
             {
                 String path = entry.getValue().getAbsolutePath();
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+            		System.out.println("SWCTarget waiting for lock in getLatestBinaryFileSpecification");
                 IBinaryFileSpecification fileSpec = project.getWorkspace().getLatestBinaryFileSpecification(path);
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+            		System.out.println("SWCTarget done with lock in getLatestBinaryFileSpecification");
     
                 if (filename != null && fileSpec != null)
                 {
@@ -978,7 +991,11 @@ public class SWCTarget extends Target implements ISWCTarget
                 {
                     String sourcePath = classDefinition.getSourcePath();
                     iconFilePath = FilenameUtils.getFullPath(sourcePath) + iconFilePath;
+                	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+                		System.out.println("SWCTarget waiting for lock in getLatestBinaryFileSpecification");
                     fileSpec = project.getWorkspace().getLatestBinaryFileSpecification(iconFilePath);
+                	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+                		System.out.println("SWCTarget done with lock in getLatestBinaryFileSpecification");
                 }
 
                 FileEntryValue value = new FileEntryValue(fileSpec, iconFileMetaTag);
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/FunctionNode.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/FunctionNode.java
index ca28b80..c48154b 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/FunctionNode.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/FunctionNode.java
@@ -34,6 +34,7 @@ import java.util.concurrent.locks.ReentrantLock;
 
 import org.apache.royale.compiler.common.ASImportTarget;
 import org.apache.royale.compiler.common.IImportTarget;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.constants.IASLanguageConstants;
 import org.apache.royale.compiler.constants.INamespaceConstants;
 import org.apache.royale.compiler.definitions.IDefinition;
@@ -800,7 +801,11 @@ public class FunctionNode extends BaseTypedDefinitionNode implements IFunctionNo
                 else
                 {
                     // from file using offset
+                	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+                		System.out.println("FunctionNode waiting for lock in parseFunctionBody");
                     sourceReader = workspace.getFileSpecification(sourcePath).createReader();
+                	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+                		System.out.println("FunctionNode done with lock in parseFunctionBody");
                     sourceReader.skip(openT.getLocalEnd());
                 }
 
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/NodeBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/NodeBase.java
index b81c9f0..d4d9941 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/NodeBase.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/as/NodeBase.java
@@ -28,6 +28,7 @@ import antlr.Token;
 import org.apache.royale.compiler.common.ASModifier;
 import org.apache.royale.compiler.common.ISourceLocation;
 import org.apache.royale.compiler.common.SourceLocation;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.definitions.IDefinition;
 import org.apache.royale.compiler.filespecs.IFileSpecification;
 import org.apache.royale.compiler.internal.common.Counter;
@@ -127,7 +128,12 @@ public abstract class NodeBase extends SourceLocation implements IASNode
         // TODO Make sure this works with include processing!!!
         ASFileScope fileScope = getFileScope();
         IWorkspace w = fileScope.getWorkspace();
-        return w.getFileSpecification(fileScope.getContainingPath());
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+    		System.out.println("NodeBase waiting for lock in getFileSpecification");
+        IFileSpecification fs = w.getFileSpecification(fileScope.getContainingPath());
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+    		System.out.println("NodeBase done with lock in getFileSpecification");
+        return fs;
     }
 
     @Override
@@ -1042,8 +1048,12 @@ public abstract class NodeBase extends SourceLocation implements IASNode
      */
     private void countNodes()
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.COUNTER) == CompilerDiagnosticsConstants.COUNTER)
+    		System.out.println("ASScopeBase incrementing counter for " + getClass().getSimpleName());
         Counter counter = Counter.getInstance();
         counter.incrementCount(getClass().getSimpleName());
         counter.incrementCount("nodes");
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.COUNTER) == CompilerDiagnosticsConstants.COUNTER)
+    		System.out.println("ASScopeBase done incrementing counter for " + getClass().getSimpleName());
     }
 }
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLFileNode.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLFileNode.java
index e5dc33d..e9c5517 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLFileNode.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLFileNode.java
@@ -29,6 +29,7 @@ import java.util.Set;
 
 import org.apache.royale.compiler.asdoc.IASDocComment;
 import org.apache.royale.compiler.common.IEmbedResolver;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.definitions.IClassDefinition;
 import org.apache.royale.compiler.definitions.IDefinition;
 import org.apache.royale.compiler.definitions.IFunctionDefinition;
@@ -367,7 +368,12 @@ public class MXMLFileNode extends MXMLNodeBase implements IMXMLFileNode, IScoped
     @Override
     public IFileSpecification getFileSpecification()
     {
-        return fileScope.getWorkspace().getFileSpecification(fileScope.getContainingPath());
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+    		System.out.println("MXMLFileNode waiting for lock in getFileSpecification");
+    	IFileSpecification fs = fileScope.getWorkspace().getFileSpecification(fileScope.getContainingPath());
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+    		System.out.println("MXMLFileNode done with lock in getFileSpecification");
+    	return fs;
     }
 
     @Override
@@ -508,10 +514,20 @@ public class MXMLFileNode extends MXMLNodeBase implements IMXMLFileNode, IScoped
      * @return CSS semantic information.
      */
     @Override
-    public synchronized CSSCompilationSession getCSSCompilationSession()
+    public CSSCompilationSession getCSSCompilationSession()
     {
         if (cssCompilationSession == null)
-            cssCompilationSession = project.getCSSCompilationSession();
+        {
+        	synchronized (this)
+        	{
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.FILE_NODE) == CompilerDiagnosticsConstants.FILE_NODE)
+            		System.out.println("MXMLFileNode waiting for lock in getCSSCompilationSession");
+                if (cssCompilationSession == null)
+                	cssCompilationSession = project.getCSSCompilationSession();        		
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.FILE_NODE) == CompilerDiagnosticsConstants.FILE_NODE)
+            		System.out.println("MXMLFileNode done with lock in getCSSCompilationSession");
+        	}
+        }
         return cssCompilationSession;
     }
 
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLScriptNode.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLScriptNode.java
index ef15874..ee5051f 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLScriptNode.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLScriptNode.java
@@ -27,6 +27,7 @@ import java.util.List;
 import org.apache.royale.compiler.problems.ICompilerProblem;
 import org.apache.royale.compiler.problems.MXMLDualContentProblem;
 import org.apache.royale.compiler.problems.UnexpectedExceptionProblem;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.filespecs.IFileSpecification;
 import org.apache.royale.compiler.internal.mxml.MXMLDialect;
 import org.apache.royale.compiler.internal.parsing.as.ASParser;
@@ -125,7 +126,11 @@ class MXMLScriptNode extends MXMLNodeBase implements IMXMLScriptNode
                 RoyaleProject project = builder.getProject();
                 Workspace workspace = builder.getWorkspace();
                 Collection<ICompilerProblem> problems = builder.getProblems();
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+            		System.out.println("MXMLScriptNode waiting for lock in processTagSpecificAttribute");
                 IFileSpecification sourceFileSpec = workspace.getFileSpecification(sourcePath);
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+            		System.out.println("MXMLScriptNode done with lock in processTagSpecificAttribute");
                 String scriptText = builder.readExternalFile(attribute, sourcePath);
 
                 if (scriptText != null)
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java
index 2fe0ecb..c910880 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/tree/mxml/MXMLTreeBuilder.java
@@ -35,6 +35,7 @@ import org.apache.royale.compiler.common.DependencyType;
 import org.apache.royale.compiler.common.IFileSpecificationGetter;
 import org.apache.royale.compiler.common.ISourceLocation;
 import org.apache.royale.compiler.common.SourceLocation;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.constants.IASLanguageConstants;
 import org.apache.royale.compiler.definitions.IDefinition;
 import org.apache.royale.compiler.definitions.ITypeDefinition;
@@ -847,8 +848,12 @@ public class MXMLTreeBuilder
         }
 
         Workspace workspace = getWorkspace();
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+    		System.out.println("MXMLTreeBuilder waiting for lock in getExternalMXMLData");
         IFileSpecification sourceFileSpec =
                 workspace.getFileSpecification(resolvedSourcePath);
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.WORKSPACE) == CompilerDiagnosticsConstants.WORKSPACE)
+    		System.out.println("MXMLTreeBuilder done with lock in getExternalMXMLData");
         IMXMLDataManager mxmlDataManager = workspace.getMXMLDataManager();
 
         return mxmlDataManager.get(sourceFileSpec);
diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/units/ASCompilationUnit.java b/compiler/src/main/java/org/apache/royale/compiler/internal/units/ASCompilationUnit.java
index c1884e8..b8266a1 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/units/ASCompilationUnit.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/units/ASCompilationUnit.java
@@ -30,6 +30,7 @@ import java.util.Set;
 
 import org.apache.royale.compiler.clients.ASC;
 import org.apache.royale.compiler.common.DependencyType;
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.definitions.IDefinition;
 import org.apache.royale.compiler.filespecs.FileSpecification;
 import org.apache.royale.compiler.filespecs.IFileSpecification;
@@ -335,7 +336,11 @@ public class ASCompilationUnit extends CompilationUnitBase
             }
             final ImmutableSet<String> includedFiles = ast.getIncludeHandler().getIncludedFiles();
             addScopeToProjectScope(new ASFileScope[] { ast.getFileScope() });
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.FILE_NODE) == CompilerDiagnosticsConstants.FILE_NODE)
+        		System.out.println("ASCompilationUnit waiting for lock in parseRequiredFunctionBodies");
             ast.parseRequiredFunctionBodies();
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.FILE_NODE) == CompilerDiagnosticsConstants.FILE_NODE)
+        		System.out.println("ASCompilationUnit done with lock in parseRequiredFunctionBodies");
             final Collection<ICompilerProblem> problemCollection = ast.getProblems();
             ASSyntaxTreeRequestResult result = new ASSyntaxTreeRequestResult(this, syntaxTreeRequest, ast, includedFiles, ast.getIncludeTreeLastModified(), problemCollection);
             getProject().getWorkspace().addIncludedFilesToCompilationUnit(this, result.getIncludedFiles());
diff --git a/compiler/src/main/java/org/apache/royale/compiler/tree/as/decorators/SymbolDecoratorProvider.java b/compiler/src/main/java/org/apache/royale/compiler/tree/as/decorators/SymbolDecoratorProvider.java
index 36c0d09..f309bad 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/tree/as/decorators/SymbolDecoratorProvider.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/tree/as/decorators/SymbolDecoratorProvider.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.compiler.definitions.IDefinition;
 import org.apache.royale.compiler.tree.as.IVariableNode;
 
@@ -71,6 +72,8 @@ public class SymbolDecoratorProvider
      */
     public List<IVariableTypeDecorator> getVariableTypeDecorators(IDefinition context)
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYMBOL_DECORATOR_PROVIDER) == CompilerDiagnosticsConstants.SYMBOL_DECORATOR_PROVIDER)
+    		System.out.println("SymbolDecoratorProvider waiting for lock in getVariableTypeDecorators");
         synchronized (variableTypeDecorators)
         {
             Iterator<IVariableTypeDecorator> it = variableTypeDecorators.iterator();
@@ -83,6 +86,8 @@ public class SymbolDecoratorProvider
                     retVal.add(next);
                 }
             }
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.SYMBOL_DECORATOR_PROVIDER) == CompilerDiagnosticsConstants.SYMBOL_DECORATOR_PROVIDER)
+        		System.out.println("SymbolDecoratorProvider done with lock in getVariableTypeDecorators");
             return retVal;
         }
     }
diff --git a/compiler/src/main/java/org/apache/royale/swf/io/InputBitStream.java b/compiler/src/main/java/org/apache/royale/swf/io/InputBitStream.java
index 0c30ec7..4cdcab9 100644
--- a/compiler/src/main/java/org/apache/royale/swf/io/InputBitStream.java
+++ b/compiler/src/main/java/org/apache/royale/swf/io/InputBitStream.java
@@ -28,6 +28,7 @@ import java.util.zip.InflaterInputStream;
 
 import org.apache.commons.io.IOUtils;
 
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.swf.Header;
 import org.apache.royale.utils.DAByteArrayOutputStream;
 
@@ -287,7 +288,12 @@ public class InputBitStream extends InputStream implements IInputBitStream
 
         try
         {
-            return new String(buffer.getDirectByteArray(), 0, buffer.size(), "UTF-8");
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+        		System.out.println("InputBitStream waiting for lock in readString");
+            String ret = new String(buffer.getDirectByteArray(), 0, buffer.size(), "UTF-8");
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+        		System.out.println("InputBitStream done with lock in readString");
+            return ret;
         }
         catch (UnsupportedEncodingException e)
         {
diff --git a/compiler/src/main/java/org/apache/royale/swf/io/LZMACompressor.java b/compiler/src/main/java/org/apache/royale/swf/io/LZMACompressor.java
index f6b02ba..428fd04 100644
--- a/compiler/src/main/java/org/apache/royale/swf/io/LZMACompressor.java
+++ b/compiler/src/main/java/org/apache/royale/swf/io/LZMACompressor.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.utils.DAByteArrayOutputStream;
 
 import SevenZip.Compression.LZMA.Encoder;
@@ -152,7 +153,11 @@ public class LZMACompressor
      */
     public void writeDataAndEnd(OutputStream outputStream) throws IOException
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+    		System.out.println("LZMACompressor waiting for lock in writeDataAndEnd");
         byte[] data = byteArrayOutputStream.getDirectByteArray();
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+    		System.out.println("LZMACompressor waiting for lock in writeDataAndEnd");
         outputStream.write(data, 0, data.length);
         outputStream.flush();
     }
diff --git a/compiler/src/main/java/org/apache/royale/swf/io/LZMAInputStream.java b/compiler/src/main/java/org/apache/royale/swf/io/LZMAInputStream.java
index 3da4a33..b8f67d8 100644
--- a/compiler/src/main/java/org/apache/royale/swf/io/LZMAInputStream.java
+++ b/compiler/src/main/java/org/apache/royale/swf/io/LZMAInputStream.java
@@ -22,6 +22,7 @@ package org.apache.royale.swf.io;
 import java.io.IOException;
 import java.io.InputStream;
 
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.utils.DAByteArrayOutputStream;
 
 import SevenZip.Compression.LZMA.Decoder;
@@ -89,6 +90,10 @@ public class LZMAInputStream extends InputStream
 
         os.flush();
         readIndex = 0;
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+    		System.out.println("LZMAInputStream waiting for lock in initDecode");
         buffer = os.getDirectByteArray();
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+    		System.out.println("LZMAInputStream waiting for lock in initDecode");
     }
 }
diff --git a/compiler/src/main/java/org/apache/royale/swf/io/OutputBitStream.java b/compiler/src/main/java/org/apache/royale/swf/io/OutputBitStream.java
index 4c886b1..ae53f9e 100644
--- a/compiler/src/main/java/org/apache/royale/swf/io/OutputBitStream.java
+++ b/compiler/src/main/java/org/apache/royale/swf/io/OutputBitStream.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.util.zip.DeflaterOutputStream;
 
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
 import org.apache.royale.utils.DAByteArrayOutputStream;
 
 /**
@@ -127,7 +128,12 @@ public class OutputBitStream implements IOutputBitStream
     public byte[] getBytes()
     {
         flush();
-        return flatOutputBuffer.getDirectByteArray();
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+    		System.out.println("OutputBitStream waiting for lock in getBytes");
+        byte[] b = flatOutputBuffer.getDirectByteArray();
+	   	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
+			System.out.println("OutputBitStream waiting for lock in getBytes");
+		return b;
     }
 
     @Override
diff --git a/compiler/src/main/java/org/apache/royale/utils/ArgumentUtil.java b/compiler/src/main/java/org/apache/royale/utils/ArgumentUtil.java
index fdd9de8..30e0310 100644
--- a/compiler/src/main/java/org/apache/royale/utils/ArgumentUtil.java
+++ b/compiler/src/main/java/org/apache/royale/utils/ArgumentUtil.java
@@ -27,6 +27,8 @@ import java.lang.reflect.Array;
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
+
 public class ArgumentUtil {
 
     // workaround for Royale bug.
@@ -36,7 +38,11 @@ public class ArgumentUtil {
         if (args.length > 1) {
             String targetPath = args[args.length - 1];
             if (targetPath.startsWith(".")) {
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.FILE_UTILS) == CompilerDiagnosticsConstants.FILE_UTILS)
+            		System.out.println("ArgumentUtil waiting for lock in getTheRealPathBecauseCanonicalizeDoesNotFixCase");
                 targetPath = FileUtils.getTheRealPathBecauseCanonicalizeDoesNotFixCase(new File(targetPath));
+            	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.FILE_UTILS) == CompilerDiagnosticsConstants.FILE_UTILS)
+            		System.out.println("ArgumentUtil waiting for lock in getTheRealPathBecauseCanonicalizeDoesNotFixCase");
                 newArgs = new String[args.length];
                 System.arraycopy(args, 0, newArgs, 0, args.length - 1);
                 newArgs[args.length - 1] = targetPath;
diff --git a/compiler/src/main/java/org/apache/royale/utils/IntMapLRUCache.java b/compiler/src/main/java/org/apache/royale/utils/IntMapLRUCache.java
index a665fc4..8c322a9 100644
--- a/compiler/src/main/java/org/apache/royale/utils/IntMapLRUCache.java
+++ b/compiler/src/main/java/org/apache/royale/utils/IntMapLRUCache.java
@@ -19,6 +19,8 @@
 
 package org.apache.royale.utils;
 
+import org.apache.royale.compiler.config.CompilerDiagnosticsConstants;
+
 /**
  * Caching data structure that uses a Least Recently Used (LRU)
  * algorithm.  This cache has a max size associated with it that is
@@ -75,6 +77,8 @@ public abstract class IntMapLRUCache
     {
         Object value = null;
 
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.INT_MAP) == CompilerDiagnosticsConstants.INT_MAP)
+    		System.out.println("IntMapLRUCache waiting for lock in get");
         synchronized (this)
         {
             //use a fast compare to see if this key matches the head object.
@@ -97,12 +101,16 @@ public abstract class IntMapLRUCache
             }
             // else not in cache, go fetch it
         }
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.INT_MAP) == CompilerDiagnosticsConstants.INT_MAP)
+    		System.out.println("IntMapLRUCache done with lock in get");
 
         try
         {
             // don't hold the lock while fetching
             value = fetch(key);
 
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.INT_MAP) == CompilerDiagnosticsConstants.INT_MAP)
+        		System.out.println("IntMapLRUCache waiting for lock in get (2nd half)");
             synchronized (this)
             {
                 ListEntry entry = new ListEntry();
@@ -111,6 +119,8 @@ public abstract class IntMapLRUCache
 
                 map.put(key, entry);
             }
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.INT_MAP) == CompilerDiagnosticsConstants.INT_MAP)
+        		System.out.println("IntMapLRUCache done with lock in get (2nd half)");
         }
         catch (UnsupportedOperationException ex)
         {
@@ -121,12 +131,16 @@ public abstract class IntMapLRUCache
 
     public int firstKey()
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.INT_MAP) == CompilerDiagnosticsConstants.INT_MAP)
+    		System.out.println("IntMapLRUCache waiting for lock in firstKey");
         synchronized (this)
         {
+        	int ret = 0;
             if (head != null)
-                return head.key;
-            else
-                return 0;
+                ret = head.key;
+        	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.INT_MAP) == CompilerDiagnosticsConstants.INT_MAP)
+        		System.out.println("IntMapLRUCache done with lock in firstKey");
+            return ret;
         }
     }
 
@@ -142,6 +156,8 @@ public abstract class IntMapLRUCache
         entry.value = value;
         entry.key = key;
 
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.INT_MAP) == CompilerDiagnosticsConstants.INT_MAP)
+    		System.out.println("IntMapLRUCache waiting for lock in put");
         synchronized (this)
         {
             //insert the entry into the table
@@ -161,6 +177,8 @@ public abstract class IntMapLRUCache
                 purgeLRUElements();
             }
         }
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.INT_MAP) == CompilerDiagnosticsConstants.INT_MAP)
+    		System.out.println("IntMapLRUCache done with lock in put");
 
         return value;
     }
@@ -170,6 +188,8 @@ public abstract class IntMapLRUCache
      */
     public void remove(int key)
     {
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.INT_MAP) == CompilerDiagnosticsConstants.INT_MAP)
+    		System.out.println("IntMapLRUCache waiting for lock in remove");
         synchronized (this)
         {
             ListEntry entry = (ListEntry)map.remove(key);
@@ -193,6 +213,8 @@ public abstract class IntMapLRUCache
                 }
             }
         }
+    	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.INT_MAP) == CompilerDiagnosticsConstants.INT_MAP)
+    		System.out.println("IntMapLRUCache done with lock in remove");
     }
 
     public void setSize(int size)