< prev index next >

src/hotspot/share/oops/method.cpp

Print this page




 488   // Try to install a pointer to MethodCounters, return true on success.
 489   return Atomic::replace_if_null(counters, &_method_counters);
 490 }
 491 
 492 int Method::extra_stack_words() {
 493   // not an inline function, to avoid a header dependency on Interpreter
 494   return extra_stack_entries() * Interpreter::stackElementSize;
 495 }
 496 
 497 
 498 void Method::compute_size_of_parameters(Thread *thread) {
 499   ArgumentSizeComputer asc(signature());
 500   set_size_of_parameters(asc.size() + (is_static() ? 0 : 1));
 501 }
 502 
 503 BasicType Method::result_type() const {
 504   ResultTypeFinder rtf(signature());
 505   return rtf.type();
 506 }
 507 
 508 #ifdef ASSERT
 509 // ValueKlass the method is declared to return. This must not
 510 // safepoint as it is called with references live on the stack at
 511 // locations the GC is unaware of.
 512 ValueKlass* Method::returned_value_type(Thread* thread) const {
 513   SignatureStream ss(signature());
 514   while (!ss.at_return_type()) {
 515     ss.next();
 516   }
 517   Handle class_loader(thread, method_holder()->class_loader());
 518   Handle protection_domain(thread, method_holder()->protection_domain());
 519   Klass* k = NULL;
 520   {
 521     NoSafepointVerifier nsv;
 522     k = ss.as_klass(class_loader, protection_domain, SignatureStream::ReturnNull, thread);
 523   }
 524   assert(k != NULL && !thread->has_pending_exception(), "can't resolve klass");
 525   return ValueKlass::cast(k);
 526 }
 527 #endif
 528 
 529 bool Method::is_empty_method() const {
 530   return  code_size() == 1
 531       && *code_base() == Bytecodes::_return;
 532 }
 533 
 534 
 535 bool Method::is_vanilla_constructor() const {
 536   // Returns true if this method is a vanilla constructor, i.e. an "<init>" "()V" method
 537   // which only calls the superclass vanilla constructor and possibly does stores of
 538   // zero constants to local fields:
 539   //
 540   //   aload_0
 541   //   invokespecial
 542   //   indexbyte1
 543   //   indexbyte2
 544   //
 545   // followed by an (optional) sequence of:
 546   //
 547   //   aload_0




 488   // Try to install a pointer to MethodCounters, return true on success.
 489   return Atomic::replace_if_null(counters, &_method_counters);
 490 }
 491 
 492 int Method::extra_stack_words() {
 493   // not an inline function, to avoid a header dependency on Interpreter
 494   return extra_stack_entries() * Interpreter::stackElementSize;
 495 }
 496 
 497 
 498 void Method::compute_size_of_parameters(Thread *thread) {
 499   ArgumentSizeComputer asc(signature());
 500   set_size_of_parameters(asc.size() + (is_static() ? 0 : 1));
 501 }
 502 
 503 BasicType Method::result_type() const {
 504   ResultTypeFinder rtf(signature());
 505   return rtf.type();
 506 }
 507 

 508 // ValueKlass the method is declared to return. This must not
 509 // safepoint as it is called with references live on the stack at
 510 // locations the GC is unaware of.
 511 ValueKlass* Method::returned_value_type(Thread* thread) const {
 512   SignatureStream ss(signature());
 513   while (!ss.at_return_type()) {
 514     ss.next();
 515   }
 516   Handle class_loader(thread, method_holder()->class_loader());
 517   Handle protection_domain(thread, method_holder()->protection_domain());
 518   Klass* k = NULL;
 519   {
 520     NoSafepointVerifier nsv;
 521     k = ss.as_klass(class_loader, protection_domain, SignatureStream::ReturnNull, thread);
 522   }
 523   assert(k != NULL && !thread->has_pending_exception(), "can't resolve klass");
 524   return ValueKlass::cast(k);
 525 }

 526 
 527 bool Method::is_empty_method() const {
 528   return  code_size() == 1
 529       && *code_base() == Bytecodes::_return;
 530 }
 531 
 532 
 533 bool Method::is_vanilla_constructor() const {
 534   // Returns true if this method is a vanilla constructor, i.e. an "<init>" "()V" method
 535   // which only calls the superclass vanilla constructor and possibly does stores of
 536   // zero constants to local fields:
 537   //
 538   //   aload_0
 539   //   invokespecial
 540   //   indexbyte1
 541   //   indexbyte2
 542   //
 543   // followed by an (optional) sequence of:
 544   //
 545   //   aload_0


< prev index next >