comparison src/share/vm/oops/methodData.cpp @ 8883:b9a918201d47

Merge with hsx25
author Gilles Duboscq <duboscq@ssw.jku.at>
date Sat, 06 Apr 2013 20:04:06 +0200
parents d343737786fe 46f6f063b272
children 89e4d67fdd2a
comparison
equal deleted inserted replaced
8660:d47b52b0ff68 8883:b9a918201d47
390 390
391 return new (loader_data, size, false, THREAD) MethodData(method(), size, CHECK_NULL); 391 return new (loader_data, size, false, THREAD) MethodData(method(), size, CHECK_NULL);
392 } 392 }
393 393
394 int MethodData::bytecode_cell_count(Bytecodes::Code code) { 394 int MethodData::bytecode_cell_count(Bytecodes::Code code) {
395 #if defined(COMPILER1) && !(defined(COMPILER2) || defined(GRAAL))
396 return no_profile_data;
397 #else
395 switch (code) { 398 switch (code) {
396 case Bytecodes::_checkcast: 399 case Bytecodes::_checkcast:
397 case Bytecodes::_instanceof: 400 case Bytecodes::_instanceof:
398 case Bytecodes::_aastore: 401 case Bytecodes::_aastore:
399 if (TypeProfileCasts) { 402 if (TypeProfileCasts) {
436 case Bytecodes::_lookupswitch: 439 case Bytecodes::_lookupswitch:
437 case Bytecodes::_tableswitch: 440 case Bytecodes::_tableswitch:
438 return variable_cell_count; 441 return variable_cell_count;
439 } 442 }
440 return no_profile_data; 443 return no_profile_data;
444 #endif
441 } 445 }
442 446
443 // Compute the size of the profiling information corresponding to 447 // Compute the size of the profiling information corresponding to
444 // the current bytecode. 448 // the current bytecode.
445 int MethodData::compute_data_size(BytecodeStream* stream) { 449 int MethodData::compute_data_size(BytecodeStream* stream) {
519 523
520 // Initialize an individual data segment. Returns the size of 524 // Initialize an individual data segment. Returns the size of
521 // the segment in bytes. 525 // the segment in bytes.
522 int MethodData::initialize_data(BytecodeStream* stream, 526 int MethodData::initialize_data(BytecodeStream* stream,
523 int data_index) { 527 int data_index) {
528 #if defined(COMPILER1) && !(defined(COMPILER2) || defined(GRAAL))
529 return 0;
530 #else
524 int cell_count = -1; 531 int cell_count = -1;
525 int tag = DataLayout::no_tag; 532 int tag = DataLayout::no_tag;
526 DataLayout* data_layout = data_layout_at(data_index); 533 DataLayout* data_layout = data_layout_at(data_index);
527 Bytecodes::Code c = stream->code(); 534 Bytecodes::Code c = stream->code();
528 switch (c) { 535 switch (c) {
597 return DataLayout::compute_size_in_bytes(cell_count); 604 return DataLayout::compute_size_in_bytes(cell_count);
598 } else { 605 } else {
599 assert(!bytecode_has_profile(c), "agree w/ !BHP"); 606 assert(!bytecode_has_profile(c), "agree w/ !BHP");
600 return 0; 607 return 0;
601 } 608 }
609 #endif
602 } 610 }
603 611
604 // Get the data at an arbitrary (sort of) data index. 612 // Get the data at an arbitrary (sort of) data index.
605 ProfileData* MethodData::data_at(int data_index) const { 613 ProfileData* MethodData::data_at(int data_index) const {
606 if (out_of_bounds(data_index)) { 614 if (out_of_bounds(data_index)) {
666 674
667 void MethodData::initialize() { 675 void MethodData::initialize() {
668 No_Safepoint_Verifier no_safepoint; // init function atomic wrt GC 676 No_Safepoint_Verifier no_safepoint; // init function atomic wrt GC
669 ResourceMark rm; 677 ResourceMark rm;
670 678
671 if (TieredCompilation) { 679 _invocation_counter.init();
672 _invocation_counter.init(); 680 _backedge_counter.init();
673 _backedge_counter.init(); 681 _invocation_counter_start = 0;
674 _invocation_counter_start = 0; 682 _backedge_counter_start = 0;
675 _backedge_counter_start = 0; 683 _num_loops = 0;
676 _num_loops = 0; 684 _num_blocks = 0;
677 _num_blocks = 0; 685 _highest_comp_level = 0;
678 _highest_comp_level = 0; 686 _highest_osr_comp_level = 0;
679 _highest_osr_comp_level = 0; 687 _would_profile = true;
680 _would_profile = true;
681 }
682 set_creation_mileage(mileage_of(method())); 688 set_creation_mileage(mileage_of(method()));
683 689
684 // Initialize flags and trap history. 690 // Initialize flags and trap history.
685 _nof_decompiles = 0; 691 _nof_decompiles = 0;
686 _nof_overflow_recompiles = 0; 692 _nof_overflow_recompiles = 0;
687 _nof_overflow_traps = 0; 693 _nof_overflow_traps = 0;
694 _eflags = 0;
695 _arg_local = 0;
696 _arg_stack = 0;
697 _arg_returned = 0;
688 assert(sizeof(_trap_hist) % sizeof(HeapWord) == 0, "align"); 698 assert(sizeof(_trap_hist) % sizeof(HeapWord) == 0, "align");
689 Copy::zero_to_words((HeapWord*) &_trap_hist, 699 Copy::zero_to_words((HeapWord*) &_trap_hist,
690 sizeof(_trap_hist) / sizeof(HeapWord)); 700 sizeof(_trap_hist) / sizeof(HeapWord));
691 701
692 // Go through the bytecodes and allocate and initialize the 702 // Go through the bytecodes and allocate and initialize the
693 // corresponding data cells. 703 // corresponding data cells.
694 int data_size = 0; 704 int data_size = 0;
695 int empty_bc_count = 0; // number of bytecodes lacking data 705 int empty_bc_count = 0; // number of bytecodes lacking data
706 _data[0] = 0; // apparently not set below.
696 BytecodeStream stream(method()); 707 BytecodeStream stream(method());
697 Bytecodes::Code c; 708 Bytecodes::Code c;
698 while ((c = stream.next()) >= 0) { 709 while ((c = stream.next()) >= 0) {
699 int size_in_bytes = initialize_data(&stream, data_size); 710 int size_in_bytes = initialize_data(&stream, data_size);
700 data_size += size_in_bytes; 711 data_size += size_in_bytes;
730 _hint_di = first_di(); 741 _hint_di = first_di();
731 742
732 post_initialize(&stream); 743 post_initialize(&stream);
733 744
734 set_size(object_size); 745 set_size(object_size);
746
735 } 747 }
736 748
737 bool MethodData::is_empty_data(int size_in_bytes, Bytecodes::Code code) { 749 bool MethodData::is_empty_data(int size_in_bytes, Bytecodes::Code code) {
738 #ifdef GRAAL 750 #ifdef GRAAL
739 return size_in_bytes == 0 && Bytecodes::can_trap(code); 751 return size_in_bytes == 0 && Bytecodes::can_trap(code);