annotate graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java @ 21556:48c1ebd24120

renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
author Doug Simon <doug.simon@oracle.com>
date Wed, 27 May 2015 00:36:16 +0200
parents a0a760b0fb5f
children 0e095e2c24e2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18120
diff changeset
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.jtt;
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19306
diff changeset
25 import com.oracle.jvmci.code.InstalledCode;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19306
diff changeset
26 import com.oracle.jvmci.meta.JavaConstant;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19306
diff changeset
27 import com.oracle.jvmci.meta.JavaType;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19306
diff changeset
28 import com.oracle.jvmci.meta.DeoptimizationReason;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 19306
diff changeset
29 import com.oracle.jvmci.meta.ResolvedJavaMethod;
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
30 import static java.lang.reflect.Modifier.*;
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31
9682
86d24f120b78 Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents: 9438
diff changeset
32 import java.util.*;
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
33
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
34 import org.junit.*;
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
35
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36 import com.oracle.graal.compiler.test.*;
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
37 import com.oracle.graal.nodes.*;
19306
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19250
diff changeset
38 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
39
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
40 /**
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
41 * Base class for the JTT tests.
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 * <p>
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
43 * These tests are executed twice: once with arguments passed to the execution and once with the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
44 * arguments bound to the test's parameters during compilation. The latter is a good test of
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7300
diff changeset
45 * canonicalization.
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
46 */
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
47 public class JTTTest extends GraalCompilerTest {
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
48
16041
f0efdd541094 less dependency between jtt tests and GraalCompilerTest constructors
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15622
diff changeset
49 public static final class DummyTestClass {
f0efdd541094 less dependency between jtt tests and GraalCompilerTest constructors
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15622
diff changeset
50 }
f0efdd541094 less dependency between jtt tests and GraalCompilerTest constructors
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15622
diff changeset
51
13674
c700811a2814 JTTTest: add optional 'bind' and 'noProfile' parameters
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
52 protected static final Set<DeoptimizationReason> EMPTY = Collections.<DeoptimizationReason> emptySet();
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
53 /**
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
54 * The arguments which, if non-null, will replace the Locals in the test method's graph.
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
55 */
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
56 Object[] argsToBind;
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
57
8232
ab374f69e4e8 JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7530
diff changeset
58 public JTTTest() {
11959
23ccaa863eda made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents: 11405
diff changeset
59 Assert.assertNotNull(getCodeCache());
8232
ab374f69e4e8 JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7530
diff changeset
60 }
ab374f69e4e8 JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7530
diff changeset
61
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
62 @Override
19306
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19250
diff changeset
63 protected StructuredGraph parseEager(ResolvedJavaMethod m, AllowAssumptions allowAssumptions) {
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19250
diff changeset
64 StructuredGraph graph = super.parseEager(m, allowAssumptions);
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
65 if (argsToBind != null) {
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
66 Object receiver = isStatic(m.getModifiers()) ? null : this;
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
67 Object[] args = argsWithReceiver(receiver, argsToBind);
18120
86ec7f6f71b3 refactored GraalCompilerTest API to be in terms of ResolvedJavaMethod instead of Method
Doug Simon <doug.simon@oracle.com>
parents: 16714
diff changeset
68 JavaType[] parameterTypes = m.toParameterTypes();
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7282
diff changeset
69 assert parameterTypes.length == args.length;
9438
3e884486cc8a Fix non-static args binding in JTT
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8233
diff changeset
70 for (int i = 0; i < args.length; i++) {
13614
0774f3303c2e rename LocalNode to ParameterNode
Lukas Stadler <lukas.stadler@jku.at>
parents: 11959
diff changeset
71 ParameterNode param = graph.getParameter(i);
16198
006d99164743 handle graphs in JTT tests where one or more parameter nodes have been dead code eliminated
Doug Simon <doug.simon@oracle.com>
parents: 16041
diff changeset
72 if (param != null) {
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 18120
diff changeset
73 JavaConstant c = getSnippetReflection().forBoxed(parameterTypes[i].getKind(), args[i]);
16198
006d99164743 handle graphs in JTT tests where one or more parameter nodes have been dead code eliminated
Doug Simon <doug.simon@oracle.com>
parents: 16041
diff changeset
74 ConstantNode replacement = ConstantNode.forConstant(c, getMetaAccess(), graph);
006d99164743 handle graphs in JTT tests where one or more parameter nodes have been dead code eliminated
Doug Simon <doug.simon@oracle.com>
parents: 16041
diff changeset
75 param.replaceAtUsages(replacement);
006d99164743 handle graphs in JTT tests where one or more parameter nodes have been dead code eliminated
Doug Simon <doug.simon@oracle.com>
parents: 16041
diff changeset
76 } else {
006d99164743 handle graphs in JTT tests where one or more parameter nodes have been dead code eliminated
Doug Simon <doug.simon@oracle.com>
parents: 16041
diff changeset
77 // Parameter is not used and has been dead-code eliminated
006d99164743 handle graphs in JTT tests where one or more parameter nodes have been dead code eliminated
Doug Simon <doug.simon@oracle.com>
parents: 16041
diff changeset
78 }
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
79 }
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
80 }
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
81 return graph;
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
82 }
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
83
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
84 @Override
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
85 protected InstalledCode getCode(ResolvedJavaMethod method, StructuredGraph graph) {
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
86 return super.getCode(method, graph, argsToBind != null);
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
87 }
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
88
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
89 Double delta;
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
90
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
91 @Override
15622
7b09605b29c5 renamed GraalTest.assertEquals* to assertDeepEquals to avoid confusion with JUnit API methods
Doug Simon <doug.simon@oracle.com>
parents: 15018
diff changeset
92 protected void assertDeepEquals(Object expected, Object actual) {
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
93 if (delta != null) {
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
94 Assert.assertEquals(((Number) expected).doubleValue(), ((Number) actual).doubleValue(), delta);
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
95 } else {
15622
7b09605b29c5 renamed GraalTest.assertEquals* to assertDeepEquals to avoid confusion with JUnit API methods
Doug Simon <doug.simon@oracle.com>
parents: 15018
diff changeset
96 super.assertDeepEquals(expected, actual);
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
97 }
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
98 }
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
99
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
100 @SuppressWarnings("hiding")
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
101 protected void runTestWithDelta(double delta, String name, Object... args) {
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
102 this.delta = Double.valueOf(delta);
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
103 runTest(name, args);
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
104 }
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
105
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
106 protected void runTest(String name, Object... args) {
13674
c700811a2814 JTTTest: add optional 'bind' and 'noProfile' parameters
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
107 runTest(EMPTY, name, args);
9682
86d24f120b78 Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents: 9438
diff changeset
108 }
86d24f120b78 Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents: 9438
diff changeset
109
10887
f11a4e137aed fix spelling
Doug Simon <doug.simon@oracle.com>
parents: 9682
diff changeset
110 protected void runTest(Set<DeoptimizationReason> shouldNotDeopt, String name, Object... args) {
13674
c700811a2814 JTTTest: add optional 'bind' and 'noProfile' parameters
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
111 runTest(shouldNotDeopt, true, false, name, args);
c700811a2814 JTTTest: add optional 'bind' and 'noProfile' parameters
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
112 }
c700811a2814 JTTTest: add optional 'bind' and 'noProfile' parameters
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
113
c700811a2814 JTTTest: add optional 'bind' and 'noProfile' parameters
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
114 protected void runTest(Set<DeoptimizationReason> shouldNotDeopt, boolean bind, boolean noProfile, String name, Object... args) {
18120
86ec7f6f71b3 refactored GraalCompilerTest API to be in terms of ResolvedJavaMethod instead of Method
Doug Simon <doug.simon@oracle.com>
parents: 16714
diff changeset
115 ResolvedJavaMethod method = getResolvedJavaMethod(name);
86ec7f6f71b3 refactored GraalCompilerTest API to be in terms of ResolvedJavaMethod instead of Method
Doug Simon <doug.simon@oracle.com>
parents: 16714
diff changeset
116 Object receiver = method.isStatic() ? null : this;
8232
ab374f69e4e8 JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7530
diff changeset
117
ab374f69e4e8 JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7530
diff changeset
118 Result expect = executeExpected(method, receiver, args);
ab374f69e4e8 JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7530
diff changeset
119
13674
c700811a2814 JTTTest: add optional 'bind' and 'noProfile' parameters
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
120 if (noProfile) {
18120
86ec7f6f71b3 refactored GraalCompilerTest API to be in terms of ResolvedJavaMethod instead of Method
Doug Simon <doug.simon@oracle.com>
parents: 16714
diff changeset
121 method.reprofile();
13674
c700811a2814 JTTTest: add optional 'bind' and 'noProfile' parameters
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
122 }
c700811a2814 JTTTest: add optional 'bind' and 'noProfile' parameters
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
123
11405
25161615539b method rename to avoid ambiguous overloading
Doug Simon <doug.simon@oracle.com>
parents: 10887
diff changeset
124 testAgainstExpected(method, expect, shouldNotDeopt, receiver, args);
13674
c700811a2814 JTTTest: add optional 'bind' and 'noProfile' parameters
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
125 if (args.length > 0 && bind) {
c700811a2814 JTTTest: add optional 'bind' and 'noProfile' parameters
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
126 if (noProfile) {
18120
86ec7f6f71b3 refactored GraalCompilerTest API to be in terms of ResolvedJavaMethod instead of Method
Doug Simon <doug.simon@oracle.com>
parents: 16714
diff changeset
127 method.reprofile();
13674
c700811a2814 JTTTest: add optional 'bind' and 'noProfile' parameters
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
128 }
c700811a2814 JTTTest: add optional 'bind' and 'noProfile' parameters
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13614
diff changeset
129
9438
3e884486cc8a Fix non-static args binding in JTT
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8233
diff changeset
130 this.argsToBind = args;
11405
25161615539b method rename to avoid ambiguous overloading
Doug Simon <doug.simon@oracle.com>
parents: 10887
diff changeset
131 testAgainstExpected(method, expect, shouldNotDeopt, receiver, args);
9438
3e884486cc8a Fix non-static args binding in JTT
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8233
diff changeset
132 this.argsToBind = null;
3e884486cc8a Fix non-static args binding in JTT
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8233
diff changeset
133 }
7282
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
134 }
390448a6b535 converted the JTT tests to use the GraalCompilerTest framework which offers more control over what is compiled and executed
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
135 }