Revision: 6499 Author: [email protected] Date: Tue Oct 27 19:12:04 2009 Log: A PermutationResult is now integrally tied to a Permutation.
Suggested by: spoon Patch by: me Review by: spoon (TBR) http://code.google.com/p/google-web-toolkit/source/detail?r=6499 Modified: /trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java /trunk/dev/core/src/com/google/gwt/dev/CompilePerms.java /trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java /trunk/dev/core/src/com/google/gwt/dev/jjs/PermutationResult.java /trunk/dev/core/src/com/google/gwt/dev/jjs/UnifiedAst.java ======================================= --- /trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java Tue Oct 27 18:11:59 2009 +++ /trunk/dev/core/src/com/google/gwt/core/ext/linker/impl/StandardLinkerContext.java Tue Oct 27 19:12:04 2009 @@ -268,7 +268,7 @@ result = new StandardCompilationResult(strongName, js, permutationResult.getSerializedSymbolMap(), permutationResult.getStatementRanges(), - permutationResult.getPermutationId()); + permutationResult.getPermutation().getId()); resultsByStrongName.put(result.getStrongName(), result); artifacts.add(result); } ======================================= --- /trunk/dev/core/src/com/google/gwt/dev/CompilePerms.java Fri Oct 23 13:15:54 2009 +++ /trunk/dev/core/src/com/google/gwt/dev/CompilePerms.java Tue Oct 27 19:12:04 2009 @@ -184,9 +184,7 @@ public static PermutationResult compile(TreeLogger logger, Permutation permutation, UnifiedAst unifiedAst) throws UnableToCompleteException { - return unifiedAst.compilePermutation(logger, - permutation.getRebindAnswers(), permutation.getPropertyOracles(), - permutation.getId()); + return unifiedAst.compilePermutation(logger, permutation); } /** ======================================= --- /trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java Tue Oct 27 18:51:02 2009 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java Tue Oct 27 19:12:04 2009 @@ -32,6 +32,7 @@ import com.google.gwt.core.ext.soyc.impl.SplitPointRecorder; import com.google.gwt.core.ext.soyc.impl.StoryRecorder; import com.google.gwt.core.linker.SoycReportLinker; +import com.google.gwt.dev.Permutation; import com.google.gwt.dev.cfg.ModuleDef; import com.google.gwt.dev.jdt.RebindPermutationOracle; import com.google.gwt.dev.jdt.WebModeCompilerFrontEnd; @@ -148,17 +149,18 @@ private static class PermutationResultImpl implements PermutationResult { private final ArtifactSet artifacts = new ArtifactSet(); private final byte[][] js; - private final int permutationId; + private Permutation permutation; private final byte[] serializedSymbolMap; private final StatementRanges[] statementRanges; - public PermutationResultImpl(String[] js, SymbolData[] symbolMap, - StatementRanges[] statementRanges, int permutationId) { + public PermutationResultImpl(String[] js, Permutation permutation, + SymbolData[] symbolMap, StatementRanges[] statementRanges) { byte[][] bytes = new byte[js.length][]; for (int i = 0; i < js.length; ++i) { bytes[i] = Util.getBytes(js[i]); } this.js = bytes; + this.permutation = permutation; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Util.writeObjectToStream(baos, (Object) symbolMap); @@ -168,7 +170,6 @@ e); } this.statementRanges = statementRanges; - this.permutationId = permutationId; } public ArtifactSet getArtifacts() { @@ -179,8 +180,8 @@ return js; } - public int getPermutationId() { - return permutationId; + public Permutation getPermutation() { + return permutation; } public byte[] getSerializedSymbolMap() { @@ -198,20 +199,17 @@ * @param logger the logger to use * @param unifiedAst the result of a * {...@link #precompile(TreeLogger, WebModeCompilerFrontEnd, String[], JJSOptions, boolean)} - * @param rebindAnswers the set of rebind answers to resolve all outstanding - * rebind decisions for this permutation - * @param propertyOracles all property oracles corresponding to this - * permutation - * @param permutationId the unique id of this permutation + * @param permutation the permutation to compile * @return the output JavaScript * @throws UnableToCompleteException if an error other than * {...@link OutOfMemoryError} occurs */ public static PermutationResult compilePermutation(TreeLogger logger, - UnifiedAst unifiedAst, Map<String, String> rebindAnswers, - PropertyOracle[] propertyOracles, int permutationId) + UnifiedAst unifiedAst, Permutation permutation) throws UnableToCompleteException { - + PropertyOracle[] propertyOracles = permutation.getPropertyOracles(); + int permutationId = permutation.getId(); + Map<String, String> rebindAnswers = permutation.getRebindAnswers(); int printId = permutationId + 1; logger.log(TreeLogger.INFO, "Compiling permutation " + printId + "..."); long permStart = System.currentTimeMillis(); @@ -356,8 +354,8 @@ generateJavaScriptCode(options, jsProgram, map, js, ranges, sizeBreakdowns, sourceInfoMaps, splitBlocks); - PermutationResult toReturn = new PermutationResultImpl(js, - makeSymbolMap(symbolTable), ranges, permutationId); + PermutationResult toReturn = new PermutationResultImpl(js, permutation, + makeSymbolMap(symbolTable), ranges); toReturn.getArtifacts().addAll( makeSoycArtifacts(logger, permutationId, jprogram, js, sizeBreakdowns, sourceInfoMaps, dependencies, map, obfuscateMap)); ======================================= --- /trunk/dev/core/src/com/google/gwt/dev/jjs/PermutationResult.java Tue Jul 28 12:27:56 2009 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/PermutationResult.java Tue Oct 27 19:12:04 2009 @@ -17,6 +17,7 @@ import com.google.gwt.core.ext.linker.ArtifactSet; import com.google.gwt.core.ext.linker.StatementRanges; +import com.google.gwt.dev.Permutation; import java.io.Serializable; @@ -24,6 +25,7 @@ * An extensible return type for the results of compiling a single permutation. */ public interface PermutationResult extends Serializable { + /** * Returns any Artifacts that may have been created as a result of compiling * the permutation. @@ -36,10 +38,10 @@ byte[][] getJs(); /** - * The ID of the permutation. + * Returns the associated permutation. */ - int getPermutationId(); - + Permutation getPermutation(); + /** * The symbol map for the permutation. */ ======================================= --- /trunk/dev/core/src/com/google/gwt/dev/jjs/UnifiedAst.java Mon Aug 31 14:02:51 2009 +++ /trunk/dev/core/src/com/google/gwt/dev/jjs/UnifiedAst.java Tue Oct 27 19:12:04 2009 @@ -15,9 +15,9 @@ */ package com.google.gwt.dev.jjs; -import com.google.gwt.core.ext.PropertyOracle; import com.google.gwt.core.ext.TreeLogger; import com.google.gwt.core.ext.UnableToCompleteException; +import com.google.gwt.dev.Permutation; import com.google.gwt.dev.jjs.ast.JProgram; import com.google.gwt.dev.js.ast.JsProgram; import com.google.gwt.dev.util.PerfLogger; @@ -29,7 +29,6 @@ import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.Collections; -import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -148,20 +147,15 @@ * Compiles a particular permutation. * * @param logger the logger to use - * @param rebindAnswers the set of rebind answers to resolve all outstanding - * rebind decisions for this permutation - * @param propertyOracles all property oracles corresponding to this - * permutation - * @param permutationId the unique id of this permutation + * @param permutation the permutation to compile * @return the permutation result * @throws UnableToCompleteException if an error other than * {...@link OutOfMemoryError} occurs */ public PermutationResult compilePermutation(TreeLogger logger, - Map<String, String> rebindAnswers, PropertyOracle[] propertyOracles, - int permutationId) throws UnableToCompleteException { + Permutation permutation) throws UnableToCompleteException { return JavaToJavaScriptCompiler.compilePermutation(logger, this, - rebindAnswers, propertyOracles, permutationId); + permutation); } /** --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
