annotate graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java @ 2967:60a58915c94d

Removed next pointer from EndNode to Merge. New scheduler.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 15 Jun 2011 16:53:30 +0200
parents 0048537e3cd7
children fe44e684f1cb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1 /*
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
4 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
7 * published by the Free Software Foundation.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
8 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
13 * accompanied this code).
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
14 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
18 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
21 * questions.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
22 */
2879
7f584bf507ed Renamed and moved phase subclasses.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2875
diff changeset
23 package com.oracle.max.graal.compiler.phases;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
24
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
25 import static com.sun.cri.bytecode.Bytecodes.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
26 import static java.lang.reflect.Modifier.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
27
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
28 import java.lang.reflect.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
29 import java.util.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
30
2874
d90bf514d647 Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2872
diff changeset
31 import com.oracle.max.graal.compiler.*;
d90bf514d647 Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2872
diff changeset
32 import com.oracle.max.graal.compiler.debug.*;
2879
7f584bf507ed Renamed and moved phase subclasses.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2875
diff changeset
33 import com.oracle.max.graal.compiler.graph.*;
2874
d90bf514d647 Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2872
diff changeset
34 import com.oracle.max.graal.compiler.graph.BlockMap.*;
d90bf514d647 Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2872
diff changeset
35 import com.oracle.max.graal.compiler.graph.BlockMap.Block;
d90bf514d647 Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2872
diff changeset
36 import com.oracle.max.graal.compiler.ir.*;
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
37 import com.oracle.max.graal.compiler.ir.Deoptimize.DeoptAction;
2874
d90bf514d647 Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2872
diff changeset
38 import com.oracle.max.graal.compiler.schedule.*;
d90bf514d647 Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2872
diff changeset
39 import com.oracle.max.graal.compiler.util.*;
d90bf514d647 Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2872
diff changeset
40 import com.oracle.max.graal.compiler.value.*;
d90bf514d647 Renamed packages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2872
diff changeset
41 import com.oracle.max.graal.graph.*;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
42 import com.sun.cri.bytecode.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
43 import com.sun.cri.ci.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
44 import com.sun.cri.ri.*;
2872
0341b6424579 Project renaming.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2869
diff changeset
45 import com.sun.cri.ri.RiType.*;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
46
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
47 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
48 * The {@code GraphBuilder} class parses the bytecode of a method and builds the IR graph.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
49 * A number of optimizations may be performed during parsing of the bytecode, including value
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
50 * numbering, inlining, constant folding, strength reduction, etc.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
51 */
2879
7f584bf507ed Renamed and moved phase subclasses.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2875
diff changeset
52 public final class GraphBuilderPhase extends Phase {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
53
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
54 /**
2888
224412c24426 Changed C1X=>Graal and c1x=>graal in Java code.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2881
diff changeset
55 * The minimum value to which {@link GraalOptions#TraceBytecodeParserLevel} must be set to trace
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
56 * the bytecode instructions as they are parsed.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
57 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
58 public static final int TRACELEVEL_INSTRUCTIONS = 1;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
59
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
60 /**
2888
224412c24426 Changed C1X=>Graal and c1x=>graal in Java code.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2881
diff changeset
61 * The minimum value to which {@link GraalOptions#TraceBytecodeParserLevel} must be set to trace
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
62 * the frame state before each bytecode instruction as it is parsed.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
63 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
64 public static final int TRACELEVEL_STATE = 2;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
65
2888
224412c24426 Changed C1X=>Graal and c1x=>graal in Java code.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2881
diff changeset
66 private final GraalCompilation compilation;
2875
3570f1f7903e Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2874
diff changeset
67 private CompilerGraph graph;
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
68
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
69 private final CiStatistics stats;
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
70 private final RiRuntime runtime;
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
71 private final RiMethod method;
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
72 private final RiConstantPool constantPool;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
73
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
74 private final BytecodeStream stream; // the bytecode stream
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
75 private final LogStream log;
2875
3570f1f7903e Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2874
diff changeset
76 private FrameStateBuilder frameState; // the current execution state
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
77
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
78 // bci-to-block mapping
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
79 private Block[] blockFromBci;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
80 private ArrayList<Block> blockList;
2928
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
81 private HashMap<Integer, BranchOverride> branchOverride;
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
82
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
83 private int nextBlockNumber;
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
84
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
85 private Value methodSynchronizedObject;
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
86 private CiExceptionHandler unwindHandler;
2830
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
87
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
88 private Block unwindBlock;
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
89 private Block returnBlock;
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
90
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
91 // the worklist of blocks, sorted by depth first number
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
92 private final PriorityQueue<Block> workList = new PriorityQueue<Block>(10, new Comparator<Block>() {
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
93 public int compare(Block o1, Block o2) {
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
94 return o1.blockID - o2.blockID;
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
95 }
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
96 });
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
97
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
98 private Instruction lastInstr; // the last instruction added
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
99
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
100 private final Set<Block> blocksOnWorklist = new HashSet<Block>();
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
101 private final Set<Block> blocksVisited = new HashSet<Block>();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
102
2875
3570f1f7903e Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2874
diff changeset
103 private final boolean createUnwind;
3570f1f7903e Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2874
diff changeset
104
2586
421da5f53b5e more Op2 changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
105
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
106 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
107 * Creates a new, initialized, {@code GraphBuilder} instance for a given compilation.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
108 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
109 * @param compilation the compilation
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
110 * @param ir the IR to build the graph into
2602
0c6564c254af new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents: 2600
diff changeset
111 * @param graph
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
112 */
2902
434d71eec7a9 Ensure that only one phase timer is running at one time.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2888
diff changeset
113 public GraphBuilderPhase(GraalCompilation compilation, RiMethod method, boolean createUnwind, boolean inline) {
2903
eb3a82946429 Measure nodes created and nodes deleted for nodes. New option -G:+Meter.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2902
diff changeset
114 super(inline ? "BuildInlineGraph" : "BuildGraph");
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
115 this.compilation = compilation;
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
116
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
117 this.runtime = compilation.runtime;
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
118 this.method = method;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
119 this.stats = compilation.stats;
2888
224412c24426 Changed C1X=>Graal and c1x=>graal in Java code.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2881
diff changeset
120 this.log = GraalOptions.TraceBytecodeParserLevel > 0 ? new LogStream(TTY.out()) : null;
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
121 this.stream = new BytecodeStream(method.code());
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
122
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
123 this.constantPool = runtime.getConstantPool(method);
2875
3570f1f7903e Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2874
diff changeset
124 this.createUnwind = createUnwind;
3570f1f7903e Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2874
diff changeset
125 }
3570f1f7903e Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2874
diff changeset
126
3570f1f7903e Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2874
diff changeset
127 @Override
3570f1f7903e Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2874
diff changeset
128 protected void run(Graph graph) {
3570f1f7903e Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2874
diff changeset
129 assert graph != null;
3570f1f7903e Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2874
diff changeset
130 this.graph = (CompilerGraph) graph;
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
131 this.frameState = new FrameStateBuilder(method, graph);
2875
3570f1f7903e Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2874
diff changeset
132 build();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
133 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
134
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
135 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
136 * Builds the graph for a the specified {@code IRScope}.
2866
7f14e6b48a9c added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 2842
diff changeset
137 *
7f14e6b48a9c added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 2842
diff changeset
138 * @param createUnwind setting this to true will always generate an unwind block, even if there is no exception
7f14e6b48a9c added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 2842
diff changeset
139 * handler and the method is not synchronized
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
140 */
2875
3570f1f7903e Changed GraphBuilder to inherit from Phase.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2874
diff changeset
141 private void build() {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
142 if (log != null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
143 log.println();
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
144 log.println("Compiling " + method);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
145 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
146
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
147 // 2. compute the block map, setup exception handlers and get the entrypoint(s)
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
148 BlockMap blockMap = compilation.getBlockMap(method);
2928
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
149 this.branchOverride = blockMap.branchOverride;
2675
bcd20d26d52d Refactoring of BlockMap so that it doesn't create BlockBegin objects, but maintains its own Block data structure
Christian.Wimmer@Oracle.com
parents: 2671
diff changeset
150
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
151 blockList = new ArrayList<Block>(blockMap.blocks);
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
152 blockFromBci = new Block[method.code().length];
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
153 for (int i = 0; i < blockList.size(); i++) {
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
154 int blockID = nextBlockNumber();
2749
36440e516e44 block entry instructions created on-demand
Lukas Stadler <lukas.stadler@jku.at>
parents: 2747
diff changeset
155 assert blockID == i;
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
156 Block block = blockList.get(i);
2928
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
157 if (block.startBci >= 0 && !(block instanceof BlockMap.DeoptBlock)) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
158 blockFromBci[block.startBci] = block;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
159 }
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
160 }
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
161
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
162 // 1. create the start block
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
163 Block startBlock = nextBlock(Instruction.SYNCHRONIZATION_ENTRY_BCI);
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
164 markOnWorkList(startBlock);
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
165 lastInstr = (Instruction) createTarget(startBlock, frameState);
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
166 graph.start().setStart(lastInstr);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
167
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
168 if (isSynchronized(method.accessFlags())) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
169 // 4A.1 add a monitor enter to the start block
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
170 methodSynchronizedObject = synchronizedObject(frameState, method);
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
171 genMonitorEnter(methodSynchronizedObject, Instruction.SYNCHRONIZATION_ENTRY_BCI);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
172 // 4A.2 finish the start block
2746
05c92e53a50d merge and clone before connecting blocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 2741
diff changeset
173 finishStartBlock(startBlock);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
174
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
175 // 4A.3 setup an exception handler to unlock the root method synchronized object
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
176 unwindHandler = new CiExceptionHandler(0, method.code().length, Instruction.SYNCHRONIZATION_ENTRY_BCI, 0, null);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
177 } else {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
178 // 4B.1 simply finish the start block
2746
05c92e53a50d merge and clone before connecting blocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 2741
diff changeset
179 finishStartBlock(startBlock);
2866
7f14e6b48a9c added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 2842
diff changeset
180
7f14e6b48a9c added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 2842
diff changeset
181 if (createUnwind) {
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
182 unwindHandler = new CiExceptionHandler(0, method.code().length, Instruction.SYNCHRONIZATION_ENTRY_BCI, 0, null);
2866
7f14e6b48a9c added dead code elimination
Lukas Stadler <lukas.stadler@jku.at>
parents: 2842
diff changeset
183 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
184 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
185
2519
f6125fb5bfbc Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2516
diff changeset
186 // 5. SKIPPED: look for intrinsics
f6125fb5bfbc Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2516
diff changeset
187
f6125fb5bfbc Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2516
diff changeset
188 // 6B.1 do the normal parsing
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
189 addToWorkList(blockFromBci[0]);
2519
f6125fb5bfbc Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2516
diff changeset
190 iterateAllBlocks();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
191
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
192 // remove Placeholders
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
193 for (Node n : graph.getNodes()) {
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
194 if (n instanceof Placeholder) {
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
195 Placeholder p = (Placeholder) n;
2960
49a8b14e9d24 Tentative change that adds successor tags.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2948
diff changeset
196 assert p.predecessors().size() == 1;
49a8b14e9d24 Tentative change that adds successor tags.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2948
diff changeset
197 Node pred = p.predecessors().get(0);
2790
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
198 int predIndex = p.predecessorsIndex().get(0);
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
199 pred.successors().setAndClear(predIndex, p, 0);
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
200 p.delete();
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
201 }
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
202 }
2783
9bc0c2eb00d6 Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2781
diff changeset
203
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
204 // remove FrameStates
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
205 for (Node n : graph.getNodes()) {
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
206 if (n instanceof FrameState) {
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
207 if (n.usages().size() == 0 && n.predecessors().size() == 0) {
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
208 n.delete();
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
209 }
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
210 }
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
211 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
212 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
213
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
214 private int nextBlockNumber() {
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
215 stats.blockCount++;
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
216 return nextBlockNumber++;
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
217 }
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
218
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
219 private Block nextBlock(int bci) {
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
220 Block block = new Block();
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
221 block.startBci = bci;
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
222 block.endBci = bci;
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
223 block.blockID = nextBlockNumber();
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
224 return block;
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
225 }
2705
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
226
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
227 private Block unwindBlock() {
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
228 if (unwindBlock == null) {
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
229 unwindBlock = new Block();
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
230 unwindBlock.startBci = Instruction.SYNCHRONIZATION_ENTRY_BCI;
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
231 unwindBlock.endBci = Instruction.SYNCHRONIZATION_ENTRY_BCI;
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
232 unwindBlock.blockID = nextBlockNumber();
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
233 addToWorkList(unwindBlock);
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
234 }
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
235 return unwindBlock;
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
236 }
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
237
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
238 private Block returnBlock() {
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
239 if (returnBlock == null) {
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
240 returnBlock = new Block();
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
241 returnBlock.startBci = Instruction.SYNCHRONIZATION_ENTRY_BCI;
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
242 returnBlock.endBci = Instruction.SYNCHRONIZATION_ENTRY_BCI;
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
243 returnBlock.blockID = nextBlockNumber();
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
244 addToWorkList(returnBlock);
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
245 }
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
246 return returnBlock;
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
247 }
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
248
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
249 private void markOnWorkList(Block block) {
2705
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
250 blocksOnWorklist.add(block);
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
251 }
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
252
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
253 private boolean isOnWorkList(Block block) {
2705
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
254 return blocksOnWorklist.contains(block);
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
255 }
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
256
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
257 private void markVisited(Block block) {
2706
5a784215351a Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2705
diff changeset
258 blocksVisited.add(block);
5a784215351a Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2705
diff changeset
259 }
5a784215351a Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2705
diff changeset
260
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
261 private boolean isVisited(Block block) {
2706
5a784215351a Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2705
diff changeset
262 return blocksVisited.contains(block);
5a784215351a Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2705
diff changeset
263 }
5a784215351a Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2705
diff changeset
264
2746
05c92e53a50d merge and clone before connecting blocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 2741
diff changeset
265 private void finishStartBlock(Block startBlock) {
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
266 assert bci() == 0;
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
267 appendGoto(createTargetAt(0, frameState));
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
268 }
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
269
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
270 public void mergeOrClone(Block target, FrameStateAccess newState) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
271 Instruction first = target.firstInstruction;
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
272 if (target.isLoopHeader && isVisited(target)) {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
273 first = ((LoopBegin) first).loopEnd();
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
274 }
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
275 assert first instanceof StateSplit;
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
276
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
277 int bci = target.startBci;
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
278
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
279 FrameState existingState = ((StateSplit) first).stateBefore();
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
280
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
281 if (existingState == null) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
282 // copy state because it is modified
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
283 FrameState duplicate = newState.duplicate(bci);
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
284
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
285 // if the block is a loop header, insert all necessary phis
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
286 if (first instanceof LoopBegin && target.isLoopHeader) {
2793
d3fc4fe063bf Rename BlockBegin to Merge, remove some Block related member from it. Made CFGPrinter work with the Block class from schedule
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2791
diff changeset
287 assert first instanceof Merge;
d3fc4fe063bf Rename BlockBegin to Merge, remove some Block related member from it. Made CFGPrinter work with the Block class from schedule
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2791
diff changeset
288 insertLoopPhis((Merge) first, duplicate);
d3fc4fe063bf Rename BlockBegin to Merge, remove some Block related member from it. Made CFGPrinter work with the Block class from schedule
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2791
diff changeset
289 ((Merge) first).setStateBefore(duplicate);
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
290 } else {
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
291 ((StateSplit) first).setStateBefore(duplicate);
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
292 }
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
293 } else {
2888
224412c24426 Changed C1X=>Graal and c1x=>graal in Java code.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2881
diff changeset
294 if (!GraalOptions.AssumeVerifiedBytecode && !existingState.isCompatibleWith(newState)) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
295 // stacks or locks do not match--bytecodes would not verify
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
296 TTY.println(existingState.toString());
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
297 TTY.println(newState.duplicate(0).toString());
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
298 throw new CiBailout("stack or locks do not match");
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
299 }
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
300 assert existingState.localsSize() == newState.localsSize();
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
301 assert existingState.stackSize() == newState.stackSize();
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
302
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
303 if (first instanceof Placeholder) {
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
304 assert !target.isLoopHeader;
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
305 Merge merge = new Merge(graph);
2790
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
306
2964
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
307
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
308
2790
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
309 Placeholder p = (Placeholder) first;
2964
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
310 assert p.predecessors().size() == 1;
2790
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
311 assert p.next() == null;
2964
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
312
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
313 EndNode end = new EndNode(graph);
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
314 p.replace(end);
2966
0048537e3cd7 Added input to Merge node.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2964
diff changeset
315 merge.addEnd(end);
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
316 //end.setNext(merge);
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
317 target.firstInstruction = merge;
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
318 merge.setStateBefore(existingState);
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
319 first = merge;
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
320 }
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
321
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
322 existingState.merge((Merge) first, newState);
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
323 }
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
324
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
325 for (int j = 0; j < frameState.localsSize() + frameState.stackSize(); ++j) {
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
326 if (frameState.valueAt(j) != null) {
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
327 assert !frameState.valueAt(j).isDeleted();
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
328 }
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
329 }
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
330 }
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
331
2793
d3fc4fe063bf Rename BlockBegin to Merge, remove some Block related member from it. Made CFGPrinter work with the Block class from schedule
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2791
diff changeset
332 private void insertLoopPhis(Merge merge, FrameState newState) {
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
333 int stackSize = newState.stackSize();
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
334 for (int i = 0; i < stackSize; i++) {
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
335 // always insert phis for the stack
2763
5e8a69041cd7 Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2757
diff changeset
336 Value x = newState.stackAt(i);
5e8a69041cd7 Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2757
diff changeset
337 if (x != null) {
5e8a69041cd7 Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2757
diff changeset
338 newState.setupPhiForStack(merge, i).addInput(x);
5e8a69041cd7 Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2757
diff changeset
339 }
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
340 }
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
341 int localsSize = newState.localsSize();
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
342 for (int i = 0; i < localsSize; i++) {
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
343 Value x = newState.localAt(i);
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
344 if (x != null) {
2763
5e8a69041cd7 Model phi inputs as direct inputs in the graph instead of referring to the framestates of the predecessors.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2757
diff changeset
345 newState.setupPhiForLocal(merge, i).addInput(x);
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
346 }
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
347 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
348 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
349
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
350 public BytecodeStream stream() {
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
351 return stream;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
352 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
353
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
354 public int bci() {
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
355 return stream.currentBCI();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
356 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
357
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
358 private void loadLocal(int index, CiKind kind) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
359 frameState.push(kind, frameState.loadLocal(index));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
360 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
361
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
362 private void storeLocal(CiKind kind, int index) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
363 frameState.storeLocal(index, frameState.pop(kind));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
364 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
365
2830
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
366 public boolean covers(RiExceptionHandler handler, int bci) {
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
367 return handler.startBCI() <= bci && bci < handler.endBCI();
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
368 }
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
369
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
370 public boolean isCatchAll(RiExceptionHandler handler) {
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
371 return handler.catchTypeCPI() == 0;
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
372 }
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
373
2833
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
374 private Instruction handleException(Value exceptionObject, int bci) {
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
375 assert bci == Instruction.SYNCHRONIZATION_ENTRY_BCI || bci == bci() : "invalid bci";
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
376
2830
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
377 RiExceptionHandler firstHandler = null;
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
378 RiExceptionHandler[] exceptionHandlers = method.exceptionHandlers();
2564
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2563
diff changeset
379 // join with all potential exception handlers
2830
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
380 if (exceptionHandlers != null) {
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
381 for (RiExceptionHandler handler : exceptionHandlers) {
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
382 // if the handler covers this bytecode index, add it to the list
2830
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
383 if (covers(handler, bci)) {
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
384 firstHandler = handler;
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
385 break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
386 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
387 }
2564
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2563
diff changeset
388 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
389
2830
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
390 if (firstHandler == null) {
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
391 firstHandler = unwindHandler;
2830
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
392 }
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
393
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
394 if (firstHandler != null) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
395 compilation.setHasExceptionHandlers();
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
396
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
397 Block dispatchBlock = null;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
398 for (Block block : blockList) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
399 if (block instanceof ExceptionBlock) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
400 ExceptionBlock excBlock = (ExceptionBlock) block;
2830
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
401 if (excBlock.handler == firstHandler) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
402 dispatchBlock = block;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
403 break;
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
404 }
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
405 }
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
406 }
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
407 // if there's no dispatch block then the catch block needs to be a catch all
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
408 if (dispatchBlock == null) {
2830
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
409 assert isCatchAll(firstHandler);
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
410 int handlerBCI = firstHandler.handlerBCI();
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
411 if (handlerBCI == Instruction.SYNCHRONIZATION_ENTRY_BCI) {
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
412 dispatchBlock = unwindBlock();
2830
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
413 } else {
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
414 dispatchBlock = blockFromBci[handlerBCI];
706047ee5f2e Removed ExceptionHandler class because of clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2829
diff changeset
415 }
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
416 }
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
417 FrameState entryState = frameState.duplicateWithEmptyStack(bci);
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
418
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
419 StateSplit entry = new Placeholder(graph);
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
420 entry.setStateBefore(entryState);
2833
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
421
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
422 Instruction currentNext = entry;
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
423 Value currentExceptionObject = exceptionObject;
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
424 if (currentExceptionObject == null) {
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
425 ExceptionObject exception = new ExceptionObject(graph);
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
426 entry.setNext(exception);
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
427 currentNext = exception;
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
428 currentExceptionObject = exception;
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
429 }
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
430 FrameState stateWithException = entryState.duplicateModified(bci, CiKind.Void, currentExceptionObject);
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
431
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
432 currentNext.setNext(createTarget(dispatchBlock, stateWithException));
2833
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
433 return entry;
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
434 }
2833
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
435 return null;
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
436 }
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
437
2657
4a6518c4d17d Removed need for base instruction. Cleanup.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2652
diff changeset
438 private void genLoadConstant(int cpi) {
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
439 Object con = constantPool.lookupConstant(cpi);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
440
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
441 if (con instanceof RiType) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
442 // this is a load of class constant which might be unresolved
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
443 RiType riType = (RiType) con;
2650
ccab1d5f345e Removed TestPatching option.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2649
diff changeset
444 if (!riType.isResolved()) {
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
445 append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
2671
d8601d421b96 New Deoptimize node, remove ResolveClass node and replace it with deoptimization
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2669
diff changeset
446 frameState.push(CiKind.Object, append(Constant.forObject(null, graph)));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
447 } else {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
448 frameState.push(CiKind.Object, append(new Constant(riType.getEncoding(Representation.JavaClass), graph)));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
449 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
450 } else if (con instanceof CiConstant) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
451 CiConstant constant = (CiConstant) con;
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
452 frameState.push(constant.kind.stackKind(), appendConstant(constant));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
453 } else {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
454 throw new Error("lookupConstant returned an object of incorrect type");
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
455 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
456 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
457
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
458 private void genLoadIndexed(CiKind kind) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
459 Value index = frameState.ipop();
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
460 Value array = frameState.apop();
2644
4694daa6af3a Removed CSE array length.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2643
diff changeset
461 Value length = append(new ArrayLength(array, graph));
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
462 Value v = append(new LoadIndexed(array, index, length, kind, graph));
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
463 frameState.push(kind.stackKind(), v);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
464 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
465
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
466 private void genStoreIndexed(CiKind kind) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
467 Value value = frameState.pop(kind.stackKind());
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
468 Value index = frameState.ipop();
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
469 Value array = frameState.apop();
2644
4694daa6af3a Removed CSE array length.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2643
diff changeset
470 Value length = append(new ArrayLength(array, graph));
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
471 StoreIndexed result = new StoreIndexed(array, index, length, kind, value, graph);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
472 append(result);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
473 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
474
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
475 private void stackOp(int opcode) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
476 switch (opcode) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
477 case POP: {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
478 frameState.xpop();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
479 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
480 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
481 case POP2: {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
482 frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
483 frameState.xpop();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
484 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
485 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
486 case DUP: {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
487 Value w = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
488 frameState.xpush(w);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
489 frameState.xpush(w);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
490 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
491 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
492 case DUP_X1: {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
493 Value w1 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
494 Value w2 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
495 frameState.xpush(w1);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
496 frameState.xpush(w2);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
497 frameState.xpush(w1);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
498 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
499 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
500 case DUP_X2: {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
501 Value w1 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
502 Value w2 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
503 Value w3 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
504 frameState.xpush(w1);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
505 frameState.xpush(w3);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
506 frameState.xpush(w2);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
507 frameState.xpush(w1);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
508 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
509 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
510 case DUP2: {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
511 Value w1 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
512 Value w2 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
513 frameState.xpush(w2);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
514 frameState.xpush(w1);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
515 frameState.xpush(w2);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
516 frameState.xpush(w1);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
517 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
518 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
519 case DUP2_X1: {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
520 Value w1 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
521 Value w2 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
522 Value w3 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
523 frameState.xpush(w2);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
524 frameState.xpush(w1);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
525 frameState.xpush(w3);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
526 frameState.xpush(w2);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
527 frameState.xpush(w1);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
528 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
529 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
530 case DUP2_X2: {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
531 Value w1 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
532 Value w2 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
533 Value w3 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
534 Value w4 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
535 frameState.xpush(w2);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
536 frameState.xpush(w1);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
537 frameState.xpush(w4);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
538 frameState.xpush(w3);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
539 frameState.xpush(w2);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
540 frameState.xpush(w1);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
541 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
542 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
543 case SWAP: {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
544 Value w1 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
545 Value w2 = frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
546 frameState.xpush(w1);
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
547 frameState.xpush(w2);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
548 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
549 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
550 default:
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
551 throw Util.shouldNotReachHere();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
552 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
553
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
554 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
555
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
556 private void genArithmeticOp(CiKind kind, int opcode) {
2622
91d3952f7eb7 Framestate work : using stateAFter and reducting the number of nodes with framestates. Intermediate state (does not pass tests)
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2621
diff changeset
557 genArithmeticOp(kind, opcode, false);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
558 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
559
2877
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2876 2874
diff changeset
560 private void genArithmeticOp(CiKind result, int opcode, boolean canTrap) {
2876
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
561 Value y = frameState.pop(result);
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
562 Value x = frameState.pop(result);
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
563 boolean isStrictFP = isStrict(method.accessFlags());
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
564 Arithmetic v;
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
565 switch(opcode){
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
566 case IADD:
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
567 case LADD: v = new IntegerAdd(result, x, y, graph); break;
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
568 case FADD:
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
569 case DADD: v = new FloatAdd(result, x, y, isStrictFP, graph); break;
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
570 case ISUB:
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
571 case LSUB: v = new IntegerSub(result, x, y, graph); break;
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
572 case FSUB:
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
573 case DSUB: v = new FloatSub(result, x, y, isStrictFP, graph); break;
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
574 case IMUL:
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
575 case LMUL: v = new IntegerMul(result, x, y, graph); break;
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
576 case FMUL:
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
577 case DMUL: v = new FloatMul(result, x, y, isStrictFP, graph); break;
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
578 case IDIV:
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
579 case LDIV: v = new IntegerDiv(result, x, y, graph); break;
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
580 case FDIV:
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
581 case DDIV: v = new FloatDiv(result, x, y, isStrictFP, graph); break;
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
582 case IREM:
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
583 case LREM: v = new IntegerRem(result, x, y, graph); break;
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
584 case FREM:
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
585 case DREM: v = new FloatRem(result, x, y, isStrictFP, graph); break;
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
586 default:
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
587 throw new CiBailout("should not reach");
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
588 }
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
589 Value result1 = append(v);
2867
Lukas Stadler <lukas.stadler@jku.at>
parents: 2866 2858
diff changeset
590 if (canTrap) {
Lukas Stadler <lukas.stadler@jku.at>
parents: 2866 2858
diff changeset
591 append(new ValueAnchor(result1, graph));
Lukas Stadler <lukas.stadler@jku.at>
parents: 2866 2858
diff changeset
592 }
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
593 frameState.push(result, result1);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
594 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
595
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
596 private void genNegateOp(CiKind kind) {
2852
c6bdec623ef9 Move TypeCHeck to floating nodes, rename Nodes to aboid using an *Op suffix
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2850
diff changeset
597 frameState.push(kind, append(new Negate(frameState.pop(kind), graph)));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
598 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
599
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
600 private void genShiftOp(CiKind kind, int opcode) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
601 Value s = frameState.ipop();
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
602 Value x = frameState.pop(kind);
2865
7a4e6e11877f Subclasses for Shift
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2862
diff changeset
603 Shift v;
7a4e6e11877f Subclasses for Shift
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2862
diff changeset
604 switch(opcode){
7a4e6e11877f Subclasses for Shift
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2862
diff changeset
605 case ISHL:
7a4e6e11877f Subclasses for Shift
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2862
diff changeset
606 case LSHL: v = new LeftShift(kind, x, s, graph); break;
7a4e6e11877f Subclasses for Shift
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2862
diff changeset
607 case ISHR:
7a4e6e11877f Subclasses for Shift
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2862
diff changeset
608 case LSHR: v = new RightShift(kind, x, s, graph); break;
7a4e6e11877f Subclasses for Shift
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2862
diff changeset
609 case IUSHR:
7a4e6e11877f Subclasses for Shift
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2862
diff changeset
610 case LUSHR: v = new UnsignedRightShift(kind, x, s, graph); break;
7a4e6e11877f Subclasses for Shift
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2862
diff changeset
611 default:
7a4e6e11877f Subclasses for Shift
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2862
diff changeset
612 throw new CiBailout("should not reach");
7a4e6e11877f Subclasses for Shift
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2862
diff changeset
613 }
7a4e6e11877f Subclasses for Shift
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2862
diff changeset
614 frameState.push(kind, append(v));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
615 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
616
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
617 private void genLogicOp(CiKind kind, int opcode) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
618 Value y = frameState.pop(kind);
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
619 Value x = frameState.pop(kind);
2853
0635ba16afe4 Reintroduce Logic subclasses, creating some Canonicalization related classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2852
diff changeset
620 Logic v;
0635ba16afe4 Reintroduce Logic subclasses, creating some Canonicalization related classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2852
diff changeset
621 switch(opcode){
0635ba16afe4 Reintroduce Logic subclasses, creating some Canonicalization related classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2852
diff changeset
622 case IAND:
0635ba16afe4 Reintroduce Logic subclasses, creating some Canonicalization related classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2852
diff changeset
623 case LAND: v = new And(kind, x, y, graph); break;
0635ba16afe4 Reintroduce Logic subclasses, creating some Canonicalization related classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2852
diff changeset
624 case IOR:
0635ba16afe4 Reintroduce Logic subclasses, creating some Canonicalization related classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2852
diff changeset
625 case LOR: v = new Or(kind, x, y, graph); break;
0635ba16afe4 Reintroduce Logic subclasses, creating some Canonicalization related classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2852
diff changeset
626 case IXOR:
0635ba16afe4 Reintroduce Logic subclasses, creating some Canonicalization related classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2852
diff changeset
627 case LXOR: v = new Xor(kind, x, y, graph); break;
0635ba16afe4 Reintroduce Logic subclasses, creating some Canonicalization related classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2852
diff changeset
628 default:
0635ba16afe4 Reintroduce Logic subclasses, creating some Canonicalization related classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2852
diff changeset
629 throw new CiBailout("should not reach");
0635ba16afe4 Reintroduce Logic subclasses, creating some Canonicalization related classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2852
diff changeset
630 }
0635ba16afe4 Reintroduce Logic subclasses, creating some Canonicalization related classes
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2852
diff changeset
631 frameState.push(kind, append(v));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
632 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
633
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
634 private void genCompareOp(CiKind kind, int opcode, CiKind resultKind) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
635 Value y = frameState.pop(kind);
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
636 Value x = frameState.pop(kind);
2862
45422967cbcf Rename Materialize => NormalizeCompare
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2858
diff changeset
637 Value value = append(new NormalizeCompare(opcode, resultKind, x, y, graph));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
638 if (!resultKind.isVoid()) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
639 frameState.ipush(value);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
640 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
641 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
642
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
643 private void genConvert(int opcode, CiKind from, CiKind to) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
644 CiKind tt = to.stackKind();
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
645 frameState.push(tt, append(new Convert(opcode, frameState.pop(from.stackKind()), tt, graph)));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
646 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
647
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
648 private void genIncrement() {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
649 int index = stream().readLocalIndex();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
650 int delta = stream().readIncrement();
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
651 Value x = frameState.localAt(index);
2594
092e628ddd5d changed Constant and Convert, more StoreIndexed changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2592
diff changeset
652 Value y = append(Constant.forInt(delta, graph));
2876
7d7cf33f8466 Subclasses for arithmetic
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2865
diff changeset
653 frameState.storeLocal(index, append(new IntegerAdd(CiKind.Int, x, y, graph)));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
654 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
655
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
656 private void genGoto(int fromBCI, int toBCI) {
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
657 appendGoto(createTargetAt(toBCI, frameState));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
658 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
659
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
660 private void ifNode(Value x, Condition cond, Value y) {
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
661 assert !x.isDeleted() && !y.isDeleted();
2862
45422967cbcf Rename Materialize => NormalizeCompare
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2858
diff changeset
662 If ifNode = new If(new Compare(x, cond, y, graph), graph);
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
663 append(ifNode);
2928
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
664 BlockMap.BranchOverride override = branchOverride.get(bci());
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
665 FixedNode tsucc;
2928
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
666 if (override == null || override.taken == false) {
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
667 tsucc = createTargetAt(stream().readBranchDest(), frameState);
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
668 } else {
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
669 tsucc = createTarget(override.block, frameState);
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
670 }
2769
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
671 ifNode.setBlockSuccessor(0, tsucc);
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
672 FixedNode fsucc;
2928
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
673 if (override == null || override.taken == true) {
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
674 fsucc = createTargetAt(stream().nextBCI(), frameState);
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
675 } else {
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
676 fsucc = createTarget(override.block, frameState);
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
677 }
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
678 ifNode.setBlockSuccessor(1, fsucc);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
679 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
680
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
681 private void genIfZero(Condition cond) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
682 Value y = appendConstant(CiConstant.INT_0);
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
683 Value x = frameState.ipop();
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
684 ifNode(x, cond, y);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
685 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
686
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
687 private void genIfNull(Condition cond) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
688 Value y = appendConstant(CiConstant.NULL_OBJECT);
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
689 Value x = frameState.apop();
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
690 ifNode(x, cond, y);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
691 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
692
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
693 private void genIfSame(CiKind kind, Condition cond) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
694 Value y = frameState.pop(kind);
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
695 Value x = frameState.pop(kind);
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
696 assert !x.isDeleted() && !y.isDeleted();
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
697 ifNode(x, cond, y);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
698 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
699
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
700 private void genThrow(int bci) {
2833
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
701 Value exception = frameState.apop();
2940
bf15ed11c2bc Rename ClipNode=>FixedGuard and FixedNullCheck=>IsNonNull.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2920
diff changeset
702 FixedGuard node = new FixedGuard(graph);
bf15ed11c2bc Rename ClipNode=>FixedGuard and FixedNullCheck=>IsNonNull.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2920
diff changeset
703 node.setNode(new IsNonNull(exception, graph));
bf15ed11c2bc Rename ClipNode=>FixedGuard and FixedNullCheck=>IsNonNull.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2920
diff changeset
704 append(node);
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
705
2833
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
706 Instruction entry = handleException(exception, bci);
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
707 if (entry != null) {
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
708 append(entry);
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
709 } else {
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
710 frameState.clearStack();
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
711 frameState.apush(exception);
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
712 appendGoto(createTarget(unwindBlock(), frameState));
2833
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
713 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
714 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
715
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
716 private void genCheckCast() {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
717 int cpi = stream().readCPI();
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
718 RiType type = constantPool.lookupType(cpi, CHECKCAST);
2671
d8601d421b96 New Deoptimize node, remove ResolveClass node and replace it with deoptimization
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2669
diff changeset
719 boolean isInitialized = type.isResolved();
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
720 Value typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, type, isInitialized, cpi);
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
721 Value object = frameState.apop();
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
722 if (typeInstruction != null) {
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
723 frameState.apush(append(new CheckCast(type, typeInstruction, object, graph)));
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
724 } else {
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
725 frameState.apush(appendConstant(CiConstant.NULL_OBJECT));
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
726 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
727 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
728
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
729 private void genInstanceOf() {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
730 int cpi = stream().readCPI();
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
731 RiType type = constantPool.lookupType(cpi, INSTANCEOF);
2671
d8601d421b96 New Deoptimize node, remove ResolveClass node and replace it with deoptimization
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2669
diff changeset
732 boolean isInitialized = type.isResolved();
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
733 Value typeInstruction = genTypeOrDeopt(RiType.Representation.ObjectHub, type, isInitialized, cpi);
2673
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
734 Value object = frameState.apop();
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
735 if (typeInstruction != null) {
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
736 frameState.ipush(append(new InstanceOf(type, typeInstruction, object, graph)));
2673
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
737 } else {
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
738 frameState.ipush(appendConstant(CiConstant.INT_0));
2673
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
739 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
740 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
741
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
742 void genNewInstance(int cpi) {
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
743 RiType type = constantPool.lookupType(cpi, NEW);
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
744 if (type.isResolved()) {
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
745 NewInstance n = new NewInstance(type, cpi, constantPool, graph);
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
746 frameState.apush(append(n));
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
747 } else {
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
748 append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
749 frameState.apush(appendConstant(CiConstant.NULL_OBJECT));
2634
4dd0573f510b FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2633
diff changeset
750 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
751 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
752
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
753 private void genNewTypeArray(int typeCode) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
754 CiKind kind = CiKind.fromArrayTypeCode(typeCode);
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
755 RiType elementType = runtime.asRiType(kind);
2634
4dd0573f510b FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2633
diff changeset
756 NewTypeArray nta = new NewTypeArray(frameState.ipop(), elementType, graph);
4dd0573f510b FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2633
diff changeset
757 frameState.apush(append(nta));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
758 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
759
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
760 private void genNewObjectArray(int cpi) {
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
761 RiType type = constantPool.lookupType(cpi, ANEWARRAY);
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
762 Value length = frameState.ipop();
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
763 if (type.isResolved()) {
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
764 NewArray n = new NewObjectArray(type, length, graph);
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
765 frameState.apush(append(n));
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
766 } else {
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
767 append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
768 frameState.apush(appendConstant(CiConstant.NULL_OBJECT));
2634
4dd0573f510b FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2633
diff changeset
769 }
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
770
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
771 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
772
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
773 private void genNewMultiArray(int cpi) {
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
774 RiType type = constantPool.lookupType(cpi, MULTIANEWARRAY);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
775 int rank = stream().readUByte(bci() + 3);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
776 Value[] dims = new Value[rank];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
777 for (int i = rank - 1; i >= 0; i--) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
778 dims[i] = frameState.ipop();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
779 }
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
780 if (type.isResolved()) {
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
781 NewArray n = new NewMultiArray(type, dims, cpi, constantPool, graph);
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
782 frameState.apush(append(n));
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
783 } else {
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
784 append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
785 frameState.apush(appendConstant(CiConstant.NULL_OBJECT));
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
786 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
787 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
788
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
789 private void genGetField(int cpi, RiField field) {
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
790 CiKind kind = field.kind();
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
791 Value receiver = frameState.apop();
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
792 if (field.isResolved()) {
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
793 LoadField load = new LoadField(receiver, field, graph);
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
794 appendOptimizedLoadField(kind, load);
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
795 } else {
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
796 append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
797 frameState.push(kind.stackKind(), append(Constant.defaultForKind(kind, graph)));
2634
4dd0573f510b FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2633
diff changeset
798 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
799 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
800
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
801 private void genPutField(int cpi, RiField field) {
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
802 Value value = frameState.pop(field.kind().stackKind());
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
803 Value receiver = frameState.apop();
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
804 if (field.isResolved()) {
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
805 StoreField store = new StoreField(receiver, field, value, graph);
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
806 appendOptimizedStoreField(store);
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
807 } else {
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
808 append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
2634
4dd0573f510b FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2633
diff changeset
809 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
810 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
811
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
812 private void genGetStatic(int cpi, RiField field) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
813 RiType holder = field.holder();
2650
ccab1d5f345e Removed TestPatching option.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2649
diff changeset
814 boolean isInitialized = field.isResolved();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
815 CiConstant constantValue = null;
2533
c480605ef068 Removed canonicalizer.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2521
diff changeset
816 if (isInitialized) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
817 constantValue = field.constantValue(null);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
818 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
819 if (constantValue != null) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
820 frameState.push(constantValue.kind.stackKind(), appendConstant(constantValue));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
821 } else {
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
822 Value container = genTypeOrDeopt(RiType.Representation.StaticFields, holder, isInitialized, cpi);
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
823 CiKind kind = field.kind();
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
824 if (container != null) {
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
825 LoadField load = new LoadField(container, field, graph);
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
826 appendOptimizedLoadField(kind, load);
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
827 } else {
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
828 append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
829 frameState.push(kind.stackKind(), append(Constant.defaultForKind(kind, graph)));
2673
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
830 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
831 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
832 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
833
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
834 private void genPutStatic(int cpi, RiField field) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
835 RiType holder = field.holder();
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
836 Value container = genTypeOrDeopt(RiType.Representation.StaticFields, holder, field.isResolved(), cpi);
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
837 Value value = frameState.pop(field.kind().stackKind());
2673
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
838 if (container != null) {
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
839 StoreField store = new StoreField(container, field, value, graph);
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
840 appendOptimizedStoreField(store);
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
841 } else {
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
842 append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
2671
d8601d421b96 New Deoptimize node, remove ResolveClass node and replace it with deoptimization
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2669
diff changeset
843 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
844 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
845
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
846 private Value genTypeOrDeopt(RiType.Representation representation, RiType holder, boolean initialized, int cpi) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
847 if (initialized) {
2673
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
848 return appendConstant(holder.getEncoding(representation));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
849 } else {
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
850 append(new Deoptimize(DeoptAction.InvalidateRecompile, graph));
2673
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
851 return null;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
852 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
853 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
854
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
855 private void appendOptimizedStoreField(StoreField store) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
856 append(store);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
857 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
858
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
859 private void appendOptimizedLoadField(CiKind kind, LoadField load) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
860 // append the load to the instruction
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
861 Value optimized = append(load);
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
862 frameState.push(kind.stackKind(), optimized);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
863 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
864
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
865 private void genInvokeStatic(RiMethod target, int cpi, RiConstantPool constantPool) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
866 RiType holder = target.holder();
2650
ccab1d5f345e Removed TestPatching option.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2649
diff changeset
867 boolean isInitialized = target.isResolved() && holder.isInitialized();
2888
224412c24426 Changed C1X=>Graal and c1x=>graal in Java code.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2881
diff changeset
868 if (!isInitialized && GraalOptions.ResolveClassBeforeStaticInvoke) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
869 // Re-use the same resolution code as for accessing a static field. Even though
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
870 // the result of resolution is not used by the invocation (only the side effect
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
871 // of initialization is required), it can be commoned with static field accesses.
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
872 genTypeOrDeopt(RiType.Representation.StaticFields, holder, isInitialized, cpi);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
873 }
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
874 Value[] args = frameState.popArguments(target.signature().argumentSlots(false));
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
875 appendInvoke(INVOKESTATIC, target, args, cpi, constantPool);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
876 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
877
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
878 private void genInvokeInterface(RiMethod target, int cpi, RiConstantPool constantPool) {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
879 Value[] args = frameState.popArguments(target.signature().argumentSlots(true));
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
880 genInvokeIndirect(INVOKEINTERFACE, target, args, cpi, constantPool);
2533
c480605ef068 Removed canonicalizer.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2521
diff changeset
881
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
882 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
883
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
884 private void genInvokeVirtual(RiMethod target, int cpi, RiConstantPool constantPool) {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
885 Value[] args = frameState.popArguments(target.signature().argumentSlots(true));
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
886 genInvokeIndirect(INVOKEVIRTUAL, target, args, cpi, constantPool);
2533
c480605ef068 Removed canonicalizer.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2521
diff changeset
887
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
888 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
889
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
890 private void genInvokeSpecial(RiMethod target, RiType knownHolder, int cpi, RiConstantPool constantPool) {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
891 Value[] args = frameState.popArguments(target.signature().argumentSlots(true));
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
892 invokeDirect(target, args, knownHolder, cpi, constantPool);
2533
c480605ef068 Removed canonicalizer.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2521
diff changeset
893
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
894 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
895
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
896 private void genInvokeIndirect(int opcode, RiMethod target, Value[] args, int cpi, RiConstantPool constantPool) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
897 Value receiver = args[0];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
898 // attempt to devirtualize the call
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
899 if (target.isResolved()) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
900 RiType klass = target.holder();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
901
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
902 // 0. check for trivial cases
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
903 if (target.canBeStaticallyBound() && !isAbstract(target.accessFlags())) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
904 // check for trivial cases (e.g. final methods, nonvirtual methods)
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
905 invokeDirect(target, args, target.holder(), cpi, constantPool);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
906 return;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
907 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
908 // 1. check if the exact type of the receiver can be determined
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
909 RiType exact = getExactType(klass, receiver);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
910 if (exact != null && exact.isResolved()) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
911 // either the holder class is exact, or the receiver object has an exact type
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
912 invokeDirect(exact.resolveMethodImpl(target), args, exact, cpi, constantPool);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
913 return;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
914 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
915 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
916 // devirtualization failed, produce an actual invokevirtual
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
917 appendInvoke(opcode, target, args, cpi, constantPool);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
918 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
919
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
920 private CiKind returnKind(RiMethod target) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
921 return target.signature().returnKind();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
922 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
923
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
924 private void invokeDirect(RiMethod target, Value[] args, RiType knownHolder, int cpi, RiConstantPool constantPool) {
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
925 appendInvoke(INVOKESPECIAL, target, args, cpi, constantPool);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
926 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
927
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
928 private void appendInvoke(int opcode, RiMethod target, Value[] args, int cpi, RiConstantPool constantPool) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
929 CiKind resultType = returnKind(target);
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2935
diff changeset
930 if (GraalOptions.DeoptALot) {
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2935
diff changeset
931 append(new Deoptimize(DeoptAction.None, graph));
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2935
diff changeset
932 frameState.pushReturn(resultType, Constant.defaultForKind(resultType, graph));
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2935
diff changeset
933 } else {
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2935
diff changeset
934 Invoke invoke = new Invoke(bci(), opcode, resultType.stackKind(), args, target, target.signature().returnType(method.holder()), method.typeProfile(bci()), graph);
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2935
diff changeset
935 Value result = appendWithBCI(invoke);
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2935
diff changeset
936 invoke.setExceptionEdge(handleException(null, bci()));
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2935
diff changeset
937 frameState.pushReturn(resultType, result);
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2935
diff changeset
938 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
939 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
940
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
941 private RiType getExactType(RiType staticType, Value receiver) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
942 RiType exact = staticType.exactType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
943 if (exact == null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
944 exact = receiver.exactType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
945 if (exact == null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
946 if (receiver.isConstant()) {
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
947 exact = runtime.getTypeOf(receiver.asConstant());
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
948 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
949 if (exact == null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
950 RiType declared = receiver.declaredType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
951 exact = declared == null || !declared.isResolved() ? null : declared.exactType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
952 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
953 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
954 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
955 return exact;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
956 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
957
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
958 private void callRegisterFinalizer() {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
959 Value receiver = frameState.loadLocal(0);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
960 RiType declaredType = receiver.declaredType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
961 RiType receiverType = declaredType;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
962 RiType exactType = receiver.exactType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
963 if (exactType == null && declaredType != null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
964 exactType = declaredType.exactType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
965 }
2771
056e392d63d4 Connected local variables to start node. No more need for frame state to emit locals.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2769
diff changeset
966 if (exactType == null && receiver instanceof Local && ((Local) receiver).index() == 0) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
967 // the exact type isn't known, but the receiver is parameter 0 => use holder
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
968 receiverType = method.holder();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
969 exactType = receiverType.exactType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
970 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
971 boolean needsCheck = true;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
972 if (exactType != null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
973 // we have an exact type
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
974 needsCheck = exactType.hasFinalizer();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
975 } else {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
976 // if either the declared type of receiver or the holder can be assumed to have no finalizers
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
977 if (declaredType != null && !declaredType.hasFinalizableSubclass()) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
978 if (compilation.recordNoFinalizableSubclassAssumption(declaredType)) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
979 needsCheck = false;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
980 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
981 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
982
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
983 if (receiverType != null && !receiverType.hasFinalizableSubclass()) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
984 if (compilation.recordNoFinalizableSubclassAssumption(receiverType)) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
985 needsCheck = false;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
986 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
987 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
988 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
989
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
990 if (needsCheck) {
2519
f6125fb5bfbc Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2516
diff changeset
991 // append a call to the finalizer registration
2671
d8601d421b96 New Deoptimize node, remove ResolveClass node and replace it with deoptimization
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2669
diff changeset
992 append(new RegisterFinalizer(frameState.loadLocal(0), frameState.create(bci()), graph));
2888
224412c24426 Changed C1X=>Graal and c1x=>graal in Java code.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2881
diff changeset
993 GraalMetrics.InlinedFinalizerChecks++;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
994 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
995 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
996
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
997 private void genReturn(Value x) {
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
998 frameState.clearStack();
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
999 if (x != null) {
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1000 frameState.push(x.kind, x);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1001 }
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1002 appendGoto(createTarget(returnBlock(), frameState));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1003 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1004
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
1005 private void genMonitorEnter(Value x, int bci) {
2644
4694daa6af3a Removed CSE array length.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2643
diff changeset
1006 int lockNumber = frameState.locksSize();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1007 MonitorAddress lockAddress = null;
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1008 if (runtime.sizeOfBasicObjectLock() != 0) {
2602
0c6564c254af new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents: 2600
diff changeset
1009 lockAddress = new MonitorAddress(lockNumber, graph);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1010 append(lockAddress);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1011 }
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1012 MonitorEnter monitorEnter = new MonitorEnter(x, lockAddress, lockNumber, graph);
2716
c1a9bf38da28 Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2715
diff changeset
1013 appendWithBCI(monitorEnter);
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1014 frameState.lock(x);
2640
9e30cf6dcf96 More frame state fixes. All jtt tests passing now again.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2639
diff changeset
1015 if (bci == Instruction.SYNCHRONIZATION_ENTRY_BCI) {
9e30cf6dcf96 More frame state fixes. All jtt tests passing now again.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2639
diff changeset
1016 monitorEnter.setStateAfter(frameState.create(0));
9e30cf6dcf96 More frame state fixes. All jtt tests passing now again.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2639
diff changeset
1017 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1018 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1019
2784
e62cfea1c134 Simplified fillSyncHandler. Fixed LIRGenerator visitUnwind.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2783
diff changeset
1020 private void genMonitorExit(Value x) {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
1021 int lockNumber = frameState.locksSize() - 1;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1022 if (lockNumber < 0) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1023 throw new CiBailout("monitor stack underflow");
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1024 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1025 MonitorAddress lockAddress = null;
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1026 if (runtime.sizeOfBasicObjectLock() != 0) {
2602
0c6564c254af new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents: 2600
diff changeset
1027 lockAddress = new MonitorAddress(lockNumber, graph);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1028 append(lockAddress);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1029 }
2716
c1a9bf38da28 Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2715
diff changeset
1030 appendWithBCI(new MonitorExit(x, lockAddress, lockNumber, graph));
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
1031 frameState.unlock();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1032 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1033
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
1034 private void genJsr(int dest) {
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1035 throw new CiBailout("jsr/ret not supported");
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1036 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1037
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
1038 private void genRet(int localIndex) {
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1039 throw new CiBailout("jsr/ret not supported");
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1040 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1041
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
1042 private void genTableswitch() {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1043 int bci = bci();
2747
84f4c7dceb14 fixes for mergeOrClone move
Lukas Stadler <lukas.stadler@jku.at>
parents: 2746
diff changeset
1044 Value value = frameState.ipop();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1045 BytecodeTableSwitch ts = new BytecodeTableSwitch(stream(), bci);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1046 int max = ts.numberOfCases();
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1047 List<Instruction> list = new ArrayList<Instruction>(max + 1);
2769
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1048 List<Integer> offsetList = new ArrayList<Integer>(max + 1);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1049 for (int i = 0; i < max; i++) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1050 // add all successors to the successor list
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1051 int offset = ts.offsetAt(i);
2769
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1052 list.add(null);
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1053 offsetList.add(offset);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1054 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1055 int offset = ts.defaultOffset();
2769
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1056 list.add(null);
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1057 offsetList.add(offset);
2774
93fd92c9f8b0 Removed usage of stateAfter on BlockEnd instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2773
diff changeset
1058 TableSwitch tableSwitch = new TableSwitch(value, list, ts.lowKey(), graph);
2769
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1059 for (int i = 0; i < offsetList.size(); ++i) {
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1060 tableSwitch.setBlockSuccessor(i, createTargetAt(bci + offsetList.get(i), frameState));
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1061 }
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1062 append(tableSwitch);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1063 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1064
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
1065 private void genLookupswitch() {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1066 int bci = bci();
2747
84f4c7dceb14 fixes for mergeOrClone move
Lukas Stadler <lukas.stadler@jku.at>
parents: 2746
diff changeset
1067 Value value = frameState.ipop();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1068 BytecodeLookupSwitch ls = new BytecodeLookupSwitch(stream(), bci);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1069 int max = ls.numberOfCases();
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1070 List<Instruction> list = new ArrayList<Instruction>(max + 1);
2769
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1071 List<Integer> offsetList = new ArrayList<Integer>(max + 1);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1072 int[] keys = new int[max];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1073 for (int i = 0; i < max; i++) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1074 // add all successors to the successor list
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1075 int offset = ls.offsetAt(i);
2769
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1076 list.add(null);
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1077 offsetList.add(offset);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1078 keys[i] = ls.keyAt(i);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1079 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1080 int offset = ls.defaultOffset();
2769
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1081 list.add(null);
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1082 offsetList.add(offset);
2774
93fd92c9f8b0 Removed usage of stateAfter on BlockEnd instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2773
diff changeset
1083 LookupSwitch lookupSwitch = new LookupSwitch(value, list, keys, graph);
2769
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1084 for (int i = 0; i < offsetList.size(); ++i) {
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1085 lookupSwitch.setBlockSuccessor(i, createTargetAt(bci + offsetList.get(i), frameState));
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1086 }
dd6419f4bfe2 Fixed several issues with incorrect predecessor count/order. One known issue around exception dispatch remaining in fop.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2768
diff changeset
1087 append(lookupSwitch);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1088 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1089
2709
7b7dbe19fafb Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2684
diff changeset
1090 private Value appendConstant(CiConstant constant) {
2805
c3f64b66fc78 Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2799
diff changeset
1091 return append(new Constant(constant, graph));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1092 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1093
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1094 private Value append(Instruction x) {
2716
c1a9bf38da28 Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2715
diff changeset
1095 return appendWithBCI(x);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1096 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1097
2805
c3f64b66fc78 Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2799
diff changeset
1098 private Value append(Value v) {
c3f64b66fc78 Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2799
diff changeset
1099 return v;
c3f64b66fc78 Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2799
diff changeset
1100 }
c3f64b66fc78 Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2799
diff changeset
1101
2716
c1a9bf38da28 Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2715
diff changeset
1102 private Value appendWithBCI(Instruction x) {
2833
1cd59ca9ac86 Removed Throw HIR instruction. Removed special handling for exceptions in register allocator.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2830
diff changeset
1103 assert x.predecessors().size() == 0 : "instruction should not have been appended yet";
2820
2b8ef0a06391 Clean up in the graph builder.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2805
diff changeset
1104 assert lastInstr.next() == null : "cannot append instruction to instruction which isn't end (" + lastInstr + "->" + lastInstr.next() + ")";
2b8ef0a06391 Clean up in the graph builder.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2805
diff changeset
1105 lastInstr.setNext(x);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1106
2820
2b8ef0a06391 Clean up in the graph builder.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2805
diff changeset
1107 lastInstr = x;
2888
224412c24426 Changed C1X=>Graal and c1x=>graal in Java code.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2881
diff changeset
1108 if (++stats.nodeCount >= GraalOptions.MaximumInstructionCount) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1109 // bailout if we've exceeded the maximum inlining size
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1110 throw new CiBailout("Method and/or inlining is too large");
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1111 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1112
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1113 return x;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1114 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1115
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
1116 private FixedNode createTargetAt(int bci, FrameStateAccess stateAfter) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1117 return createTarget(blockFromBci[bci], stateAfter);
2750
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1118 }
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1119
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
1120 private FixedNode createTarget(Block block, FrameStateAccess stateAfter) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1121 assert block != null && stateAfter != null;
2928
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
1122 assert block.isLoopHeader || block.firstInstruction == null || block.firstInstruction.next() == null :
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
1123 "non-loop block must be iterated after all its predecessors. startBci=" + block.startBci + ", " + block.getClass().getSimpleName() + ", " + block.firstInstruction.next();
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1124
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1125 if (block.isExceptionEntry) {
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1126 assert stateAfter.stackSize() == 1;
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1127 }
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1128
2750
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1129 if (block.firstInstruction == null) {
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1130 if (block.isLoopHeader) {
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1131 LoopBegin loopBegin = new LoopBegin(graph);
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1132 LoopEnd loopEnd = new LoopEnd(graph);
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1133 loopEnd.setLoopBegin(loopBegin);
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1134 block.firstInstruction = loopBegin;
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1135 } else {
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1136 block.firstInstruction = new Placeholder(graph);
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1137 }
2750
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1138 }
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1139 mergeOrClone(block, stateAfter);
2750
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1140 addToWorkList(block);
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1141
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
1142 FixedNode result = null;
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1143 if (block.firstInstruction instanceof LoopBegin && isVisited(block)) {
2964
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
1144 result = ((LoopBegin) block.firstInstruction).loopEnd();
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1145 } else {
2964
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
1146 result = block.firstInstruction;
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1147 }
2964
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
1148
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
1149 assert result instanceof Merge || result instanceof Placeholder : result;
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
1150
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
1151 if (result instanceof Merge) {
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
1152 EndNode end = new EndNode(graph);
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
1153 //end.setNext(result);
2966
0048537e3cd7 Added input to Merge node.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2964
diff changeset
1154 ((Merge) result).addEnd(end);
2964
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
1155 result = end;
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
1156 }
5200f61105a9 Add end nodes before merge nodes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2960
diff changeset
1157 return result;
2750
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1158 }
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1159
2652
6d19b4f476db Removed more OSR handling stuff.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2650
diff changeset
1160 private Value synchronizedObject(FrameStateAccess state, RiMethod target) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1161 if (isStatic(target.accessFlags())) {
2594
092e628ddd5d changed Constant and Convert, more StoreIndexed changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2592
diff changeset
1162 Constant classConstant = new Constant(target.holder().getEncoding(Representation.JavaClass), graph);
2805
c3f64b66fc78 Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2799
diff changeset
1163 return append(classConstant);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1164 } else {
2652
6d19b4f476db Removed more OSR handling stuff.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2650
diff changeset
1165 return state.localAt(0);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1166 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1167 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1168
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1169 private void iterateAllBlocks() {
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1170 Block block;
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1171 while ((block = removeFromWorkList()) != null) {
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
1172
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
1173 // remove blocks that have no predecessors by the time it their bytecodes are parsed
2755
80b024e75b29 small fix for dead blocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 2752
diff changeset
1174 if (block.firstInstruction == null) {
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1175 markVisited(block);
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
1176 continue;
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
1177 }
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
1178
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1179 if (!isVisited(block)) {
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1180 markVisited(block);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1181 // now parse the block
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1182 frameState.initializeFrom(((StateSplit) block.firstInstruction).stateBefore());
2746
05c92e53a50d merge and clone before connecting blocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 2741
diff changeset
1183 lastInstr = block.firstInstruction;
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1184 assert block.firstInstruction.next() == null : "instructions already appended at block " + block.blockID;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1185
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1186 if (block == returnBlock) {
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1187 createReturnBlock(block);
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1188 } else if (block == unwindBlock) {
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1189 createUnwindBlock(block);
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1190 } else if (block instanceof ExceptionBlock) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1191 createExceptionDispatch((ExceptionBlock) block);
2927
f9c6d9bc4fbc RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents: 2926
diff changeset
1192 } else if (block instanceof DeoptBlock) {
f9c6d9bc4fbc RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents: 2926
diff changeset
1193 createDeoptBlock((DeoptBlock) block);
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1194 } else {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1195 iterateBytecodesForBlock(block);
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1196 }
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1197 }
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1198 }
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1199 for (Block b : blocksVisited) {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1200 if (b.isLoopHeader) {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1201 LoopBegin begin = (LoopBegin) b.firstInstruction;
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1202 LoopEnd end = begin.loopEnd();
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1203
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1204 // This can happen with degenerated loops like this one:
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1205 // for (;;) {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1206 // try {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1207 // break;
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1208 // } catch (UnresolvedException iioe) {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1209 // }
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1210 // }
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1211 if (end.stateBefore() != null) {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1212 begin.stateBefore().merge(begin, end.stateBefore());
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1213 } else {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1214 end.delete();
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1215 Merge merge = new Merge(graph);
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1216 merge.successors().setAndClear(merge.nextIndex(), begin, begin.nextIndex());
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1217 begin.replace(merge);
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1218 }
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1219 }
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1220 }
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1221 }
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1222
2927
f9c6d9bc4fbc RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents: 2926
diff changeset
1223 private void createDeoptBlock(DeoptBlock block) {
2928
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
1224 // Merge x = new Merge(graph);
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
1225 // x.setStateBefore(((StateSplit) block.firstInstruction).stateBefore());
1e13559b112d small fix in deopt stub, more branch prediction code
Lukas Stadler <lukas.stadler@jku.at>
parents: 2927
diff changeset
1226 // append(x);
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
1227 append(new Deoptimize(DeoptAction.InvalidateReprofile, graph));
2927
f9c6d9bc4fbc RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents: 2926
diff changeset
1228 }
f9c6d9bc4fbc RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents: 2926
diff changeset
1229
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1230 private void createUnwindBlock(Block block) {
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1231 if (Modifier.isSynchronized(method.accessFlags())) {
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1232 genMonitorExit(methodSynchronizedObject);
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1233 }
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1234 append(graph.createUnwind(frameState.apop()));
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1235 }
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1236
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1237 private void createReturnBlock(Block block) {
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1238 if (method.isConstructor() && method.holder().superType() == null) {
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1239 callRegisterFinalizer();
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1240 }
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1241 CiKind returnKind = method.signature().returnKind().stackKind();
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1242 Value x = returnKind == CiKind.Void ? null : frameState.pop(returnKind);
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1243 assert frameState.stackSize() == 0;
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1244
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1245 if (Modifier.isSynchronized(method.accessFlags())) {
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1246 genMonitorExit(methodSynchronizedObject);
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1247 }
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1248 append(graph.createReturn(x));
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1249 }
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1250
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1251 private void createExceptionDispatch(ExceptionBlock block) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1252 if (block.handler == null) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1253 assert frameState.stackSize() == 1 : "only exception object expected on stack, actual size: " + frameState.stackSize();
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1254 createUnwindBlock(block);
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1255 } else {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1256 assert frameState.stackSize() == 1;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1257
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1258 Block nextBlock = block.next == null ? unwindBlock() : block.next;
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1259 if (block.handler.catchType().isResolved()) {
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
1260 FixedNode catchSuccessor = createTarget(blockFromBci[block.handler.handlerBCI()], frameState);
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
1261 FixedNode nextDispatch = createTarget(nextBlock, frameState);
2774
93fd92c9f8b0 Removed usage of stateAfter on BlockEnd instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2773
diff changeset
1262 append(new ExceptionDispatch(frameState.stackAt(0), catchSuccessor, nextDispatch, block.handler.catchType(), graph));
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1263 } else {
2935
9b8f30608e62 deoptimization action (invalidate, reprofile, ...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 2928
diff changeset
1264 Deoptimize deopt = new Deoptimize(DeoptAction.InvalidateRecompile, graph);
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1265 deopt.setMessage("unresolved " + block.handler.catchType().name());
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1266 append(deopt);
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
1267 FixedNode nextDispatch = createTarget(nextBlock, frameState);
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1268 appendGoto(nextDispatch);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1269 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1270 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1271 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1272
2967
60a58915c94d Removed next pointer from EndNode to Merge. New scheduler.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2966
diff changeset
1273 private void appendGoto(FixedNode target) {
2820
2b8ef0a06391 Clean up in the graph builder.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2805
diff changeset
1274 lastInstr.setNext(target);
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1275 }
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1276
2775
3b73b230b86b Removed more stateAfter usages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2774
diff changeset
1277 private void iterateBytecodesForBlock(Block block) {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
1278 assert frameState != null;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1279
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1280 stream.setBCI(block.startBci);
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1281
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1282 int endBCI = stream.endBCI();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1283 boolean blockStart = true;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1284
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1285 int bci = block.startBci;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1286 while (bci < endBCI) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1287 Block nextBlock = blockFromBci[bci];
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1288 if (nextBlock != null && nextBlock != block) {
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1289 assert !nextBlock.isExceptionEntry;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1290 // we fell through to the next block, add a goto and break
2840
75e0d39833a0 new CompilerGraph, create only one Return and one Unwind per CompilerGraph
Lukas Stadler <lukas.stadler@jku.at>
parents: 2837
diff changeset
1291 appendGoto(createTarget(nextBlock, frameState));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1292 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1293 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1294 // read the opcode
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1295 int opcode = stream.currentBC();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1296
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1297 traceState();
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1298 traceInstruction(bci, opcode, blockStart);
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1299 processBytecode(bci, opcode);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1300
2945
41318fcb6b56 Added two algorithms for identifying Java-level blocks.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2944
diff changeset
1301 if (IdentifyBlocksPhase.isBlockEnd(lastInstr) || lastInstr.next() != null) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1302 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1303 }
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1304
2640
9e30cf6dcf96 More frame state fixes. All jtt tests passing now again.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2639
diff changeset
1305 stream.next();
9e30cf6dcf96 More frame state fixes. All jtt tests passing now again.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2639
diff changeset
1306 bci = stream.currentBCI();
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1307 if (lastInstr instanceof StateSplit) {
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1308 StateSplit stateSplit = (StateSplit) lastInstr;
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1309 if (stateSplit.stateAfter() == null && stateSplit.needsStateAfter()) {
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1310 stateSplit.setStateAfter(frameState.create(bci));
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1311 }
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1312 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1313 blockStart = false;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1314 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1315 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1316
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1317 private void traceState() {
2888
224412c24426 Changed C1X=>Graal and c1x=>graal in Java code.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2881
diff changeset
1318 if (GraalOptions.TraceBytecodeParserLevel >= TRACELEVEL_STATE && !TTY.isSuppressed()) {
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1319 log.println(String.format("| state [nr locals = %d, stack depth = %d, method = %s]", frameState.localsSize(), frameState.stackSize(), method));
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
1320 for (int i = 0; i < frameState.localsSize(); ++i) {
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
1321 Value value = frameState.localAt(i);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1322 log.println(String.format("| local[%d] = %-8s : %s", i, value == null ? "bogus" : value.kind.javaName, value));
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1323 }
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
1324 for (int i = 0; i < frameState.stackSize(); ++i) {
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
1325 Value value = frameState.stackAt(i);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1326 log.println(String.format("| stack[%d] = %-8s : %s", i, value == null ? "bogus" : value.kind.javaName, value));
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1327 }
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
1328 for (int i = 0; i < frameState.locksSize(); ++i) {
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
1329 Value value = frameState.lockAt(i);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1330 log.println(String.format("| lock[%d] = %-8s : %s", i, value == null ? "bogus" : value.kind.javaName, value));
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1331 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1332 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1333 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1334
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1335 private void processBytecode(int bci, int opcode) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1336 int cpi;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1337
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1338 // Checkstyle: stop
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1339 switch (opcode) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1340 case NOP : /* nothing to do */ break;
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1341 case ACONST_NULL : frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1342 case ICONST_M1 : frameState.ipush(appendConstant(CiConstant.INT_MINUS_1)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1343 case ICONST_0 : frameState.ipush(appendConstant(CiConstant.INT_0)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1344 case ICONST_1 : frameState.ipush(appendConstant(CiConstant.INT_1)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1345 case ICONST_2 : frameState.ipush(appendConstant(CiConstant.INT_2)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1346 case ICONST_3 : frameState.ipush(appendConstant(CiConstant.INT_3)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1347 case ICONST_4 : frameState.ipush(appendConstant(CiConstant.INT_4)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1348 case ICONST_5 : frameState.ipush(appendConstant(CiConstant.INT_5)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1349 case LCONST_0 : frameState.lpush(appendConstant(CiConstant.LONG_0)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1350 case LCONST_1 : frameState.lpush(appendConstant(CiConstant.LONG_1)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1351 case FCONST_0 : frameState.fpush(appendConstant(CiConstant.FLOAT_0)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1352 case FCONST_1 : frameState.fpush(appendConstant(CiConstant.FLOAT_1)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1353 case FCONST_2 : frameState.fpush(appendConstant(CiConstant.FLOAT_2)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1354 case DCONST_0 : frameState.dpush(appendConstant(CiConstant.DOUBLE_0)); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1355 case DCONST_1 : frameState.dpush(appendConstant(CiConstant.DOUBLE_1)); break;
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1356 case BIPUSH : frameState.ipush(appendConstant(CiConstant.forInt(stream.readByte()))); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1357 case SIPUSH : frameState.ipush(appendConstant(CiConstant.forInt(stream.readShort()))); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1358 case LDC : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1359 case LDC_W : // fall through
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1360 case LDC2_W : genLoadConstant(stream.readCPI()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1361 case ILOAD : loadLocal(stream.readLocalIndex(), CiKind.Int); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1362 case LLOAD : loadLocal(stream.readLocalIndex(), CiKind.Long); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1363 case FLOAD : loadLocal(stream.readLocalIndex(), CiKind.Float); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1364 case DLOAD : loadLocal(stream.readLocalIndex(), CiKind.Double); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1365 case ALOAD : loadLocal(stream.readLocalIndex(), CiKind.Object); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1366 case ILOAD_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1367 case ILOAD_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1368 case ILOAD_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1369 case ILOAD_3 : loadLocal(opcode - ILOAD_0, CiKind.Int); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1370 case LLOAD_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1371 case LLOAD_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1372 case LLOAD_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1373 case LLOAD_3 : loadLocal(opcode - LLOAD_0, CiKind.Long); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1374 case FLOAD_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1375 case FLOAD_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1376 case FLOAD_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1377 case FLOAD_3 : loadLocal(opcode - FLOAD_0, CiKind.Float); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1378 case DLOAD_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1379 case DLOAD_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1380 case DLOAD_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1381 case DLOAD_3 : loadLocal(opcode - DLOAD_0, CiKind.Double); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1382 case ALOAD_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1383 case ALOAD_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1384 case ALOAD_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1385 case ALOAD_3 : loadLocal(opcode - ALOAD_0, CiKind.Object); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1386 case IALOAD : genLoadIndexed(CiKind.Int ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1387 case LALOAD : genLoadIndexed(CiKind.Long ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1388 case FALOAD : genLoadIndexed(CiKind.Float ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1389 case DALOAD : genLoadIndexed(CiKind.Double); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1390 case AALOAD : genLoadIndexed(CiKind.Object); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1391 case BALOAD : genLoadIndexed(CiKind.Byte ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1392 case CALOAD : genLoadIndexed(CiKind.Char ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1393 case SALOAD : genLoadIndexed(CiKind.Short ); break;
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1394 case ISTORE : storeLocal(CiKind.Int, stream.readLocalIndex()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1395 case LSTORE : storeLocal(CiKind.Long, stream.readLocalIndex()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1396 case FSTORE : storeLocal(CiKind.Float, stream.readLocalIndex()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1397 case DSTORE : storeLocal(CiKind.Double, stream.readLocalIndex()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1398 case ASTORE : storeLocal(CiKind.Object, stream.readLocalIndex()); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1399 case ISTORE_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1400 case ISTORE_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1401 case ISTORE_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1402 case ISTORE_3 : storeLocal(CiKind.Int, opcode - ISTORE_0); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1403 case LSTORE_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1404 case LSTORE_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1405 case LSTORE_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1406 case LSTORE_3 : storeLocal(CiKind.Long, opcode - LSTORE_0); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1407 case FSTORE_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1408 case FSTORE_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1409 case FSTORE_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1410 case FSTORE_3 : storeLocal(CiKind.Float, opcode - FSTORE_0); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1411 case DSTORE_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1412 case DSTORE_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1413 case DSTORE_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1414 case DSTORE_3 : storeLocal(CiKind.Double, opcode - DSTORE_0); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1415 case ASTORE_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1416 case ASTORE_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1417 case ASTORE_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1418 case ASTORE_3 : storeLocal(CiKind.Object, opcode - ASTORE_0); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1419 case IASTORE : genStoreIndexed(CiKind.Int ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1420 case LASTORE : genStoreIndexed(CiKind.Long ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1421 case FASTORE : genStoreIndexed(CiKind.Float ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1422 case DASTORE : genStoreIndexed(CiKind.Double); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1423 case AASTORE : genStoreIndexed(CiKind.Object); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1424 case BASTORE : genStoreIndexed(CiKind.Byte ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1425 case CASTORE : genStoreIndexed(CiKind.Char ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1426 case SASTORE : genStoreIndexed(CiKind.Short ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1427 case POP : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1428 case POP2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1429 case DUP : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1430 case DUP_X1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1431 case DUP_X2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1432 case DUP2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1433 case DUP2_X1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1434 case DUP2_X2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1435 case SWAP : stackOp(opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1436 case IADD : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1437 case ISUB : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1438 case IMUL : genArithmeticOp(CiKind.Int, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1439 case IDIV : // fall through
2622
91d3952f7eb7 Framestate work : using stateAFter and reducting the number of nodes with framestates. Intermediate state (does not pass tests)
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2621
diff changeset
1440 case IREM : genArithmeticOp(CiKind.Int, opcode, true); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1441 case LADD : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1442 case LSUB : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1443 case LMUL : genArithmeticOp(CiKind.Long, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1444 case LDIV : // fall through
2622
91d3952f7eb7 Framestate work : using stateAFter and reducting the number of nodes with framestates. Intermediate state (does not pass tests)
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2621
diff changeset
1445 case LREM : genArithmeticOp(CiKind.Long, opcode, true); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1446 case FADD : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1447 case FSUB : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1448 case FMUL : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1449 case FDIV : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1450 case FREM : genArithmeticOp(CiKind.Float, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1451 case DADD : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1452 case DSUB : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1453 case DMUL : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1454 case DDIV : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1455 case DREM : genArithmeticOp(CiKind.Double, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1456 case INEG : genNegateOp(CiKind.Int); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1457 case LNEG : genNegateOp(CiKind.Long); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1458 case FNEG : genNegateOp(CiKind.Float); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1459 case DNEG : genNegateOp(CiKind.Double); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1460 case ISHL : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1461 case ISHR : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1462 case IUSHR : genShiftOp(CiKind.Int, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1463 case IAND : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1464 case IOR : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1465 case IXOR : genLogicOp(CiKind.Int, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1466 case LSHL : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1467 case LSHR : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1468 case LUSHR : genShiftOp(CiKind.Long, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1469 case LAND : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1470 case LOR : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1471 case LXOR : genLogicOp(CiKind.Long, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1472 case IINC : genIncrement(); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1473 case I2L : genConvert(opcode, CiKind.Int , CiKind.Long ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1474 case I2F : genConvert(opcode, CiKind.Int , CiKind.Float ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1475 case I2D : genConvert(opcode, CiKind.Int , CiKind.Double); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1476 case L2I : genConvert(opcode, CiKind.Long , CiKind.Int ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1477 case L2F : genConvert(opcode, CiKind.Long , CiKind.Float ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1478 case L2D : genConvert(opcode, CiKind.Long , CiKind.Double); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1479 case F2I : genConvert(opcode, CiKind.Float , CiKind.Int ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1480 case F2L : genConvert(opcode, CiKind.Float , CiKind.Long ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1481 case F2D : genConvert(opcode, CiKind.Float , CiKind.Double); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1482 case D2I : genConvert(opcode, CiKind.Double, CiKind.Int ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1483 case D2L : genConvert(opcode, CiKind.Double, CiKind.Long ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1484 case D2F : genConvert(opcode, CiKind.Double, CiKind.Float ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1485 case I2B : genConvert(opcode, CiKind.Int , CiKind.Byte ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1486 case I2C : genConvert(opcode, CiKind.Int , CiKind.Char ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1487 case I2S : genConvert(opcode, CiKind.Int , CiKind.Short ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1488 case LCMP : genCompareOp(CiKind.Long, opcode, CiKind.Int); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1489 case FCMPL : genCompareOp(CiKind.Float, opcode, CiKind.Int); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1490 case FCMPG : genCompareOp(CiKind.Float, opcode, CiKind.Int); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1491 case DCMPL : genCompareOp(CiKind.Double, opcode, CiKind.Int); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1492 case DCMPG : genCompareOp(CiKind.Double, opcode, CiKind.Int); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1493 case IFEQ : genIfZero(Condition.EQ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1494 case IFNE : genIfZero(Condition.NE); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1495 case IFLT : genIfZero(Condition.LT); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1496 case IFGE : genIfZero(Condition.GE); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1497 case IFGT : genIfZero(Condition.GT); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1498 case IFLE : genIfZero(Condition.LE); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1499 case IF_ICMPEQ : genIfSame(CiKind.Int, Condition.EQ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1500 case IF_ICMPNE : genIfSame(CiKind.Int, Condition.NE); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1501 case IF_ICMPLT : genIfSame(CiKind.Int, Condition.LT); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1502 case IF_ICMPGE : genIfSame(CiKind.Int, Condition.GE); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1503 case IF_ICMPGT : genIfSame(CiKind.Int, Condition.GT); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1504 case IF_ICMPLE : genIfSame(CiKind.Int, Condition.LE); break;
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1505 case IF_ACMPEQ : genIfSame(frameState.peekKind(), Condition.EQ); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1506 case IF_ACMPNE : genIfSame(frameState.peekKind(), Condition.NE); break;
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1507 case GOTO : genGoto(stream.currentBCI(), stream.readBranchDest()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1508 case JSR : genJsr(stream.readBranchDest()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1509 case RET : genRet(stream.readLocalIndex()); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1510 case TABLESWITCH : genTableswitch(); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1511 case LOOKUPSWITCH : genLookupswitch(); break;
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1512 case IRETURN : genReturn(frameState.ipop()); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1513 case LRETURN : genReturn(frameState.lpop()); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1514 case FRETURN : genReturn(frameState.fpop()); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1515 case DRETURN : genReturn(frameState.dpop()); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1516 case ARETURN : genReturn(frameState.apop()); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1517 case RETURN : genReturn(null ); break;
2842
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1518 case GETSTATIC : cpi = stream.readCPI(); genGetStatic(cpi, constantPool.lookupField(cpi, opcode)); break;
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1519 case PUTSTATIC : cpi = stream.readCPI(); genPutStatic(cpi, constantPool.lookupField(cpi, opcode)); break;
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1520 case GETFIELD : cpi = stream.readCPI(); genGetField(cpi, constantPool.lookupField(cpi, opcode)); break;
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1521 case PUTFIELD : cpi = stream.readCPI(); genPutField(cpi, constantPool.lookupField(cpi, opcode)); break;
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1522 case INVOKEVIRTUAL : cpi = stream.readCPI(); genInvokeVirtual(constantPool.lookupMethod(cpi, opcode), cpi, constantPool); break;
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1523 case INVOKESPECIAL : cpi = stream.readCPI(); genInvokeSpecial(constantPool.lookupMethod(cpi, opcode), null, cpi, constantPool); break;
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1524 case INVOKESTATIC : cpi = stream.readCPI(); genInvokeStatic(constantPool.lookupMethod(cpi, opcode), cpi, constantPool); break;
7596ae867a7b basic inlining passes all tests, including optimistic inlining
Lukas Stadler <lukas.stadler@jku.at>
parents: 2840
diff changeset
1525 case INVOKEINTERFACE: cpi = stream.readCPI(); genInvokeInterface(constantPool.lookupMethod(cpi, opcode), cpi, constantPool); break;
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1526 case NEW : genNewInstance(stream.readCPI()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1527 case NEWARRAY : genNewTypeArray(stream.readLocalIndex()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1528 case ANEWARRAY : genNewObjectArray(stream.readCPI()); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1529 case ARRAYLENGTH : genArrayLength(); break;
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1530 case ATHROW : genThrow(stream.currentBCI()); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1531 case CHECKCAST : genCheckCast(); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1532 case INSTANCEOF : genInstanceOf(); break;
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1533 case MONITORENTER : genMonitorEnter(frameState.apop(), stream.currentBCI()); break;
2784
e62cfea1c134 Simplified fillSyncHandler. Fixed LIRGenerator visitUnwind.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2783
diff changeset
1534 case MONITOREXIT : genMonitorExit(frameState.apop()); break;
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1535 case MULTIANEWARRAY : genNewMultiArray(stream.readCPI()); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1536 case IFNULL : genIfNull(Condition.EQ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1537 case IFNONNULL : genIfNull(Condition.NE); break;
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1538 case GOTO_W : genGoto(stream.currentBCI(), stream.readFarBranchDest()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1539 case JSR_W : genJsr(stream.readFarBranchDest()); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1540 case BREAKPOINT:
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1541 throw new CiBailout("concurrent setting of breakpoint");
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1542 default:
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1543 throw new CiBailout("Unsupported opcode " + opcode + " (" + nameOf(opcode) + ") [bci=" + bci + "]");
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1544 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1545 // Checkstyle: resume
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1546 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1547
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1548 private void traceInstruction(int bci, int opcode, boolean blockStart) {
2888
224412c24426 Changed C1X=>Graal and c1x=>graal in Java code.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2881
diff changeset
1549 if (GraalOptions.TraceBytecodeParserLevel >= TRACELEVEL_INSTRUCTIONS && !TTY.isSuppressed()) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1550 StringBuilder sb = new StringBuilder(40);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1551 sb.append(blockStart ? '+' : '|');
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1552 if (bci < 10) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1553 sb.append(" ");
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1554 } else if (bci < 100) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1555 sb.append(' ');
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1556 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1557 sb.append(bci).append(": ").append(Bytecodes.nameOf(opcode));
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1558 for (int i = bci + 1; i < stream.nextBCI(); ++i) {
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1559 sb.append(' ').append(stream.readUByte(i));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1560 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1561 log.println(sb.toString());
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1562 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1563 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1564
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1565 private void genArrayLength() {
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1566 frameState.ipush(append(new ArrayLength(frameState.apop(), graph)));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1567 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1568
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1569 /**
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1570 * Adds a block to the worklist, if it is not already in the worklist.
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1571 * This method will keep the worklist topologically stored (i.e. the lower
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1572 * DFNs are earlier in the list).
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1573 * @param block the block to add to the work list
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1574 */
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1575 private void addToWorkList(Block block) {
2705
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
1576 if (!isOnWorkList(block)) {
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
1577 markOnWorkList(block);
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1578 sortIntoWorkList(block);
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1579 }
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1580 }
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1581
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1582 private void sortIntoWorkList(Block top) {
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1583 workList.offer(top);
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1584 }
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1585
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1586 /**
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1587 * Removes the next block from the worklist. The list is sorted topologically, so the
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1588 * block with the lowest depth first number in the list will be removed and returned.
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1589 * @return the next block from the worklist; {@code null} if there are no blocks
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1590 * in the worklist
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1591 */
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1592 private Block removeFromWorkList() {
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1593 return workList.poll();
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1594 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1595 }