annotate graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java @ 2820:2b8ef0a06391

Clean up in the graph builder.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Mon, 30 May 2011 16:24:22 +0200
parents c3f64b66fc78
children 244921d7cf50
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 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
23 package com.sun.c1x.graph;
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
2586
421da5f53b5e more Op2 changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
31 import com.oracle.graal.graph.*;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
32 import com.sun.c1x.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
33 import com.sun.c1x.debug.*;
2776
398b8fa5dc81 Removed stateAfter from BlockEnd class. Clean up.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2775
diff changeset
34 import com.sun.c1x.graph.BlockMap.*;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
35 import com.sun.c1x.ir.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
36 import com.sun.c1x.util.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
37 import com.sun.c1x.value.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
38 import com.sun.cri.bytecode.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
39 import com.sun.cri.ci.*;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
40 import com.sun.cri.ri.*;
2731
a2f62de90c76 Removed unused optimization settings. Removed unused imports.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2724
diff changeset
41 import com.sun.cri.ri.RiType.*;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
42
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
43 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
44 * 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
45 * 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
46 * numbering, inlining, constant folding, strength reduction, etc.
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 public final class GraphBuilder {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
49
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
50 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
51 * The minimum value to which {@link C1XOptions#TraceBytecodeParserLevel} must be set to trace
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
52 * the bytecode instructions as they are parsed.
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 public static final int TRACELEVEL_INSTRUCTIONS = 1;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
55
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
56 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
57 * The minimum value to which {@link C1XOptions#TraceBytecodeParserLevel} must be set to trace
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
58 * 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
59 */
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
60 public static final int TRACELEVEL_STATE = 2;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
61
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
62 private final IR ir;
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
63 private final C1XCompilation compilation;
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
64 private final CiStatistics stats;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
65
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
66 private final BytecodeStream stream; // the bytecode stream
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
67 // bci-to-block mapping
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
68 private Block[] blockFromBci;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
69 private ArrayList<Block> blockList;
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
70
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
71 // the constant pool
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
72 private final RiConstantPool constantPool;
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
73
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
74 // 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
75 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
76 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
77 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
78 }
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
79 });
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
80
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
81 // Exception handler list
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
82 private List<ExceptionHandler> exceptionHandlers;
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
83
2784
e62cfea1c134 Simplified fillSyncHandler. Fixed LIRGenerator visitUnwind.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2783
diff changeset
84 private FrameStateBuilder frameState; // the current execution state
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
85 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
86
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
87 private final LogStream log;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
88
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
89 private Value rootMethodSynchronizedObject;
2586
421da5f53b5e more Op2 changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
90
2602
0c6564c254af new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents: 2600
diff changeset
91 private final Graph graph;
2586
421da5f53b5e more Op2 changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
92
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
93 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
94 * 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
95 *
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
96 * @param compilation the compilation
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
97 * @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
98 * @param graph
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
99 */
2602
0c6564c254af new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents: 2600
diff changeset
100 public GraphBuilder(C1XCompilation compilation, IR ir, Graph graph) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
101 this.compilation = compilation;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
102 this.ir = ir;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
103 this.stats = compilation.stats;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
104 log = C1XOptions.TraceBytecodeParserLevel > 0 ? new LogStream(TTY.out()) : null;
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
105 stream = new BytecodeStream(compilation.method.code());
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
106 constantPool = compilation.runtime.getConstantPool(compilation.method);
2602
0c6564c254af new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents: 2600
diff changeset
107 this.graph = graph;
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
108 this.frameState = new FrameStateBuilder(compilation.method, graph);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
109 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
110
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
111 /**
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
112 * Builds the graph for a the specified {@code IRScope}.
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
113 * @param scope the top IRScope
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
114 */
2564
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2563
diff changeset
115 public void build() {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
116 RiMethod rootMethod = compilation.method;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
117
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
118 if (log != null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
119 log.println();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
120 log.println("Compiling " + compilation.method);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
121 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
122
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
123 // 2. compute the block map, setup exception handlers and get the entrypoint(s)
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
124 BlockMap blockMap = compilation.getBlockMap(rootMethod);
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
125
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
126 blockList = new ArrayList<Block>(blockMap.blocks);
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
127 blockFromBci = new Block[rootMethod.code().length];
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
128 for (int i = 0; i < blockList.size(); i++) {
2749
36440e516e44 block entry instructions created on-demand
Lukas Stadler <lukas.stadler@jku.at>
parents: 2747
diff changeset
129 int blockID = ir.nextBlockNumber();
36440e516e44 block entry instructions created on-demand
Lukas Stadler <lukas.stadler@jku.at>
parents: 2747
diff changeset
130 assert blockID == i;
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
131 Block block = blockList.get(i);
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
132 if (block.startBci >= 0) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
133 blockFromBci[block.startBci] = block;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
134 }
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
135 // System.out.println("block " + blockID + " @ " + block.startBci);
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
136 }
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
137
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
138 RiExceptionHandler[] handlers = rootMethod.exceptionHandlers();
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
139 if (handlers != null && handlers.length > 0) {
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
140 exceptionHandlers = new ArrayList<ExceptionHandler>(handlers.length);
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
141 for (RiExceptionHandler ch : handlers) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
142 Block entry = blockFromBci[ch.handlerBCI()];
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
143 // entry == null means that the exception handler is unreachable according to the BlockMap conservative analysis
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
144 if (entry != null) {
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
145 ExceptionHandler h = new ExceptionHandler(ch);
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
146 h.setEntryBlock(entry);
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
147 exceptionHandlers.add(h);
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
148 }
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
149 }
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
150 }
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
151
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
152 // 1. create the start block
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
153 Block startBlock = nextBlock(Instruction.SYNCHRONIZATION_ENTRY_BCI);
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
154 markOnWorkList(startBlock);
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
155 lastInstr = createTarget(startBlock, frameState);
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
156 graph.start().setStart(lastInstr);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
157
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
158 Block syncBlock = null;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
159 if (isSynchronized(rootMethod.accessFlags())) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
160 // 4A.1 add a monitor enter to the start block
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
161 rootMethodSynchronizedObject = synchronizedObject(frameState, compilation.method);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
162 genMonitorEnter(rootMethodSynchronizedObject, Instruction.SYNCHRONIZATION_ENTRY_BCI);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
163 // 4A.2 finish the start block
2746
05c92e53a50d merge and clone before connecting blocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 2741
diff changeset
164 finishStartBlock(startBlock);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
165
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
166 // 4A.3 setup an exception handler to unlock the root method synchronized object
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
167 syncBlock = nextBlock(Instruction.SYNCHRONIZATION_ENTRY_BCI);
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
168 markOnWorkList(syncBlock);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
169
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
170 ExceptionHandler h = new ExceptionHandler(new CiExceptionHandler(0, rootMethod.code().length, -1, 0, null));
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
171 h.setEntryBlock(syncBlock);
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
172 addExceptionHandler(h);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
173 } else {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
174 // 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
175 finishStartBlock(startBlock);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
176 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
177
2519
f6125fb5bfbc Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2516
diff changeset
178 // 5. SKIPPED: look for intrinsics
f6125fb5bfbc Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2516
diff changeset
179
f6125fb5bfbc Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2516
diff changeset
180 // 6B.1 do the normal parsing
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
181 addToWorkList(blockFromBci[0]);
2519
f6125fb5bfbc Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2516
diff changeset
182 iterateAllBlocks();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
183
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
184 if (syncBlock != null && syncBlock.firstInstruction != null) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
185 // generate unlocking code if the exception handler is reachable
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
186 fillSyncHandler(rootMethodSynchronizedObject, syncBlock);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
187 }
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
188
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
189 for (Node n : graph.getNodes()) {
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
190 if (n instanceof Placeholder) {
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
191 Placeholder p = (Placeholder) n;
2790
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
192 assert p.blockPredecessors().size() == 1;
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
193 Node pred = p.blockPredecessors().get(0);
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
194 int predIndex = p.predecessorsIndex().get(0);
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
195 pred.successors().setAndClear(predIndex, p, 0);
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
196 p.delete();
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
197 }
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
198 }
2783
9bc0c2eb00d6 Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2781
diff changeset
199
9bc0c2eb00d6 Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2781
diff changeset
200 for (Node n : graph.getNodes()) {
9bc0c2eb00d6 Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2781
diff changeset
201 assert !(n instanceof Placeholder);
9bc0c2eb00d6 Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2781
diff changeset
202 }
9bc0c2eb00d6 Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2781
diff changeset
203
9bc0c2eb00d6 Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2781
diff changeset
204
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 boolean delete = false;
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
208 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
209 delete = true;
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
210 }
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
211 // if (n.predecessors().size() == 0 && n.usages().size() == 1 && n.usages().get(0) instanceof BlockBegin) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
212 // n.usages().get(0).inputs().replace(n, null);
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
213 // delete = true;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
214 // }
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
215 if (delete) {
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
216 n.delete();
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
217 }
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
218 }
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
219 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
220 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
221
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
222 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
223 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
224 block.startBci = bci;
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
225 block.endBci = bci;
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
226 block.blockID = ir.nextBlockNumber();
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
227 return block;
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
228 }
2705
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
229
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
230 private Set<Block> blocksOnWorklist = new HashSet<Block>();
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
231
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
232 private void markOnWorkList(Block block) {
2705
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
233 blocksOnWorklist.add(block);
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
234 }
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
235
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
236 private boolean isOnWorkList(Block block) {
2705
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
237 return blocksOnWorklist.contains(block);
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
238 }
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
239
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
240 private Set<Block> blocksVisited = new HashSet<Block>();
2706
5a784215351a Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2705
diff changeset
241
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
242 private void markVisited(Block block) {
2706
5a784215351a Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2705
diff changeset
243 blocksVisited.add(block);
5a784215351a Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2705
diff changeset
244 }
5a784215351a Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2705
diff changeset
245
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
246 private boolean isVisited(Block block) {
2706
5a784215351a Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2705
diff changeset
247 return blocksVisited.contains(block);
5a784215351a Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2705
diff changeset
248 }
5a784215351a Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2705
diff changeset
249
2746
05c92e53a50d merge and clone before connecting blocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 2741
diff changeset
250 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
251 assert bci() == 0;
2774
93fd92c9f8b0 Removed usage of stateAfter on BlockEnd instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2773
diff changeset
252 Instruction target = createTargetAt(0, frameState);
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
253 appendGoto(target);
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
254 }
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
255
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
256 public void mergeOrClone(Block target, FrameStateAccess newState) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
257 Instruction first = target.firstInstruction;
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
258 if (target.isLoopHeader && isVisited(target)) {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
259 first = ((LoopBegin) first).loopEnd();
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
260 }
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
261 assert first instanceof StateSplit;
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
262
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
263 int bci = target.startBci;
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
264
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
265 FrameState existingState = ((StateSplit) first).stateBefore();
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
266
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
267 if (existingState == null) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
268 // copy state because it is modified
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
269 FrameState duplicate = newState.duplicate(bci);
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
270
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
271 // 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
272 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
273 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
274 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
275 ((Merge) first).setStateBefore(duplicate);
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
276 } else {
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
277 ((StateSplit) first).setStateBefore(duplicate);
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
278 }
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
279 } else {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
280 if (!C1XOptions.AssumeVerifiedBytecode && !existingState.isCompatibleWith(newState)) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
281 // stacks or locks do not match--bytecodes would not verify
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
282 TTY.println(existingState.toString());
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
283 TTY.println(newState.duplicate(0).toString());
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
284 throw new CiBailout("stack or locks do not match");
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
285 }
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
286 assert existingState.localsSize() == newState.localsSize();
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
287 assert existingState.stackSize() == newState.stackSize();
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
288
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
289 if (first instanceof Placeholder) {
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
290 assert !target.isLoopHeader;
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
291 Merge merge = new Merge(graph);
2790
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
292
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
293 Placeholder p = (Placeholder) first;
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
294 assert p.next() == null;
50677668afe3 Towards making goto removal work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2789
diff changeset
295 p.replace(merge);
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
296 target.firstInstruction = merge;
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
297 merge.setStateBefore(existingState);
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
298 first = merge;
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
299 }
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
300
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
301 existingState.merge((Merge) first, newState);
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
302 }
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
303
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
304 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
305 if (frameState.valueAt(j) != null) {
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
306 assert !frameState.valueAt(j).isDeleted();
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
307 }
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
308 }
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
309 }
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
310
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
311 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
312 int stackSize = newState.stackSize();
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
313 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
314 // 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
315 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
316 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
317 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
318 }
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
319 }
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
320 int localsSize = newState.localsSize();
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
321 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
322 Value x = newState.localAt(i);
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
323 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
324 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
325 }
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
326 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
327 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
328
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
329 public RiMethod method() {
2564
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2563
diff changeset
330 return compilation.method;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
331 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
332
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
333 public BytecodeStream stream() {
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
334 return stream;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
335 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
336
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
337 public int bci() {
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
338 return stream.currentBCI();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
339 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
340
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
341 private void loadLocal(int index, CiKind kind) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
342 frameState.push(kind, frameState.loadLocal(index));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
343 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
344
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
345 private void storeLocal(CiKind kind, int index) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
346 frameState.storeLocal(index, frameState.pop(kind));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
347 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
348
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
349 private void handleException(Instruction x, int bci) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
350 if (!hasHandler()) {
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
351 return;
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
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
354 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
355
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
356 ExceptionHandler firstHandler = null;
2564
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2563
diff changeset
357 // join with all potential exception handlers
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
358 if (this.exceptionHandlers != null) {
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
359 for (ExceptionHandler handler : this.exceptionHandlers) {
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
360 // if the handler covers this bytecode index, add it to the list
2564
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2563
diff changeset
361 if (handler.covers(bci)) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
362 firstHandler = new ExceptionHandler(handler);
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
363 break;
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 }
2564
274360f98f97 Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2563
diff changeset
366 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
367
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
368 if (firstHandler != null) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
369 compilation.setHasExceptionHandlers();
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
370
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
371 Block dispatchBlock = null;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
372 for (Block block : blockList) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
373 if (block instanceof ExceptionBlock) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
374 ExceptionBlock excBlock = (ExceptionBlock) block;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
375 if (excBlock.handler == firstHandler.handler) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
376 dispatchBlock = block;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
377 break;
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
378 }
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
379 }
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
380 }
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
381 // 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
382 if (dispatchBlock == null) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
383 assert firstHandler.isCatchAll();
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
384 dispatchBlock = firstHandler.entryBlock();
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
385 }
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
386 FrameState entryState = frameState.duplicateWithEmptyStack(bci);
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
387
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
388 StateSplit entry = new Placeholder(graph);
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
389 entry.setStateBefore(entryState);
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
390 ExceptionObject exception = new ExceptionObject(graph);
2820
2b8ef0a06391 Clean up in the graph builder.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2805
diff changeset
391 entry.setNext(exception);
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
392 FrameState stateWithException = entryState.duplicateModified(bci, CiKind.Void, exception);
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
393
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
394 Instruction successor = createTarget(dispatchBlock, stateWithException);
2796
d6bf240963fb Rename Goto to Anchor
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2793
diff changeset
395 BlockEnd end = new Anchor(successor, graph);
2820
2b8ef0a06391 Clean up in the graph builder.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2805
diff changeset
396 exception.setNext(end);
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
397 if (x instanceof Invoke) {
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
398 ((Invoke) x).setExceptionEdge(entry);
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
399 } else {
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
400 ((Throw) x).setExceptionEdge(entry);
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
401 }
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
402 }
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
403 }
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
404
2657
4a6518c4d17d Removed need for base instruction. Cleanup.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2652
diff changeset
405 private void genLoadConstant(int cpi) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
406 Object con = constantPool().lookupConstant(cpi);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
407
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
408 if (con instanceof RiType) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
409 // 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
410 RiType riType = (RiType) con;
2650
ccab1d5f345e Removed TestPatching option.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2649
diff changeset
411 if (!riType.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
412 append(new Deoptimize(graph));
2671
d8601d421b96 New Deoptimize node, remove ResolveClass node and replace it with deoptimization
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2669
diff changeset
413 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
414 } else {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
415 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
416 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
417 } else if (con instanceof CiConstant) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
418 CiConstant constant = (CiConstant) con;
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
419 frameState.push(constant.kind.stackKind(), appendConstant(constant));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
420 } else {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
421 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
422 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
423 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
424
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
425 private void genLoadIndexed(CiKind kind) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
426 Value index = frameState.ipop();
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
427 Value array = frameState.apop();
2644
4694daa6af3a Removed CSE array length.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2643
diff changeset
428 Value length = append(new ArrayLength(array, graph));
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
429 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
430 frameState.push(kind.stackKind(), v);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
431 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
432
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
433 private void genStoreIndexed(CiKind kind) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
434 Value value = frameState.pop(kind.stackKind());
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
435 Value index = frameState.ipop();
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
436 Value array = frameState.apop();
2644
4694daa6af3a Removed CSE array length.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2643
diff changeset
437 Value length = append(new ArrayLength(array, graph));
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
438 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
439 append(result);
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
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
442 private void stackOp(int opcode) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
443 switch (opcode) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
444 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
445 frameState.xpop();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
446 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
447 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
448 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
449 frameState.xpop();
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
450 frameState.xpop();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
451 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
452 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
453 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
454 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
455 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
456 frameState.xpush(w);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
457 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
458 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
459 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
460 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
461 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
462 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
463 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
464 frameState.xpush(w1);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
465 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
466 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
467 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
468 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
469 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
470 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
471 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
472 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
473 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
474 frameState.xpush(w1);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
475 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
476 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
477 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
478 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
479 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
480 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
481 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
482 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
483 frameState.xpush(w1);
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 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
487 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
488 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
489 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
490 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
491 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
492 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
493 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
494 frameState.xpush(w1);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
495 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
496 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
497 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
498 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
499 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
500 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
501 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
502 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
503 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
504 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
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 SWAP: {
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(w1);
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(w2);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
515 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
516 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
517 default:
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
518 throw Util.shouldNotReachHere();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
519 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
520
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
521 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
522
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
523 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
524 genArithmeticOp(kind, opcode, false);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
525 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
526
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
527 private void genArithmeticOp(CiKind kind, int opcode, boolean canTrap) {
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
528 genArithmeticOp(kind, opcode, kind, kind, canTrap);
2507
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
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
531 private void genArithmeticOp(CiKind result, int opcode, CiKind x, CiKind y, boolean canTrap) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
532 Value yValue = frameState.pop(y);
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
533 Value xValue = frameState.pop(x);
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
534 Value result1 = append(new ArithmeticOp(opcode, result, xValue, yValue, isStrict(method().accessFlags()), canTrap, graph));
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
535 frameState.push(result, result1);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
536 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
537
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
538 private void genNegateOp(CiKind kind) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
539 frameState.push(kind, append(new NegateOp(frameState.pop(kind), graph)));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
540 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
541
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
542 private void genShiftOp(CiKind kind, int opcode) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
543 Value s = frameState.ipop();
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
544 Value x = frameState.pop(kind);
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
545 frameState.push(kind, append(new ShiftOp(opcode, x, s, graph)));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
546 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
547
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
548 private void genLogicOp(CiKind kind, int opcode) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
549 Value y = frameState.pop(kind);
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
550 Value x = frameState.pop(kind);
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
551 frameState.push(kind, append(new LogicOp(opcode, x, y, graph)));
2507
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
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
554 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
555 Value y = frameState.pop(kind);
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
556 Value x = frameState.pop(kind);
2586
421da5f53b5e more Op2 changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2582
diff changeset
557 Value value = append(new CompareOp(opcode, resultKind, x, y, graph));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
558 if (!resultKind.isVoid()) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
559 frameState.ipush(value);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
560 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
561 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
562
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
563 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
564 CiKind tt = to.stackKind();
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
565 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
566 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
567
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
568 private void genIncrement() {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
569 int index = stream().readLocalIndex();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
570 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
571 Value x = frameState.localAt(index);
2594
092e628ddd5d changed Constant and Convert, more StoreIndexed changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2592
diff changeset
572 Value y = append(Constant.forInt(delta, graph));
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
573 frameState.storeLocal(index, append(new ArithmeticOp(IADD, CiKind.Int, x, y, isStrict(method().accessFlags()), false, graph)));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
574 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
575
2645
b2c1e959be46 Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2644
diff changeset
576 private void genGoto(int fromBCI, int toBCI) {
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
577 appendGoto(createTargetAt(toBCI, frameState));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
578 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
579
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
580 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
581 assert !x.isDeleted() && !y.isDeleted();
2774
93fd92c9f8b0 Removed usage of stateAfter on BlockEnd instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2773
diff changeset
582 If ifNode = new If(x, cond, y, graph);
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
583 append(ifNode);
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
584 Instruction tsucc = createTargetAt(stream().readBranchDest(), frameState);
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
585 ifNode.setBlockSuccessor(0, tsucc);
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
586 Instruction fsucc = createTargetAt(stream().nextBCI(), frameState);
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
587 ifNode.setBlockSuccessor(1, fsucc);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
588 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
589
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
590 private void genIfZero(Condition cond) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
591 Value y = appendConstant(CiConstant.INT_0);
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
592 Value x = frameState.ipop();
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
593 ifNode(x, cond, y);
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
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
596 private void genIfNull(Condition cond) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
597 Value y = appendConstant(CiConstant.NULL_OBJECT);
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
598 Value x = frameState.apop();
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
599 ifNode(x, cond, y);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
600 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
601
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
602 private void genIfSame(CiKind kind, Condition cond) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
603 Value y = frameState.pop(kind);
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
604 Value x = frameState.pop(kind);
2768
43ffa0e47a46 Towards removing stateAfter on BlockEnd.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2763
diff changeset
605 assert !x.isDeleted() && !y.isDeleted();
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
606 ifNode(x, cond, y);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
607 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
608
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
609 private void genThrow(int bci) {
2639
8e96b2b3a866 Added stateBefore to Throw instruction.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2634
diff changeset
610 FrameState stateBefore = frameState.create(bci);
2712
a0dd2b907806 Removed implicit safepoints.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
611 Throw t = new Throw(frameState.apop(), graph);
2639
8e96b2b3a866 Added stateBefore to Throw instruction.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2634
diff changeset
612 t.setStateBefore(stateBefore);
2716
c1a9bf38da28 Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2715
diff changeset
613 appendWithBCI(t);
c1a9bf38da28 Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2715
diff changeset
614 handleException(t, bci);
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
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
617 private void genCheckCast() {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
618 int cpi = stream().readCPI();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
619 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
620 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
621 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
622 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
623 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
624 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
625 } 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
626 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
627 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
628 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
629
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
630 private void genInstanceOf() {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
631 int cpi = stream().readCPI();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
632 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
633 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
634 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
635 Value object = frameState.apop();
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
636 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
637 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
638 } 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
639 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
640 }
2507
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
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
643 void genNewInstance(int cpi) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
644 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
645 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
646 NewInstance n = new NewInstance(type, cpi, constantPool(), 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
647 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
648 } 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
649 append(new Deoptimize(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
650 frameState.apush(appendConstant(CiConstant.NULL_OBJECT));
2634
4dd0573f510b FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2633
diff changeset
651 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
652 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
653
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
654 private void genNewTypeArray(int typeCode) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
655 CiKind kind = CiKind.fromArrayTypeCode(typeCode);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
656 RiType elementType = compilation.runtime.asRiType(kind);
2634
4dd0573f510b FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2633
diff changeset
657 NewTypeArray nta = new NewTypeArray(frameState.ipop(), elementType, graph);
4dd0573f510b FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2633
diff changeset
658 frameState.apush(append(nta));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
659 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
660
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
661 private void genNewObjectArray(int cpi) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
662 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
663 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
664 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
665 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
666 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
667 } 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
668 append(new Deoptimize(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
669 frameState.apush(appendConstant(CiConstant.NULL_OBJECT));
2634
4dd0573f510b FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2633
diff changeset
670 }
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
671
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
672 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
673
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
674 private void genNewMultiArray(int cpi) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
675 RiType type = constantPool().lookupType(cpi, MULTIANEWARRAY);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
676 int rank = stream().readUByte(bci() + 3);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
677 Value[] dims = new Value[rank];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
678 for (int i = rank - 1; i >= 0; i--) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
679 dims[i] = frameState.ipop();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
680 }
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
681 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
682 NewArray n = new NewMultiArray(type, dims, cpi, constantPool(), 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
683 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
684 } 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
685 append(new Deoptimize(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
686 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
687 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
688 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
689
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
690 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
691 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
692 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
693 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
694 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
695 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
696 } 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
697 append(new Deoptimize(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
698 frameState.push(kind.stackKind(), append(Constant.defaultForKind(kind, graph)));
2634
4dd0573f510b FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2633
diff changeset
699 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
700 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
701
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
702 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
703 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
704 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
705 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
706 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
707 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
708 } 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
709 append(new Deoptimize(graph));
2634
4dd0573f510b FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2633
diff changeset
710 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
711 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
712
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
713 private void genGetStatic(int cpi, RiField field) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
714 RiType holder = field.holder();
2650
ccab1d5f345e Removed TestPatching option.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2649
diff changeset
715 boolean isInitialized = field.isResolved();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
716 CiConstant constantValue = null;
2533
c480605ef068 Removed canonicalizer.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2521
diff changeset
717 if (isInitialized) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
718 constantValue = field.constantValue(null);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
719 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
720 if (constantValue != null) {
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
721 frameState.push(constantValue.kind.stackKind(), appendConstant(constantValue));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
722 } 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
723 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
724 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
725 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
726 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
727 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
728 } 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
729 append(new Deoptimize(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
730 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
731 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
732 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
733 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
734
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
735 private void genPutStatic(int cpi, RiField field) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
736 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
737 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
738 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
739 if (container != null) {
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
740 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
741 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
742 } 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
743 append(new Deoptimize(graph));
2671
d8601d421b96 New Deoptimize node, remove ResolveClass node and replace it with deoptimization
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2669
diff changeset
744 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
745 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
746
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
747 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
748 if (initialized) {
2673
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
749 return appendConstant(holder.getEncoding(representation));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
750 } 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
751 append(new Deoptimize(graph));
2673
98447ab8bd83 Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2671
diff changeset
752 return null;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
753 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
754 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
755
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
756 private void appendOptimizedStoreField(StoreField store) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
757 append(store);
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
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
760 private void appendOptimizedLoadField(CiKind kind, LoadField load) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
761 // append the load to the instruction
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
762 Value optimized = append(load);
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
763 frameState.push(kind.stackKind(), optimized);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
764 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
765
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
766 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
767 RiType holder = target.holder();
2650
ccab1d5f345e Removed TestPatching option.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2649
diff changeset
768 boolean isInitialized = target.isResolved() && holder.isInitialized();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
769 if (!isInitialized && C1XOptions.ResolveClassBeforeStaticInvoke) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
770 // 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
771 // 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
772 // 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
773 genTypeOrDeopt(RiType.Representation.StaticFields, holder, isInitialized, cpi);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
774 }
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
775 Value[] args = frameState.popArguments(target.signature().argumentSlots(false));
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
776 appendInvoke(INVOKESTATIC, target, args, cpi, constantPool);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
777 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
778
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
779 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
780 Value[] args = frameState.popArguments(target.signature().argumentSlots(true));
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
781 genInvokeIndirect(INVOKEINTERFACE, target, args, cpi, constantPool);
2533
c480605ef068 Removed canonicalizer.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2521
diff changeset
782
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
783 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
784
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
785 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
786 Value[] args = frameState.popArguments(target.signature().argumentSlots(true));
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
787 genInvokeIndirect(INVOKEVIRTUAL, target, args, cpi, constantPool);
2533
c480605ef068 Removed canonicalizer.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2521
diff changeset
788
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
789 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
790
2649
62306ff0ccc2 Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2647
diff changeset
791 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
792 Value[] args = frameState.popArguments(target.signature().argumentSlots(true));
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
793 invokeDirect(target, args, knownHolder, cpi, constantPool);
2533
c480605ef068 Removed canonicalizer.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2521
diff changeset
794
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
795 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
796
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
797 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
798 Value receiver = args[0];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
799 // attempt to devirtualize the call
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
800 if (target.isResolved()) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
801 RiType klass = target.holder();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
802
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
803 // 0. check for trivial cases
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
804 if (target.canBeStaticallyBound() && !isAbstract(target.accessFlags())) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
805 // 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
806 invokeDirect(target, args, target.holder(), cpi, constantPool);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
807 return;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
808 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
809 // 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
810 RiType exact = getExactType(klass, receiver);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
811 if (exact != null && exact.isResolved()) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
812 // 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
813 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
814 return;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
815 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
816 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
817 // devirtualization failed, produce an actual invokevirtual
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
818 appendInvoke(opcode, target, args, cpi, constantPool);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
819 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
820
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
821 private CiKind returnKind(RiMethod target) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
822 return target.signature().returnKind();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
823 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
824
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
825 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
826 appendInvoke(INVOKESPECIAL, target, args, cpi, constantPool);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
827 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
828
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
829 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
830 CiKind resultType = returnKind(target);
2716
c1a9bf38da28 Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2715
diff changeset
831 Invoke invoke = new Invoke(opcode, resultType.stackKind(), args, target, target.signature().returnType(compilation.method.holder()), graph);
c1a9bf38da28 Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2715
diff changeset
832 Value result = appendWithBCI(invoke);
c1a9bf38da28 Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2715
diff changeset
833 handleException(invoke, bci());
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
834 frameState.pushReturn(resultType, result);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
835 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
836
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
837 private RiType getExactType(RiType staticType, Value receiver) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
838 RiType exact = staticType.exactType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
839 if (exact == null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
840 exact = receiver.exactType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
841 if (exact == null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
842 if (receiver.isConstant()) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
843 exact = compilation.runtime.getTypeOf(receiver.asConstant());
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 if (exact == null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
846 RiType declared = receiver.declaredType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
847 exact = declared == null || !declared.isResolved() ? null : declared.exactType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
848 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
849 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
850 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
851 return exact;
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
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
854 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
855 Value receiver = frameState.loadLocal(0);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
856 RiType declaredType = receiver.declaredType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
857 RiType receiverType = declaredType;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
858 RiType exactType = receiver.exactType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
859 if (exactType == null && declaredType != null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
860 exactType = declaredType.exactType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
861 }
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
862 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
863 // the exact type isn't known, but the receiver is parameter 0 => use holder
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
864 receiverType = compilation.method.holder();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
865 exactType = receiverType.exactType();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
866 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
867 boolean needsCheck = true;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
868 if (exactType != null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
869 // we have an exact type
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
870 needsCheck = exactType.hasFinalizer();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
871 } else {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
872 // 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
873 if (declaredType != null && !declaredType.hasFinalizableSubclass()) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
874 if (compilation.recordNoFinalizableSubclassAssumption(declaredType)) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
875 needsCheck = false;
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 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
878
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
879 if (receiverType != null && !receiverType.hasFinalizableSubclass()) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
880 if (compilation.recordNoFinalizableSubclassAssumption(receiverType)) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
881 needsCheck = false;
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 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
884 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
885
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
886 if (needsCheck) {
2519
f6125fb5bfbc Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2516
diff changeset
887 // 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
888 append(new RegisterFinalizer(frameState.loadLocal(0), frameState.create(bci()), graph));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
889 C1XMetrics.InlinedFinalizerChecks++;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
890 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
891 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
892
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
893 private void genReturn(Value x) {
2519
f6125fb5bfbc Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2516
diff changeset
894 if (method().isConstructor() && method().holder().superType() == null) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
895 callRegisterFinalizer();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
896 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
897
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
898 frameState.clearStack();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
899 if (Modifier.isSynchronized(method().accessFlags())) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
900 // unlock before exiting the method
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
901 int lockNumber = frameState.locksSize() - 1;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
902 MonitorAddress lockAddress = null;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
903 if (compilation.runtime.sizeOfBasicObjectLock() != 0) {
2602
0c6564c254af new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents: 2600
diff changeset
904 lockAddress = new MonitorAddress(lockNumber, graph);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
905 append(lockAddress);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
906 }
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
907 append(new MonitorExit(rootMethodSynchronizedObject, 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
908 frameState.unlock();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
909 }
2712
a0dd2b907806 Removed implicit safepoints.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2708
diff changeset
910 append(new Return(x, graph));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
911 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
912
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
913 private void genMonitorEnter(Value x, int bci) {
2644
4694daa6af3a Removed CSE array length.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2643
diff changeset
914 int lockNumber = frameState.locksSize();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
915 MonitorAddress lockAddress = null;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
916 if (compilation.runtime.sizeOfBasicObjectLock() != 0) {
2602
0c6564c254af new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents: 2600
diff changeset
917 lockAddress = new MonitorAddress(lockNumber, graph);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
918 append(lockAddress);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
919 }
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
920 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
921 appendWithBCI(monitorEnter);
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
922 frameState.lock(ir, x, lockNumber + 1);
2640
9e30cf6dcf96 More frame state fixes. All jtt tests passing now again.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2639
diff changeset
923 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
924 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
925 }
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
2784
e62cfea1c134 Simplified fillSyncHandler. Fixed LIRGenerator visitUnwind.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2783
diff changeset
928 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
929 int lockNumber = frameState.locksSize() - 1;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
930 if (lockNumber < 0) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
931 throw new CiBailout("monitor stack underflow");
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
932 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
933 MonitorAddress lockAddress = null;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
934 if (compilation.runtime.sizeOfBasicObjectLock() != 0) {
2602
0c6564c254af new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents: 2600
diff changeset
935 lockAddress = new MonitorAddress(lockNumber, graph);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
936 append(lockAddress);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
937 }
2716
c1a9bf38da28 Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2715
diff changeset
938 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
939 frameState.unlock();
2507
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
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
942 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
943 throw new CiBailout("jsr/ret not supported");
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
944 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
945
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
946 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
947 throw new CiBailout("jsr/ret not supported");
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
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
950 private void genTableswitch() {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
951 int bci = bci();
2747
84f4c7dceb14 fixes for mergeOrClone move
Lukas Stadler <lukas.stadler@jku.at>
parents: 2746
diff changeset
952 Value value = frameState.ipop();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
953 BytecodeTableSwitch ts = new BytecodeTableSwitch(stream(), bci);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
954 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
955 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
956 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
957 for (int i = 0; i < max; i++) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
958 // add all successors to the successor list
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
959 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
960 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
961 offsetList.add(offset);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
962 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
963 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
964 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
965 offsetList.add(offset);
2774
93fd92c9f8b0 Removed usage of stateAfter on BlockEnd instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2773
diff changeset
966 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
967 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
968 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
969 }
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
970 append(tableSwitch);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
971 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
972
2647
0bf54306c139 Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2645
diff changeset
973 private void genLookupswitch() {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
974 int bci = bci();
2747
84f4c7dceb14 fixes for mergeOrClone move
Lukas Stadler <lukas.stadler@jku.at>
parents: 2746
diff changeset
975 Value value = frameState.ipop();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
976 BytecodeLookupSwitch ls = new BytecodeLookupSwitch(stream(), bci);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
977 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
978 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
979 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
980 int[] keys = new int[max];
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
981 for (int i = 0; i < max; i++) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
982 // add all successors to the successor list
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
983 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
984 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
985 offsetList.add(offset);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
986 keys[i] = ls.keyAt(i);
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 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
989 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
990 offsetList.add(offset);
2774
93fd92c9f8b0 Removed usage of stateAfter on BlockEnd instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2773
diff changeset
991 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
992 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
993 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
994 }
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
995 append(lookupSwitch);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
996 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
997
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
998 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
999 return append(new Constant(constant, graph));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1000 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1001
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1002 private Value append(Instruction x) {
2716
c1a9bf38da28 Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2715
diff changeset
1003 return appendWithBCI(x);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1004 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1005
2805
c3f64b66fc78 Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2799
diff changeset
1006 private Value append(Value v) {
c3f64b66fc78 Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2799
diff changeset
1007 return v;
c3f64b66fc78 Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2799
diff changeset
1008 }
c3f64b66fc78 Towards removing the next pointer from Constant and ArithmeticOp
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2799
diff changeset
1009
2716
c1a9bf38da28 Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2715
diff changeset
1010 private Value appendWithBCI(Instruction x) {
2820
2b8ef0a06391 Clean up in the graph builder.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2805
diff changeset
1011 assert x.next() == null && x.predecessors().size() == 0 : "instruction should not have been appended yet";
2b8ef0a06391 Clean up in the graph builder.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2805
diff changeset
1012 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
1013 lastInstr.setNext(x);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1014
2820
2b8ef0a06391 Clean up in the graph builder.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2805
diff changeset
1015 lastInstr = x;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1016 if (++stats.nodeCount >= C1XOptions.MaximumInstructionCount) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1017 // 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
1018 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
1019 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1020
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1021 return x;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1022 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1023
2750
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1024 private Instruction createTargetAt(int bci, FrameStateAccess stateAfter) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1025 return createTarget(blockFromBci[bci], stateAfter);
2750
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1026 }
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1027
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1028 private Instruction createTarget(Block block, FrameStateAccess stateAfter) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1029 assert block != null && stateAfter != null;
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1030 assert block.isLoopHeader || block.firstInstruction == null || block.firstInstruction.next() == null : "non-loop block must be iterated after all its predecessors";
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1031
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1032 if (block.isExceptionEntry) {
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1033 assert stateAfter.stackSize() == 1;
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1034 }
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1035
2750
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1036 if (block.firstInstruction == null) {
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1037 if (block.isLoopHeader) {
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1038 // block.firstInstruction = new Merge(block.startBci, graph);
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1039
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1040 LoopBegin loopBegin = new LoopBegin(graph);
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1041 LoopEnd loopEnd = new LoopEnd(graph);
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1042 loopEnd.setLoopBegin(loopBegin);
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1043 block.firstInstruction = loopBegin;
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1044 } else {
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1045 block.firstInstruction = new Placeholder(graph);
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1046 }
2750
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1047 }
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1048 mergeOrClone(block, stateAfter);
2750
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1049 addToWorkList(block);
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1050
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1051 if (block.firstInstruction instanceof LoopBegin && isVisited(block)) {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1052 return ((LoopBegin) block.firstInstruction).loopEnd();
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1053 } else {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1054 return block.firstInstruction;
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1055 }
2750
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1056 }
6048da340364 less references to BlockBegin in BlockEnd instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 2749
diff changeset
1057
2652
6d19b4f476db Removed more OSR handling stuff.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2650
diff changeset
1058 private Value synchronizedObject(FrameStateAccess state, RiMethod target) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1059 if (isStatic(target.accessFlags())) {
2594
092e628ddd5d changed Constant and Convert, more StoreIndexed changes
Lukas Stadler <lukas.stadler@jku.at>
parents: 2592
diff changeset
1060 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
1061 return append(classConstant);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1062 } else {
2652
6d19b4f476db Removed more OSR handling stuff.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2650
diff changeset
1063 return state.localAt(0);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1064 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1065 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1066
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1067 private void fillSyncHandler(Value lock, Block syncHandler) {
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1068 lastInstr = syncHandler.firstInstruction;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1069 while (lastInstr.next() != null) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1070 // go forward to the end of the block
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1071 lastInstr = lastInstr.next();
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1072 }
2783
9bc0c2eb00d6 Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2781
diff changeset
1073
9bc0c2eb00d6 Made graph builder removal of BlockBegin work.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2781
diff changeset
1074 frameState.initializeFrom(((StateSplit) syncHandler.firstInstruction).stateBefore());
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1075
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1076 assert lock != null;
2644
4694daa6af3a Removed CSE array length.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2643
diff changeset
1077 assert frameState.locksSize() > 0 && frameState.lockAt(frameState.locksSize() - 1) == lock;
2820
2b8ef0a06391 Clean up in the graph builder.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2805
diff changeset
1078
2784
e62cfea1c134 Simplified fillSyncHandler. Fixed LIRGenerator visitUnwind.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2783
diff changeset
1079 // Exit the monitor and unwind the stack.
e62cfea1c134 Simplified fillSyncHandler. Fixed LIRGenerator visitUnwind.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2783
diff changeset
1080 genMonitorExit(lock);
e62cfea1c134 Simplified fillSyncHandler. Fixed LIRGenerator visitUnwind.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2783
diff changeset
1081 append(new Unwind(frameState.apop(), graph));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1082
2784
e62cfea1c134 Simplified fillSyncHandler. Fixed LIRGenerator visitUnwind.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2783
diff changeset
1083 // The sync handler is always the last thing to add => we can clear the frameState.
e62cfea1c134 Simplified fillSyncHandler. Fixed LIRGenerator visitUnwind.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2783
diff changeset
1084 frameState = null;
e62cfea1c134 Simplified fillSyncHandler. Fixed LIRGenerator visitUnwind.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2783
diff changeset
1085 lastInstr = null;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1086 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1087
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1088 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
1089 Block block;
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1090 while ((block = removeFromWorkList()) != null) {
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
1091
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
1092 // 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
1093 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
1094 markVisited(block);
2707
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
1095 continue;
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
1096 }
7ed72769d51a exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2676
diff changeset
1097
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1098 if (!isVisited(block)) {
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1099 markVisited(block);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1100 // now parse the block
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1101 frameState.initializeFrom(((StateSplit) block.firstInstruction).stateBefore());
2746
05c92e53a50d merge and clone before connecting blocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 2741
diff changeset
1102 lastInstr = block.firstInstruction;
2781
bda5972a40a5 remove unnecessary BlockBegin nodes in frontend
Lukas Stadler <lukas.stadler@jku.at>
parents: 2776
diff changeset
1103 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
1104
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1105 if (block instanceof ExceptionBlock) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1106 createExceptionDispatch((ExceptionBlock) block);
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1107 } else {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1108 iterateBytecodesForBlock(block);
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1109 }
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1110 }
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1111 }
2799
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1112 for (Block b : blocksVisited) {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1113 if (b.isLoopHeader) {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1114 LoopBegin begin = (LoopBegin) b.firstInstruction;
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1115 LoopEnd end = begin.loopEnd();
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1116
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1117 // 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
1118 // for (;;) {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1119 // try {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1120 // break;
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1121 // } catch (UnresolvedException iioe) {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1122 // }
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1123 // }
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1124 if (end.stateBefore() != null) {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1125 begin.stateBefore().merge(begin, end.stateBefore());
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1126 } else {
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1127 end.delete();
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1128 Merge merge = new Merge(graph);
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1129 merge.successors().setAndClear(merge.nextIndex(), begin, begin.nextIndex());
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1130 begin.replace(merge);
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1131 }
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1132 }
e1dad0edd57a first part of loop reworking
Lukas Stadler <lukas.stadler@jku.at>
parents: 2796
diff changeset
1133 }
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1134 }
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1135
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1136 private void createExceptionDispatch(ExceptionBlock block) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1137 if (block.handler == null) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1138 assert frameState.stackSize() == 1 : "only exception object expected on stack, actual size: " + frameState.stackSize();
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1139 if (Modifier.isSynchronized(method().accessFlags())) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1140 // unlock before exiting the method
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1141 int lockNumber = frameState.locksSize() - 1;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1142 MonitorAddress lockAddress = null;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1143 if (compilation.runtime.sizeOfBasicObjectLock() != 0) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1144 lockAddress = new MonitorAddress(lockNumber, graph);
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1145 append(lockAddress);
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1146 }
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1147 append(new MonitorExit(rootMethodSynchronizedObject, lockAddress, lockNumber, graph));
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1148 frameState.unlock();
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1149 }
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1150 append(new Unwind(frameState.apop(), graph));
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1151 } else {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1152 assert frameState.stackSize() == 1;
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1153
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1154 if (block.handler.catchType().isResolved()) {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1155 Instruction catchSuccessor = createTarget(block.handlerBlock, frameState);
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1156 Instruction nextDispatch = createTarget(block.next, frameState);
2774
93fd92c9f8b0 Removed usage of stateAfter on BlockEnd instructions.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2773
diff changeset
1157 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
1158 } else {
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1159 Deoptimize deopt = new Deoptimize(graph);
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1160 deopt.setMessage("unresolved " + block.handler.catchType().name());
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1161 append(deopt);
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1162 Instruction nextDispatch = createTarget(block.next, frameState);
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1163 appendGoto(nextDispatch);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1164 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1165 }
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
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1168 private void appendGoto(Instruction target) {
2820
2b8ef0a06391 Clean up in the graph builder.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2805
diff changeset
1169 lastInstr.setNext(target);
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1170 }
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1171
2775
3b73b230b86b Removed more stateAfter usages.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2774
diff changeset
1172 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
1173 assert frameState != null;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1174
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1175 stream.setBCI(block.startBci);
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1176
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1177 int endBCI = stream.endBCI();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1178 boolean blockStart = true;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1179
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1180 int bci = block.startBci;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1181 while (bci < endBCI) {
2773
27512ea6bbcb exception dispatch simplification:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2771
diff changeset
1182 Block nextBlock = blockFromBci[bci];
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1183 if (nextBlock != null && nextBlock != block) {
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1184 assert !nextBlock.isExceptionEntry;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1185 // we fell through to the next block, add a goto and break
2747
84f4c7dceb14 fixes for mergeOrClone move
Lukas Stadler <lukas.stadler@jku.at>
parents: 2746
diff changeset
1186 Instruction next = createTarget(nextBlock, frameState);
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1187 appendGoto(next);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1188 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1189 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1190 // read the opcode
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1191 int opcode = stream.currentBC();
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1192
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1193 traceState();
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1194 traceInstruction(bci, opcode, blockStart);
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1195 processBytecode(bci, opcode);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1196
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1197 if (lastInstr instanceof BlockEnd || lastInstr.next() != null) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1198 break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1199 }
2788
df4c5254c5cc Towards goto removal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2785
diff changeset
1200
2640
9e30cf6dcf96 More frame state fixes. All jtt tests passing now again.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2639
diff changeset
1201 stream.next();
9e30cf6dcf96 More frame state fixes. All jtt tests passing now again.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2639
diff changeset
1202 bci = stream.currentBCI();
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1203 if (lastInstr instanceof StateSplit) {
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1204 StateSplit stateSplit = (StateSplit) lastInstr;
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1205 if (stateSplit.stateAfter() == null && stateSplit.needsStateAfter()) {
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1206 stateSplit.setStateAfter(frameState.create(bci));
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1207 }
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1208 }
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1209 blockStart = false;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1210 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1211 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1212
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1213 private void traceState() {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1214 if (C1XOptions.TraceBytecodeParserLevel >= TRACELEVEL_STATE && !TTY.isSuppressed()) {
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
1215 log.println(String.format("| state [nr locals = %d, stack depth = %d, method = %s]", frameState.localsSize(), frameState.stackSize(), method()));
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
1216 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
1217 Value value = frameState.localAt(i);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1218 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
1219 }
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
1220 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
1221 Value value = frameState.stackAt(i);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1222 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
1223 }
2611
bd235cb4375a FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents: 2603
diff changeset
1224 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
1225 Value value = frameState.lockAt(i);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1226 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
1227 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1228 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1229 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1230
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1231 private void processBytecode(int bci, int opcode) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1232 int cpi;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1233
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1234 // Checkstyle: stop
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1235 switch (opcode) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1236 case NOP : /* nothing to do */ break;
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1237 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
1238 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
1239 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
1240 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
1241 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
1242 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
1243 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
1244 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
1245 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
1246 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
1247 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
1248 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
1249 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
1250 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
1251 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
1252 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
1253 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
1254 case LDC : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1255 case LDC_W : // fall through
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1256 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
1257 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
1258 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
1259 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
1260 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
1261 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
1262 case ILOAD_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1263 case ILOAD_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1264 case ILOAD_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1265 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
1266 case LLOAD_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1267 case LLOAD_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1268 case LLOAD_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1269 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
1270 case FLOAD_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1271 case FLOAD_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1272 case FLOAD_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1273 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
1274 case DLOAD_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1275 case DLOAD_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1276 case DLOAD_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1277 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
1278 case ALOAD_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1279 case ALOAD_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1280 case ALOAD_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1281 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
1282 case IALOAD : genLoadIndexed(CiKind.Int ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1283 case LALOAD : genLoadIndexed(CiKind.Long ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1284 case FALOAD : genLoadIndexed(CiKind.Float ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1285 case DALOAD : genLoadIndexed(CiKind.Double); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1286 case AALOAD : genLoadIndexed(CiKind.Object); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1287 case BALOAD : genLoadIndexed(CiKind.Byte ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1288 case CALOAD : genLoadIndexed(CiKind.Char ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1289 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
1290 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
1291 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
1292 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
1293 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
1294 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
1295 case ISTORE_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1296 case ISTORE_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1297 case ISTORE_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1298 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
1299 case LSTORE_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1300 case LSTORE_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1301 case LSTORE_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1302 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
1303 case FSTORE_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1304 case FSTORE_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1305 case FSTORE_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1306 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
1307 case DSTORE_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1308 case DSTORE_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1309 case DSTORE_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1310 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
1311 case ASTORE_0 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1312 case ASTORE_1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1313 case ASTORE_2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1314 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
1315 case IASTORE : genStoreIndexed(CiKind.Int ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1316 case LASTORE : genStoreIndexed(CiKind.Long ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1317 case FASTORE : genStoreIndexed(CiKind.Float ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1318 case DASTORE : genStoreIndexed(CiKind.Double); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1319 case AASTORE : genStoreIndexed(CiKind.Object); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1320 case BASTORE : genStoreIndexed(CiKind.Byte ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1321 case CASTORE : genStoreIndexed(CiKind.Char ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1322 case SASTORE : genStoreIndexed(CiKind.Short ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1323 case POP : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1324 case POP2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1325 case DUP : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1326 case DUP_X1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1327 case DUP_X2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1328 case DUP2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1329 case DUP2_X1 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1330 case DUP2_X2 : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1331 case SWAP : stackOp(opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1332 case IADD : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1333 case ISUB : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1334 case IMUL : genArithmeticOp(CiKind.Int, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1335 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
1336 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
1337 case LADD : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1338 case LSUB : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1339 case LMUL : genArithmeticOp(CiKind.Long, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1340 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
1341 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
1342 case FADD : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1343 case FSUB : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1344 case FMUL : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1345 case FDIV : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1346 case FREM : genArithmeticOp(CiKind.Float, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1347 case DADD : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1348 case DSUB : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1349 case DMUL : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1350 case DDIV : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1351 case DREM : genArithmeticOp(CiKind.Double, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1352 case INEG : genNegateOp(CiKind.Int); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1353 case LNEG : genNegateOp(CiKind.Long); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1354 case FNEG : genNegateOp(CiKind.Float); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1355 case DNEG : genNegateOp(CiKind.Double); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1356 case ISHL : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1357 case ISHR : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1358 case IUSHR : genShiftOp(CiKind.Int, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1359 case IAND : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1360 case IOR : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1361 case IXOR : genLogicOp(CiKind.Int, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1362 case LSHL : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1363 case LSHR : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1364 case LUSHR : genShiftOp(CiKind.Long, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1365 case LAND : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1366 case LOR : // fall through
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1367 case LXOR : genLogicOp(CiKind.Long, opcode); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1368 case IINC : genIncrement(); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1369 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
1370 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
1371 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
1372 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
1373 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
1374 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
1375 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
1376 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
1377 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
1378 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
1379 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
1380 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
1381 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
1382 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
1383 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
1384 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
1385 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
1386 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
1387 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
1388 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
1389 case IFEQ : genIfZero(Condition.EQ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1390 case IFNE : genIfZero(Condition.NE); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1391 case IFLT : genIfZero(Condition.LT); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1392 case IFGE : genIfZero(Condition.GE); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1393 case IFGT : genIfZero(Condition.GT); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1394 case IFLE : genIfZero(Condition.LE); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1395 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
1396 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
1397 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
1398 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
1399 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
1400 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
1401 case IF_ACMPEQ : genIfSame(frameState.peekKind(), Condition.EQ); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1402 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
1403 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
1404 case JSR : genJsr(stream.readBranchDest()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1405 case RET : genRet(stream.readLocalIndex()); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1406 case TABLESWITCH : genTableswitch(); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1407 case LOOKUPSWITCH : genLookupswitch(); break;
2616
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1408 case IRETURN : genReturn(frameState.ipop()); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1409 case LRETURN : genReturn(frameState.lpop()); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1410 case FRETURN : genReturn(frameState.fpop()); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1411 case DRETURN : genReturn(frameState.dpop()); break;
3558ca7088c0 FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2615
diff changeset
1412 case ARETURN : genReturn(frameState.apop()); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1413 case RETURN : genReturn(null ); break;
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1414 case GETSTATIC : cpi = stream.readCPI(); genGetStatic(cpi, constantPool().lookupField(cpi, opcode)); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1415 case PUTSTATIC : cpi = stream.readCPI(); genPutStatic(cpi, constantPool().lookupField(cpi, opcode)); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1416 case GETFIELD : cpi = stream.readCPI(); genGetField(cpi, constantPool().lookupField(cpi, opcode)); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1417 case PUTFIELD : cpi = stream.readCPI(); genPutField(cpi, constantPool().lookupField(cpi, opcode)); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1418 case INVOKEVIRTUAL : cpi = stream.readCPI(); genInvokeVirtual(constantPool().lookupMethod(cpi, opcode), cpi, constantPool()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1419 case INVOKESPECIAL : cpi = stream.readCPI(); genInvokeSpecial(constantPool().lookupMethod(cpi, opcode), null, cpi, constantPool()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1420 case INVOKESTATIC : cpi = stream.readCPI(); genInvokeStatic(constantPool().lookupMethod(cpi, opcode), cpi, constantPool()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1421 case INVOKEINTERFACE: cpi = stream.readCPI(); genInvokeInterface(constantPool().lookupMethod(cpi, opcode), cpi, constantPool()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1422 case NEW : genNewInstance(stream.readCPI()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1423 case NEWARRAY : genNewTypeArray(stream.readLocalIndex()); break;
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1424 case ANEWARRAY : genNewObjectArray(stream.readCPI()); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1425 case ARRAYLENGTH : genArrayLength(); break;
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1426 case ATHROW : genThrow(stream.currentBCI()); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1427 case CHECKCAST : genCheckCast(); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1428 case INSTANCEOF : genInstanceOf(); break;
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1429 case MONITORENTER : genMonitorEnter(frameState.apop(), stream.currentBCI()); break;
2784
e62cfea1c134 Simplified fillSyncHandler. Fixed LIRGenerator visitUnwind.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2783
diff changeset
1430 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
1431 case MULTIANEWARRAY : genNewMultiArray(stream.readCPI()); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1432 case IFNULL : genIfNull(Condition.EQ); break;
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1433 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
1434 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
1435 case JSR_W : genJsr(stream.readFarBranchDest()); break;
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1436 case BREAKPOINT:
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1437 throw new CiBailout("concurrent setting of breakpoint");
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1438 default:
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1439 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
1440 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1441 // Checkstyle: resume
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1442 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1443
2741
a3cd5eb68837 more GraphBuilder cleanup, moved mergeOrClone to GraphBuilder
Lukas Stadler <lukas.stadler@jku.at>
parents: 2735
diff changeset
1444 private void traceInstruction(int bci, int opcode, boolean blockStart) {
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1445 if (C1XOptions.TraceBytecodeParserLevel >= TRACELEVEL_INSTRUCTIONS && !TTY.isSuppressed()) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1446 StringBuilder sb = new StringBuilder(40);
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1447 sb.append(blockStart ? '+' : '|');
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1448 if (bci < 10) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1449 sb.append(" ");
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1450 } else if (bci < 100) {
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1451 sb.append(' ');
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1452 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1453 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
1454 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
1455 sb.append(' ').append(stream.readUByte(i));
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1456 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1457 log.println(sb.toString());
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1458 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1459 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1460
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1461 private void genArrayLength() {
2628
569228710be8 More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2622
diff changeset
1462 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
1463 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1464
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1465 private RiConstantPool constantPool() {
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1466 return constantPool;
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1467 }
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1468
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1469 /**
2592
fec99fc30af1 checkstyle fixes, updated AccessArray + subclasses
Lukas Stadler <lukas.stadler@jku.at>
parents: 2587
diff changeset
1470 * Adds an exception handler.
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1471 * @param handler the handler to add
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1472 */
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1473 private void addExceptionHandler(ExceptionHandler handler) {
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1474 if (exceptionHandlers == null) {
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1475 exceptionHandlers = new ArrayList<ExceptionHandler>();
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1476 }
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1477 exceptionHandlers.add(handler);
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1478 }
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1479
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1480 /**
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1481 * 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
1482 * 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
1483 * 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
1484 * @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
1485 */
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1486 private void addToWorkList(Block block) {
2705
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
1487 if (!isOnWorkList(block)) {
d669ab61c7c7 Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2703
diff changeset
1488 markOnWorkList(block);
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1489 sortIntoWorkList(block);
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1490 }
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1491 }
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1492
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1493 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
1494 workList.offer(top);
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1495 }
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1496
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1497 /**
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1498 * 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
1499 * 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
1500 * @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
1501 * in the worklist
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1502 */
2730
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1503 private Block removeFromWorkList() {
027adfafd47e first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents: 2724
diff changeset
1504 return workList.poll();
2566
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1505 }
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1506
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1507 /**
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1508 * Checks whether this graph has any handlers.
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1509 * @return {@code true} if there are any exception handlers
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1510 */
d524ad648049 Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 2565
diff changeset
1511 private boolean hasHandler() {
2820
2b8ef0a06391 Clean up in the graph builder.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2805
diff changeset
1512 return Modifier.isSynchronized(compilation.method.accessFlags()) || (compilation.method.exceptionHandlers() != null && compilation.method.exceptionHandlers().length > 0);
2507
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1513 }
9ec15d6914ca Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff changeset
1514 }