Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java @ 7530:5e3d1a68664e
applied mx eclipseformat to all Java files
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 23 Jan 2013 16:34:57 +0100 |
parents | 69a8969dbf40 |
children | 0b646334c5f7 |
comparison
equal
deleted
inserted
replaced
7529:4a11124a3563 | 7530:5e3d1a68664e |
---|---|
25 import java.io.*; | 25 import java.io.*; |
26 | 26 |
27 import com.oracle.graal.api.meta.*; | 27 import com.oracle.graal.api.meta.*; |
28 | 28 |
29 /** | 29 /** |
30 * Represents the Java bytecode frame state(s) at a given position | 30 * Represents the Java bytecode frame state(s) at a given position including {@link Value locations} |
31 * including {@link Value locations} where to find the local variables, | 31 * where to find the local variables, operand stack values and locked objects of the bytecode |
32 * operand stack values and locked objects of the bytecode frame(s). | 32 * frame(s). |
33 */ | 33 */ |
34 public class BytecodeFrame extends BytecodePosition implements Serializable { | 34 public class BytecodeFrame extends BytecodePosition implements Serializable { |
35 | |
35 private static final long serialVersionUID = -345025397165977565L; | 36 private static final long serialVersionUID = -345025397165977565L; |
36 | 37 |
37 /** | 38 /** |
38 * An array of values representing how to reconstruct the state of the Java frame. | 39 * An array of values representing how to reconstruct the state of the Java frame. This is array |
39 * This is array is partitioned as follows: | 40 * is partitioned as follows: |
40 * <p> | 41 * <p> |
41 * <table border="1" cellpadding="5" frame="void", rules="all"> | 42 * <table border="1" cellpadding="5" frame="void", rules="all"> |
42 * <tr><th>Start index (inclusive)</th><th>End index (exclusive)</th><th>Description</th></tr> | 43 * <tr> |
43 * <tr><td>0</td> <td>numLocals</td> <td>Local variables</td></tr> | 44 * <th>Start index (inclusive)</th> |
44 * <tr><td>numLocals</td> <td>numLocals + numStack</td><td>Operand stack</td></tr> | 45 * <th>End index (exclusive)</th> |
45 * <tr><td>numLocals + numStack</td><td>values.length</td> <td>Locked objects</td></tr> | 46 * <th>Description</th> |
47 * </tr> | |
48 * <tr> | |
49 * <td>0</td> | |
50 * <td>numLocals</td> | |
51 * <td>Local variables</td> | |
52 * </tr> | |
53 * <tr> | |
54 * <td>numLocals</td> | |
55 * <td>numLocals + numStack</td> | |
56 * <td>Operand stack</td> | |
57 * </tr> | |
58 * <tr> | |
59 * <td>numLocals + numStack</td> | |
60 * <td>values.length</td> | |
61 * <td>Locked objects</td> | |
62 * </tr> | |
46 * </table> | 63 * </table> |
47 * <p> | 64 * <p> |
48 * Note that the number of locals and the number of stack slots may be smaller than the | 65 * Note that the number of locals and the number of stack slots may be smaller than the maximum |
49 * maximum number of locals and stack slots as specified in the compiled method. | 66 * number of locals and stack slots as specified in the compiled method. |
50 */ | 67 */ |
51 public final Value[] values; | 68 public final Value[] values; |
52 | 69 |
53 /** | 70 /** |
54 * The number of locals in the values array. | 71 * The number of locals in the values array. |
64 * The number of locks in the values array. | 81 * The number of locks in the values array. |
65 */ | 82 */ |
66 public final int numLocks; | 83 public final int numLocks; |
67 | 84 |
68 /** | 85 /** |
69 * In case this frame state belongs to a deoptimization, the leafGraphId will contain the StructuredGraph.graphId() of the graph that originally introduced this deoptimization point. | 86 * In case this frame state belongs to a deoptimization, the leafGraphId will contain the |
70 * This id is later on used by the runtime system to evict graphs from the graph cache when deoptimizations originating from them have been hit. | 87 * StructuredGraph.graphId() of the graph that originally introduced this deoptimization point. |
88 * This id is later on used by the runtime system to evict graphs from the graph cache when | |
89 * deoptimizations originating from them have been hit. | |
71 */ | 90 */ |
72 public final long leafGraphId; | 91 public final long leafGraphId; |
73 | 92 |
74 public final boolean rethrowException; | 93 public final boolean rethrowException; |
75 | 94 |
76 public final boolean duringCall; | 95 public final boolean duringCall; |
77 | 96 |
78 /** | 97 /** |
79 * Creates a new frame object. | 98 * Creates a new frame object. |
80 * | 99 * |
81 * @param caller the caller frame (which may be {@code null}) | 100 * @param caller the caller frame (which may be {@code null}) |
82 * @param method the method | 101 * @param method the method |
83 * @param bci a BCI within the method | 102 * @param bci a BCI within the method |
84 * @param rethrowException specifies if the VM should re-throw the pending exception when deopt'ing using this frame | 103 * @param rethrowException specifies if the VM should re-throw the pending exception when |
104 * deopt'ing using this frame | |
85 * @param values the frame state {@link #values} | 105 * @param values the frame state {@link #values} |
86 * @param numLocals the number of local variables | 106 * @param numLocals the number of local variables |
87 * @param numStack the depth of the stack | 107 * @param numStack the depth of the stack |
88 * @param numLocks the number of locked objects | 108 * @param numLocks the number of locked objects |
89 */ | 109 */ |
90 public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, Value[] values, int numLocals, int numStack, int numLocks, long leafGraphId) { | 110 public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, Value[] values, int numLocals, int numStack, int numLocks, |
111 long leafGraphId) { | |
91 super(caller, method, bci); | 112 super(caller, method, bci); |
92 assert values != null; | 113 assert values != null; |
93 this.rethrowException = rethrowException; | 114 this.rethrowException = rethrowException; |
94 this.duringCall = duringCall; | 115 this.duringCall = duringCall; |
95 this.values = values; | 116 this.values = values; |
100 assert !rethrowException || numStack == 1 : "must have exception on top of the stack"; | 121 assert !rethrowException || numStack == 1 : "must have exception on top of the stack"; |
101 } | 122 } |
102 | 123 |
103 /** | 124 /** |
104 * Gets the value representing the specified local variable. | 125 * Gets the value representing the specified local variable. |
126 * | |
105 * @param i the local variable index | 127 * @param i the local variable index |
106 * @return the value that can be used to reconstruct the local's current value | 128 * @return the value that can be used to reconstruct the local's current value |
107 */ | 129 */ |
108 public Value getLocalValue(int i) { | 130 public Value getLocalValue(int i) { |
109 return values[i]; | 131 return values[i]; |
110 } | 132 } |
111 | 133 |
112 /** | 134 /** |
113 * Gets the value representing the specified stack slot. | 135 * Gets the value representing the specified stack slot. |
136 * | |
114 * @param i the stack index | 137 * @param i the stack index |
115 * @return the value that can be used to reconstruct the stack slot's current value | 138 * @return the value that can be used to reconstruct the stack slot's current value |
116 */ | 139 */ |
117 public Value getStackValue(int i) { | 140 public Value getStackValue(int i) { |
118 return values[i + numLocals]; | 141 return values[i + numLocals]; |
119 } | 142 } |
120 | 143 |
121 /** | 144 /** |
122 * Gets the value representing the specified lock. | 145 * Gets the value representing the specified lock. |
146 * | |
123 * @param i the lock index | 147 * @param i the lock index |
124 * @return the value that can be used to reconstruct the lock's current value | 148 * @return the value that can be used to reconstruct the lock's current value |
125 */ | 149 */ |
126 public Value getLockValue(int i) { | 150 public Value getLockValue(int i) { |
127 return values[i + numLocals + numStack]; | 151 return values[i + numLocals + numStack]; |
128 } | 152 } |
129 | 153 |
130 /** | 154 /** |
131 * Gets the caller of this frame. | 155 * Gets the caller of this frame. |
132 * | 156 * |
133 * @return {@code null} if this frame has no caller | 157 * @return {@code null} if this frame has no caller |
134 */ | 158 */ |
135 public BytecodeFrame caller() { | 159 public BytecodeFrame caller() { |
136 return (BytecodeFrame) getCaller(); | 160 return (BytecodeFrame) getCaller(); |
137 } | 161 } |