comparison src/share/vm/oops/methodData.cpp @ 8712:3efdfd6ddbf2

8003553: NPG: metaspace objects should be zeroed in constructors Summary: Zero metadata in constructors, not in allocation (and some in constructors) Reviewed-by: jmasa, sspitsyn
author coleenp
date Fri, 08 Mar 2013 11:47:57 -0500
parents 16fb9f942703
children 46f6f063b272
comparison
equal deleted inserted replaced
8711:6b803ba47588 8712:3efdfd6ddbf2
650 No_Safepoint_Verifier no_safepoint; // init function atomic wrt GC 650 No_Safepoint_Verifier no_safepoint; // init function atomic wrt GC
651 ResourceMark rm; 651 ResourceMark rm;
652 // Set the method back-pointer. 652 // Set the method back-pointer.
653 _method = method(); 653 _method = method();
654 654
655 if (TieredCompilation) { 655 _invocation_counter.init();
656 _invocation_counter.init(); 656 _backedge_counter.init();
657 _backedge_counter.init(); 657 _invocation_counter_start = 0;
658 _invocation_counter_start = 0; 658 _backedge_counter_start = 0;
659 _backedge_counter_start = 0; 659 _num_loops = 0;
660 _num_loops = 0; 660 _num_blocks = 0;
661 _num_blocks = 0; 661 _highest_comp_level = 0;
662 _highest_comp_level = 0; 662 _highest_osr_comp_level = 0;
663 _highest_osr_comp_level = 0; 663 _would_profile = true;
664 _would_profile = true;
665 }
666 set_creation_mileage(mileage_of(method())); 664 set_creation_mileage(mileage_of(method()));
667 665
668 // Initialize flags and trap history. 666 // Initialize flags and trap history.
669 _nof_decompiles = 0; 667 _nof_decompiles = 0;
670 _nof_overflow_recompiles = 0; 668 _nof_overflow_recompiles = 0;
671 _nof_overflow_traps = 0; 669 _nof_overflow_traps = 0;
670 _eflags = 0;
671 _arg_local = 0;
672 _arg_stack = 0;
673 _arg_returned = 0;
672 assert(sizeof(_trap_hist) % sizeof(HeapWord) == 0, "align"); 674 assert(sizeof(_trap_hist) % sizeof(HeapWord) == 0, "align");
673 Copy::zero_to_words((HeapWord*) &_trap_hist, 675 Copy::zero_to_words((HeapWord*) &_trap_hist,
674 sizeof(_trap_hist) / sizeof(HeapWord)); 676 sizeof(_trap_hist) / sizeof(HeapWord));
675 677
676 // Go through the bytecodes and allocate and initialize the 678 // Go through the bytecodes and allocate and initialize the
677 // corresponding data cells. 679 // corresponding data cells.
678 int data_size = 0; 680 int data_size = 0;
679 int empty_bc_count = 0; // number of bytecodes lacking data 681 int empty_bc_count = 0; // number of bytecodes lacking data
682 _data[0] = 0; // apparently not set below.
680 BytecodeStream stream(method); 683 BytecodeStream stream(method);
681 Bytecodes::Code c; 684 Bytecodes::Code c;
682 while ((c = stream.next()) >= 0) { 685 while ((c = stream.next()) >= 0) {
683 int size_in_bytes = initialize_data(&stream, data_size); 686 int size_in_bytes = initialize_data(&stream, data_size);
684 data_size += size_in_bytes; 687 data_size += size_in_bytes;
708 _hint_di = first_di(); 711 _hint_di = first_di();
709 712
710 post_initialize(&stream); 713 post_initialize(&stream);
711 714
712 set_size(object_size); 715 set_size(object_size);
716
713 } 717 }
714 718
715 // Get a measure of how much mileage the method has on it. 719 // Get a measure of how much mileage the method has on it.
716 int MethodData::mileage_of(Method* method) { 720 int MethodData::mileage_of(Method* method) {
717 int mileage = 0; 721 int mileage = 0;