Mercurial > hg > graal-jvmci-8
comparison src/share/vm/classfile/classFileParser.cpp @ 875:6a93908f268f
6857194: Add hotspot perf counters to aid class loading performance measurement
Summary: Add new jvmstat counters to measure detailed class loading time
Reviewed-by: acorn, kamg
author | mchung |
---|---|
date | Fri, 10 Jul 2009 11:10:00 -0700 |
parents | e5b0439ef4ae |
children | 494244ae0171 |
comparison
equal
deleted
inserted
replaced
812:85d0690f7d12 | 875:6a93908f268f |
---|---|
545 | 545 |
546 objArrayHandle ClassFileParser::parse_interfaces(constantPoolHandle cp, | 546 objArrayHandle ClassFileParser::parse_interfaces(constantPoolHandle cp, |
547 int length, | 547 int length, |
548 Handle class_loader, | 548 Handle class_loader, |
549 Handle protection_domain, | 549 Handle protection_domain, |
550 PerfTraceTime* vmtimer, | |
551 symbolHandle class_name, | 550 symbolHandle class_name, |
552 TRAPS) { | 551 TRAPS) { |
553 ClassFileStream* cfs = stream(); | 552 ClassFileStream* cfs = stream(); |
554 assert(length > 0, "only called for length>0"); | 553 assert(length > 0, "only called for length>0"); |
555 objArrayHandle nullHandle; | 554 objArrayHandle nullHandle; |
573 // Don't need to check legal name because it's checked when parsing constant pool. | 572 // Don't need to check legal name because it's checked when parsing constant pool. |
574 // But need to make sure it's not an array type. | 573 // But need to make sure it's not an array type. |
575 guarantee_property(unresolved_klass->byte_at(0) != JVM_SIGNATURE_ARRAY, | 574 guarantee_property(unresolved_klass->byte_at(0) != JVM_SIGNATURE_ARRAY, |
576 "Bad interface name in class file %s", CHECK_(nullHandle)); | 575 "Bad interface name in class file %s", CHECK_(nullHandle)); |
577 | 576 |
578 vmtimer->suspend(); // do not count recursive loading twice | |
579 // Call resolve_super so classcircularity is checked | 577 // Call resolve_super so classcircularity is checked |
580 klassOop k = SystemDictionary::resolve_super_or_fail(class_name, | 578 klassOop k = SystemDictionary::resolve_super_or_fail(class_name, |
581 unresolved_klass, class_loader, protection_domain, | 579 unresolved_klass, class_loader, protection_domain, |
582 false, CHECK_(nullHandle)); | 580 false, CHECK_(nullHandle)); |
583 interf = KlassHandle(THREAD, k); | 581 interf = KlassHandle(THREAD, k); |
584 vmtimer->resume(); | |
585 | 582 |
586 if (LinkWellKnownClasses) // my super type is well known to me | 583 if (LinkWellKnownClasses) // my super type is well known to me |
587 cp->klass_at_put(interface_index, interf()); // eagerly resolve | 584 cp->klass_at_put(interface_index, interf()); // eagerly resolve |
588 } | 585 } |
589 | 586 |
2556 unsigned char *cached_class_file_bytes = NULL; | 2553 unsigned char *cached_class_file_bytes = NULL; |
2557 jint cached_class_file_length; | 2554 jint cached_class_file_length; |
2558 | 2555 |
2559 ClassFileStream* cfs = stream(); | 2556 ClassFileStream* cfs = stream(); |
2560 // Timing | 2557 // Timing |
2561 PerfTraceTime vmtimer(ClassLoader::perf_accumulated_time()); | 2558 assert(THREAD->is_Java_thread(), "must be a JavaThread"); |
2559 JavaThread* jt = (JavaThread*) THREAD; | |
2560 | |
2561 PerfClassTraceTime ctimer(ClassLoader::perf_class_parse_time(), | |
2562 ClassLoader::perf_class_parse_selftime(), | |
2563 NULL, | |
2564 jt->get_thread_stat()->perf_recursion_counts_addr(), | |
2565 jt->get_thread_stat()->perf_timers_addr(), | |
2566 PerfClassTraceTime::PARSE_CLASS); | |
2562 | 2567 |
2563 _has_finalizer = _has_empty_finalizer = _has_vanilla_constructor = false; | 2568 _has_finalizer = _has_empty_finalizer = _has_vanilla_constructor = false; |
2564 | 2569 |
2565 if (JvmtiExport::should_post_class_file_load_hook()) { | 2570 if (JvmtiExport::should_post_class_file_load_hook()) { |
2566 unsigned char* ptr = cfs->buffer(); | 2571 unsigned char* ptr = cfs->buffer(); |
2736 u2 itfs_len = cfs->get_u2_fast(); | 2741 u2 itfs_len = cfs->get_u2_fast(); |
2737 objArrayHandle local_interfaces; | 2742 objArrayHandle local_interfaces; |
2738 if (itfs_len == 0) { | 2743 if (itfs_len == 0) { |
2739 local_interfaces = objArrayHandle(THREAD, Universe::the_empty_system_obj_array()); | 2744 local_interfaces = objArrayHandle(THREAD, Universe::the_empty_system_obj_array()); |
2740 } else { | 2745 } else { |
2741 local_interfaces = parse_interfaces(cp, itfs_len, class_loader, protection_domain, &vmtimer, _class_name, CHECK_(nullHandle)); | 2746 local_interfaces = parse_interfaces(cp, itfs_len, class_loader, protection_domain, _class_name, CHECK_(nullHandle)); |
2742 } | 2747 } |
2743 | 2748 |
2744 // Fields (offsets are filled in later) | 2749 // Fields (offsets are filled in later) |
2745 struct FieldAllocationCount fac = {0,0,0,0,0,0,0,0,0,0}; | 2750 struct FieldAllocationCount fac = {0,0,0,0,0,0,0,0,0,0}; |
2746 objArrayHandle fields_annotations; | 2751 objArrayHandle fields_annotations; |
2780 sk, | 2785 sk, |
2781 class_loader, | 2786 class_loader, |
2782 protection_domain, | 2787 protection_domain, |
2783 true, | 2788 true, |
2784 CHECK_(nullHandle)); | 2789 CHECK_(nullHandle)); |
2790 | |
2785 KlassHandle kh (THREAD, k); | 2791 KlassHandle kh (THREAD, k); |
2786 super_klass = instanceKlassHandle(THREAD, kh()); | 2792 super_klass = instanceKlassHandle(THREAD, kh()); |
2787 if (LinkWellKnownClasses) // my super class is well known to me | 2793 if (LinkWellKnownClasses) // my super class is well known to me |
2788 cp->klass_at_put(super_class_index, super_klass()); // eagerly resolve | 2794 cp->klass_at_put(super_class_index, super_klass()); // eagerly resolve |
2789 } | 2795 } |