Mercurial > hg > truffle
annotate graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java @ 14824:115974c4c7fc
Specialize (baseline) emitPrologue for AMD64 and PTX.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Wed, 19 Mar 2014 17:48:39 +0100 |
parents | 836d558c3a5f |
children | 17a735726670 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
14053
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
6334
f8ba3bb81f6f
Renamed com.oracle.graal.tests project to com.oracle.graal.compiler.test
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
6329
diff
changeset
|
23 package com.oracle.graal.compiler.test; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
9612
66db0353f55a
compilation is explicitly given a CallingConvention for the graph being compiled instead of deriving it from a method
Doug Simon <doug.simon@oracle.com>
parents:
9042
diff
changeset
|
25 import static com.oracle.graal.api.code.CodeUtil.*; |
13239 | 26 import static com.oracle.graal.compiler.GraalCompiler.*; |
12573
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
27 import static com.oracle.graal.nodes.ConstantNode.*; |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9767
diff
changeset
|
28 import static com.oracle.graal.phases.GraalOptions.*; |
9612
66db0353f55a
compilation is explicitly given a CallingConvention for the graph being compiled instead of deriving it from a method
Doug Simon <doug.simon@oracle.com>
parents:
9042
diff
changeset
|
29 |
11738
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
30 import java.io.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 import java.lang.reflect.*; |
5650
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
32 import java.util.*; |
11740
a402610bc52b
made compilation ID allocation in tests be atomic
Doug Simon <doug.simon@oracle.com>
parents:
11738
diff
changeset
|
33 import java.util.concurrent.atomic.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 |
7260
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
35 import org.junit.*; |
10885
3f43462ce829
Work around missing support for boolean[] in junit.
Roland Schatz <roland.schatz@oracle.com>
parents:
10764
diff
changeset
|
36 import org.junit.internal.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
38 import com.oracle.graal.api.code.*; |
9612
66db0353f55a
compilation is explicitly given a CallingConvention for the graph being compiled instead of deriving it from a method
Doug Simon <doug.simon@oracle.com>
parents:
9042
diff
changeset
|
39 import com.oracle.graal.api.code.CallingConvention.Type; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5499
diff
changeset
|
40 import com.oracle.graal.api.meta.*; |
6540
31aa76ffd3bb
Rename project graal.api to graal.api.runtime
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6539
diff
changeset
|
41 import com.oracle.graal.api.runtime.*; |
14066
56726a90dc71
First draft of baseline compiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14056
diff
changeset
|
42 import com.oracle.graal.baseline.*; |
7836
a202f72872a4
Remove usage of left-over fields in GraalCompiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7835
diff
changeset
|
43 import com.oracle.graal.compiler.target.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
44 import com.oracle.graal.debug.*; |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
45 import com.oracle.graal.debug.Debug.Scope; |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
46 import com.oracle.graal.graph.*; |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
47 import com.oracle.graal.graph.Node.Verbosity; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
48 import com.oracle.graal.java.*; |
13229
325b4e4efb60
added CompilationResultBuilderFactory to support peep-hole instrumentation of methods as their code is emitted
Doug Simon <doug.simon@oracle.com>
parents:
13228
diff
changeset
|
49 import com.oracle.graal.lir.asm.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
50 import com.oracle.graal.nodes.*; |
6529
2e96dc4eb8e2
renamed package: com.oracle.graal.lir.cfg -> com.oracle.graal.nodes.cfg
Doug Simon <doug.simon@oracle.com>
parents:
6526
diff
changeset
|
51 import com.oracle.graal.nodes.cfg.*; |
5720
46ad94a0574a
moved everything from com.oracle.graal.nodes.cri into com.oracle.graal.nodes.spi
Doug Simon <doug.simon@oracle.com>
parents:
5719
diff
changeset
|
52 import com.oracle.graal.nodes.spi.*; |
8921
ea867ede377f
allow GraalCompilerTests to ignore virtual and floating nodes in graph comparison
Lukas Stadler <lukas.stadler@jku.at>
parents:
8598
diff
changeset
|
53 import com.oracle.graal.nodes.virtual.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6447
diff
changeset
|
54 import com.oracle.graal.phases.*; |
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6447
diff
changeset
|
55 import com.oracle.graal.phases.schedule.*; |
9968
3df534c97af1
Create Suites instance in runtime.
Roland Schatz <roland.schatz@oracle.com>
parents:
9864
diff
changeset
|
56 import com.oracle.graal.phases.tiers.*; |
12054
bba234a1670e
grouped provider values/parameters into a Providers object (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12052
diff
changeset
|
57 import com.oracle.graal.phases.util.*; |
7318
323ece2b012b
Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7282
diff
changeset
|
58 import com.oracle.graal.printer.*; |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
59 import com.oracle.graal.runtime.*; |
7717
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
60 import com.oracle.graal.test.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 /** |
6578 | 63 * Base class for Graal compiler unit tests. |
64 * <p> | |
65 * White box tests for Graal compiler transformations use this pattern: | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 * <ol> |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 * <li>Create a graph by {@linkplain #parse(String) parsing} a method.</li> |
5360
6cc970203f30
moved creation of a RiCodeInfo to the runtime side of the CRI
Doug Simon <doug.simon@oracle.com>
parents:
5122
diff
changeset
|
68 * <li>Manually modify the graph (e.g. replace a parameter node with a constant).</li> |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 * <li>Apply a transformation to the graph.</li> |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 * <li>Assert that the transformed graph is equal to an expected graph.</li> |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
71 * </ol> |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
72 * <p> |
6578 | 73 * See {@link InvokeHintsTest} as an example of a white box test. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 * <p> |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
75 * Black box tests use the {@link #test(String, Object...)} or |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
76 * {@link #testN(int, String, Object...)} to execute some method in the interpreter and compare its |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
77 * result against that produced by a Graal compiled version of the method. |
6578 | 78 * <p> |
79 * These tests will be run by the {@code mx unittest} command. | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 */ |
7717
cf94bd18eb47
lift GraalCompilerTest.getMethod to a common base class
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
81 public abstract class GraalCompilerTest extends GraalTest { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
82 |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12054
diff
changeset
|
83 private final Providers providers; |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
84 private final Backend backend; |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
85 private final Suites suites; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
86 |
14014
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
87 private static boolean substitutionsInstalled; |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
88 |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
89 private void installSubstitutions() { |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
90 if (!substitutionsInstalled) { |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
91 this.providers.getReplacements().registerSubstitutions(InjectProfileDataSubstitutions.class); |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
92 substitutionsInstalled = true; |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
93 } |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
94 } |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
95 |
5565
0083a59ced84
Renaming GraphTest => GraalCompilerTest.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
96 public GraalCompilerTest() { |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
97 this.backend = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend(); |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
98 this.providers = getBackend().getProviders(); |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
99 this.suites = backend.getSuites().createSuites(); |
14014
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
100 installSubstitutions(); |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
101 } |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
102 |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
103 /** |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
104 * Set up a test for a non-default backend. The test should check (via {@link #getBackend()} ) |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
105 * whether the desired backend is available. |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
106 * |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
107 * @param arch the name of the desired backend architecture |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
108 */ |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
109 public GraalCompilerTest(Class<? extends Architecture> arch) { |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
110 RuntimeProvider runtime = Graal.getRequiredCapability(RuntimeProvider.class); |
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
111 Backend b = runtime.getBackend(arch); |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
112 if (b != null) { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
113 this.backend = b; |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
114 } else { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
115 // Fall back to the default/host backend |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
116 this.backend = runtime.getHostBackend(); |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
117 } |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
118 this.providers = backend.getProviders(); |
12488
1a4dc163cd0a
abstracted HotSpotGraalRuntime as a RuntimeProvider which removes the recent selector addition to the Graal capabilities API and also makes Truffle independent of the graal.hotspot project (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12456
diff
changeset
|
119 this.suites = backend.getSuites().createSuites(); |
14014
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
120 installSubstitutions(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
121 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
122 |
8598
5a3703970e3f
share debug environment across multiple tests
Doug Simon <doug.simon@oracle.com>
parents:
8349
diff
changeset
|
123 @BeforeClass |
11560 | 124 public static void initializeDebugging() { |
8598
5a3703970e3f
share debug environment across multiple tests
Doug Simon <doug.simon@oracle.com>
parents:
8349
diff
changeset
|
125 DebugEnvironment.initialize(System.out); |
5a3703970e3f
share debug environment across multiple tests
Doug Simon <doug.simon@oracle.com>
parents:
8349
diff
changeset
|
126 } |
5a3703970e3f
share debug environment across multiple tests
Doug Simon <doug.simon@oracle.com>
parents:
8349
diff
changeset
|
127 |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
128 private Scope debugScope; |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
129 |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
130 @Before |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
131 public void beforeTest() { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
132 assert debugScope == null; |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
133 debugScope = Debug.scope(getClass().getSimpleName()); |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
134 } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
135 |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
136 @After |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
137 public void afterTest() { |
13579
be2b096a5f69
GraalCompilerTest: fix NPE when debugging is not enabled.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13239
diff
changeset
|
138 if (debugScope != null) { |
13580
8958eb3ff6b9
GraalCompilerTest: add messages to exception comparison asserts to make JUnit output clearer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13579
diff
changeset
|
139 debugScope.close(); |
13579
be2b096a5f69
GraalCompilerTest: fix NPE when debugging is not enabled.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13239
diff
changeset
|
140 } |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
141 debugScope = null; |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
142 } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
143 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 protected void assertEquals(StructuredGraph expected, StructuredGraph graph) { |
8921
ea867ede377f
allow GraalCompilerTests to ignore virtual and floating nodes in graph comparison
Lukas Stadler <lukas.stadler@jku.at>
parents:
8598
diff
changeset
|
145 assertEquals(expected, graph, false); |
ea867ede377f
allow GraalCompilerTests to ignore virtual and floating nodes in graph comparison
Lukas Stadler <lukas.stadler@jku.at>
parents:
8598
diff
changeset
|
146 } |
ea867ede377f
allow GraalCompilerTests to ignore virtual and floating nodes in graph comparison
Lukas Stadler <lukas.stadler@jku.at>
parents:
8598
diff
changeset
|
147 |
12573
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
148 protected int countUnusedConstants(StructuredGraph graph) { |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
149 int total = 0; |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12573
diff
changeset
|
150 for (ConstantNode node : getConstantNodes(graph)) { |
12573
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
151 if (!ConstantNodeRecordsUsages) { |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12573
diff
changeset
|
152 if (node.gatherUsages(graph).isEmpty()) { |
12573
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
153 total++; |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
154 } |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
155 } else { |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
156 if (node.usages().isEmpty()) { |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
157 total++; |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
158 } |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
159 } |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
160 } |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
161 return total; |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
162 } |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
163 |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
164 protected int getNodeCountExcludingUnusedConstants(StructuredGraph graph) { |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
165 return graph.getNodeCount() - countUnusedConstants(graph); |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
166 } |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
167 |
8921
ea867ede377f
allow GraalCompilerTests to ignore virtual and floating nodes in graph comparison
Lukas Stadler <lukas.stadler@jku.at>
parents:
8598
diff
changeset
|
168 protected void assertEquals(StructuredGraph expected, StructuredGraph graph, boolean excludeVirtual) { |
ea867ede377f
allow GraalCompilerTests to ignore virtual and floating nodes in graph comparison
Lukas Stadler <lukas.stadler@jku.at>
parents:
8598
diff
changeset
|
169 String expectedString = getCanonicalGraphString(expected, excludeVirtual); |
ea867ede377f
allow GraalCompilerTests to ignore virtual and floating nodes in graph comparison
Lukas Stadler <lukas.stadler@jku.at>
parents:
8598
diff
changeset
|
170 String actualString = getCanonicalGraphString(graph, excludeVirtual); |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
171 String mismatchString = "mismatch in graphs:\n========= expected =========\n" + expectedString + "\n\n========= actual =========\n" + actualString; |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
172 |
12573
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
173 if (!excludeVirtual && getNodeCountExcludingUnusedConstants(expected) != getNodeCountExcludingUnusedConstants(graph)) { |
4363
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4265
diff
changeset
|
174 Debug.dump(expected, "Node count not matching - expected"); |
7462c3600c3a
Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4265
diff
changeset
|
175 Debug.dump(graph, "Node count not matching - actual"); |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
176 Assert.fail("Graphs do not have the same number of nodes: " + expected.getNodeCount() + " vs. " + graph.getNodeCount() + "\n" + mismatchString); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
177 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
178 if (!expectedString.equals(actualString)) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
179 Debug.dump(expected, "mismatching graphs - expected"); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
180 Debug.dump(graph, "mismatching graphs - actual"); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
181 Assert.fail(mismatchString); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
182 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
183 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
184 |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5650
diff
changeset
|
185 protected void assertConstantReturn(StructuredGraph graph, int value) { |
8921
ea867ede377f
allow GraalCompilerTests to ignore virtual and floating nodes in graph comparison
Lukas Stadler <lukas.stadler@jku.at>
parents:
8598
diff
changeset
|
186 String graphString = getCanonicalGraphString(graph, false); |
13690
08f58bfde0dd
add IterableNodeType to ReturnNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13669
diff
changeset
|
187 Assert.assertEquals("unexpected number of ReturnNodes: " + graphString, graph.getNodes(ReturnNode.class).count(), 1); |
08f58bfde0dd
add IterableNodeType to ReturnNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13669
diff
changeset
|
188 ValueNode result = graph.getNodes(ReturnNode.class).first().result(); |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5650
diff
changeset
|
189 Assert.assertTrue("unexpected ReturnNode result node: " + graphString, result.isConstant()); |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5780
diff
changeset
|
190 Assert.assertEquals("unexpected ReturnNode result kind: " + graphString, result.asConstant().getKind(), Kind.Int); |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5650
diff
changeset
|
191 Assert.assertEquals("unexpected ReturnNode result: " + graphString, result.asConstant().asInt(), value); |
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5650
diff
changeset
|
192 } |
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5650
diff
changeset
|
193 |
8921
ea867ede377f
allow GraalCompilerTests to ignore virtual and floating nodes in graph comparison
Lukas Stadler <lukas.stadler@jku.at>
parents:
8598
diff
changeset
|
194 protected static String getCanonicalGraphString(StructuredGraph graph, boolean excludeVirtual) { |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
195 SchedulePhase schedule = new SchedulePhase(); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
196 schedule.apply(graph); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
197 |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
198 NodeMap<Integer> canonicalId = graph.createNodeMap(); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
199 int nextId = 0; |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
200 |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
201 StringBuilder result = new StringBuilder(); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
202 for (Block block : schedule.getCFG().getBlocks()) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
203 result.append("Block " + block + " "); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
204 if (block == schedule.getCFG().getStartBlock()) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
205 result.append("* "); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
206 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
207 result.append("-> "); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
208 for (Block succ : block.getSuccessors()) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
209 result.append(succ + " "); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
210 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
211 result.append("\n"); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
212 for (Node node : schedule.getBlockToNodesMap().get(block)) { |
12573
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
213 if (node.recordsUsages()) { |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
214 if (!excludeVirtual || !(node instanceof VirtualObjectNode || node instanceof ProxyNode)) { |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
215 int id; |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
216 if (canonicalId.get(node) != null) { |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
217 id = canonicalId.get(node); |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
218 } else { |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
219 id = nextId++; |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
220 canonicalId.set(node, id); |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
221 } |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
222 String name = node instanceof ConstantNode ? node.toString(Verbosity.Name) : node.getClass().getSimpleName(); |
6332050441eb
fixed tests that need to take into account ConstantNodes not recording their usages (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
223 result.append(" " + id + "|" + name + (excludeVirtual ? "\n" : " (" + node.usages().count() + ")\n")); |
8921
ea867ede377f
allow GraalCompilerTests to ignore virtual and floating nodes in graph comparison
Lukas Stadler <lukas.stadler@jku.at>
parents:
8598
diff
changeset
|
224 } |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
225 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
226 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
227 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
228 return result.toString(); |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
229 } |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5360
diff
changeset
|
230 |
12456
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
231 protected Backend getBackend() { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
232 return backend; |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
233 } |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
234 |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
235 protected Suites getSuites() { |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
236 return suites; |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
237 } |
f87c68d79f07
improved support for co-existing, multiple backends (GRAAL-363)
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
238 |
12054
bba234a1670e
grouped provider values/parameters into a Providers object (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12052
diff
changeset
|
239 protected Providers getProviders() { |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12054
diff
changeset
|
240 return providers; |
12054
bba234a1670e
grouped provider values/parameters into a Providers object (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12052
diff
changeset
|
241 } |
bba234a1670e
grouped provider values/parameters into a Providers object (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12052
diff
changeset
|
242 |
13132
922dd1415c0a
Commit pass target as a parameter to ReplacementImpl, so that it does not require a CodeCacheProvider
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12655
diff
changeset
|
243 protected TargetDescription getTarget() { |
922dd1415c0a
Commit pass target as a parameter to ReplacementImpl, so that it does not require a CodeCacheProvider
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12655
diff
changeset
|
244 return getProviders().getCodeCache().getTarget(); |
922dd1415c0a
Commit pass target as a parameter to ReplacementImpl, so that it does not require a CodeCacheProvider
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12655
diff
changeset
|
245 } |
922dd1415c0a
Commit pass target as a parameter to ReplacementImpl, so that it does not require a CodeCacheProvider
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12655
diff
changeset
|
246 |
12045
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
247 protected CodeCacheProvider getCodeCache() { |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12054
diff
changeset
|
248 return getProviders().getCodeCache(); |
11959
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11740
diff
changeset
|
249 } |
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11740
diff
changeset
|
250 |
12052
0afe7370260c
refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12045
diff
changeset
|
251 protected ConstantReflectionProvider getConstantReflection() { |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12054
diff
changeset
|
252 return getProviders().getConstantReflection(); |
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12054
diff
changeset
|
253 } |
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12054
diff
changeset
|
254 |
11959
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11740
diff
changeset
|
255 protected MetaAccessProvider getMetaAccess() { |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12054
diff
changeset
|
256 return getProviders().getMetaAccess(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
257 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
258 |
12045
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
259 protected LoweringProvider getLowerer() { |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12054
diff
changeset
|
260 return getProviders().getLowerer(); |
12045
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
261 } |
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
262 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
263 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 * Parses a Java method to produce a graph. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
265 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
266 * @param methodName the name of the method in {@code this.getClass()} to be parsed |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
267 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
268 protected StructuredGraph parse(String methodName) { |
4993
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4410
diff
changeset
|
269 return parse(getMethod(methodName)); |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4410
diff
changeset
|
270 } |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4410
diff
changeset
|
271 |
11740
a402610bc52b
made compilation ID allocation in tests be atomic
Doug Simon <doug.simon@oracle.com>
parents:
11738
diff
changeset
|
272 private static AtomicInteger compilationId = new AtomicInteger(); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
5425
diff
changeset
|
273 |
7260
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
274 /** |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
275 * Compares two given objects for {@linkplain Assert#assertEquals(Object, Object) equality}. |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
276 * Does a deep copy equality comparison if {@code expected} is an array. |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
277 */ |
5599
592dfff9d410
modified GraalCompilerTest so that subclasses can override the assertEquals test
Doug Simon <doug.simon@oracle.com>
parents:
5571
diff
changeset
|
278 protected void assertEquals(Object expected, Object actual) { |
7260
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
279 if (expected != null && expected.getClass().isArray()) { |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
280 Assert.assertTrue(expected != null); |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
281 Assert.assertTrue(actual != null); |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
282 Assert.assertEquals(expected.getClass(), actual.getClass()); |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
283 if (expected instanceof int[]) { |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
284 Assert.assertArrayEquals((int[]) expected, (int[]) actual); |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
285 } else if (expected instanceof byte[]) { |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
286 Assert.assertArrayEquals((byte[]) expected, (byte[]) actual); |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
287 } else if (expected instanceof char[]) { |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
288 Assert.assertArrayEquals((char[]) expected, (char[]) actual); |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
289 } else if (expected instanceof short[]) { |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
290 Assert.assertArrayEquals((short[]) expected, (short[]) actual); |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
291 } else if (expected instanceof float[]) { |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
292 Assert.assertArrayEquals((float[]) expected, (float[]) actual, 0.0f); |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
293 } else if (expected instanceof long[]) { |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
294 Assert.assertArrayEquals((long[]) expected, (long[]) actual); |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
295 } else if (expected instanceof double[]) { |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
296 Assert.assertArrayEquals((double[]) expected, (double[]) actual, 0.0d); |
10885
3f43462ce829
Work around missing support for boolean[] in junit.
Roland Schatz <roland.schatz@oracle.com>
parents:
10764
diff
changeset
|
297 } else if (expected instanceof boolean[]) { |
3f43462ce829
Work around missing support for boolean[] in junit.
Roland Schatz <roland.schatz@oracle.com>
parents:
10764
diff
changeset
|
298 new ExactComparisonCriteria().arrayEquals(null, expected, actual); |
7260
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
299 } else if (expected instanceof Object[]) { |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
300 Assert.assertArrayEquals((Object[]) expected, (Object[]) actual); |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
301 } else { |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
302 Assert.fail("non-array value encountered: " + expected); |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
303 } |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
304 } else { |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
305 Assert.assertEquals(expected, actual); |
169bbc849ee9
moved deep array equality comparison into base test class
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
306 } |
5599
592dfff9d410
modified GraalCompilerTest so that subclasses can override the assertEquals test
Doug Simon <doug.simon@oracle.com>
parents:
5571
diff
changeset
|
307 } |
592dfff9d410
modified GraalCompilerTest so that subclasses can override the assertEquals test
Doug Simon <doug.simon@oracle.com>
parents:
5571
diff
changeset
|
308 |
11738
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
309 @SuppressWarnings("serial") |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
310 public static class MultiCauseAssertionError extends AssertionError { |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
311 |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
312 private Throwable[] causes; |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
313 |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
314 public MultiCauseAssertionError(String message, Throwable... causes) { |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
315 super(message); |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
316 this.causes = causes; |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
317 } |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
318 |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
319 @Override |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
320 public void printStackTrace(PrintStream out) { |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
321 super.printStackTrace(out); |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
322 int num = 0; |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
323 for (Throwable cause : causes) { |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
324 if (cause != null) { |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
325 out.print("cause " + (num++)); |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
326 cause.printStackTrace(out); |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
327 } |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
328 } |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
329 } |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
330 |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
331 @Override |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
332 public void printStackTrace(PrintWriter out) { |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
333 super.printStackTrace(out); |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
334 int num = 0; |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
335 for (Throwable cause : causes) { |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
336 if (cause != null) { |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
337 out.print("cause " + (num++) + ": "); |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
338 cause.printStackTrace(out); |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
339 } |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
340 } |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
341 } |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
342 } |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
343 |
6370
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
344 protected void testN(int n, final String name, final Object... args) { |
11738
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
345 final List<Throwable> errors = new ArrayList<>(n); |
6370
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
346 Thread[] threads = new Thread[n]; |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
347 for (int i = 0; i < n; i++) { |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
348 Thread t = new Thread(i + ":" + name) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
349 |
6370
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
350 @Override |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
351 public void run() { |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
352 try { |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
353 test(name, args); |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
354 } catch (Throwable e) { |
11738
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
355 errors.add(e); |
6370
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
356 } |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
357 } |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
358 }; |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
359 threads[i] = t; |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
360 t.start(); |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
361 } |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
362 for (int i = 0; i < n; i++) { |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
363 try { |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
364 threads[i].join(); |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
365 } catch (InterruptedException e) { |
11738
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
366 errors.add(e); |
6370
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
367 } |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
368 } |
11738
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
369 if (!errors.isEmpty()) { |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
370 throw new MultiCauseAssertionError(errors.size() + " failures", errors.toArray(new Throwable[errors.size()])); |
aa10794f1574
better reporting of failures during multi-threaded tests
Doug Simon <doug.simon@oracle.com>
parents:
11660
diff
changeset
|
371 } |
6370
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
372 } |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
373 |
6431
2e376f8ea4e2
added snippet for lowering NewMultiArrayNodes
Doug Simon <doug.simon@oracle.com>
parents:
6370
diff
changeset
|
374 protected Object referenceInvoke(Method method, Object receiver, Object... args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { |
2e376f8ea4e2
added snippet for lowering NewMultiArrayNodes
Doug Simon <doug.simon@oracle.com>
parents:
6370
diff
changeset
|
375 return method.invoke(receiver, args); |
2e376f8ea4e2
added snippet for lowering NewMultiArrayNodes
Doug Simon <doug.simon@oracle.com>
parents:
6370
diff
changeset
|
376 } |
2e376f8ea4e2
added snippet for lowering NewMultiArrayNodes
Doug Simon <doug.simon@oracle.com>
parents:
6370
diff
changeset
|
377 |
8232
ab374f69e4e8
JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8217
diff
changeset
|
378 protected static class Result { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
379 |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
380 final Object returnValue; |
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
381 final Throwable exception; |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
382 |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
383 public Result(Object returnValue, Throwable exception) { |
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
384 this.returnValue = returnValue; |
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
385 this.exception = exception; |
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
386 } |
9682
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
387 |
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
388 @Override |
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
389 public String toString() { |
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
390 return exception == null ? returnValue == null ? "null" : returnValue.toString() : "!" + exception; |
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
391 } |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
392 } |
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
393 |
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:
7260
diff
changeset
|
394 /** |
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:
7260
diff
changeset
|
395 * Called before a test is executed. |
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:
7260
diff
changeset
|
396 */ |
9682
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
397 protected void before(@SuppressWarnings("unused") Method method) { |
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:
7260
diff
changeset
|
398 } |
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:
7260
diff
changeset
|
399 |
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:
7260
diff
changeset
|
400 /** |
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:
7260
diff
changeset
|
401 * Called after a test is executed. |
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:
7260
diff
changeset
|
402 */ |
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:
7260
diff
changeset
|
403 protected void after() { |
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:
7260
diff
changeset
|
404 } |
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:
7260
diff
changeset
|
405 |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
406 protected Result executeExpected(Method method, Object receiver, Object... args) { |
9682
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
407 before(method); |
5557
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
408 try { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
409 // This gives us both the expected return value as well as ensuring that the method to |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
410 // be compiled is fully resolved |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
411 return new Result(referenceInvoke(method, receiver, args), null); |
5557
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
412 } catch (InvocationTargetException e) { |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
413 return new Result(null, e.getTargetException()); |
5557
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
414 } catch (Exception e) { |
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
415 throw new RuntimeException(e); |
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:
7260
diff
changeset
|
416 } finally { |
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:
7260
diff
changeset
|
417 after(); |
5557
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
418 } |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
419 } |
6370
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
420 |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
421 protected Result executeActual(Method method, Object receiver, Object... args) { |
9682
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
422 before(method); |
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:
7260
diff
changeset
|
423 Object[] executeArgs = argsWithReceiver(receiver, 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:
7260
diff
changeset
|
424 |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12054
diff
changeset
|
425 ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(method); |
8233
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
426 checkArgs(javaMethod, executeArgs); |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
427 |
14053
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
428 InstalledCode compiledMethod = null; |
14066
56726a90dc71
First draft of baseline compiler.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14056
diff
changeset
|
429 if (UseBaselineCompiler.getValue()) { |
14053
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
430 compiledMethod = getCodeBaseline(javaMethod, method); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
431 } else { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
432 compiledMethod = getCode(javaMethod, parse(method)); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
433 } |
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:
7260
diff
changeset
|
434 try { |
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:
7260
diff
changeset
|
435 return new Result(compiledMethod.executeVarargs(executeArgs), 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:
7260
diff
changeset
|
436 } catch (Throwable e) { |
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:
7260
diff
changeset
|
437 return new Result(null, e); |
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:
7260
diff
changeset
|
438 } finally { |
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:
7260
diff
changeset
|
439 after(); |
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:
7260
diff
changeset
|
440 } |
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:
7260
diff
changeset
|
441 } |
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:
7260
diff
changeset
|
442 |
14053
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
443 protected InstalledCode getCodeBaseline(ResolvedJavaMethod javaMethod, Method method) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
444 return getCodeBaseline(javaMethod, method, false); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
445 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
446 |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
447 protected InstalledCode getCodeBaseline(ResolvedJavaMethod javaMethod, Method method, boolean forceCompile) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
448 assert method.getAnnotation(Test.class) == null : "shouldn't parse method with @Test annotation: " + method; |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
449 |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
450 try (Scope bds = Debug.scope("Baseline")) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
451 Debug.log("getCodeBaseline()"); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
452 } catch (Throwable e) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
453 throw Debug.handle(e); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
454 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
455 |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
456 if (!forceCompile) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
457 InstalledCode cached = cache.get(javaMethod); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
458 if (cached != null) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
459 if (cached.isValid()) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
460 return cached; |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
461 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
462 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
463 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
464 |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
465 final int id = compilationId.incrementAndGet(); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
466 |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
467 InstalledCode installedCode = null; |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
468 try (Scope ds = Debug.scope("Compiling", new DebugDumpScope(String.valueOf(id), true))) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
469 final boolean printCompilation = PrintCompilation.getValue() && !TTY.isSuppressed(); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
470 |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
471 if (printCompilation) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
472 TTY.println(String.format("@%-6d Graal %-70s %-45s %-50s ...", id, javaMethod.getDeclaringClass().getName(), javaMethod.getName(), javaMethod.getSignature())); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
473 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
474 long start = System.currentTimeMillis(); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
475 |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
476 CompilationResult compResult = compileBaseline(javaMethod); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
477 |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
478 if (printCompilation) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
479 TTY.println(String.format("@%-6d Graal %-70s %-45s %-50s | %4dms %5dB", id, "", "", "", System.currentTimeMillis() - start, compResult.getTargetCodeSize())); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
480 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
481 |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
482 try (Scope s = Debug.scope("CodeInstall", getCodeCache(), javaMethod)) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
483 installedCode = addMethod(javaMethod, compResult); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
484 if (installedCode == null) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
485 throw new GraalInternalError("Could not install code for " + MetaUtil.format("%H.%n(%p)", javaMethod)); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
486 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
487 } catch (Throwable e) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
488 throw Debug.handle(e); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
489 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
490 } catch (Throwable e) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
491 throw Debug.handle(e); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
492 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
493 |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
494 if (!forceCompile) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
495 cache.put(javaMethod, installedCode); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
496 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
497 return installedCode; |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
498 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
499 |
14055
89bbedfe0ad3
Direct LIR generation: refactoring alternative compilation path in GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14054
diff
changeset
|
500 private CompilationResult compileBaseline(ResolvedJavaMethod javaMethod) { |
14824
115974c4c7fc
Specialize (baseline) emitPrologue for AMD64 and PTX.
Josef Eisl <josef.eisl@jku.at>
parents:
14816
diff
changeset
|
501 try (Scope bds = Debug.scope("compileBaseline", javaMethod, providers.getCodeCache())) { |
14127
452bb6e73298
BaselineCompiler: fix typo.
Josef Eisl <josef.eisl@jku.at>
parents:
14067
diff
changeset
|
502 BaselineCompiler baselineCompiler = new BaselineCompiler(GraphBuilderConfiguration.getDefault(), providers.getMetaAccess()); |
14790
3518daf2f9bc
Add call to GraalCompiler.emitCode() from BaselineCompiler.
Josef Eisl <josef.eisl@jku.at>
parents:
14147
diff
changeset
|
503 return baselineCompiler.generate(javaMethod, -1, getBackend(), new CompilationResult(), javaMethod, CompilationResultBuilderFactory.Default); |
14053
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
504 } catch (Throwable e) { |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
505 throw Debug.handle(e); |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
506 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
507 } |
a7f26a522439
Direct LIR generation: added alternative compilation path to GraalCompilerTest.
Josef Eisl <josef.eisl@jku.at>
parents:
14014
diff
changeset
|
508 |
8233
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
509 protected void checkArgs(ResolvedJavaMethod method, Object[] args) { |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
510 JavaType[] sig = MetaUtil.signatureToTypes(method); |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
511 Assert.assertEquals(sig.length, args.length); |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
512 for (int i = 0; i < args.length; i++) { |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
513 JavaType javaType = sig[i]; |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
514 Kind kind = javaType.getKind(); |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
515 Object arg = args[i]; |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
516 if (kind == Kind.Object) { |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
517 if (arg != null && javaType instanceof ResolvedJavaType) { |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
518 ResolvedJavaType resolvedJavaType = (ResolvedJavaType) javaType; |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12054
diff
changeset
|
519 Assert.assertTrue(resolvedJavaType + " from " + getMetaAccess().lookupJavaType(arg.getClass()), resolvedJavaType.isAssignableFrom(getMetaAccess().lookupJavaType(arg.getClass()))); |
8233
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
520 } |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
521 } else { |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
522 Assert.assertNotNull(arg); |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
523 Assert.assertEquals(kind.toBoxedJavaClass(), arg.getClass()); |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
524 } |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
525 } |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
526 } |
9484e7602276
GraalCompilerTest should assert that parameters passed to executeActual have the right type.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8232
diff
changeset
|
527 |
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:
7260
diff
changeset
|
528 /** |
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:
7260
diff
changeset
|
529 * Prepends a non-null receiver argument to a given list or args. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
530 * |
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:
7260
diff
changeset
|
531 * @param receiver the receiver argument to prepend if it is non-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:
7260
diff
changeset
|
532 */ |
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:
7260
diff
changeset
|
533 protected Object[] argsWithReceiver(Object receiver, Object... args) { |
6370
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
534 Object[] executeArgs; |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
535 if (receiver == null) { |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
536 executeArgs = args; |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
537 } else { |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
538 executeArgs = new Object[args.length + 1]; |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
539 executeArgs[0] = receiver; |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
540 for (int i = 0; i < args.length; i++) { |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
541 executeArgs[i + 1] = args[i]; |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
542 } |
703a6ab8ca82
added support for multi-threaded compiler tests
Doug Simon <doug.simon@oracle.com>
parents:
6334
diff
changeset
|
543 } |
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:
7260
diff
changeset
|
544 return executeArgs; |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
545 } |
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
546 |
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
547 protected void test(String name, Object... args) { |
13647
8edc6b0779f0
suppress the exception raised by Junit's "assume" mechanism in GraalCompilerTest.test()
Doug Simon <doug.simon@oracle.com>
parents:
13622
diff
changeset
|
548 try { |
8edc6b0779f0
suppress the exception raised by Junit's "assume" mechanism in GraalCompilerTest.test()
Doug Simon <doug.simon@oracle.com>
parents:
13622
diff
changeset
|
549 Method method = getMethod(name); |
8edc6b0779f0
suppress the exception raised by Junit's "assume" mechanism in GraalCompilerTest.test()
Doug Simon <doug.simon@oracle.com>
parents:
13622
diff
changeset
|
550 Object receiver = Modifier.isStatic(method.getModifiers()) ? null : this; |
8edc6b0779f0
suppress the exception raised by Junit's "assume" mechanism in GraalCompilerTest.test()
Doug Simon <doug.simon@oracle.com>
parents:
13622
diff
changeset
|
551 test(method, receiver, args); |
8edc6b0779f0
suppress the exception raised by Junit's "assume" mechanism in GraalCompilerTest.test()
Doug Simon <doug.simon@oracle.com>
parents:
13622
diff
changeset
|
552 } catch (AssumptionViolatedException e) { |
8edc6b0779f0
suppress the exception raised by Junit's "assume" mechanism in GraalCompilerTest.test()
Doug Simon <doug.simon@oracle.com>
parents:
13622
diff
changeset
|
553 // Suppress so that subsequent calls to this method within the |
8edc6b0779f0
suppress the exception raised by Junit's "assume" mechanism in GraalCompilerTest.test()
Doug Simon <doug.simon@oracle.com>
parents:
13622
diff
changeset
|
554 // same Junit @Test annotated method can proceed. |
8edc6b0779f0
suppress the exception raised by Junit's "assume" mechanism in GraalCompilerTest.test()
Doug Simon <doug.simon@oracle.com>
parents:
13622
diff
changeset
|
555 } |
8232
ab374f69e4e8
JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8217
diff
changeset
|
556 } |
ab374f69e4e8
JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8217
diff
changeset
|
557 |
ab374f69e4e8
JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8217
diff
changeset
|
558 protected void test(Method method, Object receiver, Object... args) { |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
559 Result expect = executeExpected(method, receiver, args); |
11959
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11740
diff
changeset
|
560 if (getCodeCache() == null) { |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
561 return; |
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
562 } |
11405
25161615539b
method rename to avoid ambiguous overloading
Doug Simon <doug.simon@oracle.com>
parents:
11316
diff
changeset
|
563 testAgainstExpected(method, expect, receiver, args); |
8232
ab374f69e4e8
JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8217
diff
changeset
|
564 } |
ab374f69e4e8
JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8217
diff
changeset
|
565 |
11405
25161615539b
method rename to avoid ambiguous overloading
Doug Simon <doug.simon@oracle.com>
parents:
11316
diff
changeset
|
566 protected void testAgainstExpected(Method method, Result expect, Object receiver, Object... args) { |
25161615539b
method rename to avoid ambiguous overloading
Doug Simon <doug.simon@oracle.com>
parents:
11316
diff
changeset
|
567 testAgainstExpected(method, expect, Collections.<DeoptimizationReason> emptySet(), receiver, args); |
9682
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
568 } |
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
569 |
10030
85f926430ae6
Test deoptimization in DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10019
diff
changeset
|
570 protected Result executeActualCheckDeopt(Method method, Set<DeoptimizationReason> shouldNotDeopt, Object receiver, Object... args) { |
9682
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
571 Map<DeoptimizationReason, Integer> deoptCounts = new EnumMap<>(DeoptimizationReason.class); |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12054
diff
changeset
|
572 ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(method); |
11316
33ea8e2addac
Fix GraalCompilerTest deopt checks: need to re-aquire the profile after running the method since the MethodData may not be present before running it.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11259
diff
changeset
|
573 ProfilingInfo profile = javaMethod.getProfilingInfo(); |
9682
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
574 for (DeoptimizationReason reason : shouldNotDeopt) { |
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
575 deoptCounts.put(reason, profile.getDeoptimizationCount(reason)); |
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
576 } |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
577 Result actual = executeActual(method, receiver, args); |
11316
33ea8e2addac
Fix GraalCompilerTest deopt checks: need to re-aquire the profile after running the method since the MethodData may not be present before running it.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11259
diff
changeset
|
578 profile = javaMethod.getProfilingInfo(); // profile can change after execution |
9682
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
579 for (DeoptimizationReason reason : shouldNotDeopt) { |
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
580 Assert.assertEquals((int) deoptCounts.get(reason), profile.getDeoptimizationCount(reason)); |
86d24f120b78
Allow tests to check for deoptimizations, provide Method object in before hook.
Roland Schatz <roland.schatz@oracle.com>
parents:
9621
diff
changeset
|
581 } |
10030
85f926430ae6
Test deoptimization in DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10019
diff
changeset
|
582 return actual; |
85f926430ae6
Test deoptimization in DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10019
diff
changeset
|
583 } |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
584 |
10030
85f926430ae6
Test deoptimization in DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10019
diff
changeset
|
585 protected void assertEquals(Result expect, Result actual) { |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
586 if (expect.exception != null) { |
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
587 Assert.assertTrue("expected " + expect.exception, actual.exception != null); |
13580
8958eb3ff6b9
GraalCompilerTest: add messages to exception comparison asserts to make JUnit output clearer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13579
diff
changeset
|
588 Assert.assertEquals("Exception class", expect.exception.getClass(), actual.exception.getClass()); |
8958eb3ff6b9
GraalCompilerTest: add messages to exception comparison asserts to make JUnit output clearer
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13579
diff
changeset
|
589 Assert.assertEquals("Exception message", expect.exception.getMessage(), actual.exception.getMessage()); |
5557
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
590 } else { |
8232
ab374f69e4e8
JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8217
diff
changeset
|
591 if (actual.exception != null) { |
ab374f69e4e8
JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8217
diff
changeset
|
592 actual.exception.printStackTrace(); |
ab374f69e4e8
JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8217
diff
changeset
|
593 Assert.fail("expected " + expect.returnValue + " but got an exception"); |
ab374f69e4e8
JTTTest gets the expeted result only once
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8217
diff
changeset
|
594 } |
6447
d7bcbdf4749c
minor restructuring of GraalCompilerTest
Doug Simon <doug.simon@oracle.com>
parents:
6431
diff
changeset
|
595 assertEquals(expect.returnValue, actual.returnValue); |
5557
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
596 } |
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
597 } |
2e2a77f091f2
re-enabled disassembler output to C1Visualizer after code installation
Doug Simon <doug.simon@oracle.com>
parents:
5546
diff
changeset
|
598 |
11405
25161615539b
method rename to avoid ambiguous overloading
Doug Simon <doug.simon@oracle.com>
parents:
11316
diff
changeset
|
599 protected void testAgainstExpected(Method method, Result expect, Set<DeoptimizationReason> shouldNotDeopt, Object receiver, Object... args) { |
10030
85f926430ae6
Test deoptimization in DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10019
diff
changeset
|
600 Result actual = executeActualCheckDeopt(method, shouldNotDeopt, receiver, args); |
85f926430ae6
Test deoptimization in DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10019
diff
changeset
|
601 assertEquals(expect, actual); |
85f926430ae6
Test deoptimization in DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10019
diff
changeset
|
602 } |
85f926430ae6
Test deoptimization in DynamicNewArrayNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
10019
diff
changeset
|
603 |
5650
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
604 private Map<ResolvedJavaMethod, InstalledCode> cache = new HashMap<>(); |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
605 |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
606 /** |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
607 * Gets installed code for a given method and graph, compiling it first if necessary. |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
608 */ |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
609 protected InstalledCode getCode(final ResolvedJavaMethod method, final StructuredGraph graph) { |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
610 return getCode(method, graph, false); |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
611 } |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
612 |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
613 /** |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
614 * Gets installed code for a given method and graph, compiling it first if necessary. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
615 * |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
616 * @param forceCompile specifies whether to ignore any previous code cached for the (method, |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
617 * key) pair |
5650
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
618 */ |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
619 protected InstalledCode getCode(final ResolvedJavaMethod method, final StructuredGraph graph, boolean forceCompile) { |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
620 if (!forceCompile) { |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
621 InstalledCode cached = cache.get(method); |
7028
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
6676
diff
changeset
|
622 if (cached != null) { |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
6676
diff
changeset
|
623 if (cached.isValid()) { |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
6676
diff
changeset
|
624 return cached; |
0353b031235a
added tests for instanceof with array types
Doug Simon <doug.simon@oracle.com>
parents:
6676
diff
changeset
|
625 } |
5650
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
626 } |
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
627 } |
7154
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7123
diff
changeset
|
628 |
11740
a402610bc52b
made compilation ID allocation in tests be atomic
Doug Simon <doug.simon@oracle.com>
parents:
11738
diff
changeset
|
629 final int id = compilationId.incrementAndGet(); |
7154
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7123
diff
changeset
|
630 |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
631 InstalledCode installedCode = null; |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
632 try (Scope ds = Debug.scope("Compiling", new DebugDumpScope(String.valueOf(id), true))) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
633 final boolean printCompilation = PrintCompilation.getValue() && !TTY.isSuppressed(); |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
634 if (printCompilation) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
635 TTY.println(String.format("@%-6d Graal %-70s %-45s %-50s ...", id, method.getDeclaringClass().getName(), method.getName(), method.getSignature())); |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
636 } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
637 long start = System.currentTimeMillis(); |
13622
02d3cfc90603
made GraalCompilerTest slightly more extensible
Doug Simon <doug.simon@oracle.com>
parents:
13612
diff
changeset
|
638 CompilationResult compResult = compile(method, graph); |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
639 if (printCompilation) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
640 TTY.println(String.format("@%-6d Graal %-70s %-45s %-50s | %4dms %5dB", id, "", "", "", System.currentTimeMillis() - start, compResult.getTargetCodeSize())); |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
641 } |
9767
e415e58e0db2
changed location of debug scope so that a subclass that overrides 'addMethod' still matches -G:Dump=CodeInstall option
Doug Simon <doug.simon@oracle.com>
parents:
9682
diff
changeset
|
642 |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
643 try (Scope s = Debug.scope("CodeInstall", getCodeCache(), method)) { |
13233
8ea51438445c
consolidated logging and dumping of InstalledCode to HotSpotCodeCacheProvider
Doug Simon <doug.simon@oracle.com>
parents:
13229
diff
changeset
|
644 installedCode = addMethod(method, compResult); |
8ea51438445c
consolidated logging and dumping of InstalledCode to HotSpotCodeCacheProvider
Doug Simon <doug.simon@oracle.com>
parents:
13229
diff
changeset
|
645 if (installedCode == null) { |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
646 throw new GraalInternalError("Could not install code for " + MetaUtil.format("%H.%n(%p)", method)); |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
647 } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
648 } catch (Throwable e) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
649 throw Debug.handle(e); |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
5425
diff
changeset
|
650 } |
13197
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
651 } catch (Throwable e) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
652 throw Debug.handle(e); |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
13132
diff
changeset
|
653 } |
7154
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7123
diff
changeset
|
654 |
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:
7260
diff
changeset
|
655 if (!forceCompile) { |
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:
7260
diff
changeset
|
656 cache.put(method, installedCode); |
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:
7260
diff
changeset
|
657 } |
5650
8d420cfd2a6f
added unit tests for the Word type
Doug Simon <doug.simon@oracle.com>
parents:
5599
diff
changeset
|
658 return installedCode; |
5433
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
5425
diff
changeset
|
659 } |
d7b5cc23945e
refactored tests to share support for dump-aware compilation
Doug Simon <doug.simon@oracle.com>
parents:
5425
diff
changeset
|
660 |
13622
02d3cfc90603
made GraalCompilerTest slightly more extensible
Doug Simon <doug.simon@oracle.com>
parents:
13612
diff
changeset
|
661 protected CompilationResult compile(ResolvedJavaMethod method, final StructuredGraph graph) { |
02d3cfc90603
made GraalCompilerTest slightly more extensible
Doug Simon <doug.simon@oracle.com>
parents:
13612
diff
changeset
|
662 CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); |
14142
4eac66a9b87d
Remove reference to graph in LIRGenerator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14127
diff
changeset
|
663 return compileGraph(graph, null, cc, method, getProviders(), getBackend(), getCodeCache().getTarget(), null, getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, |
14143
8836f566b0bc
Remove withScope parameter on GraalCompiler.compileGraph.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14142
diff
changeset
|
664 getProfilingInfo(graph), getSpeculationLog(), getSuites(), new CompilationResult(), CompilationResultBuilderFactory.Default); |
13773
e7c2351ed7d5
Throw-away speculation logs should not be used. Just use null instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13690
diff
changeset
|
665 } |
e7c2351ed7d5
Throw-away speculation logs should not be used. Just use null instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13690
diff
changeset
|
666 |
e7c2351ed7d5
Throw-away speculation logs should not be used. Just use null instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13690
diff
changeset
|
667 protected SpeculationLog getSpeculationLog() { |
e7c2351ed7d5
Throw-away speculation logs should not be used. Just use null instead
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13690
diff
changeset
|
668 return null; |
13622
02d3cfc90603
made GraalCompilerTest slightly more extensible
Doug Simon <doug.simon@oracle.com>
parents:
13612
diff
changeset
|
669 } |
02d3cfc90603
made GraalCompilerTest slightly more extensible
Doug Simon <doug.simon@oracle.com>
parents:
13612
diff
changeset
|
670 |
10019
6e4b72bcc97f
Remove graph from HotSpotNMethod
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
9969
diff
changeset
|
671 protected InstalledCode addMethod(final ResolvedJavaMethod method, final CompilationResult compResult) { |
13669
034706a93f27
CodeCacheProvider.addMethod: add speculationLog argument
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13647
diff
changeset
|
672 return getCodeCache().addMethod(method, compResult, null); |
5360
6cc970203f30
moved creation of a RiCodeInfo to the runtime side of the CRI
Doug Simon <doug.simon@oracle.com>
parents:
5122
diff
changeset
|
673 } |
6cc970203f30
moved creation of a RiCodeInfo to the runtime side of the CRI
Doug Simon <doug.simon@oracle.com>
parents:
5122
diff
changeset
|
674 |
4340
5caca26cb1b9
small fix (missing changes)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4315
diff
changeset
|
675 /** |
5caca26cb1b9
small fix (missing changes)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4315
diff
changeset
|
676 * Parses a Java method to produce a graph. |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7321
diff
changeset
|
677 * |
4340
5caca26cb1b9
small fix (missing changes)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4315
diff
changeset
|
678 * @param methodName the name of the method in {@code this.getClass()} to be parsed |
5caca26cb1b9
small fix (missing changes)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4315
diff
changeset
|
679 */ |
5caca26cb1b9
small fix (missing changes)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4315
diff
changeset
|
680 protected StructuredGraph parseProfiled(String methodName) { |
4993
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4410
diff
changeset
|
681 return parseProfiled(getMethod(methodName)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
682 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
683 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
684 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
685 * Parses a Java method to produce a graph. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
686 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
687 protected StructuredGraph parse(Method m) { |
13612
8c019a9beb16
use graph builder suite for compiler tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
688 return parse0(m, getCustomGraphBuilderSuite(GraphBuilderConfiguration.getEagerDefault())); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
689 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
690 |
4340
5caca26cb1b9
small fix (missing changes)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4315
diff
changeset
|
691 /** |
5caca26cb1b9
small fix (missing changes)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4315
diff
changeset
|
692 * Parses a Java method to produce a graph. |
5caca26cb1b9
small fix (missing changes)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4315
diff
changeset
|
693 */ |
5caca26cb1b9
small fix (missing changes)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4315
diff
changeset
|
694 protected StructuredGraph parseProfiled(Method m) { |
13612
8c019a9beb16
use graph builder suite for compiler tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
695 return parse0(m, getDefaultGraphBuilderSuite()); |
9003
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8637
diff
changeset
|
696 } |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8637
diff
changeset
|
697 |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8637
diff
changeset
|
698 /** |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8637
diff
changeset
|
699 * Parses a Java method in debug mode to produce a graph with extra infopoints. |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8637
diff
changeset
|
700 */ |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8637
diff
changeset
|
701 protected StructuredGraph parseDebug(Method m) { |
13612
8c019a9beb16
use graph builder suite for compiler tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
702 return parse0(m, getCustomGraphBuilderSuite(GraphBuilderConfiguration.getEagerInfopointDefault())); |
9003
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8637
diff
changeset
|
703 } |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8637
diff
changeset
|
704 |
13612
8c019a9beb16
use graph builder suite for compiler tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
705 private StructuredGraph parse0(Method m, PhaseSuite<HighTierContext> graphBuilderSuite) { |
10764
d2f8addaf504
assertion in GraalCompiler (don't parse @Test methods)
Lukas Stadler <lukas.stadler@jku.at>
parents:
10577
diff
changeset
|
706 assert m.getAnnotation(Test.class) == null : "shouldn't parse method with @Test annotation: " + m; |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12054
diff
changeset
|
707 ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(m); |
5719
429accae15aa
moved some methods from CodeUtil to MetaUtil
Doug Simon <doug.simon@oracle.com>
parents:
5718
diff
changeset
|
708 StructuredGraph graph = new StructuredGraph(javaMethod); |
13612
8c019a9beb16
use graph builder suite for compiler tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
709 graphBuilderSuite.apply(graph, new HighTierContext(providers, null, null, graphBuilderSuite, OptimisticOptimizations.ALL)); |
4340
5caca26cb1b9
small fix (missing changes)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4315
diff
changeset
|
710 return graph; |
5caca26cb1b9
small fix (missing changes)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4315
diff
changeset
|
711 } |
5caca26cb1b9
small fix (missing changes)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4315
diff
changeset
|
712 |
13585 | 713 protected PhaseSuite<HighTierContext> getDefaultGraphBuilderSuite() { |
714 // defensive copying | |
715 return backend.getSuites().getDefaultGraphBuilderSuite().copy(); | |
9003
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8637
diff
changeset
|
716 } |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8637
diff
changeset
|
717 |
13612
8c019a9beb16
use graph builder suite for compiler tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
718 protected PhaseSuite<HighTierContext> getCustomGraphBuilderSuite(GraphBuilderConfiguration gbConf) { |
13585 | 719 PhaseSuite<HighTierContext> suite = getDefaultGraphBuilderSuite().copy(); |
720 ListIterator<BasePhase<? super HighTierContext>> iterator = suite.findPhase(GraphBuilderPhase.class); | |
721 iterator.remove(); | |
722 iterator.add(new GraphBuilderPhase(gbConf)); | |
723 return suite; | |
4204
4df4499e0289
Fixed unit tests.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4203
diff
changeset
|
724 } |
12054
bba234a1670e
grouped provider values/parameters into a Providers object (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12052
diff
changeset
|
725 |
bba234a1670e
grouped provider values/parameters into a Providers object (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12052
diff
changeset
|
726 protected Replacements getReplacements() { |
12362
f53dc8bbb88c
refactored isReexecutable(), getKilledLocations() and canDeoptimize() out of MetaAccessProvider into ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12054
diff
changeset
|
727 return getProviders().getReplacements(); |
12054
bba234a1670e
grouped provider values/parameters into a Providers object (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
12052
diff
changeset
|
728 } |
14014
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
729 |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
730 /** |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
731 * Inject a probability for a branch condition into the profiling information of this test case. |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
732 * |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
733 * @param p the probability that cond is true |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
734 * @param cond the condition of the branch |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
735 * @return cond |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
736 */ |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
737 protected static boolean branchProbability(double p, boolean cond) { |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
738 return cond; |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
739 } |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
740 |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
741 /** |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
742 * Inject an iteration count for a loop condition into the profiling information of this test |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
743 * case. |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
744 * |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
745 * @param i the iteration count of the loop |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
746 * @param cond the condition of the loop |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
747 * @return cond |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
748 */ |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
749 protected static boolean iterationCount(double i, boolean cond) { |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
750 return cond; |
ac599fff18dc
Substitution methods for injecting fake profiling data into unit tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
13773
diff
changeset
|
751 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
752 } |