Mercurial > hg > truffle
annotate graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java @ 19033:74b144f7c54a
Merge.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Wed, 28 Jan 2015 19:32:47 +0100 |
parents | beb7c10b7747 c943ba97b2a7 |
children | 173bdcc85ab8 76dd59e530b2 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
18157
diff
changeset
|
2 * Copyright (c) 2009, 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 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.compiler; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
11504
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
25 import static com.oracle.graal.compiler.GraalCompiler.Options.*; |
11491
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
26 import static com.oracle.graal.compiler.MethodFilter.*; |
15259
d90e5c22ba55
Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15192
diff
changeset
|
27 import static com.oracle.graal.compiler.common.GraalOptions.*; |
17065
37d6d174bc40
denote certain applications of DeadCodeEliminationPhase as optional and only run them if -G:-ReduceDCE
Doug Simon <doug.simon@oracle.com>
parents:
16952
diff
changeset
|
28 import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*; |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9855
diff
changeset
|
29 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 import java.util.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 |
6317
3ee3eb48e683
Clean up ComputeLinearScanOrder. Rename to ComputeBlockOrder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
6316
diff
changeset
|
32 import com.oracle.graal.alloc.*; |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
33 import com.oracle.graal.api.code.*; |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
18157
diff
changeset
|
34 import com.oracle.graal.api.code.CompilationResult.ConstantReference; |
14172
cd22c8dbda4f
Made graph caching compilation local
Doug Simon <doug.simon@oracle.com>
parents:
14148
diff
changeset
|
35 import com.oracle.graal.api.code.CompilationResult.DataPatch; |
9621
e97dc9bbfedc
introduced installedCodeOwner parameter of type ResolvedJavaMethod to GraalCompiler.compileGraph to properly distinguish the source method of a graph from the method under which the code compiled for the graph will be installed
Doug Simon <doug.simon@oracle.com>
parents:
9615
diff
changeset
|
36 import com.oracle.graal.api.meta.*; |
14172
cd22c8dbda4f
Made graph caching compilation local
Doug Simon <doug.simon@oracle.com>
parents:
14148
diff
changeset
|
37 import com.oracle.graal.api.meta.ProfilingInfo.TriState; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
38 import com.oracle.graal.compiler.alloc.*; |
15192
644dfe49c0f4
Move packages com.oracle.graal.cfg to com.oracle.graal.compiler.common.cfg.
Josef Eisl <josef.eisl@jku.at>
parents:
15170
diff
changeset
|
39 import com.oracle.graal.compiler.common.cfg.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
40 import com.oracle.graal.compiler.target.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
41 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:
12687
diff
changeset
|
42 import com.oracle.graal.debug.Debug.Scope; |
11487
21738e530332
added metrics for timing front-end, back-end and code installation (GRAAL-448)
Doug Simon <doug.simon@oracle.com>
parents:
10937
diff
changeset
|
43 import com.oracle.graal.debug.internal.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
44 import com.oracle.graal.lir.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
45 import com.oracle.graal.lir.asm.*; |
16952
2451521ed26f
Add ConstantLoadOptimization.
Josef Eisl <josef.eisl@jku.at>
parents:
15838
diff
changeset
|
46 import com.oracle.graal.lir.constopt.*; |
18443
1c92d437179b
FrameMapBuilder: move into package.
Josef Eisl <josef.eisl@jku.at>
parents:
18431
diff
changeset
|
47 import com.oracle.graal.lir.framemap.*; |
15292
a38d791982e1
Move LIRGenerationResult* to graal.lir.
Josef Eisl <josef.eisl@jku.at>
parents:
15259
diff
changeset
|
48 import com.oracle.graal.lir.gen.*; |
19031
beb7c10b7747
Move StackSlotAllocators into a package.
Josef Eisl <josef.eisl@jku.at>
parents:
19028
diff
changeset
|
49 import com.oracle.graal.lir.stackslotalloc.*; |
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.*; |
15337
c4be3c1b2d6d
Use NodeLIRBuilderTool instead of NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
15333
diff
changeset
|
52 import com.oracle.graal.nodes.spi.*; |
11504
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
53 import com.oracle.graal.options.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6524
diff
changeset
|
54 import com.oracle.graal.phases.*; |
6526
ee651c726397
split phases out of graal.phases project into graal.phases.common project
Doug Simon <doug.simon@oracle.com>
parents:
6525
diff
changeset
|
55 import com.oracle.graal.phases.common.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6524
diff
changeset
|
56 import com.oracle.graal.phases.schedule.*; |
9001
94583d9eead8
HighTier phase suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
8983
diff
changeset
|
57 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
|
58 import com.oracle.graal.phases.util.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 |
9615
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
60 /** |
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
61 * Static methods for orchestrating the compilation of a {@linkplain StructuredGraph graph}. |
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
62 */ |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 public class GraalCompiler { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 |
11487
21738e530332
added metrics for timing front-end, back-end and code installation (GRAAL-448)
Doug Simon <doug.simon@oracle.com>
parents:
10937
diff
changeset
|
65 private static final DebugTimer FrontEnd = Debug.timer("FrontEnd"); |
21738e530332
added metrics for timing front-end, back-end and code installation (GRAAL-448)
Doug Simon <doug.simon@oracle.com>
parents:
10937
diff
changeset
|
66 private static final DebugTimer BackEnd = Debug.timer("BackEnd"); |
21738e530332
added metrics for timing front-end, back-end and code installation (GRAAL-448)
Doug Simon <doug.simon@oracle.com>
parents:
10937
diff
changeset
|
67 |
11504
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
68 /** |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
69 * The set of positive filters specified by the {@code -G:IntrinsificationsEnabled} option. To |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
70 * enable a fast path in {@link #shouldIntrinsify(JavaMethod)}, this field is {@code null} when |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
71 * no enabling/disabling filters are specified. |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
72 */ |
11491
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
73 private static final MethodFilter[] positiveIntrinsificationFilter; |
11504
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
74 |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
75 /** |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
76 * The set of negative filters specified by the {@code -G:IntrinsificationsDisabled} option. |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
77 */ |
11491
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
78 private static final MethodFilter[] negativeIntrinsificationFilter; |
11504
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
79 |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
80 static class Options { |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
81 |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
82 // @formatter:off |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
83 /** |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
84 * @see MethodFilter |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
85 */ |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
86 @Option(help = "Pattern for method(s) to which intrinsification (if available) will be applied. " + |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
87 "By default, all available intrinsifications are applied except for methods matched " + |
18674
ecb9d0cedbab
First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18610
diff
changeset
|
88 "by IntrinsificationsDisabled. See MethodFilter class for pattern syntax.", type = OptionType.Debug) |
11504
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
89 public static final OptionValue<String> IntrinsificationsEnabled = new OptionValue<>(null); |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
90 /** |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
91 * @see MethodFilter |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
92 */ |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
93 @Option(help = "Pattern for method(s) to which intrinsification will not be applied. " + |
18674
ecb9d0cedbab
First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18610
diff
changeset
|
94 "See MethodFilter class for pattern syntax.", type = OptionType.Debug) |
11871
69a527047c40
fix, simplify and enable ObjectClone intrinsification
Lukas Stadler <lukas.stadler@jku.at>
parents:
11833
diff
changeset
|
95 public static final OptionValue<String> IntrinsificationsDisabled = new OptionValue<>(null); |
11504
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
96 // @formatter:on |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
97 |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
98 } |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
99 |
11491
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
100 static { |
11504
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
101 if (IntrinsificationsDisabled.getValue() != null) { |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
102 negativeIntrinsificationFilter = parse(IntrinsificationsDisabled.getValue()); |
11491
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
103 } else { |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
104 negativeIntrinsificationFilter = null; |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
105 } |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
106 |
11504
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
107 if (Options.IntrinsificationsEnabled.getValue() != null) { |
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
108 positiveIntrinsificationFilter = parse(IntrinsificationsEnabled.getValue()); |
11491
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
109 } else if (negativeIntrinsificationFilter != null) { |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
110 positiveIntrinsificationFilter = new MethodFilter[0]; |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
111 } else { |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
112 positiveIntrinsificationFilter = null; |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
113 } |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
114 } |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
115 |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
116 /** |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
117 * Determines if a given method should be intrinsified based on the values of |
11504
be283d587cfc
moved IntrinsificationsEnabled and IntrinsificationsDisabled to new GraalCompiler.Options class
Doug Simon <doug.simon@oracle.com>
parents:
11491
diff
changeset
|
118 * {@link Options#IntrinsificationsEnabled} and {@link Options#IntrinsificationsDisabled}. |
11491
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
119 */ |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
120 public static boolean shouldIntrinsify(JavaMethod method) { |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
121 if (positiveIntrinsificationFilter == null) { |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
122 return true; |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
123 } |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
124 if (positiveIntrinsificationFilter.length == 0 || matches(positiveIntrinsificationFilter, method)) { |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
125 return negativeIntrinsificationFilter == null || !matches(negativeIntrinsificationFilter, method); |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
126 } |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
127 return false; |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
128 } |
a03452edfc4d
made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents:
11487
diff
changeset
|
129 |
9615
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
130 /** |
18297
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
131 * Encapsulates all the inputs to a {@linkplain GraalCompiler#compile(Request) compilation}. |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
132 */ |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
133 public static class Request<T extends CompilationResult> { |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
134 public final StructuredGraph graph; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
135 public final Object stub; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
136 public final CallingConvention cc; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
137 public final ResolvedJavaMethod installedCodeOwner; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
138 public final Providers providers; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
139 public final Backend backend; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
140 public final TargetDescription target; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
141 public final Map<ResolvedJavaMethod, StructuredGraph> cache; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
142 public final PhaseSuite<HighTierContext> graphBuilderSuite; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
143 public final OptimisticOptimizations optimisticOpts; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
144 public final ProfilingInfo profilingInfo; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
145 public final SpeculationLog speculationLog; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
146 public final Suites suites; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
147 public final T compilationResult; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
148 public final CompilationResultBuilderFactory factory; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
149 |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
150 /** |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
151 * @param graph the graph to be compiled |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
152 * @param cc the calling convention for calls to the code compiled for {@code graph} |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
153 * @param installedCodeOwner the method the compiled code will be associated with once |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
154 * installed. This argument can be null. |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
155 * @param stub |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
156 * @param providers |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
157 * @param backend |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
158 * @param target |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
159 * @param cache |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
160 * @param graphBuilderSuite |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
161 * @param optimisticOpts |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
162 * @param profilingInfo |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
163 * @param speculationLog |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
164 * @param suites |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
165 * @param compilationResult |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
166 * @param factory |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
167 */ |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
168 public Request(StructuredGraph graph, Object stub, CallingConvention cc, ResolvedJavaMethod installedCodeOwner, Providers providers, Backend backend, TargetDescription target, |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
169 Map<ResolvedJavaMethod, StructuredGraph> cache, PhaseSuite<HighTierContext> graphBuilderSuite, OptimisticOptimizations optimisticOpts, ProfilingInfo profilingInfo, |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
170 SpeculationLog speculationLog, Suites suites, T compilationResult, CompilationResultBuilderFactory factory) { |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
171 this.graph = graph; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
172 this.stub = stub; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
173 this.cc = cc; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
174 this.installedCodeOwner = installedCodeOwner; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
175 this.providers = providers; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
176 this.backend = backend; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
177 this.target = target; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
178 this.cache = cache; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
179 this.graphBuilderSuite = graphBuilderSuite; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
180 this.optimisticOpts = optimisticOpts; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
181 this.profilingInfo = profilingInfo; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
182 this.speculationLog = speculationLog; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
183 this.suites = suites; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
184 this.compilationResult = compilationResult; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
185 this.factory = factory; |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
186 } |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
187 |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
188 /** |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
189 * Executes this compilation request. |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
190 * |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
191 * @return the result of the compilation |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
192 */ |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
193 public T execute() { |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
194 return GraalCompiler.compile(this); |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
195 } |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
196 } |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
197 |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
198 /** |
9615
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
199 * Requests compilation of a given graph. |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
200 * |
9615
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
201 * @param graph the graph to be compiled |
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
202 * @param cc the calling convention for calls to the code compiled for {@code graph} |
15161
2c940b1a48d8
Convert InstalledCode from an interface into an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15011
diff
changeset
|
203 * @param installedCodeOwner the method the compiled code will be associated with once |
2c940b1a48d8
Convert InstalledCode from an interface into an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15011
diff
changeset
|
204 * installed. This argument can be null. |
9615
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
205 * @return the result of the compilation |
1089d63ef168
removed 'method' parameter from GraalCompiler.compiledMethod() and renamed the latter to 'compileGraph'.
Doug Simon <doug.simon@oracle.com>
parents:
9614
diff
changeset
|
206 */ |
14142
4eac66a9b87d
Remove reference to graph in LIRGenerator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14128
diff
changeset
|
207 public static <T extends CompilationResult> T compileGraph(StructuredGraph graph, Object stub, CallingConvention cc, ResolvedJavaMethod installedCodeOwner, Providers providers, Backend backend, |
14172
cd22c8dbda4f
Made graph caching compilation local
Doug Simon <doug.simon@oracle.com>
parents:
14148
diff
changeset
|
208 TargetDescription target, Map<ResolvedJavaMethod, StructuredGraph> cache, PhaseSuite<HighTierContext> graphBuilderSuite, OptimisticOptimizations optimisticOpts, |
cd22c8dbda4f
Made graph caching compilation local
Doug Simon <doug.simon@oracle.com>
parents:
14148
diff
changeset
|
209 ProfilingInfo profilingInfo, SpeculationLog speculationLog, Suites suites, T compilationResult, CompilationResultBuilderFactory factory) { |
18297
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
210 return compile(new Request<>(graph, stub, cc, installedCodeOwner, providers, backend, target, cache, graphBuilderSuite, optimisticOpts, profilingInfo, speculationLog, suites, |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
211 compilationResult, factory)); |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
212 } |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
213 |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
214 /** |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
215 * Services a given compilation request. |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
216 * |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
217 * @return the result of the compilation |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
218 */ |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
219 public static <T extends CompilationResult> T compile(Request<T> r) { |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
220 assert !r.graph.isFrozen(); |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
221 try (Scope s0 = Debug.scope("GraalCompiler", r.graph, r.providers.getCodeCache())) { |
13228
4568980f7257
removed GraalCompiler.compileGraphNoScope
Doug Simon <doug.simon@oracle.com>
parents:
13227
diff
changeset
|
222 Assumptions assumptions = new Assumptions(OptAssumptions.getValue()); |
18297
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
223 SchedulePhase schedule = emitFrontEnd(r.providers, r.target, r.graph, assumptions, r.cache, r.graphBuilderSuite, r.optimisticOpts, r.profilingInfo, r.speculationLog, r.suites); |
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
224 emitBackEnd(r.graph, r.stub, r.cc, r.installedCodeOwner, r.backend, r.target, r.compilationResult, r.factory, assumptions, schedule, 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:
12687
diff
changeset
|
225 } 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:
12687
diff
changeset
|
226 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:
12687
diff
changeset
|
227 } |
18297
d1f5e41c3afe
added GraalCompiler.Request to encapsulate all inputs to a compilation
Doug Simon <doug.simon@oracle.com>
parents:
18187
diff
changeset
|
228 return r.compilationResult; |
12544
c69d0a705553
improved debug scope context when compiling Truffle IR graphs by making a Truffle compilable masquerade as a JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
12488
diff
changeset
|
229 } |
6316
2e25b9c14b84
Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5891
diff
changeset
|
230 |
13239 | 231 public static ProfilingInfo getProfilingInfo(StructuredGraph graph) { |
13217
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13197
diff
changeset
|
232 if (graph.method() != null) { |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13197
diff
changeset
|
233 return graph.method().getProfilingInfo(); |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13197
diff
changeset
|
234 } else { |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13197
diff
changeset
|
235 return DefaultProfilingInfo.get(TriState.UNKNOWN); |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13197
diff
changeset
|
236 } |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13197
diff
changeset
|
237 } |
210f58e992a1
Use separate method profile for OSR compilations.
Roland Schatz <roland.schatz@oracle.com>
parents:
13197
diff
changeset
|
238 |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
239 /** |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
240 * Builds the graph, optimizes it. |
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
241 */ |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
242 public static SchedulePhase emitFrontEnd(Providers providers, TargetDescription target, StructuredGraph graph, Assumptions assumptions, Map<ResolvedJavaMethod, StructuredGraph> cache, |
14172
cd22c8dbda4f
Made graph caching compilation local
Doug Simon <doug.simon@oracle.com>
parents:
14148
diff
changeset
|
243 PhaseSuite<HighTierContext> graphBuilderSuite, OptimisticOptimizations optimisticOpts, ProfilingInfo profilingInfo, SpeculationLog speculationLog, Suites suites) { |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
244 try (Scope s = Debug.scope("FrontEnd"); TimerCloseable a = FrontEnd.start()) { |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
245 if (speculationLog != null) { |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
246 speculationLog.collectFailedSpeculations(); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
247 } |
4353
043bec543161
More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4352
diff
changeset
|
248 |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
249 HighTierContext highTierContext = new HighTierContext(providers, assumptions, cache, graphBuilderSuite, optimisticOpts); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
250 if (graph.start().next() == null) { |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
251 graphBuilderSuite.apply(graph, highTierContext); |
17094
86888df288ec
fixed case of Optionality constants
Doug Simon <doug.simon@oracle.com>
parents:
17065
diff
changeset
|
252 new DeadCodeEliminationPhase(Optional).apply(graph); |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
253 } else { |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
254 Debug.dump(graph, "initial state"); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
255 } |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
256 |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
257 suites.getHighTier().apply(graph, highTierContext); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
258 graph.maybeCompress(); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
259 |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
260 MidTierContext midTierContext = new MidTierContext(providers, assumptions, target, optimisticOpts, profilingInfo, speculationLog); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
261 suites.getMidTier().apply(graph, midTierContext); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
262 graph.maybeCompress(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
263 |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
264 LowTierContext lowTierContext = new LowTierContext(providers, assumptions, target); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
265 suites.getLowTier().apply(graph, lowTierContext); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
266 graph.maybeCompress(); |
8600
c423a5fd8ac7
Cull frame states before lowering.
Roland Schatz <roland.schatz@oracle.com>
parents:
8560
diff
changeset
|
267 |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
268 SchedulePhase schedule = new SchedulePhase(); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
269 schedule.apply(graph); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
270 Debug.dump(schedule, "Final HIR schedule"); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
271 return schedule; |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
272 } catch (Throwable e) { |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
273 throw Debug.handle(e); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
274 } |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
275 } |
8534
4f33d1871dca
pipeline: canonicalize after ConditionalElimination and EliminatePartiallyRedundantGuards
Bernhard Urban <bernhard.urban@jku.at>
parents:
8506
diff
changeset
|
276 |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
277 public static <T extends CompilationResult> void emitBackEnd(StructuredGraph graph, Object stub, CallingConvention cc, ResolvedJavaMethod installedCodeOwner, Backend backend, |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
278 TargetDescription target, T compilationResult, CompilationResultBuilderFactory factory, Assumptions assumptions, SchedulePhase schedule, RegisterConfig registerConfig) { |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
279 try (TimerCloseable a = BackEnd.start()) { |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
280 LIRGenerationResult lirGen = null; |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
281 lirGen = emitLIR(backend, target, schedule, graph, stub, cc, registerConfig); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
282 try (Scope s = Debug.scope("CodeGen", lirGen)) { |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
283 emitCode(backend, assumptions, lirGen, compilationResult, installedCodeOwner, factory); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
284 } catch (Throwable e) { |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
285 throw Debug.handle(e); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
286 } |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
287 } catch (Throwable e) { |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
288 throw Debug.handle(e); |
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
289 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
290 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
291 |
18941
c943ba97b2a7
Remove class ScheduledNode from the node class hierarchy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18674
diff
changeset
|
292 private static void emitBlock(NodeLIRBuilderTool nodeLirGen, LIRGenerationResult lirGenRes, Block b, StructuredGraph graph, BlockMap<List<ValueNode>> blockMap) { |
14813
fafbff0eeebf
Removed NodeLIRGenerator again.
Josef Eisl <josef.eisl@jku.at>
parents:
14809
diff
changeset
|
293 if (lirGenRes.getLIR().getLIRforBlock(b) == 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:
12687
diff
changeset
|
294 for (Block pred : b.getPredecessors()) { |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
12687
diff
changeset
|
295 if (!b.isLoopHeader() || !pred.isLoopEnd()) { |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
296 emitBlock(nodeLirGen, lirGenRes, pred, graph, blockMap); |
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:
12687
diff
changeset
|
297 } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
12687
diff
changeset
|
298 } |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
299 nodeLirGen.doBlock(b, graph, blockMap); |
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:
12687
diff
changeset
|
300 } |
8569b9e047cd
change debug scopes implementation to prevent extra frames related to mechanism being added to call stack
Doug Simon <doug.simon@oracle.com>
parents:
12687
diff
changeset
|
301 } |
6316
2e25b9c14b84
Temporarily remove experimental register allocators.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5891
diff
changeset
|
302 |
15011
c8e575742f36
allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14921
diff
changeset
|
303 public static LIRGenerationResult emitLIR(Backend backend, TargetDescription target, SchedulePhase schedule, StructuredGraph graph, Object stub, CallingConvention cc, RegisterConfig registerConfig) { |
15537
8117e9cadb48
Use List instead of an array in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
15470
diff
changeset
|
304 List<Block> blocks = schedule.getCFG().getBlocks(); |
14128
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
305 Block startBlock = schedule.getCFG().getStartBlock(); |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
306 assert startBlock != null; |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
307 assert startBlock.getPredecessorCount() == 0; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
308 |
14128
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
309 LIR lir = null; |
14786
a6595f1b55b0
Make LIR use AbstractBlock. (errors)
Josef Eisl <josef.eisl@jku.at>
parents:
14148
diff
changeset
|
310 List<Block> codeEmittingOrder = null; |
a6595f1b55b0
Make LIR use AbstractBlock. (errors)
Josef Eisl <josef.eisl@jku.at>
parents:
14148
diff
changeset
|
311 List<Block> linearScanOrder = null; |
14128
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
312 try (Scope ds = Debug.scope("MidEnd")) { |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
313 try (Scope s = Debug.scope("ComputeLinearScanOrder")) { |
15537
8117e9cadb48
Use List instead of an array in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
15470
diff
changeset
|
314 codeEmittingOrder = ComputeBlockOrder.computeCodeEmittingOrder(blocks.size(), startBlock); |
8117e9cadb48
Use List instead of an array in AbstractControlFlowGraph.
Josef Eisl <josef.eisl@jku.at>
parents:
15470
diff
changeset
|
315 linearScanOrder = ComputeBlockOrder.computeLinearScanOrder(blocks.size(), startBlock); |
7370
39a4192ae632
Experiment with new block order for LSRA.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7348
diff
changeset
|
316 |
14144
8bdebcc53d15
Remove nodesForBlock mapping in LIR data structure.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14143
diff
changeset
|
317 lir = new LIR(schedule.getCFG(), linearScanOrder, codeEmittingOrder); |
14128
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
318 Debug.dump(lir, "After linear scan order"); |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
319 } catch (Throwable e) { |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
320 throw Debug.handle(e); |
4265
4643ccd37dac
* removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents:
4263
diff
changeset
|
321 } |
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:
12687
diff
changeset
|
322 } 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:
12687
diff
changeset
|
323 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:
12687
diff
changeset
|
324 } |
14128
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
325 try (Scope ds = Debug.scope("BackEnd", lir)) { |
18154
448be95baef8
Add Backend.newFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
18153
diff
changeset
|
326 FrameMapBuilder frameMapBuilder = backend.newFrameMapBuilder(registerConfig); |
18151
04b54406c292
Use FrameMapBuilder in Backend.newLIRGenerationResult().
Josef Eisl <josef.eisl@jku.at>
parents:
18149
diff
changeset
|
327 LIRGenerationResult lirGenRes = backend.newLIRGenerationResult(lir, frameMapBuilder, graph.method(), stub); |
15333
06ecedffb109
Use LIRGeneratorTool in Backend.
Josef Eisl <josef.eisl@jku.at>
parents:
15292
diff
changeset
|
328 LIRGeneratorTool lirGen = backend.newLIRGenerator(cc, lirGenRes); |
15338
5e544920ad9f
Rename Backend.newNodeLIRGenerator to Backend.newNodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
15337
diff
changeset
|
329 NodeLIRBuilderTool nodeLirGen = backend.newNodeLIRBuilder(graph, lirGen); |
13842
a02441dcf05f
Do control flow optimizations independent of register allocation.
Roland Schatz <roland.schatz@oracle.com>
parents:
13744
diff
changeset
|
330 |
14128
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
331 try (Scope s = Debug.scope("LIRGen", lirGen)) { |
14813
fafbff0eeebf
Removed NodeLIRGenerator again.
Josef Eisl <josef.eisl@jku.at>
parents:
14809
diff
changeset
|
332 for (Block b : linearScanOrder) { |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
333 emitBlock(nodeLirGen, lirGenRes, b, graph, schedule.getBlockToNodesMap()); |
14128
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
334 } |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
335 lirGen.beforeRegisterAllocation(); |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
336 |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
337 Debug.dump(lir, "After LIR generation"); |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
338 } catch (Throwable e) { |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
339 throw Debug.handle(e); |
13937
814800074308
Allow disabling of redundant move elimination
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13842
diff
changeset
|
340 } |
14128
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
341 |
16952
2451521ed26f
Add ConstantLoadOptimization.
Josef Eisl <josef.eisl@jku.at>
parents:
15838
diff
changeset
|
342 if (ConstantLoadOptimization.Options.ConstantLoadOptimization.getValue()) { |
2451521ed26f
Add ConstantLoadOptimization.
Josef Eisl <josef.eisl@jku.at>
parents:
15838
diff
changeset
|
343 try (Scope s = Debug.scope("ConstantLoadOptimization", lir)) { |
2451521ed26f
Add ConstantLoadOptimization.
Josef Eisl <josef.eisl@jku.at>
parents:
15838
diff
changeset
|
344 ConstantLoadOptimization.optimize(lirGenRes.getLIR(), lirGen); |
2451521ed26f
Add ConstantLoadOptimization.
Josef Eisl <josef.eisl@jku.at>
parents:
15838
diff
changeset
|
345 Debug.dump(lir, "After constant load optimization"); |
2451521ed26f
Add ConstantLoadOptimization.
Josef Eisl <josef.eisl@jku.at>
parents:
15838
diff
changeset
|
346 } catch (Throwable e) { |
2451521ed26f
Add ConstantLoadOptimization.
Josef Eisl <josef.eisl@jku.at>
parents:
15838
diff
changeset
|
347 throw Debug.handle(e); |
2451521ed26f
Add ConstantLoadOptimization.
Josef Eisl <josef.eisl@jku.at>
parents:
15838
diff
changeset
|
348 } |
2451521ed26f
Add ConstantLoadOptimization.
Josef Eisl <josef.eisl@jku.at>
parents:
15838
diff
changeset
|
349 } |
2451521ed26f
Add ConstantLoadOptimization.
Josef Eisl <josef.eisl@jku.at>
parents:
15838
diff
changeset
|
350 |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
351 try (Scope s = Debug.scope("Allocator", nodeLirGen)) { |
14128
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
352 if (backend.shouldAllocateRegisters()) { |
18152
ff694c40bdee
LIRGenerationResult: add buildFrameMap() and getFrameMap().
Josef Eisl <josef.eisl@jku.at>
parents:
18151
diff
changeset
|
353 LinearScan.allocate(target, lirGenRes); |
14128
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
354 } |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
355 } catch (Throwable e) { |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
356 throw Debug.handle(e); |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
357 } |
13842
a02441dcf05f
Do control flow optimizations independent of register allocation.
Roland Schatz <roland.schatz@oracle.com>
parents:
13744
diff
changeset
|
358 |
19019
56e6b5756886
LinearScan: remove support for markFrameLocations.
Josef Eisl <josef.eisl@jku.at>
parents:
18674
diff
changeset
|
359 try (Scope s1 = Debug.scope("BuildFrameMap")) { |
56e6b5756886
LinearScan: remove support for markFrameLocations.
Josef Eisl <josef.eisl@jku.at>
parents:
18674
diff
changeset
|
360 // build frame map |
19028
f59fc4850df5
StackSlotAllocator: add linear scan stack slot allocator.
Josef Eisl <josef.eisl@jku.at>
parents:
19022
diff
changeset
|
361 final StackSlotAllocator allocator; |
f59fc4850df5
StackSlotAllocator: add linear scan stack slot allocator.
Josef Eisl <josef.eisl@jku.at>
parents:
19022
diff
changeset
|
362 if (LSStackSlotAllocator.Options.EnableLSStackSlotAllocation.getValue()) { |
f59fc4850df5
StackSlotAllocator: add linear scan stack slot allocator.
Josef Eisl <josef.eisl@jku.at>
parents:
19022
diff
changeset
|
363 allocator = new LSStackSlotAllocator(); |
f59fc4850df5
StackSlotAllocator: add linear scan stack slot allocator.
Josef Eisl <josef.eisl@jku.at>
parents:
19022
diff
changeset
|
364 } else { |
f59fc4850df5
StackSlotAllocator: add linear scan stack slot allocator.
Josef Eisl <josef.eisl@jku.at>
parents:
19022
diff
changeset
|
365 allocator = new SimpleStackSlotAllocator(); |
18610 | 366 } |
19028
f59fc4850df5
StackSlotAllocator: add linear scan stack slot allocator.
Josef Eisl <josef.eisl@jku.at>
parents:
19022
diff
changeset
|
367 lirGenRes.buildFrameMap(allocator); |
19019
56e6b5756886
LinearScan: remove support for markFrameLocations.
Josef Eisl <josef.eisl@jku.at>
parents:
18674
diff
changeset
|
368 Debug.dump(lir, "After FrameMap building"); |
56e6b5756886
LinearScan: remove support for markFrameLocations.
Josef Eisl <josef.eisl@jku.at>
parents:
18674
diff
changeset
|
369 } |
56e6b5756886
LinearScan: remove support for markFrameLocations.
Josef Eisl <josef.eisl@jku.at>
parents:
18674
diff
changeset
|
370 try (Scope s1 = Debug.scope("MarkLocations")) { |
56e6b5756886
LinearScan: remove support for markFrameLocations.
Josef Eisl <josef.eisl@jku.at>
parents:
18674
diff
changeset
|
371 if (backend.shouldAllocateRegisters()) { |
56e6b5756886
LinearScan: remove support for markFrameLocations.
Josef Eisl <josef.eisl@jku.at>
parents:
18674
diff
changeset
|
372 // currently we mark locations only if we do register allocation |
56e6b5756886
LinearScan: remove support for markFrameLocations.
Josef Eisl <josef.eisl@jku.at>
parents:
18674
diff
changeset
|
373 LocationMarker.markLocations(lir, lirGenRes.getFrameMap()); |
18610 | 374 } |
375 } | |
376 | |
14128
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
377 try (Scope s = Debug.scope("ControlFlowOptimizations")) { |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
378 EdgeMoveOptimizer.optimize(lir); |
14787
6ce74db1c9fb
Use List<T> instead of Iterable<T> in AbstractBlock to (temporary) allow editing.
Josef Eisl <josef.eisl@jku.at>
parents:
14786
diff
changeset
|
379 ControlFlowOptimizer.optimize(lir, codeEmittingOrder); |
14128
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
380 if (lirGen.canEliminateRedundantMoves()) { |
18151
04b54406c292
Use FrameMapBuilder in Backend.newLIRGenerationResult().
Josef Eisl <josef.eisl@jku.at>
parents:
18149
diff
changeset
|
381 RedundantMoveElimination.optimize(lir, frameMapBuilder); |
14128
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
382 } |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
383 NullCheckOptimizer.optimize(lir, target.implicitNullCheckLimit); |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
384 |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
385 Debug.dump(lir, "After control flow optimization"); |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
386 } catch (Throwable e) { |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
387 throw Debug.handle(e); |
d2030fa96c22
Compute LinearScanOrder in emitLIR.
Josef Eisl <josef.eisl@jku.at>
parents:
14070
diff
changeset
|
388 } |
14813
fafbff0eeebf
Removed NodeLIRGenerator again.
Josef Eisl <josef.eisl@jku.at>
parents:
14809
diff
changeset
|
389 return lirGenRes; |
13842
a02441dcf05f
Do control flow optimizations independent of register allocation.
Roland Schatz <roland.schatz@oracle.com>
parents:
13744
diff
changeset
|
390 } catch (Throwable e) { |
a02441dcf05f
Do control flow optimizations independent of register allocation.
Roland Schatz <roland.schatz@oracle.com>
parents:
13744
diff
changeset
|
391 throw Debug.handle(e); |
a02441dcf05f
Do control flow optimizations independent of register allocation.
Roland Schatz <roland.schatz@oracle.com>
parents:
13744
diff
changeset
|
392 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
393 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
394 |
14809
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14806
diff
changeset
|
395 public static void emitCode(Backend backend, Assumptions assumptions, LIRGenerationResult lirGenRes, CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner, |
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
|
396 CompilationResultBuilderFactory factory) { |
18152
ff694c40bdee
LIRGenerationResult: add buildFrameMap() and getFrameMap().
Josef Eisl <josef.eisl@jku.at>
parents:
18151
diff
changeset
|
397 FrameMap frameMap = lirGenRes.getFrameMap(); |
18148
aed00dc20923
Pass FrameMap to Backend.newCompilationResultBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
17126
diff
changeset
|
398 CompilationResultBuilder crb = backend.newCompilationResultBuilder(lirGenRes, frameMap, compilationResult, factory); |
14809
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14806
diff
changeset
|
399 backend.emitCode(crb, lirGenRes.getLIR(), installedCodeOwner); |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13226
diff
changeset
|
400 crb.finish(); |
7064
8d16b9b2c51e
first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7063
diff
changeset
|
401 if (!assumptions.isEmpty()) { |
13224
7086a2fe7370
renamed TargetMethodAssembler.finishTargetMethod to finalize and made its return type void
Doug Simon <doug.simon@oracle.com>
parents:
13197
diff
changeset
|
402 compilationResult.setAssumptions(assumptions); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
403 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
404 |
13226
0b4d38339708
moved CompilationResult metric updating out from TargetMethodAssembler.finish()
Doug Simon <doug.simon@oracle.com>
parents:
13225
diff
changeset
|
405 if (Debug.isMeterEnabled()) { |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
18157
diff
changeset
|
406 List<DataPatch> ldp = compilationResult.getDataPatches(); |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
407 Kind[] kindValues = Kind.values(); |
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
408 DebugMetric[] dms = new DebugMetric[kindValues.length]; |
13226
0b4d38339708
moved CompilationResult metric updating out from TargetMethodAssembler.finish()
Doug Simon <doug.simon@oracle.com>
parents:
13225
diff
changeset
|
409 for (int i = 0; i < dms.length; i++) { |
14616
aa7bcf1fa423
expanded Debug API to avoid any allocation for timer and metric creation if debugging is disabled
Doug Simon <doug.simon@oracle.com>
parents:
14595
diff
changeset
|
410 dms[i] = Debug.metric("DataPatches-%s", kindValues[i]); |
13226
0b4d38339708
moved CompilationResult metric updating out from TargetMethodAssembler.finish()
Doug Simon <doug.simon@oracle.com>
parents:
13225
diff
changeset
|
411 } |
0b4d38339708
moved CompilationResult metric updating out from TargetMethodAssembler.finish()
Doug Simon <doug.simon@oracle.com>
parents:
13225
diff
changeset
|
412 |
0b4d38339708
moved CompilationResult metric updating out from TargetMethodAssembler.finish()
Doug Simon <doug.simon@oracle.com>
parents:
13225
diff
changeset
|
413 for (DataPatch dp : ldp) { |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
18157
diff
changeset
|
414 Kind kind = Kind.Illegal; |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
18157
diff
changeset
|
415 if (dp.reference instanceof ConstantReference) { |
18186
ef357effbda7
Backout of changeset 9a804ec7f707 (converted Constant and Value to be interfaces).
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
416 VMConstant constant = ((ConstantReference) dp.reference).getConstant(); |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18186
diff
changeset
|
417 kind = ((JavaConstant) constant).getKind(); |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
18157
diff
changeset
|
418 } |
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
18157
diff
changeset
|
419 dms[kind.ordinal()].add(1); |
13226
0b4d38339708
moved CompilationResult metric updating out from TargetMethodAssembler.finish()
Doug Simon <doug.simon@oracle.com>
parents:
13225
diff
changeset
|
420 } |
0b4d38339708
moved CompilationResult metric updating out from TargetMethodAssembler.finish()
Doug Simon <doug.simon@oracle.com>
parents:
13225
diff
changeset
|
421 |
0b4d38339708
moved CompilationResult metric updating out from TargetMethodAssembler.finish()
Doug Simon <doug.simon@oracle.com>
parents:
13225
diff
changeset
|
422 Debug.metric("CompilationResults").increment(); |
0b4d38339708
moved CompilationResult metric updating out from TargetMethodAssembler.finish()
Doug Simon <doug.simon@oracle.com>
parents:
13225
diff
changeset
|
423 Debug.metric("CodeBytesEmitted").add(compilationResult.getTargetCodeSize()); |
0b4d38339708
moved CompilationResult metric updating out from TargetMethodAssembler.finish()
Doug Simon <doug.simon@oracle.com>
parents:
13225
diff
changeset
|
424 Debug.metric("InfopointsEmitted").add(compilationResult.getInfopoints().size()); |
0b4d38339708
moved CompilationResult metric updating out from TargetMethodAssembler.finish()
Doug Simon <doug.simon@oracle.com>
parents:
13225
diff
changeset
|
425 Debug.metric("DataPatches").add(ldp.size()); |
0b4d38339708
moved CompilationResult metric updating out from TargetMethodAssembler.finish()
Doug Simon <doug.simon@oracle.com>
parents:
13225
diff
changeset
|
426 Debug.metric("ExceptionHandlersEmitted").add(compilationResult.getExceptionHandlers().size()); |
0b4d38339708
moved CompilationResult metric updating out from TargetMethodAssembler.finish()
Doug Simon <doug.simon@oracle.com>
parents:
13225
diff
changeset
|
427 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
428 |
12472
85d03b72f269
added support disassembling during CodeGen
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
429 if (Debug.isLogEnabled()) { |
13224
7086a2fe7370
renamed TargetMethodAssembler.finishTargetMethod to finalize and made its return type void
Doug Simon <doug.simon@oracle.com>
parents:
13197
diff
changeset
|
430 Debug.log("%s", backend.getProviders().getCodeCache().disassemble(compilationResult, null)); |
12472
85d03b72f269
added support disassembling during CodeGen
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
431 } |
85d03b72f269
added support disassembling during CodeGen
Doug Simon <doug.simon@oracle.com>
parents:
12362
diff
changeset
|
432 |
13224
7086a2fe7370
renamed TargetMethodAssembler.finishTargetMethod to finalize and made its return type void
Doug Simon <doug.simon@oracle.com>
parents:
13197
diff
changeset
|
433 Debug.dump(compilationResult, "After code generation"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
434 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
435 } |