comparison src/share/vm/interpreter/interpreter.cpp @ 1602:136b78722a08

6939203: JSR 292 needs method handle constants Summary: Add new CP types CONSTANT_MethodHandle, CONSTANT_MethodType; extend 'ldc' bytecode. Reviewed-by: twisti, never
author jrose
date Wed, 09 Jun 2010 18:50:45 -0700
parents e9ff18c4ace7
children 2a47bd84841f
comparison
equal deleted inserted replaced
1585:49fac4acd688 1602:136b78722a08
265 default : ShouldNotReachHere(); 265 default : ShouldNotReachHere();
266 } 266 }
267 } 267 }
268 #endif // PRODUCT 268 #endif // PRODUCT
269 269
270 static BasicType constant_pool_type(methodOop method, int index) {
271 constantTag tag = method->constants()->tag_at(index);
272 if (tag.is_int ()) return T_INT;
273 else if (tag.is_float ()) return T_FLOAT;
274 else if (tag.is_long ()) return T_LONG;
275 else if (tag.is_double ()) return T_DOUBLE;
276 else if (tag.is_string ()) return T_OBJECT;
277 else if (tag.is_unresolved_string()) return T_OBJECT;
278 else if (tag.is_klass ()) return T_OBJECT;
279 else if (tag.is_unresolved_klass ()) return T_OBJECT;
280 ShouldNotReachHere();
281 return T_ILLEGAL;
282 }
283
284 270
285 //------------------------------------------------------------------------------------------------------------------------ 271 //------------------------------------------------------------------------------------------------------------------------
286 // Deoptimization support 272 // Deoptimization support
287 273
288 // If deoptimization happens, this function returns the point of next bytecode to continue execution 274 // If deoptimization happens, this function returns the point of next bytecode to continue execution
328 } 314 }
329 break; 315 break;
330 } 316 }
331 317
332 case Bytecodes::_ldc : 318 case Bytecodes::_ldc :
333 type = constant_pool_type( method, *(bcp+1) );
334 break;
335
336 case Bytecodes::_ldc_w : // fall through 319 case Bytecodes::_ldc_w : // fall through
337 case Bytecodes::_ldc2_w: 320 case Bytecodes::_ldc2_w:
338 type = constant_pool_type( method, Bytes::get_Java_u2(bcp+1) ); 321 {
339 break; 322 Thread *thread = Thread::current();
323 ResourceMark rm(thread);
324 methodHandle mh(thread, method);
325 type = Bytecode_loadconstant_at(mh, bci)->result_type();
326 break;
327 }
340 328
341 default: 329 default:
342 type = Bytecodes::result_type(code); 330 type = Bytecodes::result_type(code);
343 break; 331 break;
344 } 332 }