-
Notifications
You must be signed in to change notification settings - Fork 383
Description
As far as I can tell, OptimizedOnlyCompilerSuite has never run as part of the ant build since it was introduced, it has always been in the gwt.junit.testcase.web.excludes list, which prevents it from running not only in draft mode but also prod tests. It was first introduced in 24de83e, and was in the excludes list from then on forward.
Only one test fails:
gwt/user/test/com/google/gwt/dev/jjs/optimized/JsOverlayMethodOptimizationTest.java
Lines 29 to 65 in a433a55
| public class JsOverlayMethodOptimizationTest extends OptimizationTestBase { | |
| @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") | |
| private static class NativeType { | |
| private native int nativeMethod(); | |
| @JsOverlay | |
| final boolean contains(String s1, String s2) { | |
| return s1.contains(s2); | |
| } | |
| @JsOverlay | |
| final int alwaysCallNative() { | |
| // NativeType.contains should get inlined by Java passes so the code below should be | |
| // statically evaluated to return "this". | |
| return contains("1234","1") ? this.nativeMethod() : 0; | |
| } | |
| } | |
| public static int callAlwaysCallNative(NativeType obj) { | |
| return obj.alwaysCallNative(); | |
| } | |
| private static native String getGeneratedFunctionDefinition() /*-{ | |
| return function() { | |
| @JsOverlayMethodOptimizationTest::callAlwaysCallNative(*)({}); | |
| }.toString(); | |
| }-*/; | |
| /** | |
| * Tests whether JsOverlay is inlined by the Java optimization passes rather than being just | |
| * devirtualized. | |
| */ | |
| public void testJsOverlayIsInlined() throws Exception { | |
| String functionDef = getGeneratedFunctionDefinition(); | |
| assertFunctionMatches(functionDef, "({}.nativeMethod())"); | |
| } |
The contains() method is not statically evaluated as expected and the rest of alwaysCallNative ends up not being inlined - instead we keep the overlap method (despite only having one invocation, which should make it an obvious candidate for js inlining).
In the short term we could disable the test and enable the suite for non-draft "web" runs. Should also bisect to see when it started failing, if this points to something else being broken.
Testcase: testJsOverlayIsInlined took 0.001 sec
FAILED
content: "rd({});" does not match pattern: \(\{\}\.nativeMethod(\(\))?\);? - expected: <true>, actual: <false>
junit.framework.AssertionFailedError: content: "rd({});" does not match pattern: \(\{\}\.nativeMethod(\(\))?\);? - expected: <true>, actual: <false>
at com.google.gwt.dev.jjs.optimized.OptimizationTestBase.assertFunctionMatches(OptimizationTestBase.java:30)
at com.google.gwt.dev.jjs.optimized.JsOverlayMethodOptimizationTest.testJsOverlayIsInlined(JsOverlayMethodOptimizationTest.java:62)
at Unknown.@script in about:blank from(Unknown)
function rd(a){return '1234'.includes('1')?a.nativeMethod():0}