Mercurial > hg > truffle
annotate graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/MidTier.java @ 18699:08b17b738500
Add hooks for verifying heap from generated code
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Tue, 16 Dec 2014 13:36:16 -0800 |
parents | cd755faecaec |
children | deb2467530e4 |
rev | line source |
---|---|
9137 | 1 /* |
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package com.oracle.graal.compiler.phases; | |
24 | |
15259
d90e5c22ba55
Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
13680
diff
changeset
|
25 import static com.oracle.graal.compiler.common.GraalOptions.*; |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9679
diff
changeset
|
26 |
9511
715f82d1f695
Enable the loop safepoint elimination.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9271
diff
changeset
|
27 import com.oracle.graal.loop.phases.*; |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13378
diff
changeset
|
28 import com.oracle.graal.nodes.spi.*; |
9137 | 29 import com.oracle.graal.phases.*; |
30 import com.oracle.graal.phases.common.*; | |
31 import com.oracle.graal.phases.tiers.*; | |
10814
8b0c8fbbfa1c
make early read elimination work on read/write nodes (in addition to load/store)
Lukas Stadler <lukas.stadler@jku.at>
parents:
10807
diff
changeset
|
32 import com.oracle.graal.virtual.phases.ea.*; |
9137 | 33 |
34 public class MidTier extends PhaseSuite<MidTierContext> { | |
35 | |
36 public MidTier() { | |
13378
16d99e9d77ad
Options: rename flag (AOTCompilation -> ImmutableCode)
Bernhard Urban <bernhard.urban@jku.at>
parents:
13129
diff
changeset
|
37 CanonicalizerPhase canonicalizer = new CanonicalizerPhase(!ImmutableCode.getValue()); |
9916
491cd7d69539
CanonicalizerPhase: remove it from context, add it to tiers instead and configure/pass it there (GRAAL-309)
Bernhard Urban <bernhard.urban@jku.at>
parents:
9907
diff
changeset
|
38 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9679
diff
changeset
|
39 if (OptPushThroughPi.getValue()) { |
10029
839791e70ff1
Method for adding a new phase at the beginning of a suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
10009
diff
changeset
|
40 appendPhase(new PushThroughPiPhase()); |
10805
842166781ddb
always perform canonicalization at the beginning of MidTier
Lukas Stadler <lukas.stadler@jku.at>
parents:
10671
diff
changeset
|
41 } |
842166781ddb
always perform canonicalization at the beginning of MidTier
Lukas Stadler <lukas.stadler@jku.at>
parents:
10671
diff
changeset
|
42 if (OptCanonicalizer.getValue()) { |
842166781ddb
always perform canonicalization at the beginning of MidTier
Lukas Stadler <lukas.stadler@jku.at>
parents:
10671
diff
changeset
|
43 appendPhase(canonicalizer); |
9137 | 44 } |
45 | |
10807
d3a677910eea
new ValueAnchorCleanupPhase to make lock elimination work again, tests for lock elimination
Lukas Stadler <lukas.stadler@jku.at>
parents:
10806
diff
changeset
|
46 appendPhase(new ValueAnchorCleanupPhase()); |
10806
f272fe8a2f9a
move LockElimination to MidTier
Lukas Stadler <lukas.stadler@jku.at>
parents:
10805
diff
changeset
|
47 appendPhase(new LockEliminationPhase()); |
f272fe8a2f9a
move LockElimination to MidTier
Lukas Stadler <lukas.stadler@jku.at>
parents:
10805
diff
changeset
|
48 |
10814
8b0c8fbbfa1c
make early read elimination work on read/write nodes (in addition to load/store)
Lukas Stadler <lukas.stadler@jku.at>
parents:
10807
diff
changeset
|
49 if (OptReadElimination.getValue()) { |
11571
5bbc028f4507
Pass canonicalizer into EffectsPhase.
Roland Schatz <roland.schatz@oracle.com>
parents:
11566
diff
changeset
|
50 appendPhase(new EarlyReadEliminationPhase(canonicalizer)); |
10814
8b0c8fbbfa1c
make early read elimination work on read/write nodes (in addition to load/store)
Lukas Stadler <lukas.stadler@jku.at>
parents:
10807
diff
changeset
|
51 } |
8b0c8fbbfa1c
make early read elimination work on read/write nodes (in addition to load/store)
Lukas Stadler <lukas.stadler@jku.at>
parents:
10807
diff
changeset
|
52 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9679
diff
changeset
|
53 if (OptFloatingReads.getValue()) { |
15290
0225dc47596e
simplify usage of IncrementalCanonicalizerPhase, use incremental canonicalizer for GuardLowering
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15259
diff
changeset
|
54 appendPhase(new IncrementalCanonicalizerPhase<>(canonicalizer, new FloatingReadPhase())); |
9137 | 55 } |
10029
839791e70ff1
Method for adding a new phase at the beginning of a suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
10009
diff
changeset
|
56 appendPhase(new RemoveValueProxyPhase()); |
9137 | 57 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9679
diff
changeset
|
58 if (OptCanonicalizer.getValue()) { |
10029
839791e70ff1
Method for adding a new phase at the beginning of a suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
10009
diff
changeset
|
59 appendPhase(canonicalizer); |
9137 | 60 } |
61 | |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9679
diff
changeset
|
62 if (OptEliminatePartiallyRedundantGuards.getValue()) { |
13680
54ee3d025596
Rename OptimizeGuardAnchors to OptimizeGuardAnchorsPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13505
diff
changeset
|
63 appendPhase(new OptimizeGuardAnchorsPhase()); |
9137 | 64 } |
65 | |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9679
diff
changeset
|
66 if (ConditionalElimination.getValue() && OptCanonicalizer.getValue()) { |
11574
50577f991923
Pass canonicalizer into IterativeConditionalEliminationPhase.
Roland Schatz <roland.schatz@oracle.com>
parents:
11571
diff
changeset
|
67 appendPhase(new IterativeConditionalEliminationPhase(canonicalizer)); |
9137 | 68 } |
69 | |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9679
diff
changeset
|
70 if (OptEliminatePartiallyRedundantGuards.getValue()) { |
13680
54ee3d025596
Rename OptimizeGuardAnchors to OptimizeGuardAnchorsPhase
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13505
diff
changeset
|
71 appendPhase(new OptimizeGuardAnchorsPhase()); |
9137 | 72 } |
73 | |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9679
diff
changeset
|
74 if (OptCanonicalizer.getValue()) { |
10029
839791e70ff1
Method for adding a new phase at the beginning of a suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
10009
diff
changeset
|
75 appendPhase(canonicalizer); |
9137 | 76 } |
9271
7409a84b6001
Move more phases into tiers.
Roland Schatz <roland.schatz@oracle.com>
parents:
9143
diff
changeset
|
77 |
15852
8b8208aa2f44
put LoopSafepointEliminationPhase into an IncrementalCanonicalizerPhase
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15290
diff
changeset
|
78 appendPhase(new IncrementalCanonicalizerPhase<>(canonicalizer, new LoopSafepointEliminationPhase())); |
9511
715f82d1f695
Enable the loop safepoint elimination.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
9271
diff
changeset
|
79 |
11760
ce0b00597980
made safepoint-on-return use specialized HotSpot runtime support for such safepoints (which have no debug info attached)
Doug Simon <doug.simon@oracle.com>
parents:
11725
diff
changeset
|
80 appendPhase(new LoopSafepointInsertionPhase()); |
9271
7409a84b6001
Move more phases into tiers.
Roland Schatz <roland.schatz@oracle.com>
parents:
9143
diff
changeset
|
81 |
15290
0225dc47596e
simplify usage of IncrementalCanonicalizerPhase, use incremental canonicalizer for GuardLowering
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15259
diff
changeset
|
82 appendPhase(new IncrementalCanonicalizerPhase<>(canonicalizer, new GuardLoweringPhase())); |
9679
661dfb29b59b
Do a full canonicalization at the end of MidTier.
Roland Schatz <roland.schatz@oracle.com>
parents:
9511
diff
changeset
|
83 |
18699
08b17b738500
Add hooks for verifying heap from generated code
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15864
diff
changeset
|
84 if (VerifyHeapAtReturn.getValue()) { |
08b17b738500
Add hooks for verifying heap from generated code
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15864
diff
changeset
|
85 appendPhase(new VerifyHeapAtReturnPhase()); |
08b17b738500
Add hooks for verifying heap from generated code
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15864
diff
changeset
|
86 } |
08b17b738500
Add hooks for verifying heap from generated code
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15864
diff
changeset
|
87 |
13505
75a67ebd50e8
Introduce a LoweringStage so that lowerings can be conditional on one of the three times that lowering is performed by default
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13378
diff
changeset
|
88 appendPhase(new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.MID_TIER)); |
10671
69089865435a
New lowering phase after framestate assignment.
Roland Schatz <roland.schatz@oracle.com>
parents:
10029
diff
changeset
|
89 |
69089865435a
New lowering phase after framestate assignment.
Roland Schatz <roland.schatz@oracle.com>
parents:
10029
diff
changeset
|
90 appendPhase(new FrameStateAssignmentPhase()); |
69089865435a
New lowering phase after framestate assignment.
Roland Schatz <roland.schatz@oracle.com>
parents:
10029
diff
changeset
|
91 |
13129
3a05ef752a40
Introduce option to disable deoptimization grouping
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12481
diff
changeset
|
92 if (OptDeoptimizationGrouping.getValue()) { |
3a05ef752a40
Introduce option to disable deoptimization grouping
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12481
diff
changeset
|
93 appendPhase(new DeoptimizationGroupingPhase()); |
3a05ef752a40
Introduce option to disable deoptimization grouping
Christian Wimmer <christian.wimmer@oracle.com>
parents:
12481
diff
changeset
|
94 } |
11725
45570e4fe8a9
Group Deoptimization which have the same FrameState
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11584
diff
changeset
|
95 |
9864
063a712fe8d8
converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents:
9679
diff
changeset
|
96 if (OptCanonicalizer.getValue()) { |
10029
839791e70ff1
Method for adding a new phase at the beginning of a suite.
Roland Schatz <roland.schatz@oracle.com>
parents:
10009
diff
changeset
|
97 appendPhase(canonicalizer); |
9679
661dfb29b59b
Do a full canonicalization at the end of MidTier.
Roland Schatz <roland.schatz@oracle.com>
parents:
9511
diff
changeset
|
98 } |
9137 | 99 } |
100 } |