annotate graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java @ 13129:3a05ef752a40

Introduce option to disable deoptimization grouping
author Christian Wimmer <christian.wimmer@oracle.com>
date Fri, 22 Nov 2013 12:12:38 -0800
parents 9652640fae42
children 16d99e9d77ad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9121
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
1 /*
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
4 *
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
8 *
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
13 * accompanied this code).
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
14 *
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
18 *
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
21 * questions.
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
22 */
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.compiler.phases;
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
24
11586
9652640fae42 tightened option verifier to check all class initializers in the hierarchy of a class that declares at least one @Option
Doug Simon <doug.simon@oracle.com>
parents: 11584
diff changeset
25 import static com.oracle.graal.compiler.phases.HighTier.Options.*;
9864
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9329
diff changeset
26 import static com.oracle.graal.phases.GraalOptions.*;
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9329
diff changeset
27
10937
87d9b5518065 Move VerifyUsageWithEquals phases into HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10935
diff changeset
28 import com.oracle.graal.api.code.*;
87d9b5518065 Move VerifyUsageWithEquals phases into HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10935
diff changeset
29 import com.oracle.graal.api.meta.*;
9121
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
30 import com.oracle.graal.loop.phases.*;
10935
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
31 import com.oracle.graal.options.*;
9121
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
32 import com.oracle.graal.phases.*;
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
33 import com.oracle.graal.phases.common.*;
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
34 import com.oracle.graal.phases.tiers.*;
10937
87d9b5518065 Move VerifyUsageWithEquals phases into HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10935
diff changeset
35 import com.oracle.graal.phases.verify.*;
9121
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
36 import com.oracle.graal.virtual.phases.ea.*;
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
37
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
38 public class HighTier extends PhaseSuite<HighTierContext> {
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
39
13129
3a05ef752a40 Introduce option to disable deoptimization grouping
Christian Wimmer <christian.wimmer@oracle.com>
parents: 11586
diff changeset
40 public static class Options {
11586
9652640fae42 tightened option verifier to check all class initializers in the hierarchy of a class that declares at least one @Option
Doug Simon <doug.simon@oracle.com>
parents: 11584
diff changeset
41
9652640fae42 tightened option verifier to check all class initializers in the hierarchy of a class that declares at least one @Option
Doug Simon <doug.simon@oracle.com>
parents: 11584
diff changeset
42 // @formatter:off
9652640fae42 tightened option verifier to check all class initializers in the hierarchy of a class that declares at least one @Option
Doug Simon <doug.simon@oracle.com>
parents: 11584
diff changeset
43 @Option(help = "")
9652640fae42 tightened option verifier to check all class initializers in the hierarchy of a class that declares at least one @Option
Doug Simon <doug.simon@oracle.com>
parents: 11584
diff changeset
44 public static final OptionValue<Boolean> VerifyUsageWithEquals = new OptionValue<>(true);
9652640fae42 tightened option verifier to check all class initializers in the hierarchy of a class that declares at least one @Option
Doug Simon <doug.simon@oracle.com>
parents: 11584
diff changeset
45 @Option(help = "Enable inlining")
9652640fae42 tightened option verifier to check all class initializers in the hierarchy of a class that declares at least one @Option
Doug Simon <doug.simon@oracle.com>
parents: 11584
diff changeset
46 public static final OptionValue<Boolean> Inline = new OptionValue<>(true);
9652640fae42 tightened option verifier to check all class initializers in the hierarchy of a class that declares at least one @Option
Doug Simon <doug.simon@oracle.com>
parents: 11584
diff changeset
47 // @formatter:on
9652640fae42 tightened option verifier to check all class initializers in the hierarchy of a class that declares at least one @Option
Doug Simon <doug.simon@oracle.com>
parents: 11584
diff changeset
48 }
10935
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
49
9121
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
50 public HighTier() {
10009
b5c87b5c6e9c add option to enable ahead of time compilation for hotspot (GRAAL-290)
Bernhard Urban <bernhard.urban@jku.at>
parents: 9944
diff changeset
51 CanonicalizerPhase canonicalizer = new CanonicalizerPhase(!AOTCompilation.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
52
10937
87d9b5518065 Move VerifyUsageWithEquals phases into HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10935
diff changeset
53 if (VerifyUsageWithEquals.getValue()) {
87d9b5518065 Move VerifyUsageWithEquals phases into HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10935
diff changeset
54 appendPhase(new VerifyUsageWithEquals(Value.class));
87d9b5518065 Move VerifyUsageWithEquals phases into HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10935
diff changeset
55 appendPhase(new VerifyUsageWithEquals(Register.class));
87d9b5518065 Move VerifyUsageWithEquals phases into HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10935
diff changeset
56 }
87d9b5518065 Move VerifyUsageWithEquals phases into HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10935
diff changeset
57
10935
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
58 if (OptCanonicalizer.getValue()) {
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
59 appendPhase(canonicalizer);
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
60 }
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
61
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
62 if (Inline.getValue()) {
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
63 if (IterativeInlining.getValue()) {
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
64 appendPhase(new IterativeInliningPhase(canonicalizer));
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
65 } else {
11567
c69df2e602f4 Use CanonicalizerPhase.applyIncremental in InliningPhase.
Roland Schatz <roland.schatz@oracle.com>
parents: 11566
diff changeset
66 appendPhase(new InliningPhase(canonicalizer));
10935
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
67 appendPhase(new DeadCodeEliminationPhase());
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
68
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
69 if (ConditionalElimination.getValue() && OptCanonicalizer.getValue()) {
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
70 appendPhase(canonicalizer);
11574
50577f991923 Pass canonicalizer into IterativeConditionalEliminationPhase.
Roland Schatz <roland.schatz@oracle.com>
parents: 11573
diff changeset
71 appendPhase(new IterativeConditionalEliminationPhase(canonicalizer));
10935
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
72 }
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
73 }
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
74 }
2da7f2efe6e2 Move inlining phases to HighTier.
Roland Schatz <roland.schatz@oracle.com>
parents: 10929
diff changeset
75
10929
b2418691c7cb Move cleaning of TypeProfileProxyNode into a compiler phase.
Roland Schatz <roland.schatz@oracle.com>
parents: 10806
diff changeset
76 appendPhase(new CleanTypeProfileProxyPhase());
b2418691c7cb Move cleaning of TypeProfileProxyNode into a compiler phase.
Roland Schatz <roland.schatz@oracle.com>
parents: 10806
diff changeset
77
9864
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9329
diff changeset
78 if (FullUnroll.getValue()) {
11572
a63b63822183 Pass canonicalizer into loop transformations.
Roland Schatz <roland.schatz@oracle.com>
parents: 11571
diff changeset
79 appendPhase(new LoopFullUnrollPhase(canonicalizer));
9121
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
80 }
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
81
9864
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9329
diff changeset
82 if (OptTailDuplication.getValue()) {
11573
8a3d99fc36cf Pass canonicalizer into tail duplication.
Roland Schatz <roland.schatz@oracle.com>
parents: 11572
diff changeset
83 appendPhase(new TailDuplicationPhase(canonicalizer));
9121
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
84 }
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
85
9864
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9329
diff changeset
86 if (PartialEscapeAnalysis.getValue()) {
11571
5bbc028f4507 Pass canonicalizer into EffectsPhase.
Roland Schatz <roland.schatz@oracle.com>
parents: 11567
diff changeset
87 appendPhase(new PartialEscapePhase(true, canonicalizer));
9121
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
88 }
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
89
9864
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9329
diff changeset
90 if (OptConvertDeoptsToGuards.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
91 appendPhase(new ConvertDeoptimizeToGuardPhase());
9121
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
92 }
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
93
9864
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9329
diff changeset
94 if (OptLoopTransform.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
95 appendPhase(new LoopTransformHighPhase());
839791e70ff1 Method for adding a new phase at the beginning of a suite.
Roland Schatz <roland.schatz@oracle.com>
parents: 10009
diff changeset
96 appendPhase(new LoopTransformLowPhase());
9121
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
97 }
10029
839791e70ff1 Method for adding a new phase at the beginning of a suite.
Roland Schatz <roland.schatz@oracle.com>
parents: 10009
diff changeset
98 appendPhase(new RemoveValueProxyPhase());
9121
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
99
9864
063a712fe8d8 converted remaining options in GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9329
diff changeset
100 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
101 appendPhase(canonicalizer);
9121
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
102 }
9271
7409a84b6001 Move more phases into tiers.
Roland Schatz <roland.schatz@oracle.com>
parents: 9121
diff changeset
103
11584
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11574 11579
diff changeset
104 appendPhase(new LoweringPhase(canonicalizer));
9121
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
105 }
3476bda8dd78 Make phase suites extensible.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff changeset
106 }