protected abstract class JavaToJavaScriptCompiler.PermutationCompiler extends Object
Constructor and Description |
---|
PermutationCompiler(Permutation permutation) |
Modifier and Type | Method and Description |
---|---|
PermutationResult |
compilePermutation(UnifiedAst unifiedAst)
Takes as input an unresolved Java AST (a Java AST wherein all rebind result classes are
available and have not yet been pruned down to the set applicable for a particular
permutation) that was previously constructed by the Precompiler and from that constructs
output Js source code and related information.
|
protected abstract ResolveRuntimeTypeReferences.TypeMapper<?> |
normalizeSemantics()
Transform patterns that can't be represented in JS (such as multiple catch blocks) into
equivalent but compatible patterns and take JVM semantics (such as numeric casts) that are
not explicit in the AST and make them explicit.
These passes can not be reordering because of subtle interdependencies. |
protected abstract void |
optimizeJava() |
protected abstract void |
optimizeJs(Set<JsNode> inlinableJsFunctions) |
protected void |
optimizeJsLoop(Collection<JsNode> toInline) |
protected abstract void |
postNormalizationOptimizeJava() |
protected abstract Map<JsName,JsLiteral> |
runDetailedNamer(ConfigProps config) |
protected abstract Pair<SyntheticArtifact,MultipleDependencyGraphRecorder> |
splitJsIntoFragments(PermProps props,
int permutationId,
JavaToJavaScriptMap jjsmap) |
public PermutationCompiler(Permutation permutation)
public PermutationResult compilePermutation(UnifiedAst unifiedAst) throws UnableToCompleteException
1. initialize local state 2. transform unresolved Java AST to resolved Java AST 3. normalize the resolved Java AST 4. optimize the resolved Java AST 5. construct the Js AST 6. normalize the Js AST 7. optimize the Js AST 8. generate Js source 9. construct and return a valueThere are some other types of work here (mostly metrics and data gathering) which do not serve the goal of output program construction. This work should really be moved into subclasses or some sort of callback or plugin system so as not to visually pollute the real compile logic.
UnableToCompleteException
protected abstract void optimizeJs(Set<JsNode> inlinableJsFunctions) throws InterruptedException
InterruptedException
protected abstract void optimizeJava() throws InterruptedException
InterruptedException
protected abstract void postNormalizationOptimizeJava()
protected abstract Map<JsName,JsLiteral> runDetailedNamer(ConfigProps config) throws JsNamer.IllegalNameException
JsNamer.IllegalNameException
protected abstract Pair<SyntheticArtifact,MultipleDependencyGraphRecorder> splitJsIntoFragments(PermProps props, int permutationId, JavaToJavaScriptMap jjsmap)
protected abstract ResolveRuntimeTypeReferences.TypeMapper<?> normalizeSemantics()
protected void optimizeJsLoop(Collection<JsNode> toInline) throws InterruptedException
InterruptedException
Copyright © 2018. All rights reserved.