Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java @ 17153:646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 18 Sep 2014 23:19:03 +0200 |
parents | 583bf03b3e1a |
children | 12c6c5a5bd88 |
rev | line source |
---|---|
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.meta; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
15259
d90e5c22ba55
Move GraalOptions to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
14991
diff
changeset
|
25 import static com.oracle.graal.compiler.common.GraalOptions.*; |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
13640
diff
changeset
|
26 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 import com.oracle.graal.hotspot.*; |
17153
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
28 import com.oracle.graal.hotspot.bridge.*; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 import com.oracle.graal.hotspot.phases.*; |
13585 | 30 import com.oracle.graal.java.*; |
17113
583bf03b3e1a
apply CompilerToVM.shouldDebugNonSafepoints() to HotSpot Truffle compilations as well
Doug Simon <doug.simon@oracle.com>
parents:
16871
diff
changeset
|
31 import com.oracle.graal.java.GraphBuilderConfiguration.*; |
16871
e728b9d4905c
Recompute phase suites when options are changed.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
32 import com.oracle.graal.options.*; |
13585 | 33 import com.oracle.graal.phases.*; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 import com.oracle.graal.phases.tiers.*; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 /** |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 * HotSpot implementation of {@link SuitesProvider}. |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 */ |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 public class HotSpotSuitesProvider implements SuitesProvider { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 |
16871
e728b9d4905c
Recompute phase suites when options are changed.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
41 protected final DerivedOptionValue<Suites> defaultSuites; |
13585 | 42 protected final PhaseSuite<HighTierContext> defaultGraphBuilderSuite; |
13640
bfe7a8c8c3c6
Add UseConcMarcSweepGC flag to HotSpotVMConfig.
Roland Schatz <roland.schatz@oracle.com>
parents:
13591
diff
changeset
|
43 protected final HotSpotGraalRuntime runtime; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 |
12431
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
45 public HotSpotSuitesProvider(HotSpotGraalRuntime runtime) { |
7080a96be216
rename: graalRuntime -> runtime, getGraalRuntime -> getRuntime
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
46 this.runtime = runtime; |
13585 | 47 this.defaultGraphBuilderSuite = createGraphBuilderSuite(); |
16871
e728b9d4905c
Recompute phase suites when options are changed.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
48 this.defaultSuites = new DerivedOptionValue<>(this::createSuites); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 public Suites getDefaultSuites() { |
16871
e728b9d4905c
Recompute phase suites when options are changed.
Roland Schatz <roland.schatz@oracle.com>
parents:
15909
diff
changeset
|
52 return defaultSuites.getValue(); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 |
13585 | 55 public PhaseSuite<HighTierContext> getDefaultGraphBuilderSuite() { |
56 return defaultGraphBuilderSuite; | |
57 } | |
58 | |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 public Suites createSuites() { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 Suites ret = Suites.createDefaultSuites(); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 |
13378
16d99e9d77ad
Options: rename flag (AOTCompilation -> ImmutableCode)
Bernhard Urban <bernhard.urban@jku.at>
parents:
12431
diff
changeset
|
62 if (ImmutableCode.getValue()) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 // lowering introduces class constants, therefore it must be after lowering |
15909
e43591136d9f
Support for compressed constants.
Roland Schatz <roland.schatz@oracle.com>
parents:
15259
diff
changeset
|
64 ret.getHighTier().appendPhase(new LoadJavaMirrorWithKlassPhase(runtime.getConfig().classMirrorOffset, runtime.getConfig().getOopEncoding())); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 if (VerifyPhases.getValue()) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 ret.getHighTier().appendPhase(new AheadOfTimeVerificationPhase()); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 ret.getMidTier().appendPhase(new WriteBarrierAdditionPhase()); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 if (VerifyPhases.getValue()) { |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 ret.getMidTier().appendPhase(new WriteBarrierVerificationPhase()); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 } |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 return ret; |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 } |
13585 | 77 |
13591
2b5c77ff960e
small interface fixes to SuitesProvider and MonitorIdNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
13585
diff
changeset
|
78 protected PhaseSuite<HighTierContext> createGraphBuilderSuite() { |
13585 | 79 PhaseSuite<HighTierContext> suite = new PhaseSuite<>(); |
17113
583bf03b3e1a
apply CompilerToVM.shouldDebugNonSafepoints() to HotSpot Truffle compilations as well
Doug Simon <doug.simon@oracle.com>
parents:
16871
diff
changeset
|
80 GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(); |
583bf03b3e1a
apply CompilerToVM.shouldDebugNonSafepoints() to HotSpot Truffle compilations as well
Doug Simon <doug.simon@oracle.com>
parents:
16871
diff
changeset
|
81 suite.appendPhase(new GraphBuilderPhase(config)); |
13585 | 82 return suite; |
83 } | |
17153
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
84 |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
85 /** |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
86 * Modifies the {@link GraphBuilderConfiguration} to build extra |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
87 * {@linkplain DebugInfoMode#Simple debug info} if the VM |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
88 * {@linkplain CompilerToVM#shouldDebugNonSafepoints() requests} it. |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
89 * |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
90 * @param gbs the current graph builder suite |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
91 * @return a possibly modified graph builder suite |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
92 */ |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
93 public static PhaseSuite<HighTierContext> withSimpleDebugInfoIfRequested(PhaseSuite<HighTierContext> gbs) { |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
94 if (HotSpotGraalRuntime.runtime().getCompilerToVM().shouldDebugNonSafepoints()) { |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
95 PhaseSuite<HighTierContext> newGbs = gbs.copy(); |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
96 GraphBuilderPhase graphBuilderPhase = (GraphBuilderPhase) newGbs.findPhase(GraphBuilderPhase.class).previous(); |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
97 GraphBuilderConfiguration graphBuilderConfig = graphBuilderPhase.getGraphBuilderConfig(); |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
98 GraphBuilderPhase newGraphBuilderPhase = new GraphBuilderPhase(graphBuilderConfig.withDebugInfoMode(DebugInfoMode.Simple)); |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
99 newGbs.findPhase(GraphBuilderPhase.class).set(newGraphBuilderPhase); |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
100 return newGbs; |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
101 } |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
102 return gbs; |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
103 } |
646ddd52d79a
only generate extra debug info if on HotSpot *and* compiling for HotSpot execution
Doug Simon <doug.simon@oracle.com>
parents:
17113
diff
changeset
|
104 |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
105 } |