< prev index next >

src/share/vm/ci/ciMethodData.cpp

Print this page




 105     case DataLayout::speculative_trap_data_tag: {
 106       ciSpeculativeTrapData* data_dst = new ciSpeculativeTrapData(dp_dst);
 107       SpeculativeTrapData* data_src = new SpeculativeTrapData(dp_src);
 108 
 109       data_dst->translate_from(data_src);
 110 
 111 #ifdef ASSERT
 112       SpeculativeTrapData* data_src2 = new SpeculativeTrapData(dp_src);
 113       assert(data_src2->method() == data_src->method() && data_src2->bci() == data_src->bci(), "entries changed while translating");
 114 #endif
 115 
 116       break;
 117     }
 118     case DataLayout::bit_data_tag:
 119       break;
 120     case DataLayout::no_tag:
 121     case DataLayout::arg_info_data_tag:
 122       // An empty slot or ArgInfoData entry marks the end of the trap data
 123       return;
 124     default:
 125       fatal(err_msg("bad tag = %d", dp_dst->tag()));
 126     }
 127   }
 128 }
 129 
 130 void ciMethodData::load_data() {
 131   MethodData* mdo = get_MethodData();
 132   if (mdo == NULL) {
 133     return;
 134   }
 135 
 136   // To do: don't copy the data if it is not "ripe" -- require a minimum #
 137   // of invocations.
 138 
 139   // Snapshot the data -- actually, take an approximate snapshot of
 140   // the data.  Any concurrently executing threads may be changing the
 141   // data as we copy it.
 142   Copy::disjoint_words((HeapWord*) mdo,
 143                        (HeapWord*) &_orig,
 144                        sizeof(_orig) / HeapWordSize);
 145   Arena* arena = CURRENT_ENV->arena();


 272       _saw_free_extra_data = true;  // observed an empty slot (common case)
 273       two_free_slots = (MethodData::next_extra(dp)->tag() == DataLayout::no_tag);
 274       return NULL;
 275     case DataLayout::arg_info_data_tag:
 276       return NULL; // ArgInfoData is at the end of extra data section.
 277     case DataLayout::bit_data_tag:
 278       if (m == NULL && dp->bci() == bci) {
 279         return new ciBitData(dp);
 280       }
 281       break;
 282     case DataLayout::speculative_trap_data_tag: {
 283       ciSpeculativeTrapData* data = new ciSpeculativeTrapData(dp);
 284       // data->method() might be null if the MDO is snapshotted
 285       // concurrently with a trap
 286       if (m != NULL && data->method() == m && dp->bci() == bci) {
 287         return data;
 288       }
 289       break;
 290     }
 291     default:
 292       fatal(err_msg("bad tag = %d", dp->tag()));
 293     }
 294   }
 295   return NULL;
 296 }
 297 
 298 // Translate a bci to its corresponding data, or NULL.
 299 ciProfileData* ciMethodData::bci_to_data(int bci, ciMethod* m) {
 300   // If m is not NULL we look for a SpeculativeTrapData entry
 301   if (m == NULL) {
 302     ciProfileData* data = data_before(bci);
 303     for ( ; is_valid(data); data = next_data(data)) {
 304       if (data->bci() == bci) {
 305         set_hint_di(dp_to_di(data->dp()));
 306         return data;
 307       } else if (data->bci() > bci) {
 308         break;
 309       }
 310     }
 311   }
 312   bool two_free_slots = false;


 561     switch(dp->tag()) {
 562     case DataLayout::no_tag:
 563     case DataLayout::arg_info_data_tag:
 564       return;
 565     case DataLayout::bit_data_tag:
 566       break;
 567     case DataLayout::speculative_trap_data_tag: {
 568       ciSpeculativeTrapData* data = new ciSpeculativeTrapData(dp);
 569       ciMethod* m = data->method();
 570       if (m != NULL) {
 571         if (round == 0) {
 572           count++;
 573         } else {
 574           out->print(" %d ", (int)(dp_to_di(((address)dp) + in_bytes(ciSpeculativeTrapData::method_offset())) / sizeof(intptr_t)));
 575           m->dump_name_as_ascii(out);
 576         }
 577       }
 578       break;
 579     }
 580     default:
 581       fatal(err_msg("bad tag = %d", dp->tag()));
 582     }
 583   }
 584 }
 585 
 586 void ciMethodData::dump_replay_data(outputStream* out) {
 587   ResourceMark rm;
 588   MethodData* mdo = get_MethodData();
 589   Method* method = mdo->method();
 590   Klass* holder = method->method_holder();
 591   out->print("ciMethodData %s %s %s %d %d",
 592              holder->name()->as_quoted_ascii(),
 593              method->name()->as_quoted_ascii(),
 594              method->signature()->as_quoted_ascii(),
 595              _state,
 596              current_mileage());
 597 
 598   // dump the contents of the MDO header as raw data
 599   unsigned char* orig = (unsigned char*)&_orig;
 600   int length = sizeof(_orig);
 601   out->print(" orig %d", length);


 673   }
 674   st->print_cr("--- Extra data:");
 675   DataLayout* dp  = extra_data_base();
 676   DataLayout* end = args_data_limit();
 677   for (;; dp = MethodData::next_extra(dp)) {
 678     assert(dp < end, "moved past end of extra data");
 679     switch (dp->tag()) {
 680     case DataLayout::no_tag:
 681       continue;
 682     case DataLayout::bit_data_tag:
 683       data = new BitData(dp);
 684       break;
 685     case DataLayout::arg_info_data_tag:
 686       data = new ciArgInfoData(dp);
 687       dp = end; // ArgInfoData is at the end of extra data section.
 688       break;
 689     case DataLayout::speculative_trap_data_tag:
 690       data = new ciSpeculativeTrapData(dp);
 691       break;
 692     default:
 693       fatal(err_msg("unexpected tag %d", dp->tag()));
 694     }
 695     st->print("%d", dp_to_di(data->dp()));
 696     st->fill_to(6);
 697     data->print_data_on(st);
 698     if (dp >= end) return;
 699   }
 700 }
 701 
 702 void ciTypeEntries::print_ciklass(outputStream* st, intptr_t k) {
 703   if (TypeEntries::is_type_none(k)) {
 704     st->print("none");
 705   } else if (TypeEntries::is_type_unknown(k)) {
 706     st->print("unknown");
 707   } else {
 708     valid_ciklass(k)->print_name_on(st);
 709   }
 710   if (TypeEntries::was_null_seen(k)) {
 711     st->print(" (null seen)");
 712   }
 713 }




 105     case DataLayout::speculative_trap_data_tag: {
 106       ciSpeculativeTrapData* data_dst = new ciSpeculativeTrapData(dp_dst);
 107       SpeculativeTrapData* data_src = new SpeculativeTrapData(dp_src);
 108 
 109       data_dst->translate_from(data_src);
 110 
 111 #ifdef ASSERT
 112       SpeculativeTrapData* data_src2 = new SpeculativeTrapData(dp_src);
 113       assert(data_src2->method() == data_src->method() && data_src2->bci() == data_src->bci(), "entries changed while translating");
 114 #endif
 115 
 116       break;
 117     }
 118     case DataLayout::bit_data_tag:
 119       break;
 120     case DataLayout::no_tag:
 121     case DataLayout::arg_info_data_tag:
 122       // An empty slot or ArgInfoData entry marks the end of the trap data
 123       return;
 124     default:
 125       fatal("bad tag = %d", dp_dst->tag());
 126     }
 127   }
 128 }
 129 
 130 void ciMethodData::load_data() {
 131   MethodData* mdo = get_MethodData();
 132   if (mdo == NULL) {
 133     return;
 134   }
 135 
 136   // To do: don't copy the data if it is not "ripe" -- require a minimum #
 137   // of invocations.
 138 
 139   // Snapshot the data -- actually, take an approximate snapshot of
 140   // the data.  Any concurrently executing threads may be changing the
 141   // data as we copy it.
 142   Copy::disjoint_words((HeapWord*) mdo,
 143                        (HeapWord*) &_orig,
 144                        sizeof(_orig) / HeapWordSize);
 145   Arena* arena = CURRENT_ENV->arena();


 272       _saw_free_extra_data = true;  // observed an empty slot (common case)
 273       two_free_slots = (MethodData::next_extra(dp)->tag() == DataLayout::no_tag);
 274       return NULL;
 275     case DataLayout::arg_info_data_tag:
 276       return NULL; // ArgInfoData is at the end of extra data section.
 277     case DataLayout::bit_data_tag:
 278       if (m == NULL && dp->bci() == bci) {
 279         return new ciBitData(dp);
 280       }
 281       break;
 282     case DataLayout::speculative_trap_data_tag: {
 283       ciSpeculativeTrapData* data = new ciSpeculativeTrapData(dp);
 284       // data->method() might be null if the MDO is snapshotted
 285       // concurrently with a trap
 286       if (m != NULL && data->method() == m && dp->bci() == bci) {
 287         return data;
 288       }
 289       break;
 290     }
 291     default:
 292       fatal("bad tag = %d", dp->tag());
 293     }
 294   }
 295   return NULL;
 296 }
 297 
 298 // Translate a bci to its corresponding data, or NULL.
 299 ciProfileData* ciMethodData::bci_to_data(int bci, ciMethod* m) {
 300   // If m is not NULL we look for a SpeculativeTrapData entry
 301   if (m == NULL) {
 302     ciProfileData* data = data_before(bci);
 303     for ( ; is_valid(data); data = next_data(data)) {
 304       if (data->bci() == bci) {
 305         set_hint_di(dp_to_di(data->dp()));
 306         return data;
 307       } else if (data->bci() > bci) {
 308         break;
 309       }
 310     }
 311   }
 312   bool two_free_slots = false;


 561     switch(dp->tag()) {
 562     case DataLayout::no_tag:
 563     case DataLayout::arg_info_data_tag:
 564       return;
 565     case DataLayout::bit_data_tag:
 566       break;
 567     case DataLayout::speculative_trap_data_tag: {
 568       ciSpeculativeTrapData* data = new ciSpeculativeTrapData(dp);
 569       ciMethod* m = data->method();
 570       if (m != NULL) {
 571         if (round == 0) {
 572           count++;
 573         } else {
 574           out->print(" %d ", (int)(dp_to_di(((address)dp) + in_bytes(ciSpeculativeTrapData::method_offset())) / sizeof(intptr_t)));
 575           m->dump_name_as_ascii(out);
 576         }
 577       }
 578       break;
 579     }
 580     default:
 581       fatal("bad tag = %d", dp->tag());
 582     }
 583   }
 584 }
 585 
 586 void ciMethodData::dump_replay_data(outputStream* out) {
 587   ResourceMark rm;
 588   MethodData* mdo = get_MethodData();
 589   Method* method = mdo->method();
 590   Klass* holder = method->method_holder();
 591   out->print("ciMethodData %s %s %s %d %d",
 592              holder->name()->as_quoted_ascii(),
 593              method->name()->as_quoted_ascii(),
 594              method->signature()->as_quoted_ascii(),
 595              _state,
 596              current_mileage());
 597 
 598   // dump the contents of the MDO header as raw data
 599   unsigned char* orig = (unsigned char*)&_orig;
 600   int length = sizeof(_orig);
 601   out->print(" orig %d", length);


 673   }
 674   st->print_cr("--- Extra data:");
 675   DataLayout* dp  = extra_data_base();
 676   DataLayout* end = args_data_limit();
 677   for (;; dp = MethodData::next_extra(dp)) {
 678     assert(dp < end, "moved past end of extra data");
 679     switch (dp->tag()) {
 680     case DataLayout::no_tag:
 681       continue;
 682     case DataLayout::bit_data_tag:
 683       data = new BitData(dp);
 684       break;
 685     case DataLayout::arg_info_data_tag:
 686       data = new ciArgInfoData(dp);
 687       dp = end; // ArgInfoData is at the end of extra data section.
 688       break;
 689     case DataLayout::speculative_trap_data_tag:
 690       data = new ciSpeculativeTrapData(dp);
 691       break;
 692     default:
 693       fatal("unexpected tag %d", dp->tag());
 694     }
 695     st->print("%d", dp_to_di(data->dp()));
 696     st->fill_to(6);
 697     data->print_data_on(st);
 698     if (dp >= end) return;
 699   }
 700 }
 701 
 702 void ciTypeEntries::print_ciklass(outputStream* st, intptr_t k) {
 703   if (TypeEntries::is_type_none(k)) {
 704     st->print("none");
 705   } else if (TypeEntries::is_type_unknown(k)) {
 706     st->print("unknown");
 707   } else {
 708     valid_ciklass(k)->print_name_on(st);
 709   }
 710   if (TypeEntries::was_null_seen(k)) {
 711     st->print(" (null seen)");
 712   }
 713 }


< prev index next >