Mercurial > hg > truffle
comparison src/share/vm/ci/ciStreams.cpp @ 6634:7f813940ac35
7192406: JSR 292: C2 needs exact return type information for invokedynamic and invokehandle call sites
Reviewed-by: kvn
author | twisti |
---|---|
date | Tue, 28 Aug 2012 15:24:39 -0700 |
parents | 1d7922586cf6 |
children | da91efe96a93 |
comparison
equal
deleted
inserted
replaced
6633:a5dd6e3ef9f3 | 6634:7f813940ac35 |
---|---|
353 | 353 |
354 // ------------------------------------------------------------------ | 354 // ------------------------------------------------------------------ |
355 // ciBytecodeStream::get_method | 355 // ciBytecodeStream::get_method |
356 // | 356 // |
357 // If this is a method invocation bytecode, get the invoked method. | 357 // If this is a method invocation bytecode, get the invoked method. |
358 ciMethod* ciBytecodeStream::get_method(bool& will_link) { | 358 // Additionally return the declared signature to get more concrete |
359 VM_ENTRY_MARK; | 359 // type information if required (Cf. invokedynamic and invokehandle). |
360 constantPoolHandle cpool(_method->get_methodOop()->constants()); | 360 ciMethod* ciBytecodeStream::get_method(bool& will_link, ciSignature* *declared_signature_result) { |
361 ciMethod* m = CURRENT_ENV->get_method_by_index(cpool, get_method_index(), cur_bc(), _holder); | 361 VM_ENTRY_MARK; |
362 ciEnv* env = CURRENT_ENV; | |
363 constantPoolHandle cpool(_method->get_methodOop()->constants()); | |
364 ciMethod* m = env->get_method_by_index(cpool, get_method_index(), cur_bc(), _holder); | |
362 will_link = m->is_loaded(); | 365 will_link = m->is_loaded(); |
366 // Get declared method signature and return it. | |
367 if (has_optional_appendix()) { | |
368 const int sig_index = get_method_signature_index(); | |
369 Symbol* sig_sym = cpool->symbol_at(sig_index); | |
370 ciKlass* pool_holder = env->get_object(cpool->pool_holder())->as_klass(); | |
371 (*declared_signature_result) = new (env->arena()) ciSignature(pool_holder, cpool, env->get_symbol(sig_sym)); | |
372 } else { | |
373 (*declared_signature_result) = m->signature(); | |
374 } | |
363 return m; | 375 return m; |
364 } | 376 } |
365 | 377 |
366 // ------------------------------------------------------------------ | 378 // ------------------------------------------------------------------ |
367 // ciBytecodeStream::has_appendix | 379 // ciBytecodeStream::has_appendix |
417 constantPoolOop cpool = _method->get_methodOop()->constants(); | 429 constantPoolOop cpool = _method->get_methodOop()->constants(); |
418 return cpool->klass_ref_index_at(get_method_index()); | 430 return cpool->klass_ref_index_at(get_method_index()); |
419 } | 431 } |
420 | 432 |
421 // ------------------------------------------------------------------ | 433 // ------------------------------------------------------------------ |
422 // ciBytecodeStream::get_declared_method_signature | |
423 // | |
424 // Get the declared signature of the currently referenced method. | |
425 // | |
426 // This is always the same as the signature of the resolved method | |
427 // itself, except for _invokehandle and _invokedynamic calls. | |
428 // | |
429 ciSignature* ciBytecodeStream::get_declared_method_signature() { | |
430 int sig_index = get_method_signature_index(); | |
431 VM_ENTRY_MARK; | |
432 ciEnv* env = CURRENT_ENV; | |
433 constantPoolHandle cpool(_method->get_methodOop()->constants()); | |
434 Symbol* sig_sym = cpool->symbol_at(sig_index); | |
435 ciKlass* pool_holder = env->get_object(cpool->pool_holder())->as_klass(); | |
436 return new (env->arena()) ciSignature(pool_holder, cpool, env->get_symbol(sig_sym)); | |
437 } | |
438 | |
439 // ------------------------------------------------------------------ | |
440 // ciBytecodeStream::get_method_signature_index | 434 // ciBytecodeStream::get_method_signature_index |
441 // | 435 // |
442 // Get the constant pool index of the signature of the method | 436 // Get the constant pool index of the signature of the method |
443 // referenced by the current bytecode. Used for generating | 437 // referenced by the current bytecode. Used for generating |
444 // deoptimization information. | 438 // deoptimization information. |
445 int ciBytecodeStream::get_method_signature_index() { | 439 int ciBytecodeStream::get_method_signature_index() { |
446 VM_ENTRY_MARK; | 440 GUARDED_VM_ENTRY( |
447 constantPoolOop cpool = _holder->get_instanceKlass()->constants(); | 441 constantPoolOop cpool = _holder->get_instanceKlass()->constants(); |
448 int method_index = get_method_index(); | 442 const int method_index = get_method_index(); |
449 int name_and_type_index = cpool->name_and_type_ref_index_at(method_index); | 443 const int name_and_type_index = cpool->name_and_type_ref_index_at(method_index); |
450 return cpool->signature_ref_index_at(name_and_type_index); | 444 return cpool->signature_ref_index_at(name_and_type_index); |
445 ) | |
451 } | 446 } |
452 | 447 |
453 // ------------------------------------------------------------------ | 448 // ------------------------------------------------------------------ |
454 // ciBytecodeStream::get_cpcache | 449 // ciBytecodeStream::get_cpcache |
455 ciCPCache* ciBytecodeStream::get_cpcache() const { | 450 ciCPCache* ciBytecodeStream::get_cpcache() const { |