304 #ifdef ASSERT
305 switch (cur_bc()) {
306 case Bytecodes::_invokeinterface:
307 case Bytecodes::_invokevirtual:
308 case Bytecodes::_invokespecial:
309 case Bytecodes::_invokestatic:
310 case Bytecodes::_invokedynamic:
311 break;
312 default:
313 ShouldNotReachHere();
314 }
315 #endif
316 return get_index_int();
317 }
318
319 // ------------------------------------------------------------------
320 // ciBytecodeStream::get_method
321 //
322 // If this is a method invocation bytecode, get the invoked method.
323 ciMethod* ciBytecodeStream::get_method(bool& will_link) {
324 ciMethod* m = CURRENT_ENV->get_method_by_index(_holder, get_method_index(),cur_bc());
325 will_link = m->is_loaded();
326 return m;
327 }
328
329 // ------------------------------------------------------------------
330 // ciBytecodeStream::get_declared_method_holder
331 //
332 // Get the declared holder of the currently referenced method.
333 //
334 // Usage note: the holder() of a ciMethod class returns the canonical
335 // holder of the method, rather than the holder declared in the
336 // bytecodes.
337 //
338 // There is no "will_link" result passed back. The user is responsible
339 // for checking linkability when retrieving the associated method.
340 ciKlass* ciBytecodeStream::get_declared_method_holder() {
341 bool ignore;
342 // report as InvokeDynamic for invokedynamic, which is syntactically classless
343 if (cur_bc() == Bytecodes::_invokedynamic)
344 return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_dyn_InvokeDynamic(), false);
353 // deoptimization information.
354 int ciBytecodeStream::get_method_holder_index() {
355 VM_ENTRY_MARK;
356 constantPoolOop cpool = _holder->get_instanceKlass()->constants();
357 return cpool->klass_ref_index_at(get_method_index());
358 }
359
360 // ------------------------------------------------------------------
361 // ciBytecodeStream::get_method_signature_index
362 //
363 // Get the constant pool index of the signature of the method
364 // referenced by the current bytecode. Used for generating
365 // deoptimization information.
366 int ciBytecodeStream::get_method_signature_index() {
367 VM_ENTRY_MARK;
368 constantPoolOop cpool = _holder->get_instanceKlass()->constants();
369 int method_index = get_method_index();
370 int name_and_type_index = cpool->name_and_type_ref_index_at(method_index);
371 return cpool->signature_ref_index_at(name_and_type_index);
372 }
|
304 #ifdef ASSERT
305 switch (cur_bc()) {
306 case Bytecodes::_invokeinterface:
307 case Bytecodes::_invokevirtual:
308 case Bytecodes::_invokespecial:
309 case Bytecodes::_invokestatic:
310 case Bytecodes::_invokedynamic:
311 break;
312 default:
313 ShouldNotReachHere();
314 }
315 #endif
316 return get_index_int();
317 }
318
319 // ------------------------------------------------------------------
320 // ciBytecodeStream::get_method
321 //
322 // If this is a method invocation bytecode, get the invoked method.
323 ciMethod* ciBytecodeStream::get_method(bool& will_link) {
324 ciMethod* m = CURRENT_ENV->get_method_by_index(_holder, get_method_index(), cur_bc());
325 will_link = m->is_loaded();
326 return m;
327 }
328
329 // ------------------------------------------------------------------
330 // ciBytecodeStream::get_declared_method_holder
331 //
332 // Get the declared holder of the currently referenced method.
333 //
334 // Usage note: the holder() of a ciMethod class returns the canonical
335 // holder of the method, rather than the holder declared in the
336 // bytecodes.
337 //
338 // There is no "will_link" result passed back. The user is responsible
339 // for checking linkability when retrieving the associated method.
340 ciKlass* ciBytecodeStream::get_declared_method_holder() {
341 bool ignore;
342 // report as InvokeDynamic for invokedynamic, which is syntactically classless
343 if (cur_bc() == Bytecodes::_invokedynamic)
344 return CURRENT_ENV->get_klass_by_name(_holder, ciSymbol::java_dyn_InvokeDynamic(), false);
353 // deoptimization information.
354 int ciBytecodeStream::get_method_holder_index() {
355 VM_ENTRY_MARK;
356 constantPoolOop cpool = _holder->get_instanceKlass()->constants();
357 return cpool->klass_ref_index_at(get_method_index());
358 }
359
360 // ------------------------------------------------------------------
361 // ciBytecodeStream::get_method_signature_index
362 //
363 // Get the constant pool index of the signature of the method
364 // referenced by the current bytecode. Used for generating
365 // deoptimization information.
366 int ciBytecodeStream::get_method_signature_index() {
367 VM_ENTRY_MARK;
368 constantPoolOop cpool = _holder->get_instanceKlass()->constants();
369 int method_index = get_method_index();
370 int name_and_type_index = cpool->name_and_type_ref_index_at(method_index);
371 return cpool->signature_ref_index_at(name_and_type_index);
372 }
373
374 // ------------------------------------------------------------------
375 // ciBytecodeStream::get_cpcache
376 ciCPCache* ciBytecodeStream::get_cpcache() {
377 VM_ENTRY_MARK;
378 // Get the constant pool.
379 constantPoolOop cpool = _holder->get_instanceKlass()->constants();
380 constantPoolCacheOop cpcache = cpool->cache();
381
382 return CURRENT_ENV->get_object(cpcache)->as_cpcache();
383 }
|