You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/12/09 06:17:02 UTC
[05/10] git commit: [flex-falcon] [refs/heads/develop] - AST's were
getting GC'd and causing crashes. Cache them instead
AST's were getting GC'd and causing crashes. Cache them instead
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/b9619779
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/b9619779
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/b9619779
Branch: refs/heads/develop
Commit: b9619779e6b382568daad2e4102c496c59d955f1
Parents: 03fb666
Author: Alex Harui <ah...@apache.org>
Authored: Mon Dec 1 12:51:11 2014 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Dec 8 17:25:01 2014 -0800
----------------------------------------------------------------------
.../flex/compiler/internal/projects/FlexJSProject.java | 8 ++++++++
.../flex/compiler/internal/projects/CompilerProject.java | 11 +++++++++++
.../internal/projects/FlexProjectConfigurator.java | 1 +
.../flex/compiler/internal/units/ASCompilationUnit.java | 1 +
.../compiler/internal/units/MXMLCompilationUnit.java | 1 +
5 files changed, 22 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b9619779/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
index 2be9d0f..ceacef0 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
@@ -32,6 +32,7 @@ import org.apache.flex.compiler.internal.driver.js.flexjs.JSCSSCompilationSessio
import org.apache.flex.compiler.internal.scopes.ASProjectScope.DefinitionPromise;
import org.apache.flex.compiler.internal.tree.mxml.MXMLClassDefinitionNode;
import org.apache.flex.compiler.internal.workspaces.Workspace;
+import org.apache.flex.compiler.tree.as.IASNode;
import org.apache.flex.compiler.units.ICompilationUnit;
/**
@@ -157,4 +158,11 @@ public class FlexJSProject extends FlexProject
return new JSCSSCompilationSession();
}
+ private HashMap<IASNode, String> astCache = new HashMap<IASNode, String>();
+
+ @Override
+ public void addToASTCache(IASNode ast)
+ {
+ astCache.put(ast, "");
+ }
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b9619779/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java b/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java
index ae2cbd5..c378d8e 100644
--- a/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java
+++ b/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java
@@ -59,6 +59,7 @@ import org.apache.flex.compiler.scopes.IASScope;
import org.apache.flex.compiler.targets.ISWFTarget;
import org.apache.flex.compiler.targets.ITargetProgressMonitor;
import org.apache.flex.compiler.targets.ITargetSettings;
+import org.apache.flex.compiler.tree.as.IASNode;
import org.apache.flex.compiler.units.ICompilationUnit;
import org.apache.flex.compiler.units.requests.IFileScopeRequestResult;
import org.apache.flex.compiler.units.requests.IRequest;
@@ -945,4 +946,14 @@ public abstract class CompilerProject implements ICompilerProject
this.enableInlining = enableInlining;
clean();
}
+
+ /**
+ * Add AST to cache. By default, not added to any cache.
+ *
+ * @param ast The AST.
+ */
+ public void addToASTCache(IASNode ast)
+ {
+ }
+
}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b9619779/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java b/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java
index 64e5ba5..3a19838 100644
--- a/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java
+++ b/compiler/src/org/apache/flex/compiler/internal/projects/FlexProjectConfigurator.java
@@ -208,6 +208,7 @@ public class FlexProjectConfigurator
className = configValue.substring(dotIndex + 1);
BindableHelper.NAME_PROPERTY_CHANGE_EVENT = new Name(CONSTANT_Qname, new Nsset(new Namespace(CONSTANT_PackageNs, packageName)), className);
BindableHelper.NAMESPACE_MX_EVENTS = new Namespace(CONSTANT_PackageNs, packageName);
+ BindableHelper.PROPERTY_CHANGE_EVENT = configValue;
configValue = configuration.getBindingValueChangeEventKind();
dotIndex = configValue.lastIndexOf(".");
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b9619779/compiler/src/org/apache/flex/compiler/internal/units/ASCompilationUnit.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/units/ASCompilationUnit.java b/compiler/src/org/apache/flex/compiler/internal/units/ASCompilationUnit.java
index c4141fe..90d1958 100644
--- a/compiler/src/org/apache/flex/compiler/internal/units/ASCompilationUnit.java
+++ b/compiler/src/org/apache/flex/compiler/internal/units/ASCompilationUnit.java
@@ -437,6 +437,7 @@ public class ASCompilationUnit extends CompilationUnitBase
final Collection<ICompilerProblem> problemCollection = ast.getProblems();
ASSyntaxTreeRequestResult result = new ASSyntaxTreeRequestResult(this, syntaxTreeRequest, ast, includedFiles, ast.getIncludeTreeLastModified(), problemCollection);
getProject().getWorkspace().addIncludedFilesToCompilationUnit(this, result.getIncludedFiles());
+ getProject().addToASTCache(ast);
return result;
}
finally
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b9619779/compiler/src/org/apache/flex/compiler/internal/units/MXMLCompilationUnit.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/units/MXMLCompilationUnit.java b/compiler/src/org/apache/flex/compiler/internal/units/MXMLCompilationUnit.java
index f794ce7..32965c9 100644
--- a/compiler/src/org/apache/flex/compiler/internal/units/MXMLCompilationUnit.java
+++ b/compiler/src/org/apache/flex/compiler/internal/units/MXMLCompilationUnit.java
@@ -155,6 +155,7 @@ public class MXMLCompilationUnit extends CompilationUnitBase
stopProfile(Operation.GET_SYNTAX_TREE);
}
+ getProject().addToASTCache(fileNode);
return new SyntaxTreeRequestResult(fileNode, ImmutableSet.<String>copyOf(fileScope.getSourceDependencies()), fileNode.getIncludeTreeLastModified(), problems);
}