--- old/src/hotspot/share/oops/method.cpp 2020-01-24 19:18:32.190102720 +0000 +++ new/src/hotspot/share/oops/method.cpp 2020-01-24 19:18:31.398503994 +0000 @@ -577,9 +577,16 @@ return extra_stack_entries() * Interpreter::stackElementSize; } -void Method::compute_size_of_parameters(Thread *thread) { - ArgumentSizeComputer asc(signature()); - set_size_of_parameters(asc.size() + (is_static() ? 0 : 1)); +// Derive size of parameters, return type, and fingerprint, +// all in one pass, which is run at load time. +// We need the first two, and might as well grab the third. +void Method::compute_from_signature(Symbol* sig) { + // At this point, since we are scanning the signature, + // we might as well compute the whole fingerprint. + Fingerprinter fp(sig, is_static()); + set_size_of_parameters(fp.size_of_parameters()); + constMethod()->set_result_type(fp.return_type()); + constMethod()->set_fingerprint(fp.fingerprint()); } bool Method::is_empty_method() const { @@ -1443,9 +1450,7 @@ m->set_signature_index(_imcp_invoke_signature); assert(MethodHandles::is_signature_polymorphic_name(m->name()), ""); assert(m->signature() == signature, ""); - ResultTypeFinder rtf(signature); - m->constMethod()->set_result_type(rtf.type()); - m->compute_size_of_parameters(THREAD); + m->compute_from_signature(signature); m->init_intrinsic_id(); assert(m->is_method_handle_intrinsic(), ""); #ifdef ASSERT @@ -1685,7 +1690,7 @@ ResourceMark rm(THREAD); Symbol* signature = m->signature(); for(SignatureStream ss(signature); !ss.is_done(); ss.next()) { - if (ss.is_object()) { + if (ss.is_reference()) { Symbol* sym = ss.as_symbol(); Symbol* name = sym; Klass* klass = SystemDictionary::resolve_or_null(name, class_loader, @@ -1713,7 +1718,7 @@ Symbol* signature = m->signature(); for(SignatureStream ss(signature); !ss.is_done(); ss.next()) { if (ss.type() == T_OBJECT) { - Symbol* name = ss.as_symbol_or_null(); + Symbol* name = ss.as_symbol(); if (name == NULL) return true; Klass* klass = SystemDictionary::find(name, class_loader, protection_domain, THREAD); if (klass == NULL) return true; @@ -1733,7 +1738,7 @@ name()->print_symbol_on(st); if (WizardMode) signature()->print_symbol_on(st); else if (MethodHandles::is_signature_polymorphic(intrinsic_id())) - MethodHandles::print_as_basic_type_signature_on(st, signature(), true); + MethodHandles::print_as_basic_type_signature_on(st, signature()); } // Comparer for sorting an object array containing @@ -1786,8 +1791,8 @@ _use_separator = false; } - void print_parameters() { _use_separator = false; iterate_parameters(); } - void print_returntype() { _use_separator = false; iterate_returntype(); } + void print_parameters() { _use_separator = false; do_parameters_on(this); } + void print_returntype() { _use_separator = false; do_type(return_type()); } };