comparison src/share/vm/oops/methodData.cpp @ 8611:6c4db417385a

added API to reset the profiling information for a method added some test cases that check the recorded profiling information
author Christian Haeubl <haeubl@ssw.jku.at>
date Wed, 27 Mar 2013 17:25:59 +0100
parents 0026a2e70695
children 91c79e13b9cf
comparison
equal deleted inserted replaced
8610:5407d1dd6450 8611:6c4db417385a
657 } 657 }
658 } 658 }
659 659
660 // Initialize the MethodData* corresponding to a given method. 660 // Initialize the MethodData* corresponding to a given method.
661 MethodData::MethodData(methodHandle method, int size, TRAPS) { 661 MethodData::MethodData(methodHandle method, int size, TRAPS) {
662 // Set the method back-pointer.
663 _method = method();
664 initialize();
665 }
666
667 void MethodData::initialize() {
662 No_Safepoint_Verifier no_safepoint; // init function atomic wrt GC 668 No_Safepoint_Verifier no_safepoint; // init function atomic wrt GC
663 ResourceMark rm; 669 ResourceMark rm;
664 // Set the method back-pointer.
665 _method = method();
666 670
667 if (TieredCompilation) { 671 if (TieredCompilation) {
668 _invocation_counter.init(); 672 _invocation_counter.init();
669 _backedge_counter.init(); 673 _backedge_counter.init();
670 _invocation_counter_start = 0; 674 _invocation_counter_start = 0;
687 691
688 // Go through the bytecodes and allocate and initialize the 692 // Go through the bytecodes and allocate and initialize the
689 // corresponding data cells. 693 // corresponding data cells.
690 int data_size = 0; 694 int data_size = 0;
691 int empty_bc_count = 0; // number of bytecodes lacking data 695 int empty_bc_count = 0; // number of bytecodes lacking data
692 BytecodeStream stream(method); 696 BytecodeStream stream(method());
693 Bytecodes::Code c; 697 Bytecodes::Code c;
694 while ((c = stream.next()) >= 0) { 698 while ((c = stream.next()) >= 0) {
695 int size_in_bytes = initialize_data(&stream, data_size); 699 int size_in_bytes = initialize_data(&stream, data_size);
696 data_size += size_in_bytes; 700 data_size += size_in_bytes;
697 701
702 706
703 // Add some extra DataLayout cells (at least one) to track stray traps. 707 // Add some extra DataLayout cells (at least one) to track stray traps.
704 int extra_data_count = compute_extra_data_count(data_size, empty_bc_count); 708 int extra_data_count = compute_extra_data_count(data_size, empty_bc_count);
705 int extra_size = extra_data_count * DataLayout::compute_size_in_bytes(0); 709 int extra_size = extra_data_count * DataLayout::compute_size_in_bytes(0);
706 object_size += extra_size; 710 object_size += extra_size;
711
712 Copy::zero_to_bytes((HeapWord*) extra_data_base(), extra_size);
707 713
708 #ifndef GRAALVM 714 #ifndef GRAALVM
709 // Add a cell to record information about modified arguments. 715 // Add a cell to record information about modified arguments.
710 // Set up _args_modified array after traps cells so that 716 // Set up _args_modified array after traps cells so that
711 // the code for traps cells works. 717 // the code for traps cells works.