annotate graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoopSafepointInsertionPhase.java @ 19429:459337ee0593

Experiment with a different way of swapping instanceof profiles in IfNode.prepareForSwap
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 17 Feb 2015 18:05:39 +0100
parents 61d3cb8e1280
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5272
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
7937
29c2103630ef New strategy for inserting safepoints - always insert in loops but avoid in leaf methods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7530
diff changeset
2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
5272
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
6526
ee651c726397 split phases out of graal.phases project into graal.phases.common project
Doug Simon <doug.simon@oracle.com>
parents: 6525
diff changeset
23 package com.oracle.graal.phases.common;
5272
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
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: 11760
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: 8204
diff changeset
26
5272
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27 import com.oracle.graal.nodes.*;
6525
2c913b643422 rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents: 6522
diff changeset
28 import com.oracle.graal.phases.*;
5272
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
29
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
30 /**
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: 11665
diff changeset
31 * Adds safepoints to loops.
5272
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
32 */
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: 11665
diff changeset
33 public class LoopSafepointInsertionPhase extends Phase {
5272
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
34
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
35 @Override
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36 protected void run(StructuredGraph graph) {
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: 11665
diff changeset
37 if (GenLoopSafepoints.getValue()) {
19403
61d3cb8e1280 Add generic parameter to NodeClass. Change Graph#getNodes(Class) to Graph#getNodes(NodeClass).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18845
diff changeset
38 for (LoopEndNode loopEndNode : graph.getNodes(LoopEndNode.TYPE)) {
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: 11665
diff changeset
39 if (loopEndNode.canSafepoint()) {
18845
f57d86eb036f removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents: 16895
diff changeset
40 SafepointNode safepointNode = graph.add(new SafepointNode());
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: 11665
diff changeset
41 graph.addBeforeFixed(loopEndNode, safepointNode);
5272
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
42 }
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
43 }
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
44 }
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
45 }
a44b5ebb28a0 moved loop safepoint insertion from graph building to just before scheduling, removing the need for safepoint elimination
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
46 }