[gwt-contrib] Change in gwt[master]: Removes dublicate method dispatchers generated by GWTTestCase.
Goktug Gokdogan has uploaded a new change for review. https://gwt-review.googlesource.com/2590 Change subject: Removes dublicate method dispatchers generated by GWTTestCase. .. Removes dublicate method dispatchers generated by GWTTestCase. This also adds test cases to verify GWTTestCase correctly handlers inhertiance. Change-Id: I52fe1d3ee60ec4c289e4055653125253c5639e76 --- M user/src/com/google/gwt/junit/rebind/GWTRunnerProxyGenerator.java M user/test/com/google/gwt/junit/JUnitSuite.java A user/test/com/google/gwt/junit/client/GWTTestCaseInheritanceTest.java 3 files changed, 73 insertions(+), 7 deletions(-) diff --git a/user/src/com/google/gwt/junit/rebind/GWTRunnerProxyGenerator.java b/user/src/com/google/gwt/junit/rebind/GWTRunnerProxyGenerator.java index dc174d4..1a6d6a0 100644 --- a/user/src/com/google/gwt/junit/rebind/GWTRunnerProxyGenerator.java +++ b/user/src/com/google/gwt/junit/rebind/GWTRunnerProxyGenerator.java @@ -246,13 +246,11 @@ return composerFactory.createSourceWriter(ctx, printWriter); } - private static ListJMethod getTestMethods(JClassType requestedClass) { + private static ListJMethod getTestMethods(JClassType cls) { ListJMethod list = new ArrayListJMethod(); -for (JClassType cls = requestedClass; cls != null; cls = cls.getSuperclass()) { - for (JMethod declMethod : cls.getMethods()) { -if (isJUnitTestMethod(declMethod)) { - list.add(declMethod); -} +for (JMethod method : cls.getInheritableMethods()) { + if (isJUnitTestMethod(method)) { +list.add(method); } } return list; diff --git a/user/test/com/google/gwt/junit/JUnitSuite.java b/user/test/com/google/gwt/junit/JUnitSuite.java index 9d2a7b4..86c4098 100644 --- a/user/test/com/google/gwt/junit/JUnitSuite.java +++ b/user/test/com/google/gwt/junit/JUnitSuite.java @@ -17,6 +17,7 @@ import com.google.gwt.junit.client.DevModeOnCompiledScriptTest; import com.google.gwt.junit.client.GWTTestCaseAsyncTest; +import com.google.gwt.junit.client.GWTTestCaseInheritanceTest; import com.google.gwt.junit.client.GWTTestCaseSetupTearDownTest; import com.google.gwt.junit.client.GWTTestCaseStackTraceTest; import com.google.gwt.junit.client.GWTTestCaseTest; @@ -36,8 +37,9 @@ suite.addTestSuite(GWTTestCaseTest.class); suite.addTestSuite(GWTTestCaseStackTraceTest.class); suite.addTestSuite(GWTTestCaseUncaughtExceptionHandlerTest.class); -suite.addTest(new TestSuiteWithOrder(GWTTestCaseAsyncTest.class)); suite.addTest(new TestSuiteWithOrder(GWTTestCaseSetupTearDownTest.class)); +suite.addTest(new TestSuiteWithOrder(GWTTestCaseInheritanceTest.class)); +suite.addTest(new TestSuiteWithOrder(GWTTestCaseAsyncTest.class)); suite.addTestSuite(DevModeOnCompiledScriptTest.class); diff --git a/user/test/com/google/gwt/junit/client/GWTTestCaseInheritanceTest.java b/user/test/com/google/gwt/junit/client/GWTTestCaseInheritanceTest.java new file mode 100644 index 000..7073305 --- /dev/null +++ b/user/test/com/google/gwt/junit/client/GWTTestCaseInheritanceTest.java @@ -0,0 +1,66 @@ +/* + * Copyright 2013 Google Inc. + * + * Licensed 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 com.google.gwt.junit.client; + + +import static java.util.Arrays.asList; + +import java.util.ArrayList; +import java.util.List; + +/** + * This class tests inherited tests are properly executed. + * + * Note: This test requires some test methods to be executed in a specific order. + */ +public class GWTTestCaseInheritanceTest extends InheritedTest { + + private static ListString executions = new ArrayListString(); + + @Override + protected void gwtTearDown() throws Exception { +executions.add(getName()); + } + + @Override + public void testOverridden() { +// Success! + } + + @ExpectedFailure + public void testFail() { +fail(failed in purpose); + } + + /** + * This is the last test to be executed (under_score forces that). Will assert all test runs. + */ + public void test_assertExecution() { +assertEquals(asList(testFail, testOverridden, testSuccess), executions); + } +} + +// A test class to inherit +class InheritedTest extends GWTTestCaseTestBase { + + public void testSuccess() { +// Success! + } + + public void testOverridden() { +fail(Should not have failed because of override); + } +} \ No
[gwt-contrib] Change in gwt[master]: reduces Java AST optimization time by bailing out when the r...
Roberto Lublinerman has posted comments on this change. Change subject: reduces Java AST optimization time by bailing out when the rate of change slows to a crawl (only applies on optimization levels less than 9) .. Patch Set 1: Code-Review+1 (1 comment) File dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java Line 813: if (options.isAggressivelyOptimize()) { I think we should also make the default of aggresivelyOptimize be false. -- To view, visit https://gwt-review.googlesource.com/2580 To unsubscribe, visit https://gwt-review.googlesource.com/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iabf844d6a02f694e8d14103377f74f46e4e01915 Gerrit-PatchSet: 1 Gerrit-Project: gwt Gerrit-Branch: master Gerrit-Owner: John Stalcup stal...@google.com Gerrit-Reviewer: Roberto Lublinerman rlu...@google.com Gerrit-HasComments: Yes -- -- http://groups.google.com/group/Google-Web-Toolkit-Contributors --- You received this message because you are subscribed to the Google Groups Google Web Toolkit Contributors group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[gwt-contrib] Change in gwt[master]: reduces Java AST optimization time by bailing out when the r...
John Stalcup has uploaded a new change for review. https://gwt-review.googlesource.com/2580 Change subject: reduces Java AST optimization time by bailing out when the rate of change slows to a crawl (only applies on optimization levels less than 9) .. reduces Java AST optimization time by bailing out when the rate of change slows to a crawl (only applies on optimization levels less than 9) Change-Id: Iabf844d6a02f694e8d14103377f74f46e4e01915 --- M dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java 1 file changed, 57 insertions(+), 26 deletions(-) diff --git a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java index b7ccabb..431ab9d 100644 --- a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java +++ b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java @@ -252,15 +252,27 @@ private static final String ENUM_NAME_OBFUSCATION_PROPERTY = compiler.enum.obfuscate.names; /** + * Continuing to apply optimizations till the rate of change reaches this value causes the AST to + * reach a fixed point. + */ + private static final int FIXED_POINT_CHANGE_RATE = 0; + + /** + * Ending optimization passes when the rate of change has reached this value results in + * gaining nearly all of the impact while avoiding the long tail of costly but low-impact passes. + */ + private static final float EFFICIENT_CHANGE_RATE = 0.01f; + + /** * Compiles a particular permutation, based on a precompiled unified AST. * * @param logger the logger to use - * @param unifiedAst the result of a - * {@link #precompile(TreeLogger, ModuleDef, RebindPermutationOracle, String[], String[], JJSOptions, boolean, PrecompilationMetricsArtifact)} + * @param unifiedAst the result of a {@link #precompile(TreeLogger, ModuleDef, + * RebindPermutationOracle, String[], String[], JJSOptions, boolean, + * PrecompilationMetricsArtifact)} * @param permutation the permutation to compile * @return the output JavaScript - * @throws UnableToCompleteException if an error other than - * {@link OutOfMemoryError} occurs + * @throws UnableToCompleteException if an error other than {@link OutOfMemoryError} occurs */ public static PermutationResult compilePermutation(TreeLogger logger, UnifiedAst unifiedAst, Permutation permutation) throws UnableToCompleteException { @@ -768,11 +780,16 @@ Event optimizeEvent = SpeedTracerLogger.start(CompilerEventType.OPTIMIZE); ListOptimizerStats allOptimizerStats = new ArrayListOptimizerStats(); -int counter = 0; -int optimizationLevel = options.getOptimizationLevel(); +int passCount = 0; +int nodeCount = getNodeCount(jprogram); +int lastNodeCount; + +int passLimit = options.getOptimizationLevel(); +float minimumChangeRate = passLimit OptionOptimize.OPTIMIZE_LEVEL_MAX +? EFFICIENT_CHANGE_RATE : FIXED_POINT_CHANGE_RATE; while (true) { - counter++; - if (optimizationLevel OptionOptimize.OPTIMIZE_LEVEL_MAX counter optimizationLevel) { + passCount++; + if (passLimit OptionOptimize.OPTIMIZE_LEVEL_MAX passCount passLimit) { break; } if (Thread.interrupted()) { @@ -781,9 +798,14 @@ } AstDumper.maybeDumpAST(jprogram); OptimizerStats stats = - optimizeLoop(Pass + counter, jprogram, options.isAggressivelyOptimize()); + optimizeLoop(Pass + passCount, jprogram, options.isAggressivelyOptimize(), nodeCount); allOptimizerStats.add(stats); - if (!stats.didChange()) { + lastNodeCount = nodeCount; + nodeCount = getNodeCount(jprogram); + + float nodeChangeRate = stats.getNumMods() / (float) lastNodeCount; + float sizeChangeRate = (lastNodeCount - nodeCount) / (float) lastNodeCount; + if (nodeChangeRate = minimumChangeRate sizeChangeRate = minimumChangeRate) { break; } } @@ -849,15 +871,15 @@ protected static OptimizerStats optimizeLoop(String passName, JProgram jprogram, boolean isAggressivelyOptimize) { -Event optimizeEvent = SpeedTracerLogger.start(CompilerEventType.OPTIMIZE, phase, loop); - -// Count the number of nodes in the AST so we can measure the efficiency of -// the optimizers. -Event countEvent = SpeedTracerLogger.start(CompilerEventType.OPTIMIZE, phase, countNodes); TreeStatistics treeStats = new TreeStatistics(); treeStats.accept(jprogram); -int numNodes = treeStats.getNodeCount(); -countEvent.end(); +int nodeCount = treeStats.getNodeCount(); +return optimizeLoop(Early Optimization, jprogram, false, nodeCount); + } + + protected static OptimizerStats optimizeLoop(String passName, JProgram jprogram, +
[gwt-contrib] Change in gwt[master]: Adds new configuration property to specify minimum fragment ...
Ray Cromwell has uploaded a new change for review. https://gwt-review.googlesource.com/2581 Change subject: Adds new configuration property to specify minimum fragment size. .. Adds new configuration property to specify minimum fragment size. set-configuration-property name=compiler.splitpoint.leftovermerge.size value=size in bytes/ Any exclusive fragment smaller than this limit will be merged into the left overs fragment. Change-Id: Ifcf035d88db70e890c739eab3997b85fa2e5677e --- M dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java M dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java M dev/core/src/com/google/gwt/dev/jjs/impl/CodeSplitter2.java M dev/core/src/com/google/gwt/dev/js/JsSourceGenerationVisitorWithSizeBreakdown.java M dev/core/src/com/google/gwt/dev/js/JsToStringGenerationVisitor.java M dev/core/test/com/google/gwt/dev/jjs/impl/CodeSplitter2Test.java M user/src/com/google/gwt/core/CompilerParameters.gwt.xml 7 files changed, 267 insertions(+), 27 deletions(-) diff --git a/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java b/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java index c0d6ebb..3f57ee5 100644 --- a/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java +++ b/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java @@ -597,8 +597,8 @@ options.produceReferenceInfo = true; // Turn off all warnings, saves some memory / speed. -options.reportUnusedDeclaredThrownExceptionIncludeDocCommentReference = false; -options.reportUnusedDeclaredThrownExceptionExemptExceptionAndThrowable = false; +// options.reportUnusedDeclaredThrownExceptionIncludeDocCommentReference = false; +// options.reportUnusedDeclaredThrownExceptionExemptExceptionAndThrowable = false; options.warningThreshold = 0; options.inlineJsrBytecode = true; return options; diff --git a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java index b7ccabb..197e6a3 100644 --- a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java +++ b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java @@ -400,7 +400,9 @@ // merging. if (fragmentsMerge 0) { CodeSplitter2.exec(logger, jprogram, jsProgram, jjsmap, fragmentsMerge, - chooseDependencyRecorder(options.isSoycEnabled(), baos)); + chooseDependencyRecorder(options.isSoycEnabled(), baos), + findIntegerConfigurationProperty(propertyOracles, logger, + CodeSplitter2.LEFTOVERMERGE_SIZE, 0)); } else { CodeSplitter.exec(logger, jprogram, jsProgram, jjsmap, chooseDependencyRecorder(options .isSoycEnabled(), baos)); @@ -569,6 +571,25 @@ return toReturn; } + /** + * Look for a configuration property in all property oracles. + */ + public static int findIntegerConfigurationProperty( + PropertyOracle[] propertyOracles, TreeLogger logger, + String name, int def) { +int toReturn = def; +for (PropertyOracle oracle : propertyOracles) { + try { +com.google.gwt.core.ext.ConfigurationProperty property = oracle.getConfigurationProperty(name); +toReturn = Integer.parseInt(property.getValues().get(0)); + } catch (Exception e) { +break; + } +} +return toReturn; + } + + public static UnifiedAst precompile(TreeLogger logger, ModuleDef module, RebindPermutationOracle rpo, String[] declEntryPts, String[] additionalRootTypes, JJSOptions options, boolean singlePermutation) throws UnableToCompleteException { diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/CodeSplitter2.java b/dev/core/src/com/google/gwt/dev/jjs/impl/CodeSplitter2.java index 2c871f4..897464d 100644 --- a/dev/core/src/com/google/gwt/dev/jjs/impl/CodeSplitter2.java +++ b/dev/core/src/com/google/gwt/dev/jjs/impl/CodeSplitter2.java @@ -43,6 +43,7 @@ import com.google.gwt.dev.jjs.impl.FragmentExtractor.CfaLivenessPredicate; import com.google.gwt.dev.jjs.impl.FragmentExtractor.LivenessPredicate; import com.google.gwt.dev.jjs.impl.FragmentExtractor.NothingAlivePredicate; +import com.google.gwt.dev.js.JsToStringGenerationVisitor; import com.google.gwt.dev.js.ast.JsBlock; import com.google.gwt.dev.js.ast.JsContext; import com.google.gwt.dev.js.ast.JsModVisitor; @@ -50,6 +51,7 @@ import com.google.gwt.dev.js.ast.JsProgram; import com.google.gwt.dev.js.ast.JsStatement; import com.google.gwt.dev.util.JsniRef; +import com.google.gwt.dev.util.TextOutput; import com.google.gwt.dev.util.collect.HashMap; import com.google.gwt.dev.util.collect.Lists; import com.google.gwt.dev.util.log.speedtracer.CompilerEventType; @@ -277,7 +279,10 @@ * The property key for a list of initially loaded split points. */ private static final String
[gwt-contrib] Change in gwt[master]: Adds new configuration property to specify minimum fragment ...
Ray Cromwell has uploaded a new patch set (#2). Change subject: Adds new configuration property to specify minimum fragment size. .. Adds new configuration property to specify minimum fragment size. set-configuration-property name=compiler.splitpoint.leftovermerge.size value=size in bytes/ Any exclusive fragment smaller than this limit will be merged into the left overs fragment. Change-Id: Ifcf035d88db70e890c739eab3997b85fa2e5677e Review-Link: https://gwt-review.googlesource.com/#/c/2581/ --- M dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java M dev/core/src/com/google/gwt/dev/jjs/impl/CodeSplitter2.java M dev/core/src/com/google/gwt/dev/js/JsSourceGenerationVisitorWithSizeBreakdown.java M dev/core/src/com/google/gwt/dev/js/JsToStringGenerationVisitor.java M dev/core/test/com/google/gwt/dev/jjs/impl/CodeSplitter2Test.java M user/src/com/google/gwt/core/CompilerParameters.gwt.xml 6 files changed, 265 insertions(+), 25 deletions(-) -- To view, visit https://gwt-review.googlesource.com/2581 To unsubscribe, visit https://gwt-review.googlesource.com/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ifcf035d88db70e890c739eab3997b85fa2e5677e Gerrit-PatchSet: 2 Gerrit-Project: gwt Gerrit-Branch: master Gerrit-Owner: Ray Cromwell cromwell...@google.com -- -- http://groups.google.com/group/Google-Web-Toolkit-Contributors --- You received this message because you are subscribed to the Google Groups Google Web Toolkit Contributors group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.