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