src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/DontReuseArgumentSpaceTest.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/DontReuseArgumentSpaceTest.java

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 /*
  24  */
  25 package org.graalvm.compiler.core.test;
  26 
  27 import org.junit.Test;
  28 
  29 import org.graalvm.compiler.code.CompilationResult;
  30 import org.graalvm.compiler.core.phases.HighTier;

  31 import org.graalvm.compiler.nodes.StructuredGraph;
  32 import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
  33 import org.graalvm.compiler.options.OptionValues;
  34 import org.graalvm.compiler.phases.tiers.Suites;
  35 
  36 import jdk.vm.ci.meta.ResolvedJavaMethod;
  37 
  38 public final class DontReuseArgumentSpaceTest extends GraalCompilerTest {
  39 
  40     @Override
  41     @SuppressWarnings("try")
  42     protected Suites createSuites(OptionValues options) {
  43         return super.createSuites(new OptionValues(options, HighTier.Options.Inline, false));
  44     }
  45 
  46     @BytecodeParserNeverInline
  47     public static int killArguments(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j) {
  48         return a + b + c + d + e + f + g + h + i + j;
  49     }
  50 


  55          * appear to be redundant moves.
  56          */
  57         killArguments(a, b, c, d, e, f, g, h, i, j);
  58         return killArguments(a, b, c, d, e, f, g, h, i, j);
  59     }
  60 
  61     @Test
  62     public void run0() throws Throwable {
  63         /*
  64          * Exercise the methods once so everything is resolved
  65          */
  66         callTwice(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
  67 
  68         /*
  69          * Create a standalone compile of killArguments. This test assumes that zapping of argument
  70          * space is being performed by the backend.
  71          */
  72         ResolvedJavaMethod javaMethod = getResolvedJavaMethod("killArguments");
  73         StructuredGraph graph = parseEager(javaMethod, AllowAssumptions.YES);
  74         CompilationResult compilationResult = compile(javaMethod, graph);
  75         getBackend().createDefaultInstalledCode(javaMethod, compilationResult);

  76 
  77         test("callTwice", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
  78     }
  79 }


  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 /*
  24  */
  25 package org.graalvm.compiler.core.test;
  26 
  27 import org.junit.Test;
  28 
  29 import org.graalvm.compiler.code.CompilationResult;
  30 import org.graalvm.compiler.core.phases.HighTier;
  31 import org.graalvm.compiler.debug.DebugContext;
  32 import org.graalvm.compiler.nodes.StructuredGraph;
  33 import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
  34 import org.graalvm.compiler.options.OptionValues;
  35 import org.graalvm.compiler.phases.tiers.Suites;
  36 
  37 import jdk.vm.ci.meta.ResolvedJavaMethod;
  38 
  39 public final class DontReuseArgumentSpaceTest extends GraalCompilerTest {
  40 
  41     @Override
  42     @SuppressWarnings("try")
  43     protected Suites createSuites(OptionValues options) {
  44         return super.createSuites(new OptionValues(options, HighTier.Options.Inline, false));
  45     }
  46 
  47     @BytecodeParserNeverInline
  48     public static int killArguments(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j) {
  49         return a + b + c + d + e + f + g + h + i + j;
  50     }
  51 


  56          * appear to be redundant moves.
  57          */
  58         killArguments(a, b, c, d, e, f, g, h, i, j);
  59         return killArguments(a, b, c, d, e, f, g, h, i, j);
  60     }
  61 
  62     @Test
  63     public void run0() throws Throwable {
  64         /*
  65          * Exercise the methods once so everything is resolved
  66          */
  67         callTwice(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
  68 
  69         /*
  70          * Create a standalone compile of killArguments. This test assumes that zapping of argument
  71          * space is being performed by the backend.
  72          */
  73         ResolvedJavaMethod javaMethod = getResolvedJavaMethod("killArguments");
  74         StructuredGraph graph = parseEager(javaMethod, AllowAssumptions.YES);
  75         CompilationResult compilationResult = compile(javaMethod, graph);
  76         DebugContext debug = getDebugContext();
  77         getBackend().createDefaultInstalledCode(debug, javaMethod, compilationResult);
  78 
  79         test("callTwice", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
  80     }
  81 }
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/DontReuseArgumentSpaceTest.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File