Mercurial > hg > truffle
changeset 12697:8577cb721f51
use scoped option overriding for some HSAIL tests
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 06 Nov 2013 18:43:45 +0100 |
parents | 22780dc399da |
children | d59a65c11feb |
files | graal/com.oracle.graal.compiler.hsail.test.infra/src/com/oracle/graal/compiler/hsail/test/infra/GraalKernelTester.java graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StaticNBodyCallTest.java graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StaticNBodyTest.java graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StringContainsAcceptTest.java |
diffstat | 4 files changed, 39 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.hsail.test.infra/src/com/oracle/graal/compiler/hsail/test/infra/GraalKernelTester.java Wed Nov 06 16:56:05 2013 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test.infra/src/com/oracle/graal/compiler/hsail/test/infra/GraalKernelTester.java Wed Nov 06 18:43:45 2013 +0100 @@ -27,12 +27,14 @@ * This class extends KernelTester and provides a base class * for which the HSAIL code comes from the Graal compiler. */ -import com.oracle.graal.hotspot.hsail.*; +import static com.oracle.graal.phases.GraalOptions.*; -import java.lang.reflect.Method; import java.io.*; +import java.lang.reflect.*; -import static com.oracle.graal.phases.GraalOptions.*; +import com.oracle.graal.graph.*; +import com.oracle.graal.hotspot.hsail.*; +import com.oracle.graal.options.*; public abstract class GraalKernelTester extends KernelTester { @@ -75,4 +77,14 @@ boolean canExecuteCalls = runningOnSimulator(); return (canGenerateCalls && canExecuteCalls); } + + public static OptionValue<?> getOptionFromField(Class declaringClass, String fieldName) { + try { + Field f = declaringClass.getDeclaredField(fieldName); + f.setAccessible(true); + return (OptionValue<?>) f.get(null); + } catch (Exception e) { + throw new GraalInternalError(e); + } + } }
--- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StaticNBodyCallTest.java Wed Nov 06 16:56:05 2013 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StaticNBodyCallTest.java Wed Nov 06 18:43:45 2013 +0100 @@ -23,10 +23,15 @@ package com.oracle.graal.compiler.hsail.test; +import static com.oracle.graal.phases.GraalOptions.*; import static org.junit.Assume.*; import org.junit.*; +import com.oracle.graal.options.*; +import com.oracle.graal.options.OptionValue.OverrideScope; +import com.oracle.graal.phases.*; + /** * Unit test of NBody demo app. This version uses a call to the main routine which would normally be * too large to inline. @@ -37,10 +42,15 @@ StaticNBodyTest.run(inxyz, outxyz, invxyz, outvxyz, gid); } + public void before() { + } + @Test @Override - public void test() { - assumeTrue(aggressiveInliningEnabled() || canHandleHSAILMethodCalls()); - testGeneratedHsail(); + public void test() throws Exception { + try (OverrideScope s = OptionValue.override(InlineEverything, true, getOptionFromField(GraalOptions.class, "RemoveNeverExecutedCode"), false)) { + assumeTrue(aggressiveInliningEnabled() || canHandleHSAILMethodCalls()); + testGeneratedHsail(); + } } }
--- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StaticNBodyTest.java Wed Nov 06 16:56:05 2013 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StaticNBodyTest.java Wed Nov 06 18:43:45 2013 +0100 @@ -96,7 +96,7 @@ } @Test - public void test() { + public void test() throws Exception { testGeneratedHsail(); } }
--- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StringContainsAcceptTest.java Wed Nov 06 16:56:05 2013 +0100 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/StringContainsAcceptTest.java Wed Nov 06 18:43:45 2013 +0100 @@ -24,6 +24,12 @@ package com.oracle.graal.compiler.hsail.test; import org.junit.Test; + +import com.oracle.graal.options.*; +import com.oracle.graal.options.OptionValue.*; +import com.oracle.graal.phases.*; + +import static com.oracle.graal.phases.GraalOptions.*; import static org.junit.Assume.*; /** @@ -50,8 +56,9 @@ @Test @Override public void test() { - assumeTrue(aggressiveInliningEnabled() || canHandleHSAILMethodCalls()); - testGeneratedHsail(); + try (OverrideScope s = OptionValue.override(InlineEverything, true, getOptionFromField(GraalOptions.class, "RemoveNeverExecutedCode"), false)) { + assumeTrue(aggressiveInliningEnabled() || canHandleHSAILMethodCalls()); + testGeneratedHsail(); + } } - }