552 methodHandle mh(THREAD, m);
553 MethodCounters* counters = MethodCounters::allocate(mh, THREAD);
554 if (HAS_PENDING_EXCEPTION) {
555 CompileBroker::log_metaspace_failure();
556 ClassLoaderDataGraph::set_metaspace_oom(true);
557 return NULL; // return the exception (which is cleared)
558 }
559 if (!mh->init_method_counters(counters)) {
560 MetadataFactory::free_metadata(mh->method_holder()->class_loader_data(), counters);
561 }
562
563 if (LogTouchedMethods) {
564 mh->log_touched(CHECK_NULL);
565 }
566
567 return mh->method_counters();
568 }
569
570 bool Method::init_method_counters(MethodCounters* counters) {
571 // Try to install a pointer to MethodCounters, return true on success.
572 return Atomic::replace_if_null(counters, &_method_counters);
573 }
574
575 int Method::extra_stack_words() {
576 // not an inline function, to avoid a header dependency on Interpreter
577 return extra_stack_entries() * Interpreter::stackElementSize;
578 }
579
580 void Method::compute_size_of_parameters(Thread *thread) {
581 ArgumentSizeComputer asc(signature());
582 set_size_of_parameters(asc.size() + (is_static() ? 0 : 1));
583 }
584
585 bool Method::is_empty_method() const {
586 return code_size() == 1
587 && *code_base() == Bytecodes::_return;
588 }
589
590 bool Method::is_vanilla_constructor() const {
591 // Returns true if this method is a vanilla constructor, i.e. an "<init>" "()V" method
592 // which only calls the superclass vanilla constructor and possibly does stores of
|
552 methodHandle mh(THREAD, m);
553 MethodCounters* counters = MethodCounters::allocate(mh, THREAD);
554 if (HAS_PENDING_EXCEPTION) {
555 CompileBroker::log_metaspace_failure();
556 ClassLoaderDataGraph::set_metaspace_oom(true);
557 return NULL; // return the exception (which is cleared)
558 }
559 if (!mh->init_method_counters(counters)) {
560 MetadataFactory::free_metadata(mh->method_holder()->class_loader_data(), counters);
561 }
562
563 if (LogTouchedMethods) {
564 mh->log_touched(CHECK_NULL);
565 }
566
567 return mh->method_counters();
568 }
569
570 bool Method::init_method_counters(MethodCounters* counters) {
571 // Try to install a pointer to MethodCounters, return true on success.
572 return Atomic::replace_if_null(&_method_counters, counters);
573 }
574
575 int Method::extra_stack_words() {
576 // not an inline function, to avoid a header dependency on Interpreter
577 return extra_stack_entries() * Interpreter::stackElementSize;
578 }
579
580 void Method::compute_size_of_parameters(Thread *thread) {
581 ArgumentSizeComputer asc(signature());
582 set_size_of_parameters(asc.size() + (is_static() ? 0 : 1));
583 }
584
585 bool Method::is_empty_method() const {
586 return code_size() == 1
587 && *code_base() == Bytecodes::_return;
588 }
589
590 bool Method::is_vanilla_constructor() const {
591 // Returns true if this method is a vanilla constructor, i.e. an "<init>" "()V" method
592 // which only calls the superclass vanilla constructor and possibly does stores of
|