Mercurial > hg > graal-jvmci-8
annotate graal/GraalCompiler/src/com/sun/c1x/graph/GraphBuilder.java @ 2730:027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 19 May 2011 17:24:23 +0200 |
parents | e2d20fc3760f |
children | 2ef23785ca93 |
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 | 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.*; |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
34 import com.sun.c1x.graph.BlockMap.Block; |
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.*; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
41 import com.sun.cri.ri.RiType.Representation; |
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 |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
62 /** |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
63 * An enumeration of flags describing scope attributes. |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
64 */ |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
65 public enum Flag { |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
66 /** |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
67 * Scope is protected by an exception handler. |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
68 * This attribute is inherited by nested scopes. |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
69 */ |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
70 HasHandler, |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
71 |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
72 /** |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
73 * Code in scope cannot contain safepoints. |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
74 * This attribute is inherited by nested scopes. |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
75 */ |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
76 NoSafepoints; |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
77 |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
78 public final int mask = 1 << ordinal(); |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
79 } |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
80 |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
81 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
|
82 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
|
83 private final CiStatistics stats; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
84 |
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 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
|
86 // bci-to-block mapping |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
87 private Block[] blockList; |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
88 |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
89 // 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
|
90 private final RiConstantPool constantPool; |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
91 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
92 // 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
|
93 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
|
94 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
|
95 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
|
96 } |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
97 }); |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
98 |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
99 /** |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
100 * Mask of {@link Flag} values. |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
101 */ |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
102 private int flags; |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
103 |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
104 // 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
|
105 private List<ExceptionHandler> exceptionHandlers; |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
106 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
107 private Block curBlock; // the current block |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
108 private final 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
|
109 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
|
110 private Instruction placeholder; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
111 |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
112 |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
113 private final LogStream log; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
114 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
115 private Value rootMethodSynchronizedObject; |
2586 | 116 |
2602
0c6564c254af
new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents:
2600
diff
changeset
|
117 private final Graph graph; |
2586 | 118 |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
119 private BlockBegin unwindBlock; |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2673
diff
changeset
|
120 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
121 private final Set<Instruction> loopHeaders = new HashSet<Instruction>(); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
122 |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
123 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
124 * 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
|
125 * |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
126 * @param compilation the compilation |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
127 * @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
|
128 * @param graph |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
129 */ |
2602
0c6564c254af
new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents:
2600
diff
changeset
|
130 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
|
131 this.compilation = compilation; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
132 this.ir = ir; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
133 this.stats = compilation.stats; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
134 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
|
135 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
|
136 constantPool = compilation.runtime.getConstantPool(compilation.method); |
2602
0c6564c254af
new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents:
2600
diff
changeset
|
137 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
|
138 this.frameState = new FrameStateBuilder(compilation.method, graph); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
139 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
140 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
141 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
142 * 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
|
143 * @param scope the top IRScope |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
144 */ |
2564
274360f98f97
Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2563
diff
changeset
|
145 public void build() { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
146 RiMethod rootMethod = compilation.method; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
147 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
148 if (log != null) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
149 log.println(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
150 log.println("Compiling " + compilation.method); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
151 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
152 |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
153 if (rootMethod.noSafepoints()) { |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
154 flags |= Flag.NoSafepoints.mask; |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
155 } |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
156 |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
157 // 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
|
158 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
|
159 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
160 blockList = new Block[rootMethod.code().length]; |
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
|
161 for (int i = 0; i < blockMap.blocks.size(); i++) { |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
162 Block block = blockMap.blocks.get(i); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
163 |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
164 // if (block.isLoopHeader) { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
165 BlockBegin blockBegin = new BlockBegin(block.startBci, ir.nextBlockNumber(), graph); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
166 blockBegin.setDepthFirstNumber(blockBegin.blockID); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
167 |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
168 block.firstInstruction = blockBegin; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
169 blockList[block.startBci] = block; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
170 |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
171 if (block.isLoopHeader) { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
172 loopHeaders.add(blockBegin); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
173 } |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
174 // } else { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
175 // blockList[block.startBci] = new Placeholder(graph); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
176 // } |
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
|
177 } |
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
|
178 |
2695
785e9ecdcc69
Removed the instruction substitutor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2684
diff
changeset
|
179 |
785e9ecdcc69
Removed the instruction substitutor.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2684
diff
changeset
|
180 // 1. create the start block |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
181 Block startBlock = 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
|
182 BlockBegin startBlockBegin = new BlockBegin(0, startBlock.blockID, graph); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
183 startBlock.firstInstruction = startBlockBegin; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
184 |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
185 graph.root().setStart(startBlockBegin); |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
186 curBlock = startBlock; |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
187 |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
188 RiExceptionHandler[] handlers = rootMethod.exceptionHandlers(); |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
189 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
|
190 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
|
191 for (RiExceptionHandler ch : handlers) { |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
192 Block entry = blockList[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
|
193 // 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
|
194 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
|
195 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
|
196 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
|
197 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
|
198 } |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
199 } |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
200 flags |= Flag.HasHandler.mask; |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
201 } |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
202 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
203 assert !loopHeaders.contains(startBlock); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
204 startBlockBegin.mergeOrClone(frameState, rootMethod, false); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
205 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
206 // 3. setup internal state for appending instructions |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
207 curBlock = startBlock; |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
208 lastInstr = startBlockBegin; |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
209 lastInstr.appendNext(null); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
210 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
211 Instruction entryBlock = blockAt(0); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
212 BlockBegin syncHandler = null; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
213 Block syncBlock = null; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
214 if (isSynchronized(rootMethod.accessFlags())) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
215 // 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
|
216 rootMethodSynchronizedObject = synchronizedObject(frameState, compilation.method); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
217 genMonitorEnter(rootMethodSynchronizedObject, Instruction.SYNCHRONIZATION_ENTRY_BCI); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
218 // 4A.2 finish the start block |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
219 finishStartBlock(startBlockBegin, entryBlock); |
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 // 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
|
222 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
|
223 syncHandler = new BlockBegin(Instruction.SYNCHRONIZATION_ENTRY_BCI, syncBlock.blockID, graph); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
224 syncBlock.firstInstruction = syncHandler; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
225 markOnWorkList(syncBlock); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
226 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
227 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
|
228 h.setEntryBlock(syncBlock); |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
229 addExceptionHandler(h); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
230 } else { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
231 // 4B.1 simply finish the start block |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
232 finishStartBlock(startBlockBegin, entryBlock); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
233 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
234 |
2519
f6125fb5bfbc
Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2516
diff
changeset
|
235 // 5. SKIPPED: look for intrinsics |
f6125fb5bfbc
Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2516
diff
changeset
|
236 |
f6125fb5bfbc
Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2516
diff
changeset
|
237 // 6B.1 do the normal parsing |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
238 addToWorkList(blockList[0]); |
2519
f6125fb5bfbc
Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2516
diff
changeset
|
239 iterateAllBlocks(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
240 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
241 if (syncBlock != null && syncHandler.stateBefore() != null) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
242 // 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
|
243 fillSyncHandler(rootMethodSynchronizedObject, syncBlock); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
244 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
245 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
246 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
247 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
|
248 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
|
249 block.startBci = bci; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
250 block.endBci = bci; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
251 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
|
252 return block; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
253 } |
2705
d669ab61c7c7
Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2703
diff
changeset
|
254 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
255 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
|
256 |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
257 private void markOnWorkList(Block block) { |
2705
d669ab61c7c7
Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2703
diff
changeset
|
258 blocksOnWorklist.add(block); |
d669ab61c7c7
Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2703
diff
changeset
|
259 } |
d669ab61c7c7
Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2703
diff
changeset
|
260 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
261 private boolean isOnWorkList(Block block) { |
2705
d669ab61c7c7
Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2703
diff
changeset
|
262 return blocksOnWorklist.contains(block); |
d669ab61c7c7
Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2703
diff
changeset
|
263 } |
d669ab61c7c7
Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2703
diff
changeset
|
264 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
265 private Set<Block> blocksVisited = new HashSet<Block>(); |
2706
5a784215351a
Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2705
diff
changeset
|
266 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
267 private void markVisited(Block block) { |
2706
5a784215351a
Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2705
diff
changeset
|
268 blocksVisited.add(block); |
5a784215351a
Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2705
diff
changeset
|
269 } |
5a784215351a
Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2705
diff
changeset
|
270 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
271 private boolean isVisited(Block block) { |
2706
5a784215351a
Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2705
diff
changeset
|
272 return blocksVisited.contains(block); |
5a784215351a
Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2705
diff
changeset
|
273 } |
5a784215351a
Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2705
diff
changeset
|
274 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
275 private void finishStartBlock(BlockBegin startBlock, Instruction stdEntry) { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
276 assert bci() == 0; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
277 assert curBlock.firstInstruction == startBlock; |
2657
4a6518c4d17d
Removed need for base instruction. Cleanup.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2652
diff
changeset
|
278 FrameState stateAfter = frameState.create(bci()); |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
279 Goto base = new Goto((BlockBegin) stdEntry, stateAfter, graph); |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
280 appendWithBCI(base); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
281 startBlock.setEnd(base); |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
282 // assert stdEntry instanceof Placeholder; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
283 assert ((BlockBegin) stdEntry).stateBefore() == null; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
284 prepareTarget(0); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
285 mergeOrClone(stdEntry, stateAfter, method(), loopHeaders.contains(stdEntry)); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
286 } |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
287 |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
288 private void prepareTarget(int bci) { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
289 } |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
290 |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
291 private void mergeOrClone(Instruction block, FrameState stateAfter, RiMethod method, boolean loopHeader) { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
292 ((BlockBegin) block).mergeOrClone(stateAfter, method, loopHeader); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
293 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
294 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
295 public RiMethod method() { |
2564
274360f98f97
Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2563
diff
changeset
|
296 return compilation.method; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
297 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
298 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
299 public BytecodeStream stream() { |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
300 return stream; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
301 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
302 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
303 public int bci() { |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
304 return stream.currentBCI(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
305 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
306 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
307 public int nextBCI() { |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
308 return stream.nextBCI(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
309 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
310 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
311 private void loadLocal(int index, CiKind kind) { |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
312 frameState.push(kind, frameState.loadLocal(index)); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
313 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
314 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
315 private void storeLocal(CiKind kind, int index) { |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
316 frameState.storeLocal(index, frameState.pop(kind)); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
317 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
318 |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
319 private void handleException(Instruction x, int bci) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
320 if (!hasHandler()) { |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
321 return; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
322 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
323 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
324 ArrayList<ExceptionHandler> exceptionHandlers = new ArrayList<ExceptionHandler>(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
325 |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
326 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
|
327 |
2564
274360f98f97
Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2563
diff
changeset
|
328 // 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
|
329 if (this.exceptionHandlers != null) { |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
330 for (ExceptionHandler handler : this.exceptionHandlers) { |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
331 // 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
|
332 if (handler.covers(bci)) { |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
333 ExceptionHandler newHandler = addExceptionHandler(handler, frameState); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
334 exceptionHandlers.add(newHandler); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
335 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
336 // stop when reaching catch all |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
337 if (handler.isCatchAll()) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
338 break; |
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 } |
2564
274360f98f97
Remove inlining (2nd part) removed IRScope
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2563
diff
changeset
|
342 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
343 |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
344 if (!exceptionHandlers.isEmpty()) { |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
345 Instruction successor; |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
346 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
347 ArrayList<BlockBegin> newBlocks = new ArrayList<BlockBegin>(); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
348 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
349 int current = exceptionHandlers.size() - 1; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
350 if (exceptionHandlers.get(current).isCatchAll()) { |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
351 successor = exceptionHandlers.get(current).entryBlock().firstInstruction; |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
352 current--; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
353 } else { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
354 if (unwindBlock == null) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
355 unwindBlock = new BlockBegin(bci, ir.nextBlockNumber(), graph); |
2712
a0dd2b907806
Removed implicit safepoints.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
356 Unwind unwind = new Unwind(null, graph); |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
357 unwindBlock.appendNext(unwind); |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
358 unwindBlock.setEnd(unwind); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
359 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
360 successor = unwindBlock; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
361 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
362 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
363 for (; current >= 0; current--) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
364 ExceptionHandler handler = exceptionHandlers.get(current); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
365 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
366 BlockBegin newSucc = null; |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
367 for (Node pred : successor.predecessors()) { |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
368 if (pred instanceof ExceptionDispatch) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
369 ExceptionDispatch dispatch = (ExceptionDispatch) pred; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
370 if (dispatch.handler().handler == handler.handler) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
371 newSucc = dispatch.begin(); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
372 break; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
373 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
374 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
375 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
376 if (newSucc != null) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
377 successor = newSucc; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
378 } else { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
379 BlockBegin dispatchEntry = new BlockBegin(handler.handlerBCI(), ir.nextBlockNumber(), graph); |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
380 |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
381 if (handler.handler.catchType().isResolved()) { |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
382 ExceptionDispatch end = new ExceptionDispatch(null, (BlockBegin) handler.entryBlock().firstInstruction, null, handler, null, graph); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
383 end.setBlockSuccessor(0, (BlockBegin) successor); |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
384 dispatchEntry.appendNext(end); |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
385 dispatchEntry.setEnd(end); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
386 } else { |
2711
fb4cc9812591
Fix for last merge
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2710
diff
changeset
|
387 Deoptimize deopt = new Deoptimize(graph); |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
388 dispatchEntry.appendNext(deopt); |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
389 Goto end = new Goto((BlockBegin) successor, null, graph); |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
390 deopt.appendNext(end); |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
391 dispatchEntry.setEnd(end); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
392 } |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
393 |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
394 newBlocks.add(dispatchEntry); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
395 successor = dispatchEntry; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
396 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
397 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
398 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
399 FrameState entryState = frameState.duplicateWithEmptyStack(bci); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
400 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
401 BlockBegin entry = new BlockBegin(bci, ir.nextBlockNumber(), graph); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
402 entry.setStateBefore(entryState); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
403 ExceptionObject exception = new ExceptionObject(graph); |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
404 entry.appendNext(exception); |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
405 FrameState stateWithException = entryState.duplicateModified(bci, CiKind.Void, exception); |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
406 BlockEnd end = new Goto((BlockBegin) successor, stateWithException, graph); |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
407 exception.appendNext(end); |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
408 entry.setEnd(end); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
409 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
410 if (x instanceof Invoke) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
411 ((Invoke) x).setExceptionEdge(entry); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
412 } else { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
413 ((Throw) x).setExceptionEdge(entry); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
414 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
415 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
416 updateDispatchChain(end.blockSuccessor(0), stateWithException, bci); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
417 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
418 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
419 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
420 private void updateDispatchChain(BlockBegin dispatchEntry, FrameStateAccess state, int bci) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
421 FrameState oldState = dispatchEntry.stateBefore(); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
422 if (oldState != null && dispatchEntry.predecessors().size() == 1) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
423 dispatchEntry.setStateBefore(null); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
424 } |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
425 dispatchEntry.mergeOrClone(state, null, false); |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
426 FrameState mergedState = dispatchEntry.stateBefore(); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
427 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
428 if (dispatchEntry.next() instanceof ExceptionDispatch) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
429 // ordinary dispatch handler |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
430 ExceptionDispatch dispatch = (ExceptionDispatch) dispatchEntry.next(); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
431 dispatch.setStateAfter(mergedState.duplicate(bci)); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
432 dispatch.setException(mergedState.stackAt(0)); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
433 dispatch.catchSuccessor().setStateBefore(mergedState.duplicate(bci)); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
434 updateDispatchChain(dispatch.otherSuccessor(), mergedState, bci); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
435 } else if (dispatchEntry.next() instanceof Deoptimize) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
436 // deoptimizing handler |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
437 Deoptimize deopt = (Deoptimize) dispatchEntry.next(); |
2711
fb4cc9812591
Fix for last merge
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2710
diff
changeset
|
438 //deopt.setStateBefore(mergedState.duplicate(bci)); |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
439 dispatchEntry.end().setStateAfter(mergedState.duplicate(bci)); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
440 updateDispatchChain(dispatchEntry.end().blockSuccessor(0), mergedState, bci); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
441 } else if (dispatchEntry.next() instanceof Unwind) { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
442 // unwind handler |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
443 Unwind unwind = (Unwind) dispatchEntry.next(); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
444 unwind.setStateAfter(mergedState.duplicate(bci)); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
445 unwind.setException(mergedState.stackAt(0)); |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
446 } else { |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
447 // synchronization or default exception handler, nothing to do |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
448 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
449 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
450 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
451 /** |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
452 * Adds an exception handler to the {@linkplain BlockBegin#exceptionHandlerBlocks() list} |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
453 * of exception handlers for the {@link #curBlock current block}. |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
454 */ |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
455 private ExceptionHandler addExceptionHandler(ExceptionHandler handler, FrameStateAccess curState) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
456 compilation.setHasExceptionHandlers(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
457 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
458 BlockMap.Block entry = handler.entryBlock(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
459 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
460 // clone exception handler |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
461 ExceptionHandler newHandler = new ExceptionHandler(handler); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
462 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
463 // fill in exception handler subgraph lazily |
2706
5a784215351a
Removed WasVisited flag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2705
diff
changeset
|
464 if (!isVisited(entry)) { |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
465 if (handler.handlerBCI() != 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
|
466 addToWorkList(blockList[handler.handlerBCI()]); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
467 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
468 } else { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
469 // This will occur for exception handlers that cover themselves. This code |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
470 // pattern is generated by javac for synchronized blocks. See the following |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
471 // for why this change to javac was made: |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
472 // |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
473 // http://www.cs.arizona.edu/projects/sumatra/hallofshame/java-async-race.html |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
474 } |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
475 return newHandler; |
2507
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 |
2657
4a6518c4d17d
Removed need for base instruction. Cleanup.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2652
diff
changeset
|
478 private void genLoadConstant(int cpi) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
479 Object con = constantPool().lookupConstant(cpi); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
480 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
481 if (con instanceof RiType) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
482 // 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
|
483 RiType riType = (RiType) con; |
2650
ccab1d5f345e
Removed TestPatching option.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2649
diff
changeset
|
484 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
|
485 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
|
486 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
|
487 } else { |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
488 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
|
489 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
490 } else if (con instanceof CiConstant) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
491 CiConstant constant = (CiConstant) con; |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
492 frameState.push(constant.kind.stackKind(), appendConstant(constant)); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
493 } else { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
494 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
|
495 } |
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 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
498 private void genLoadIndexed(CiKind kind) { |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
499 Value index = frameState.ipop(); |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
500 Value array = frameState.apop(); |
2644
4694daa6af3a
Removed CSE array length.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2643
diff
changeset
|
501 Value length = append(new ArrayLength(array, graph)); |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
502 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
|
503 frameState.push(kind.stackKind(), v); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
504 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
505 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
506 private void genStoreIndexed(CiKind kind) { |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
507 Value value = frameState.pop(kind.stackKind()); |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
508 Value index = frameState.ipop(); |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
509 Value array = frameState.apop(); |
2644
4694daa6af3a
Removed CSE array length.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2643
diff
changeset
|
510 Value length = append(new ArrayLength(array, graph)); |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
511 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
|
512 append(result); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
513 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
514 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
515 private void stackOp(int opcode) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
516 switch (opcode) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
517 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
|
518 frameState.xpop(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
519 break; |
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 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
|
522 frameState.xpop(); |
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
523 frameState.xpop(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
524 break; |
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 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
|
527 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
|
528 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
|
529 frameState.xpush(w); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
530 break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
531 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
532 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
|
533 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
|
534 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
|
535 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
|
536 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
|
537 frameState.xpush(w1); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
538 break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
539 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
540 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
|
541 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
|
542 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
|
543 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
|
544 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
|
545 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
|
546 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
|
547 frameState.xpush(w1); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
548 break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
549 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
550 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
|
551 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
|
552 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
|
553 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
|
554 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
|
555 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
|
556 frameState.xpush(w1); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
557 break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
558 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
559 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
|
560 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
|
561 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
|
562 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
|
563 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
|
564 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
|
565 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
|
566 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
|
567 frameState.xpush(w1); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
568 break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
569 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
570 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
|
571 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
|
572 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
|
573 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
|
574 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
|
575 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
|
576 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
|
577 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
|
578 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
|
579 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
|
580 frameState.xpush(w1); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
581 break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
582 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
583 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
|
584 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
|
585 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
|
586 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
|
587 frameState.xpush(w2); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
588 break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
589 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
590 default: |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
591 throw Util.shouldNotReachHere(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
592 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
593 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
594 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
595 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
596 private void 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
|
597 genArithmeticOp(kind, opcode, false); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
598 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
599 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
600 private void 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
|
601 genArithmeticOp(kind, opcode, kind, kind, canTrap); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
602 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
603 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
604 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
|
605 Value yValue = frameState.pop(y); |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
606 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
|
607 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
|
608 frameState.push(result, result1); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
609 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
610 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
611 private void genNegateOp(CiKind kind) { |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
612 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
|
613 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
614 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
615 private void genShiftOp(CiKind kind, int opcode) { |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
616 Value s = frameState.ipop(); |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
617 Value x = frameState.pop(kind); |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
618 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
|
619 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
620 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
621 private void genLogicOp(CiKind kind, int opcode) { |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
622 Value y = frameState.pop(kind); |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
623 Value x = frameState.pop(kind); |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
624 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
|
625 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
626 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
627 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
|
628 Value y = frameState.pop(kind); |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
629 Value x = frameState.pop(kind); |
2586 | 630 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
|
631 if (!resultKind.isVoid()) { |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
632 frameState.ipush(value); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
633 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
634 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
635 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
636 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
|
637 CiKind tt = to.stackKind(); |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
638 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
|
639 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
640 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
641 private void genIncrement() { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
642 int index = stream().readLocalIndex(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
643 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
|
644 Value x = frameState.localAt(index); |
2594
092e628ddd5d
changed Constant and Convert, more StoreIndexed changes
Lukas Stadler <lukas.stadler@jku.at>
parents:
2592
diff
changeset
|
645 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
|
646 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
|
647 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
648 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
649 private void genGoto(int fromBCI, int toBCI) { |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
650 append(new Goto((BlockBegin) blockAt(toBCI), null, graph)); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
651 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
652 |
2645
b2c1e959be46
Clean up around BlockBegin / StdEntry.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2644
diff
changeset
|
653 private void ifNode(Value x, Condition cond, Value y, FrameState stateBefore) { |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
654 Instruction tsucc = blockAt(stream().readBranchDest()); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
655 Instruction fsucc = blockAt(stream().nextBCI()); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
656 append(new If(x, cond, y, (BlockBegin) tsucc, (BlockBegin) fsucc, null, graph)); |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
657 stateBefore.delete(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
658 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
659 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
660 private void genIfZero(Condition cond) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
661 Value y = appendConstant(CiConstant.INT_0); |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
662 FrameState stateBefore = frameState.create(bci()); |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
663 Value x = frameState.ipop(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
664 ifNode(x, cond, y, stateBefore); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
665 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
666 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
667 private void genIfNull(Condition cond) { |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
668 FrameState stateBefore = frameState.create(bci()); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
669 Value y = appendConstant(CiConstant.NULL_OBJECT); |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
670 Value x = frameState.apop(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
671 ifNode(x, cond, y, stateBefore); |
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 genIfSame(CiKind kind, Condition cond) { |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
675 FrameState stateBefore = frameState.create(bci()); |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
676 Value y = frameState.pop(kind); |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
677 Value x = frameState.pop(kind); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
678 ifNode(x, cond, y, stateBefore); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
679 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
680 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
681 private void genThrow(int bci) { |
2639
8e96b2b3a866
Added stateBefore to Throw instruction.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2634
diff
changeset
|
682 FrameState stateBefore = frameState.create(bci); |
2712
a0dd2b907806
Removed implicit safepoints.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
683 Throw t = new Throw(frameState.apop(), graph); |
2639
8e96b2b3a866
Added stateBefore to Throw instruction.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2634
diff
changeset
|
684 t.setStateBefore(stateBefore); |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
685 appendWithBCI(t); |
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
686 handleException(t, bci); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
687 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
688 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
689 private void genCheckCast() { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
690 int cpi = stream().readCPI(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
691 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
|
692 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
|
693 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
|
694 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
|
695 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
|
696 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
|
697 } 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
|
698 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
|
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 genInstanceOf() { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
703 int cpi = stream().readCPI(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
704 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
|
705 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
|
706 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
|
707 Value object = frameState.apop(); |
98447ab8bd83
Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2671
diff
changeset
|
708 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
|
709 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
|
710 } 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
|
711 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
|
712 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
713 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
714 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
715 void genNewInstance(int cpi) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
716 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
|
717 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
|
718 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
|
719 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
|
720 } 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
|
721 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
|
722 frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); |
2634
4dd0573f510b
FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2633
diff
changeset
|
723 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
724 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
725 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
726 private void genNewTypeArray(int typeCode) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
727 CiKind kind = CiKind.fromArrayTypeCode(typeCode); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
728 RiType elementType = compilation.runtime.asRiType(kind); |
2634
4dd0573f510b
FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2633
diff
changeset
|
729 NewTypeArray nta = new NewTypeArray(frameState.ipop(), elementType, graph); |
4dd0573f510b
FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2633
diff
changeset
|
730 frameState.apush(append(nta)); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
731 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
732 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
733 private void genNewObjectArray(int cpi) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
734 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
|
735 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
|
736 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
|
737 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
|
738 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
|
739 } 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
|
740 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
|
741 frameState.apush(appendConstant(CiConstant.NULL_OBJECT)); |
2634
4dd0573f510b
FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2633
diff
changeset
|
742 } |
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
|
743 |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
744 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
745 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
746 private void genNewMultiArray(int cpi) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
747 RiType type = constantPool().lookupType(cpi, MULTIANEWARRAY); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
748 int rank = stream().readUByte(bci() + 3); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
749 Value[] dims = new Value[rank]; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
750 for (int i = rank - 1; i >= 0; i--) { |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
751 dims[i] = frameState.ipop(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
752 } |
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
|
753 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
|
754 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
|
755 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
|
756 } 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
|
757 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
|
758 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
|
759 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
760 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
761 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
762 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
|
763 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
|
764 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
|
765 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
|
766 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
|
767 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
|
768 } 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
|
769 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
|
770 frameState.push(kind.stackKind(), append(Constant.defaultForKind(kind, graph))); |
2634
4dd0573f510b
FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2633
diff
changeset
|
771 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
772 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
773 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
774 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
|
775 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
|
776 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
|
777 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
|
778 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
|
779 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
|
780 } 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
|
781 append(new Deoptimize(graph)); |
2634
4dd0573f510b
FrameState fixes.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2633
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 genGetStatic(int cpi, RiField field) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
786 RiType holder = field.holder(); |
2650
ccab1d5f345e
Removed TestPatching option.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2649
diff
changeset
|
787 boolean isInitialized = field.isResolved(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
788 CiConstant constantValue = null; |
2533
c480605ef068
Removed canonicalizer.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2521
diff
changeset
|
789 if (isInitialized) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
790 constantValue = field.constantValue(null); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
791 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
792 if (constantValue != null) { |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
793 frameState.push(constantValue.kind.stackKind(), appendConstant(constantValue)); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
794 } 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
|
795 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
|
796 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
|
797 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
|
798 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
|
799 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
|
800 } 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
|
801 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
|
802 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
|
803 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
804 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
805 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
806 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
807 private void genPutStatic(int cpi, RiField field) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
808 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
|
809 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
|
810 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
|
811 if (container != null) { |
98447ab8bd83
Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2671
diff
changeset
|
812 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
|
813 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
|
814 } 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
|
815 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
|
816 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
817 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
818 |
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
|
819 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
|
820 if (initialized) { |
2673
98447ab8bd83
Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2671
diff
changeset
|
821 return appendConstant(holder.getEncoding(representation)); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
822 } 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
|
823 append(new Deoptimize(graph)); |
2673
98447ab8bd83
Create less nodes in case of Deopt
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2671
diff
changeset
|
824 return null; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
825 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
826 } |
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 private void appendOptimizedStoreField(StoreField store) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
829 append(store); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
830 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
831 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
832 private void appendOptimizedLoadField(CiKind kind, LoadField load) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
833 // append the load to the instruction |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
834 Value optimized = append(load); |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
835 frameState.push(kind.stackKind(), optimized); |
2507
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 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
838 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
|
839 RiType holder = target.holder(); |
2650
ccab1d5f345e
Removed TestPatching option.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2649
diff
changeset
|
840 boolean isInitialized = target.isResolved() && holder.isInitialized(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
841 if (!isInitialized && C1XOptions.ResolveClassBeforeStaticInvoke) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
842 // 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
|
843 // 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
|
844 // 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
|
845 genTypeOrDeopt(RiType.Representation.StaticFields, holder, isInitialized, cpi); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
846 } |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
847 Value[] args = frameState.popArguments(target.signature().argumentSlots(false)); |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
848 appendInvoke(INVOKESTATIC, target, args, cpi, constantPool); |
2507
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 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
851 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
|
852 Value[] args = frameState.popArguments(target.signature().argumentSlots(true)); |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
853 genInvokeIndirect(INVOKEINTERFACE, target, args, cpi, constantPool); |
2533
c480605ef068
Removed canonicalizer.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2521
diff
changeset
|
854 |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
855 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
856 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
857 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
|
858 Value[] args = frameState.popArguments(target.signature().argumentSlots(true)); |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
859 genInvokeIndirect(INVOKEVIRTUAL, target, args, cpi, constantPool); |
2533
c480605ef068
Removed canonicalizer.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2521
diff
changeset
|
860 |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
861 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
862 |
2649
62306ff0ccc2
Removed check for direct compare.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2647
diff
changeset
|
863 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
|
864 Value[] args = frameState.popArguments(target.signature().argumentSlots(true)); |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
865 invokeDirect(target, args, knownHolder, cpi, constantPool); |
2533
c480605ef068
Removed canonicalizer.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2521
diff
changeset
|
866 |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
867 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
868 |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
869 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
|
870 Value receiver = args[0]; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
871 // attempt to devirtualize the call |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
872 if (target.isResolved()) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
873 RiType klass = target.holder(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
874 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
875 // 0. check for trivial cases |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
876 if (target.canBeStaticallyBound() && !isAbstract(target.accessFlags())) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
877 // 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
|
878 invokeDirect(target, args, target.holder(), cpi, constantPool); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
879 return; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
880 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
881 // 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
|
882 RiType exact = getExactType(klass, receiver); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
883 if (exact != null && exact.isResolved()) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
884 // 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
|
885 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
|
886 return; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
887 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
888 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
889 // devirtualization failed, produce an actual invokevirtual |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
890 appendInvoke(opcode, target, args, cpi, constantPool); |
2507
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 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
893 private CiKind returnKind(RiMethod target) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
894 return target.signature().returnKind(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
895 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
896 |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
897 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
|
898 appendInvoke(INVOKESPECIAL, target, args, cpi, constantPool); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
899 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
900 |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
901 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
|
902 CiKind resultType = returnKind(target); |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
903 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
|
904 Value result = appendWithBCI(invoke); |
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
905 handleException(invoke, bci()); |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
906 frameState.pushReturn(resultType, result); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
907 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
908 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
909 private RiType getExactType(RiType staticType, Value receiver) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
910 RiType exact = staticType.exactType(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
911 if (exact == null) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
912 exact = receiver.exactType(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
913 if (exact == null) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
914 if (receiver.isConstant()) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
915 exact = compilation.runtime.getTypeOf(receiver.asConstant()); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
916 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
917 if (exact == null) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
918 RiType declared = receiver.declaredType(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
919 exact = declared == null || !declared.isResolved() ? null : declared.exactType(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
920 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
921 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
922 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
923 return exact; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
924 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
925 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
926 private RiType getAssumedLeafType(RiType type) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
927 if (isFinal(type.accessFlags())) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
928 return type; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
929 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
930 RiType assumed = null; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
931 if (C1XOptions.UseAssumptions) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
932 assumed = type.uniqueConcreteSubtype(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
933 if (assumed != null) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
934 if (C1XOptions.PrintAssumptions) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
935 TTY.println("Recording concrete subtype assumption in context of " + type.name() + ": " + assumed.name()); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
936 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
937 compilation.assumptions.recordConcreteSubtype(type, assumed); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
938 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
939 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
940 return assumed; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
941 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
942 |
2647
0bf54306c139
Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2645
diff
changeset
|
943 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
|
944 Value receiver = frameState.loadLocal(0); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
945 RiType declaredType = receiver.declaredType(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
946 RiType receiverType = declaredType; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
947 RiType exactType = receiver.exactType(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
948 if (exactType == null && declaredType != null) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
949 exactType = declaredType.exactType(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
950 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
951 if (exactType == null && receiver instanceof Local && ((Local) receiver).javaIndex() == 0) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
952 // 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
|
953 receiverType = compilation.method.holder(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
954 exactType = receiverType.exactType(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
955 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
956 boolean needsCheck = true; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
957 if (exactType != null) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
958 // we have an exact type |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
959 needsCheck = exactType.hasFinalizer(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
960 } else { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
961 // 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
|
962 if (declaredType != null && !declaredType.hasFinalizableSubclass()) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
963 if (compilation.recordNoFinalizableSubclassAssumption(declaredType)) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
964 needsCheck = false; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
965 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
966 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
967 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
968 if (receiverType != null && !receiverType.hasFinalizableSubclass()) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
969 if (compilation.recordNoFinalizableSubclassAssumption(receiverType)) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
970 needsCheck = false; |
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 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
973 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
974 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
975 if (needsCheck) { |
2519
f6125fb5bfbc
Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2516
diff
changeset
|
976 // 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
|
977 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
|
978 C1XMetrics.InlinedFinalizerChecks++; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
979 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
980 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
981 |
2647
0bf54306c139
Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2645
diff
changeset
|
982 private void genReturn(Value x) { |
2519
f6125fb5bfbc
Removed intrinsics.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2516
diff
changeset
|
983 if (method().isConstructor() && method().holder().superType() == null) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
984 callRegisterFinalizer(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
985 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
986 |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
987 frameState.clearStack(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
988 if (Modifier.isSynchronized(method().accessFlags())) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
989 // 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
|
990 int lockNumber = frameState.locksSize() - 1; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
991 MonitorAddress lockAddress = null; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
992 if (compilation.runtime.sizeOfBasicObjectLock() != 0) { |
2602
0c6564c254af
new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents:
2600
diff
changeset
|
993 lockAddress = new MonitorAddress(lockNumber, graph); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
994 append(lockAddress); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
995 } |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
996 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
|
997 frameState.unlock(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
998 } |
2712
a0dd2b907806
Removed implicit safepoints.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2708
diff
changeset
|
999 append(new Return(x, 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 |
2647
0bf54306c139
Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2645
diff
changeset
|
1002 private void genMonitorEnter(Value x, int bci) { |
2644
4694daa6af3a
Removed CSE array length.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2643
diff
changeset
|
1003 int lockNumber = frameState.locksSize(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1004 MonitorAddress lockAddress = null; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1005 if (compilation.runtime.sizeOfBasicObjectLock() != 0) { |
2602
0c6564c254af
new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents:
2600
diff
changeset
|
1006 lockAddress = new MonitorAddress(lockNumber, graph); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1007 append(lockAddress); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1008 } |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
1009 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
|
1010 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
|
1011 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
|
1012 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
|
1013 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
|
1014 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1015 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1016 |
2647
0bf54306c139
Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2645
diff
changeset
|
1017 private void genMonitorExit(Value x, int bci) { |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
1018 int lockNumber = frameState.locksSize() - 1; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1019 if (lockNumber < 0) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1020 throw new CiBailout("monitor stack underflow"); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1021 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1022 MonitorAddress lockAddress = null; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1023 if (compilation.runtime.sizeOfBasicObjectLock() != 0) { |
2602
0c6564c254af
new node layout: BlockBegin, BlockEnd
Lukas Stadler <lukas.stadler@jku.at>
parents:
2600
diff
changeset
|
1024 lockAddress = new MonitorAddress(lockNumber, graph); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1025 append(lockAddress); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1026 } |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
1027 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
|
1028 frameState.unlock(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1029 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1030 |
2647
0bf54306c139
Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2645
diff
changeset
|
1031 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
|
1032 throw new CiBailout("jsr/ret not supported"); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1033 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1034 |
2647
0bf54306c139
Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2645
diff
changeset
|
1035 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
|
1036 throw new CiBailout("jsr/ret not supported"); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1037 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1038 |
2647
0bf54306c139
Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2645
diff
changeset
|
1039 private void genTableswitch() { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1040 int bci = bci(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1041 BytecodeTableSwitch ts = new BytecodeTableSwitch(stream(), bci); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1042 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
|
1043 List<Instruction> list = new ArrayList<Instruction>(max + 1); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1044 boolean isBackwards = false; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1045 for (int i = 0; i < max; i++) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1046 // add all successors to the successor list |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1047 int offset = ts.offsetAt(i); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1048 list.add(blockAt(bci + offset)); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1049 isBackwards |= offset < 0; // track if any of the successors are backwards |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1050 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1051 int offset = ts.defaultOffset(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1052 isBackwards |= offset < 0; // if the default successor is backwards |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1053 list.add(blockAt(bci + offset)); |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1054 boolean isSafepoint = isBackwards && !noSafepoints(); |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
1055 FrameState stateBefore = isSafepoint ? frameState.create(bci()) : null; |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1056 append(new TableSwitch(frameState.ipop(), (List) list, ts.lowKey(), stateBefore, graph)); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1057 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1058 |
2647
0bf54306c139
Removed accessor workaround.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2645
diff
changeset
|
1059 private void genLookupswitch() { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1060 int bci = bci(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1061 BytecodeLookupSwitch ls = new BytecodeLookupSwitch(stream(), bci); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1062 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
|
1063 List<Instruction> list = new ArrayList<Instruction>(max + 1); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1064 int[] keys = new int[max]; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1065 boolean isBackwards = false; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1066 for (int i = 0; i < max; i++) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1067 // add all successors to the successor list |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1068 int offset = ls.offsetAt(i); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1069 list.add(blockAt(bci + offset)); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1070 keys[i] = ls.keyAt(i); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1071 isBackwards |= offset < 0; // track if any of the successors are backwards |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1072 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1073 int offset = ls.defaultOffset(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1074 isBackwards |= offset < 0; // if the default successor is backwards |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1075 list.add(blockAt(bci + offset)); |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1076 boolean isSafepoint = isBackwards && !noSafepoints(); |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
1077 FrameState stateBefore = isSafepoint ? frameState.create(bci()) : null; |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1078 append(new LookupSwitch(frameState.ipop(), (List) list, keys, stateBefore, graph)); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1079 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1080 |
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
|
1081 private Value appendConstant(CiConstant constant) { |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
1082 return appendWithBCI(new Constant(constant, graph)); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1083 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1084 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1085 private Value append(Instruction x) { |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
1086 return appendWithBCI(x); |
2507
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 |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
1089 private Value appendWithBCI(Instruction x) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1090 if (x.isAppended()) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1091 // the instruction has already been added |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1092 return x; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1093 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1094 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1095 assert x.next() == null : "instruction should not have been appended yet"; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1096 assert lastInstr.next() == null : "cannot append instruction to instruction which isn't end (" + lastInstr + "->" + lastInstr.next() + ")"; |
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
|
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 (placeholder != null) { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1099 placeholder = null; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1100 } |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1101 |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
1102 lastInstr = lastInstr.appendNext(x); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1103 if (++stats.nodeCount >= C1XOptions.MaximumInstructionCount) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1104 // 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
|
1105 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
|
1106 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1107 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1108 return x; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1109 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1110 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1111 private Instruction blockAtOrNull(int bci) { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1112 return blockList[bci] != null ? blockList[bci].firstInstruction : null; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1113 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1114 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1115 private Instruction blockAt(int bci) { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1116 Instruction result = blockAtOrNull(bci); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1117 assert result != null : "Expected a block to begin at " + bci; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1118 return result; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1119 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1120 |
2652
6d19b4f476db
Removed more OSR handling stuff.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2650
diff
changeset
|
1121 private Value synchronizedObject(FrameStateAccess state, RiMethod target) { |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1122 if (isStatic(target.accessFlags())) { |
2594
092e628ddd5d
changed Constant and Convert, more StoreIndexed changes
Lukas Stadler <lukas.stadler@jku.at>
parents:
2592
diff
changeset
|
1123 Constant classConstant = new Constant(target.holder().getEncoding(Representation.JavaClass), graph); |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
1124 return appendWithBCI(classConstant); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1125 } else { |
2652
6d19b4f476db
Removed more OSR handling stuff.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2650
diff
changeset
|
1126 return state.localAt(0); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1127 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1128 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1129 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1130 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
|
1131 Block origBlock = curBlock; |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
1132 FrameState origState = frameState.create(-1); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1133 Instruction origLast = lastInstr; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1134 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1135 lastInstr = syncHandler.firstInstruction; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1136 curBlock = syncHandler; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1137 while (lastInstr.next() != null) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1138 // go forward to the end of the block |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1139 lastInstr = lastInstr.next(); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1140 } |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1141 frameState.initializeFrom(((BlockBegin) syncHandler.firstInstruction).stateBefore()); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1142 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1143 int bci = Instruction.SYNCHRONIZATION_ENTRY_BCI; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1144 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1145 assert lock != null; |
2644
4694daa6af3a
Removed CSE array length.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2643
diff
changeset
|
1146 assert frameState.locksSize() > 0 && frameState.lockAt(frameState.locksSize() - 1) == lock; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1147 if (lock instanceof Instruction) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1148 Instruction l = (Instruction) lock; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1149 if (!l.isAppended()) { |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
1150 lock = appendWithBCI(l); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1151 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1152 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1153 // exit the monitor |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1154 genMonitorExit(lock, Instruction.SYNCHRONIZATION_ENTRY_BCI); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1155 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1156 genThrow(bci); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1157 BlockEnd end = (BlockEnd) lastInstr; |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1158 ((BlockBegin) curBlock.firstInstruction).setEnd(end); |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
1159 end.setStateAfter(frameState.create(bci())); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1160 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1161 curBlock = origBlock; |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
1162 frameState.initializeFrom(origState); |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
1163 origState.delete(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1164 lastInstr = origLast; |
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 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
|
1168 Block block; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1169 while ((block = removeFromWorkList()) != null) { |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
1170 |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
1171 // remove blocks that have no predecessors by the time it their bytecodes are parsed |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1172 if (block.firstInstruction.predecessors().size() == 0) { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1173 markVisited(block); |
2707
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
1174 continue; |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
1175 } |
7ed72769d51a
exception handling related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2676
diff
changeset
|
1176 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1177 if (!isVisited(block)) { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1178 markVisited(block); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1179 // now parse the block |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1180 curBlock = block; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1181 if (block.firstInstruction instanceof Placeholder) { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1182 assert false; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1183 placeholder = block.firstInstruction; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1184 frameState.initializeFrom(((Placeholder) placeholder).stateBefore()); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1185 lastInstr = null; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1186 } else { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1187 assert block.firstInstruction instanceof BlockBegin; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1188 placeholder = null; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1189 frameState.initializeFrom(((BlockBegin) block.firstInstruction).stateBefore()); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1190 lastInstr = block.firstInstruction; |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1191 } |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1192 assert block.firstInstruction.next() == null; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1193 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1194 iterateBytecodesForBlock(block.startBci); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1195 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1196 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1197 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1198 |
2703
42450f536d24
More cleanup towards separation of graphbuilding<>graph<>lirgeneration
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2700
diff
changeset
|
1199 private BlockEnd iterateBytecodesForBlock(int bci) { |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
1200 assert frameState != null; |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1201 stream.setBCI(bci); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1202 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1203 BlockBegin block = (BlockBegin) curBlock.firstInstruction; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1204 BlockEnd end = null; |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1205 int endBCI = stream.endBCI(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1206 boolean blockStart = true; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1207 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1208 while (bci < endBCI) { |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1209 Instruction nextBlock = blockAtOrNull(bci); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1210 if (nextBlock != null && nextBlock != block) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1211 // we fell through to the next block, add a goto and break |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1212 end = new Goto((BlockBegin) nextBlock, null, graph); |
2716
c1a9bf38da28
Removed bci from the Instruction class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2715
diff
changeset
|
1213 lastInstr = lastInstr.appendNext(end); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1214 break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1215 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1216 // read the opcode |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1217 int opcode = stream.currentBC(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1218 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1219 traceState(); |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1220 traceInstruction(bci, stream, opcode, blockStart); |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1221 processBytecode(bci, stream, opcode); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1222 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1223 if (lastInstr instanceof BlockEnd) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1224 end = (BlockEnd) lastInstr; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1225 break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1226 } |
2640
9e30cf6dcf96
More frame state fixes. All jtt tests passing now again.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2639
diff
changeset
|
1227 stream.next(); |
9e30cf6dcf96
More frame state fixes. All jtt tests passing now again.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2639
diff
changeset
|
1228 bci = stream.currentBCI(); |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
1229 if (lastInstr instanceof StateSplit) { |
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
1230 StateSplit stateSplit = (StateSplit) lastInstr; |
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
1231 if (stateSplit.stateAfter() == null && stateSplit.needsStateAfter()) { |
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
1232 stateSplit.setStateAfter(frameState.create(bci)); |
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
1233 } |
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
1234 } |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1235 blockStart = false; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1236 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1237 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1238 // if the method terminates, we don't need the stack anymore |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1239 if (end instanceof Return || end instanceof Throw) { |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
1240 frameState.clearStack(); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1241 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1242 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1243 // connect to begin and set state |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1244 // NOTE that inlining may have changed the block we are parsing |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1245 assert end != null : "end should exist after iterating over bytecodes"; |
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
|
1246 FrameState stateAtEnd = frameState.create(bci()); |
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
|
1247 end.setStateAfter(stateAtEnd); |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1248 block.setEnd(end); |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2673
diff
changeset
|
1249 |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1250 // propagate the state |
2581
4a36a0bd6d18
added GraalGraph to classpath, Node as superclass of Value
Lukas Stadler <lukas.stadler@jku.at>
parents:
2570
diff
changeset
|
1251 for (BlockBegin succ : end.blockSuccessors()) { |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1252 assert succ.blockPredecessors().contains(block.end()); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1253 succ.mergeOrClone(stateAtEnd, method(), loopHeaders.contains(succ)); |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1254 addToWorkList(blockList[succ.bci()]); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1255 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1256 return end; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1257 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1258 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1259 private void traceState() { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1260 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
|
1261 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
|
1262 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
|
1263 Value value = frameState.localAt(i); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1264 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
|
1265 } |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
1266 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
|
1267 Value value = frameState.stackAt(i); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1268 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
|
1269 } |
2611
bd235cb4375a
FrameState cleanup: split into FrameStateBuilder and fixed-size FrameState, removed MutableFrameState
Lukas Stadler <lukas.stadler@jku.at>
parents:
2603
diff
changeset
|
1270 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
|
1271 Value value = frameState.lockAt(i); |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1272 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
|
1273 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1274 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1275 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1276 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1277 private void processBytecode(int bci, BytecodeStream s, int opcode) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1278 int cpi; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1279 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1280 // Checkstyle: stop |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1281 switch (opcode) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1282 case NOP : /* nothing to do */ break; |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
1283 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
|
1284 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
|
1285 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
|
1286 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
|
1287 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
|
1288 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
|
1289 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
|
1290 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
|
1291 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
|
1292 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
|
1293 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
|
1294 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
|
1295 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
|
1296 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
|
1297 case DCONST_1 : frameState.dpush(appendConstant(CiConstant.DOUBLE_1)); break; |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
1298 case BIPUSH : frameState.ipush(appendConstant(CiConstant.forInt(s.readByte()))); break; |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
1299 case SIPUSH : frameState.ipush(appendConstant(CiConstant.forInt(s.readShort()))); break; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1300 case LDC : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1301 case LDC_W : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1302 case LDC2_W : genLoadConstant(s.readCPI()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1303 case ILOAD : loadLocal(s.readLocalIndex(), CiKind.Int); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1304 case LLOAD : loadLocal(s.readLocalIndex(), CiKind.Long); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1305 case FLOAD : loadLocal(s.readLocalIndex(), CiKind.Float); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1306 case DLOAD : loadLocal(s.readLocalIndex(), CiKind.Double); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1307 case ALOAD : loadLocal(s.readLocalIndex(), CiKind.Object); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1308 case ILOAD_0 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1309 case ILOAD_1 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1310 case ILOAD_2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1311 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
|
1312 case LLOAD_0 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1313 case LLOAD_1 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1314 case LLOAD_2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1315 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
|
1316 case FLOAD_0 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1317 case FLOAD_1 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1318 case FLOAD_2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1319 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
|
1320 case DLOAD_0 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1321 case DLOAD_1 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1322 case DLOAD_2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1323 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
|
1324 case ALOAD_0 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1325 case ALOAD_1 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1326 case ALOAD_2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1327 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
|
1328 case IALOAD : genLoadIndexed(CiKind.Int ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1329 case LALOAD : genLoadIndexed(CiKind.Long ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1330 case FALOAD : genLoadIndexed(CiKind.Float ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1331 case DALOAD : genLoadIndexed(CiKind.Double); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1332 case AALOAD : genLoadIndexed(CiKind.Object); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1333 case BALOAD : genLoadIndexed(CiKind.Byte ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1334 case CALOAD : genLoadIndexed(CiKind.Char ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1335 case SALOAD : genLoadIndexed(CiKind.Short ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1336 case ISTORE : storeLocal(CiKind.Int, s.readLocalIndex()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1337 case LSTORE : storeLocal(CiKind.Long, s.readLocalIndex()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1338 case FSTORE : storeLocal(CiKind.Float, s.readLocalIndex()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1339 case DSTORE : storeLocal(CiKind.Double, s.readLocalIndex()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1340 case ASTORE : storeLocal(CiKind.Object, s.readLocalIndex()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1341 case ISTORE_0 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1342 case ISTORE_1 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1343 case ISTORE_2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1344 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
|
1345 case LSTORE_0 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1346 case LSTORE_1 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1347 case LSTORE_2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1348 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
|
1349 case FSTORE_0 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1350 case FSTORE_1 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1351 case FSTORE_2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1352 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
|
1353 case DSTORE_0 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1354 case DSTORE_1 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1355 case DSTORE_2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1356 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
|
1357 case ASTORE_0 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1358 case ASTORE_1 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1359 case ASTORE_2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1360 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
|
1361 case IASTORE : genStoreIndexed(CiKind.Int ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1362 case LASTORE : genStoreIndexed(CiKind.Long ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1363 case FASTORE : genStoreIndexed(CiKind.Float ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1364 case DASTORE : genStoreIndexed(CiKind.Double); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1365 case AASTORE : genStoreIndexed(CiKind.Object); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1366 case BASTORE : genStoreIndexed(CiKind.Byte ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1367 case CASTORE : genStoreIndexed(CiKind.Char ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1368 case SASTORE : genStoreIndexed(CiKind.Short ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1369 case POP : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1370 case POP2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1371 case DUP : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1372 case DUP_X1 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1373 case DUP_X2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1374 case DUP2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1375 case DUP2_X1 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1376 case DUP2_X2 : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1377 case SWAP : stackOp(opcode); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1378 case IADD : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1379 case ISUB : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1380 case IMUL : genArithmeticOp(CiKind.Int, opcode); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1381 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
|
1382 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
|
1383 case LADD : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1384 case LSUB : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1385 case LMUL : genArithmeticOp(CiKind.Long, opcode); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1386 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
|
1387 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
|
1388 case FADD : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1389 case FSUB : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1390 case FMUL : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1391 case FDIV : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1392 case FREM : genArithmeticOp(CiKind.Float, opcode); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1393 case DADD : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1394 case DSUB : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1395 case DMUL : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1396 case DDIV : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1397 case DREM : genArithmeticOp(CiKind.Double, opcode); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1398 case INEG : genNegateOp(CiKind.Int); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1399 case LNEG : genNegateOp(CiKind.Long); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1400 case FNEG : genNegateOp(CiKind.Float); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1401 case DNEG : genNegateOp(CiKind.Double); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1402 case ISHL : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1403 case ISHR : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1404 case IUSHR : genShiftOp(CiKind.Int, opcode); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1405 case IAND : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1406 case IOR : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1407 case IXOR : genLogicOp(CiKind.Int, opcode); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1408 case LSHL : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1409 case LSHR : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1410 case LUSHR : genShiftOp(CiKind.Long, opcode); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1411 case LAND : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1412 case LOR : // fall through |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1413 case LXOR : genLogicOp(CiKind.Long, opcode); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1414 case IINC : genIncrement(); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1415 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
|
1416 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
|
1417 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
|
1418 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
|
1419 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
|
1420 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
|
1421 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
|
1422 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
|
1423 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
|
1424 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
|
1425 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
|
1426 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
|
1427 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
|
1428 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
|
1429 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
|
1430 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
|
1431 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
|
1432 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
|
1433 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
|
1434 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
|
1435 case IFEQ : genIfZero(Condition.EQ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1436 case IFNE : genIfZero(Condition.NE); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1437 case IFLT : genIfZero(Condition.LT); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1438 case IFGE : genIfZero(Condition.GE); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1439 case IFGT : genIfZero(Condition.GT); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1440 case IFLE : genIfZero(Condition.LE); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1441 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
|
1442 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
|
1443 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
|
1444 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
|
1445 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
|
1446 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
|
1447 case IF_ACMPEQ : genIfSame(frameState.peekKind(), Condition.EQ); break; |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
1448 case IF_ACMPNE : genIfSame(frameState.peekKind(), Condition.NE); break; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1449 case GOTO : genGoto(s.currentBCI(), s.readBranchDest()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1450 case JSR : genJsr(s.readBranchDest()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1451 case RET : genRet(s.readLocalIndex()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1452 case TABLESWITCH : genTableswitch(); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1453 case LOOKUPSWITCH : genLookupswitch(); break; |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
1454 case IRETURN : genReturn(frameState.ipop()); break; |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
1455 case LRETURN : genReturn(frameState.lpop()); break; |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
1456 case FRETURN : genReturn(frameState.fpop()); break; |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
1457 case DRETURN : genReturn(frameState.dpop()); break; |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
1458 case ARETURN : genReturn(frameState.apop()); break; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1459 case RETURN : genReturn(null ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1460 case GETSTATIC : cpi = s.readCPI(); genGetStatic(cpi, constantPool().lookupField(cpi, opcode)); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1461 case PUTSTATIC : cpi = s.readCPI(); genPutStatic(cpi, constantPool().lookupField(cpi, opcode)); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1462 case GETFIELD : cpi = s.readCPI(); genGetField(cpi, constantPool().lookupField(cpi, opcode)); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1463 case PUTFIELD : cpi = s.readCPI(); genPutField(cpi, constantPool().lookupField(cpi, opcode)); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1464 case INVOKEVIRTUAL : cpi = s.readCPI(); genInvokeVirtual(constantPool().lookupMethod(cpi, opcode), cpi, constantPool()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1465 case INVOKESPECIAL : cpi = s.readCPI(); genInvokeSpecial(constantPool().lookupMethod(cpi, opcode), null, cpi, constantPool()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1466 case INVOKESTATIC : cpi = s.readCPI(); genInvokeStatic(constantPool().lookupMethod(cpi, opcode), cpi, constantPool()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1467 case INVOKEINTERFACE: cpi = s.readCPI(); genInvokeInterface(constantPool().lookupMethod(cpi, opcode), cpi, constantPool()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1468 case NEW : genNewInstance(s.readCPI()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1469 case NEWARRAY : genNewTypeArray(s.readLocalIndex()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1470 case ANEWARRAY : genNewObjectArray(s.readCPI()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1471 case ARRAYLENGTH : genArrayLength(); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1472 case ATHROW : genThrow(s.currentBCI()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1473 case CHECKCAST : genCheckCast(); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1474 case INSTANCEOF : genInstanceOf(); break; |
2616
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
1475 case MONITORENTER : genMonitorEnter(frameState.apop(), s.currentBCI()); break; |
3558ca7088c0
FrameState and Graphviz changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2615
diff
changeset
|
1476 case MONITOREXIT : genMonitorExit(frameState.apop(), s.currentBCI()); break; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1477 case MULTIANEWARRAY : genNewMultiArray(s.readCPI()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1478 case IFNULL : genIfNull(Condition.EQ); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1479 case IFNONNULL : genIfNull(Condition.NE); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1480 case GOTO_W : genGoto(s.currentBCI(), s.readFarBranchDest()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1481 case JSR_W : genJsr(s.readFarBranchDest()); break; |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1482 case BREAKPOINT: |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1483 throw new CiBailout("concurrent setting of breakpoint"); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1484 default: |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1485 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
|
1486 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1487 // Checkstyle: resume |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1488 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1489 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1490 private void traceInstruction(int bci, BytecodeStream s, int opcode, boolean blockStart) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1491 if (C1XOptions.TraceBytecodeParserLevel >= TRACELEVEL_INSTRUCTIONS && !TTY.isSuppressed()) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1492 StringBuilder sb = new StringBuilder(40); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1493 sb.append(blockStart ? '+' : '|'); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1494 if (bci < 10) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1495 sb.append(" "); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1496 } else if (bci < 100) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1497 sb.append(' '); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1498 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1499 sb.append(bci).append(": ").append(Bytecodes.nameOf(opcode)); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1500 for (int i = bci + 1; i < s.nextBCI(); ++i) { |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1501 sb.append(' ').append(s.readUByte(i)); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1502 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1503 log.println(sb.toString()); |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1504 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1505 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1506 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1507 private void genArrayLength() { |
2628
569228710be8
More FrameState work
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2622
diff
changeset
|
1508 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
|
1509 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1510 |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1511 private RiConstantPool constantPool() { |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1512 return constantPool; |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1513 } |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1514 |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1515 /** |
2592
fec99fc30af1
checkstyle fixes, updated AccessArray + subclasses
Lukas Stadler <lukas.stadler@jku.at>
parents:
2587
diff
changeset
|
1516 * Adds an exception handler. |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1517 * @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
|
1518 */ |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1519 private void addExceptionHandler(ExceptionHandler handler) { |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1520 if (exceptionHandlers == null) { |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1521 exceptionHandlers = new ArrayList<ExceptionHandler>(); |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1522 } |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1523 exceptionHandlers.add(handler); |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1524 flags |= Flag.HasHandler.mask; |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1525 } |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1526 |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1527 /** |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1528 * 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
|
1529 * 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
|
1530 * 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
|
1531 * @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
|
1532 */ |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1533 private void addToWorkList(Block block) { |
2705
d669ab61c7c7
Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2703
diff
changeset
|
1534 if (!isOnWorkList(block)) { |
d669ab61c7c7
Removed IsOnWorklistFlag
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2703
diff
changeset
|
1535 markOnWorkList(block); |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1536 sortIntoWorkList(block); |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1537 } |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1538 } |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1539 |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1540 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
|
1541 workList.offer(top); |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1542 } |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1543 |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1544 /** |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1545 * 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
|
1546 * 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
|
1547 * @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
|
1548 * in the worklist |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1549 */ |
2730
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1550 private Block removeFromWorkList() { |
027adfafd47e
first batch of GraphBuilder changes to remove dependencies on BlockBegin
Lukas Stadler <lukas.stadler@jku.at>
parents:
2724
diff
changeset
|
1551 return workList.poll(); |
2566
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1552 } |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1553 |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1554 /** |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1555 * 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
|
1556 * @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
|
1557 */ |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1558 private boolean hasHandler() { |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1559 return (flags & Flag.HasHandler.mask) != 0; |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1560 } |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1561 |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1562 /** |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1563 * Checks whether this graph can contain safepoints. |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1564 */ |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1565 private boolean noSafepoints() { |
d524ad648049
Finish remove inlining (removed ScopeData), remove JSR support
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
2565
diff
changeset
|
1566 return (flags & Flag.NoSafepoints.mask) != 0; |
2507
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1567 } |
9ec15d6914ca
Pull over of compiler from maxine repository.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
diff
changeset
|
1568 } |