Mercurial > hg > graal-jvmci-8
comparison src/share/vm/interpreter/abstractInterpreter.hpp @ 1506:2338d41fbd81
6943304: remove tagged stack interpreter
Reviewed-by: coleenp, never, gbenson
author | twisti |
---|---|
date | Fri, 30 Apr 2010 08:37:24 -0700 |
parents | ddb7834449d0 |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
1505:0c5b3cf3c1f5 | 1506:2338d41fbd81 |
---|---|
165 static int BasicType_as_index(BasicType type); // computes index into result_handler_by_index table | 165 static int BasicType_as_index(BasicType type); // computes index into result_handler_by_index table |
166 static bool in_native_entry(address pc) { return _native_entry_begin <= pc && pc < _native_entry_end; } | 166 static bool in_native_entry(address pc) { return _native_entry_begin <= pc && pc < _native_entry_end; } |
167 // Debugging/printing | 167 // Debugging/printing |
168 static void print(); // prints the interpreter code | 168 static void print(); // prints the interpreter code |
169 | 169 |
170 // Support for Tagged Stacks | 170 public: |
171 // | 171 // Interpreter helpers |
172 // Tags are stored on the Java Expression stack above the value: | 172 const static int stackElementWords = 1; |
173 // | 173 const static int stackElementSize = stackElementWords * wordSize; |
174 // tag | 174 const static int logStackElementSize = LogBytesPerWord; |
175 // value | |
176 // | |
177 // For double values: | |
178 // | |
179 // tag2 | |
180 // high word | |
181 // tag1 | |
182 // low word | |
183 | |
184 public: | |
185 static int stackElementWords() { return TaggedStackInterpreter ? 2 : 1; } | |
186 static int stackElementSize() { return stackElementWords()*wordSize; } | |
187 static int logStackElementSize() { return | |
188 TaggedStackInterpreter? LogBytesPerWord+1 : LogBytesPerWord; } | |
189 | |
190 // Tag is at pointer, value is one below for a stack growing down | |
191 // (or above for stack growing up) | |
192 static int value_offset_in_bytes() { | |
193 return TaggedStackInterpreter ? | |
194 frame::interpreter_frame_expression_stack_direction() * wordSize : 0; | |
195 } | |
196 static int tag_offset_in_bytes() { | |
197 assert(TaggedStackInterpreter, "should not call this"); | |
198 return 0; | |
199 } | |
200 | |
201 // Tagged Locals | |
202 // Locals are stored relative to Llocals: | |
203 // | |
204 // tag <- Llocals[n] | |
205 // value | |
206 // | |
207 // Category 2 types are indexed as: | |
208 // | |
209 // tag <- Llocals[-n] | |
210 // high word | |
211 // tag <- Llocals[-n+1] | |
212 // low word | |
213 // | |
214 | 175 |
215 // Local values relative to locals[n] | 176 // Local values relative to locals[n] |
216 static int local_offset_in_bytes(int n) { | 177 static int local_offset_in_bytes(int n) { |
217 return ((frame::interpreter_frame_expression_stack_direction() * n) * | 178 return ((frame::interpreter_frame_expression_stack_direction() * n) * stackElementSize); |
218 stackElementSize()) + value_offset_in_bytes(); | |
219 } | |
220 static int local_tag_offset_in_bytes(int n) { | |
221 assert(TaggedStackInterpreter, "should not call this"); | |
222 return ((frame::interpreter_frame_expression_stack_direction() * n) * | |
223 stackElementSize()) + tag_offset_in_bytes(); | |
224 } | 179 } |
225 | 180 |
226 // access to stacked values according to type: | 181 // access to stacked values according to type: |
227 static oop* oop_addr_in_slot(intptr_t* slot_addr) { | 182 static oop* oop_addr_in_slot(intptr_t* slot_addr) { |
228 return (oop*) slot_addr; | 183 return (oop*) slot_addr; |
235 return (jint*) slot_addr; | 190 return (jint*) slot_addr; |
236 } | 191 } |
237 static jlong long_in_slot(intptr_t* slot_addr) { | 192 static jlong long_in_slot(intptr_t* slot_addr) { |
238 if (sizeof(intptr_t) >= sizeof(jlong)) { | 193 if (sizeof(intptr_t) >= sizeof(jlong)) { |
239 return *(jlong*) slot_addr; | 194 return *(jlong*) slot_addr; |
240 } else if (!TaggedStackInterpreter) { | 195 } else { |
241 return Bytes::get_native_u8((address)slot_addr); | 196 return Bytes::get_native_u8((address)slot_addr); |
242 } else { | |
243 assert(sizeof(intptr_t) * 2 == sizeof(jlong), "ILP32"); | |
244 // assemble the long in memory order (not arithmetic order) | |
245 union { jlong j; jint i[2]; } u; | |
246 u.i[0] = (jint) slot_addr[0*stackElementSize()]; | |
247 u.i[1] = (jint) slot_addr[1*stackElementSize()]; | |
248 return u.j; | |
249 } | 197 } |
250 } | 198 } |
251 static void set_long_in_slot(intptr_t* slot_addr, jlong value) { | 199 static void set_long_in_slot(intptr_t* slot_addr, jlong value) { |
252 if (sizeof(intptr_t) >= sizeof(jlong)) { | 200 if (sizeof(intptr_t) >= sizeof(jlong)) { |
253 *(jlong*) slot_addr = value; | 201 *(jlong*) slot_addr = value; |
254 } else if (!TaggedStackInterpreter) { | 202 } else { |
255 Bytes::put_native_u8((address)slot_addr, value); | 203 Bytes::put_native_u8((address)slot_addr, value); |
256 } else { | |
257 assert(sizeof(intptr_t) * 2 == sizeof(jlong), "ILP32"); | |
258 // assemble the long in memory order (not arithmetic order) | |
259 union { jlong j; jint i[2]; } u; | |
260 u.j = value; | |
261 slot_addr[0*stackElementSize()] = (intptr_t) u.i[0]; | |
262 slot_addr[1*stackElementSize()] = (intptr_t) u.i[1]; | |
263 } | 204 } |
264 } | 205 } |
265 static void get_jvalue_in_slot(intptr_t* slot_addr, BasicType type, jvalue* value) { | 206 static void get_jvalue_in_slot(intptr_t* slot_addr, BasicType type, jvalue* value) { |
266 switch (type) { | 207 switch (type) { |
267 case T_BOOLEAN: value->z = *int_addr_in_slot(slot_addr); break; | 208 case T_BOOLEAN: value->z = *int_addr_in_slot(slot_addr); break; |