src/share/vm/ci/ciMethodData.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/ci

src/share/vm/ci/ciMethodData.cpp

Print this page
rev 5774 : 8031752: Failed speculative optimizations should be reattempted when root of compilation is different
Summary: support for speculative traps that keep track of the root of the compilation in which a trap occurs.
Reviewed-by:
rev 5775 : imported patch spectrap-chris
rev 5776 : imported patch spectrapfix


  61 //
  62 // No MethodData*.
  63 ciMethodData::ciMethodData() : ciMetadata(NULL) {
  64   Copy::zero_to_words((HeapWord*) &_orig, sizeof(_orig) / sizeof(HeapWord));
  65   _data = NULL;
  66   _data_size = 0;
  67   _extra_data_size = 0;
  68   _current_mileage = 0;
  69   _invocation_counter = 0;
  70   _backedge_counter = 0;
  71   _state = empty_state;
  72   _saw_free_extra_data = false;
  73   // Set an initial hint. Don't use set_hint_di() because
  74   // first_di() may be out of bounds if data_size is 0.
  75   _hint_di = first_di();
  76   // Initialize the escape information (to "don't know.");
  77   _eflags = _arg_local = _arg_stack = _arg_returned = 0;
  78   _parameters = NULL;
  79 }
  80 





























  81 void ciMethodData::load_data() {
  82   MethodData* mdo = get_MethodData();
  83   if (mdo == NULL) {
  84     return;
  85   }
  86 
  87   // To do: don't copy the data if it is not "ripe" -- require a minimum #
  88   // of invocations.
  89 
  90   // Snapshot the data -- actually, take an approximate snapshot of
  91   // the data.  Any concurrently executing threads may be changing the
  92   // data as we copy it.
  93   Copy::disjoint_words((HeapWord*) mdo,
  94                        (HeapWord*) &_orig,
  95                        sizeof(_orig) / HeapWordSize);
  96   Arena* arena = CURRENT_ENV->arena();
  97   _data_size = mdo->data_size();
  98   _extra_data_size = mdo->extra_data_size();
  99   int total_size = _data_size + _extra_data_size;
 100   _data = (intptr_t *) arena->Amalloc(total_size);
 101   Copy::disjoint_words((HeapWord*) mdo->data_base(), (HeapWord*) _data, total_size / HeapWordSize);
 102 
 103   // Traverse the profile data, translating any oops into their
 104   // ci equivalents.
 105   ResourceMark rm;
 106   ciProfileData* ci_data = first_data();
 107   ProfileData* data = mdo->first_data();
 108   while (is_valid(ci_data)) {
 109     ci_data->translate_from(data);
 110     ci_data = next_data(ci_data);
 111     data = mdo->next_data(data);
 112   }
 113   if (mdo->parameters_type_data() != NULL) {
 114     _parameters = data_layout_at(mdo->parameters_type_data_di());
 115     ciParametersTypeData* parameters = new ciParametersTypeData(_parameters);
 116     parameters->translate_from(mdo->parameters_type_data());
 117   }
 118 


 119   // Note:  Extra data are all BitData, and do not need translation.
 120   _current_mileage = MethodData::mileage_of(mdo->method());
 121   _invocation_counter = mdo->invocation_count();
 122   _backedge_counter = mdo->backedge_count();
 123   _state = mdo->is_mature()? mature_state: immature_state;
 124 
 125   _eflags = mdo->eflags();
 126   _arg_local = mdo->arg_local();
 127   _arg_stack = mdo->arg_stack();
 128   _arg_returned  = mdo->arg_returned();
 129 #ifndef PRODUCT
 130   if (ReplayCompiles) {
 131     ciReplay::initialize(this);
 132   }
 133 #endif
 134 }
 135 
 136 void ciReceiverTypeData::translate_receiver_data_from(const ProfileData* data) {
 137   for (uint row = 0; row < row_limit(); row++) {
 138     Klass* k = data->as_ReceiverTypeData()->receiver(row);
 139     if (k != NULL) {
 140       ciKlass* klass = CURRENT_ENV->get_klass(k);
 141       set_receiver(row, klass);
 142     }
 143   }
 144 }
 145 
 146 
 147 void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
 148   for (int i = 0; i < _number_of_entries; i++) {
 149     intptr_t k = entries->type(i);
 150     TypeStackSlotEntries::set_type(i, translate_klass(k));
 151   }
 152 }
 153 
 154 void ciReturnTypeEntry::translate_type_data_from(const ReturnTypeEntry* ret) {
 155   intptr_t k = ret->type();
 156   set_type(translate_klass(k));
 157 }
 158 






 159 // Get the data at an arbitrary (sort of) data index.
 160 ciProfileData* ciMethodData::data_at(int data_index) {
 161   if (out_of_bounds(data_index)) {
 162     return NULL;
 163   }
 164   DataLayout* data_layout = data_layout_at(data_index);
 165 
 166   switch (data_layout->tag()) {
 167   case DataLayout::no_tag:
 168   default:
 169     ShouldNotReachHere();
 170     return NULL;
 171   case DataLayout::bit_data_tag:
 172     return new ciBitData(data_layout);
 173   case DataLayout::counter_data_tag:
 174     return new ciCounterData(data_layout);
 175   case DataLayout::jump_data_tag:
 176     return new ciJumpData(data_layout);
 177   case DataLayout::receiver_type_data_tag:
 178     return new ciReceiverTypeData(data_layout);


 186     return new ciMultiBranchData(data_layout);
 187   case DataLayout::arg_info_data_tag:
 188     return new ciArgInfoData(data_layout);
 189   case DataLayout::call_type_data_tag:
 190     return new ciCallTypeData(data_layout);
 191   case DataLayout::virtual_call_type_data_tag:
 192     return new ciVirtualCallTypeData(data_layout);
 193   case DataLayout::parameters_type_data_tag:
 194     return new ciParametersTypeData(data_layout);
 195   };
 196 }
 197 
 198 // Iteration over data.
 199 ciProfileData* ciMethodData::next_data(ciProfileData* current) {
 200   int current_index = dp_to_di(current->dp());
 201   int next_index = current_index + current->size_in_bytes();
 202   ciProfileData* next = data_at(next_index);
 203   return next;
 204 }
 205 


































 206 // Translate a bci to its corresponding data, or NULL.
 207 ciProfileData* ciMethodData::bci_to_data(int bci) {


 208   ciProfileData* data = data_before(bci);
 209   for ( ; is_valid(data); data = next_data(data)) {
 210     if (data->bci() == bci) {
 211       set_hint_di(dp_to_di(data->dp()));
 212       return data;
 213     } else if (data->bci() > bci) {
 214       break;
 215     }
 216   }
 217   // bci_to_extra_data(bci) ...
 218   DataLayout* dp  = data_layout_at(data_size());
 219   DataLayout* end = data_layout_at(data_size() + extra_data_size());
 220   for (; dp < end; dp = MethodData::next_extra(dp)) {
 221     if (dp->tag() == DataLayout::no_tag) {
 222       _saw_free_extra_data = true;  // observed an empty slot (common case)
 223       return NULL;
 224     }
 225     if (dp->tag() == DataLayout::arg_info_data_tag) {
 226       break; // ArgInfoData is at the end of extra data section.
 227     }
 228     if (dp->bci() == bci) {
 229       assert(dp->tag() == DataLayout::bit_data_tag, "sane");
 230       return new ciBitData(dp);
 231     }










 232   }
 233   return NULL;
 234 }
 235 
 236 // Conservatively decode the trap_state of a ciProfileData.
 237 int ciMethodData::has_trap_at(ciProfileData* data, int reason) {
 238   typedef Deoptimization::DeoptReason DR_t;
 239   int per_bc_reason
 240     = Deoptimization::reason_recorded_per_bytecode_if_any((DR_t) reason);
 241   if (trap_count(reason) == 0) {
 242     // Impossible for this trap to have occurred, regardless of trap_state.
 243     // Note:  This happens if the MDO is empty.
 244     return 0;
 245   } else if (per_bc_reason == Deoptimization::Reason_none) {
 246     // We cannot conclude anything; a trap happened somewhere, maybe here.
 247     return -1;
 248   } else if (data == NULL) {
 249     // No profile here, not even an extra_data record allocated on the fly.
 250     // If there are empty extra_data records, and there had been a trap,
 251     // there would have been a non-null data pointer.  If there are no


 508   }
 509   out->cr();
 510 }
 511 
 512 #ifndef PRODUCT
 513 void ciMethodData::print() {
 514   print_data_on(tty);
 515 }
 516 
 517 void ciMethodData::print_data_on(outputStream* st) {
 518   ResourceMark rm;
 519   ciProfileData* data;
 520   for (data = first_data(); is_valid(data); data = next_data(data)) {
 521     st->print("%d", dp_to_di(data->dp()));
 522     st->fill_to(6);
 523     data->print_data_on(st);
 524   }
 525   st->print_cr("--- Extra data:");
 526   DataLayout* dp  = data_layout_at(data_size());
 527   DataLayout* end = data_layout_at(data_size() + extra_data_size());
 528   for (; dp < end; dp = MethodData::next_extra(dp)) {
 529     if (dp->tag() == DataLayout::no_tag)  continue;
 530     if (dp->tag() == DataLayout::bit_data_tag) {



 531       data = new BitData(dp);
 532     } else {
 533       assert(dp->tag() == DataLayout::arg_info_data_tag, "must be BitData or ArgInfo");
 534       data = new ciArgInfoData(dp);
 535       dp = end; // ArgInfoData is at the end of extra data section.



 536     }
 537     st->print("%d", dp_to_di(data->dp()));
 538     st->fill_to(6);
 539     data->print_data_on(st);

 540   }
 541 }
 542 
 543 void ciTypeEntries::print_ciklass(outputStream* st, intptr_t k) {
 544   if (TypeEntries::is_type_none(k)) {
 545     st->print("none");
 546   } else if (TypeEntries::is_type_unknown(k)) {
 547     st->print("unknown");
 548   } else {
 549     valid_ciklass(k)->print_name_on(st);
 550   }
 551   if (TypeEntries::was_null_seen(k)) {
 552     st->print(" (null seen)");
 553   }
 554 }
 555 
 556 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
 557   for (int i = 0; i < _number_of_entries; i++) {
 558     _pd->tab(st);
 559     st->print("%d: stack (%u) ", i, stack_slot(i));
 560     print_ciklass(st, type(i));
 561     st->cr();
 562   }
 563 }
 564 
 565 void ciReturnTypeEntry::print_data_on(outputStream* st) const {
 566   _pd->tab(st);
 567   st->print("ret ");
 568   print_ciklass(st, type());
 569   st->cr();
 570 }
 571 
 572 void ciCallTypeData::print_data_on(outputStream* st) const {
 573   print_shared(st, "ciCallTypeData");
 574   if (has_arguments()) {
 575     tab(st, true);
 576     st->print("argument types");
 577     args()->print_data_on(st);
 578   }
 579   if (has_return()) {
 580     tab(st, true);
 581     st->print("return type");
 582     ret()->print_data_on(st);
 583   }
 584 }
 585 
 586 void ciReceiverTypeData::print_receiver_data_on(outputStream* st) const {
 587   uint row;
 588   int entries = 0;
 589   for (row = 0; row < row_limit(); row++) {
 590     if (receiver(row) != NULL)  entries++;
 591   }
 592   st->print_cr("count(%u) entries(%u)", count(), entries);
 593   for (row = 0; row < row_limit(); row++) {
 594     if (receiver(row) != NULL) {
 595       tab(st);
 596       receiver(row)->print_name_on(st);
 597       st->print_cr("(%u)", receiver_count(row));
 598     }
 599   }
 600 }
 601 
 602 void ciReceiverTypeData::print_data_on(outputStream* st) const {
 603   print_shared(st, "ciReceiverTypeData");
 604   print_receiver_data_on(st);
 605 }
 606 
 607 void ciVirtualCallData::print_data_on(outputStream* st) const {
 608   print_shared(st, "ciVirtualCallData");
 609   rtd_super()->print_receiver_data_on(st);
 610 }
 611 
 612 void ciVirtualCallTypeData::print_data_on(outputStream* st) const {
 613   print_shared(st, "ciVirtualCallTypeData");
 614   rtd_super()->print_receiver_data_on(st);
 615   if (has_arguments()) {
 616     tab(st, true);
 617     st->print("argument types");
 618     args()->print_data_on(st);
 619   }
 620   if (has_return()) {
 621     tab(st, true);
 622     st->print("return type");
 623     ret()->print_data_on(st);
 624   }
 625 }
 626 
 627 void ciParametersTypeData::print_data_on(outputStream* st) const {
 628   st->print_cr("Parametertypes");
 629   parameters()->print_data_on(st);







 630 }
 631 #endif


  61 //
  62 // No MethodData*.
  63 ciMethodData::ciMethodData() : ciMetadata(NULL) {
  64   Copy::zero_to_words((HeapWord*) &_orig, sizeof(_orig) / sizeof(HeapWord));
  65   _data = NULL;
  66   _data_size = 0;
  67   _extra_data_size = 0;
  68   _current_mileage = 0;
  69   _invocation_counter = 0;
  70   _backedge_counter = 0;
  71   _state = empty_state;
  72   _saw_free_extra_data = false;
  73   // Set an initial hint. Don't use set_hint_di() because
  74   // first_di() may be out of bounds if data_size is 0.
  75   _hint_di = first_di();
  76   // Initialize the escape information (to "don't know.");
  77   _eflags = _arg_local = _arg_stack = _arg_returned = 0;
  78   _parameters = NULL;
  79 }
  80 
  81 void ciMethodData::load_extra_data() {
  82   MethodData* mdo = get_MethodData();
  83 
  84   // speculative trap entries also hold a pointer to a Method so need to be translated
  85   DataLayout* dp_src  = mdo->extra_data_base();
  86   DataLayout* end_src = mdo->extra_data_limit();
  87   DataLayout* dp_dst  = extra_data_base();
  88   for (;; dp_src = MethodData::next_extra(dp_src), dp_dst = MethodData::next_extra(dp_dst)) {
  89     assert(dp_src < end_src, "moved past end of extra data");
  90     assert(dp_src->tag() == dp_dst->tag(), err_msg("should be same tags %d != %d", dp_src->tag(), dp_dst->tag()));
  91     switch(dp_src->tag()) {
  92     case DataLayout::speculative_trap_data_tag: {
  93       ciSpeculativeTrapData* data_dst = new ciSpeculativeTrapData(dp_dst);
  94       SpeculativeTrapData* data_src = new SpeculativeTrapData(dp_src);
  95       data_dst->translate_from(data_src);
  96       break;
  97     }
  98     case DataLayout::bit_data_tag:
  99       break;
 100     case DataLayout::no_tag:
 101     case DataLayout::arg_info_data_tag:
 102       // An empty slot or ArgInfoData entry marks the end of the trap data
 103       return;
 104     default:
 105       fatal(err_msg("bad tag = %d", dp_src->tag()));
 106     }
 107   }
 108 }
 109 
 110 void ciMethodData::load_data() {
 111   MethodData* mdo = get_MethodData();
 112   if (mdo == NULL) {
 113     return;
 114   }
 115 
 116   // To do: don't copy the data if it is not "ripe" -- require a minimum #
 117   // of invocations.
 118 
 119   // Snapshot the data -- actually, take an approximate snapshot of
 120   // the data.  Any concurrently executing threads may be changing the
 121   // data as we copy it.
 122   Copy::disjoint_words((HeapWord*) mdo,
 123                        (HeapWord*) &_orig,
 124                        sizeof(_orig) / HeapWordSize);
 125   Arena* arena = CURRENT_ENV->arena();
 126   _data_size = mdo->data_size();
 127   _extra_data_size = mdo->extra_data_size();
 128   int total_size = _data_size + _extra_data_size;
 129   _data = (intptr_t *) arena->Amalloc(total_size);
 130   Copy::disjoint_words((HeapWord*) mdo->data_base(), (HeapWord*) _data, total_size / HeapWordSize);
 131 
 132   // Traverse the profile data, translating any oops into their
 133   // ci equivalents.
 134   ResourceMark rm;
 135   ciProfileData* ci_data = first_data();
 136   ProfileData* data = mdo->first_data();
 137   while (is_valid(ci_data)) {
 138     ci_data->translate_from(data);
 139     ci_data = next_data(ci_data);
 140     data = mdo->next_data(data);
 141   }
 142   if (mdo->parameters_type_data() != NULL) {
 143     _parameters = data_layout_at(mdo->parameters_type_data_di());
 144     ciParametersTypeData* parameters = new ciParametersTypeData(_parameters);
 145     parameters->translate_from(mdo->parameters_type_data());
 146   }
 147 
 148   load_extra_data();
 149 
 150   // Note:  Extra data are all BitData, and do not need translation.
 151   _current_mileage = MethodData::mileage_of(mdo->method());
 152   _invocation_counter = mdo->invocation_count();
 153   _backedge_counter = mdo->backedge_count();
 154   _state = mdo->is_mature()? mature_state: immature_state;
 155 
 156   _eflags = mdo->eflags();
 157   _arg_local = mdo->arg_local();
 158   _arg_stack = mdo->arg_stack();
 159   _arg_returned  = mdo->arg_returned();
 160 #ifndef PRODUCT
 161   if (ReplayCompiles) {
 162     ciReplay::initialize(this);
 163   }
 164 #endif
 165 }
 166 
 167 void ciReceiverTypeData::translate_receiver_data_from(const ProfileData* data) {
 168   for (uint row = 0; row < row_limit(); row++) {
 169     Klass* k = data->as_ReceiverTypeData()->receiver(row);
 170     if (k != NULL) {
 171       ciKlass* klass = CURRENT_ENV->get_klass(k);
 172       set_receiver(row, klass);
 173     }
 174   }
 175 }
 176 
 177 
 178 void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
 179   for (int i = 0; i < _number_of_entries; i++) {
 180     intptr_t k = entries->type(i);
 181     TypeStackSlotEntries::set_type(i, translate_klass(k));
 182   }
 183 }
 184 
 185 void ciReturnTypeEntry::translate_type_data_from(const ReturnTypeEntry* ret) {
 186   intptr_t k = ret->type();
 187   set_type(translate_klass(k));
 188 }
 189 
 190 void ciSpeculativeTrapData::translate_from(const ProfileData* data) {
 191   Method* m = data->as_SpeculativeTrapData()->method();
 192   ciMethod* ci_m = CURRENT_ENV->get_method(m);
 193   set_method(ci_m);
 194 }
 195 
 196 // Get the data at an arbitrary (sort of) data index.
 197 ciProfileData* ciMethodData::data_at(int data_index) {
 198   if (out_of_bounds(data_index)) {
 199     return NULL;
 200   }
 201   DataLayout* data_layout = data_layout_at(data_index);
 202 
 203   switch (data_layout->tag()) {
 204   case DataLayout::no_tag:
 205   default:
 206     ShouldNotReachHere();
 207     return NULL;
 208   case DataLayout::bit_data_tag:
 209     return new ciBitData(data_layout);
 210   case DataLayout::counter_data_tag:
 211     return new ciCounterData(data_layout);
 212   case DataLayout::jump_data_tag:
 213     return new ciJumpData(data_layout);
 214   case DataLayout::receiver_type_data_tag:
 215     return new ciReceiverTypeData(data_layout);


 223     return new ciMultiBranchData(data_layout);
 224   case DataLayout::arg_info_data_tag:
 225     return new ciArgInfoData(data_layout);
 226   case DataLayout::call_type_data_tag:
 227     return new ciCallTypeData(data_layout);
 228   case DataLayout::virtual_call_type_data_tag:
 229     return new ciVirtualCallTypeData(data_layout);
 230   case DataLayout::parameters_type_data_tag:
 231     return new ciParametersTypeData(data_layout);
 232   };
 233 }
 234 
 235 // Iteration over data.
 236 ciProfileData* ciMethodData::next_data(ciProfileData* current) {
 237   int current_index = dp_to_di(current->dp());
 238   int next_index = current_index + current->size_in_bytes();
 239   ciProfileData* next = data_at(next_index);
 240   return next;
 241 }
 242 
 243 ciProfileData* ciMethodData::bci_to_extra_data(int bci, ciMethod* m, bool& two_free_slots) {
 244   // bci_to_extra_data(bci) ...
 245   DataLayout* dp  = data_layout_at(data_size());
 246   DataLayout* end = data_layout_at(data_size() + extra_data_size());
 247   two_free_slots = false;
 248   for (;dp < end; dp = MethodData::next_extra(dp)) {
 249     switch(dp->tag()) {
 250     case DataLayout::no_tag:
 251       _saw_free_extra_data = true;  // observed an empty slot (common case)
 252       two_free_slots = (MethodData::next_extra(dp)->tag() == DataLayout::no_tag);
 253       return NULL;
 254     case DataLayout::arg_info_data_tag:
 255       return NULL; // ArgInfoData is at the end of extra data section.
 256     case DataLayout::bit_data_tag:
 257       if (m == NULL && dp->bci() == bci) {
 258         return new ciBitData(dp);
 259       }
 260       break;
 261     case DataLayout::speculative_trap_data_tag: {
 262       ciSpeculativeTrapData* data = new ciSpeculativeTrapData(dp);
 263       // data->method() might be null if the MDO is snapshotted
 264       // concurrently with a trap
 265       if (m != NULL && data->method() == m && dp->bci() == bci) {
 266         return data;
 267       }
 268       break;
 269     }
 270     default:
 271       fatal(err_msg("bad tag = %d", dp->tag()));
 272     }
 273   }
 274   return NULL;
 275 }
 276 
 277 // Translate a bci to its corresponding data, or NULL.
 278 ciProfileData* ciMethodData::bci_to_data(int bci, ciMethod* m) {
 279   // If m is not NULL we look for a SpeculativeTrapData entry
 280   if (m == NULL) {
 281     ciProfileData* data = data_before(bci);
 282     for ( ; is_valid(data); data = next_data(data)) {
 283       if (data->bci() == bci) {
 284         set_hint_di(dp_to_di(data->dp()));
 285         return data;
 286       } else if (data->bci() > bci) {
 287         break;
 288       }
 289     }














 290   }
 291   bool two_free_slots = false;
 292   ciProfileData* result = bci_to_extra_data(bci, m, two_free_slots);
 293   if (result != NULL) {
 294     return result;
 295   }
 296   if (m != NULL && !two_free_slots) {
 297     // We were looking for a SpeculativeTrapData entry we didn't
 298     // find. Room is not available for more SpeculativeTrapData
 299     // entries, look in the non SpeculativeTrapData entries.
 300     return bci_to_data(bci, NULL);
 301   }
 302   return NULL;
 303 }
 304 
 305 // Conservatively decode the trap_state of a ciProfileData.
 306 int ciMethodData::has_trap_at(ciProfileData* data, int reason) {
 307   typedef Deoptimization::DeoptReason DR_t;
 308   int per_bc_reason
 309     = Deoptimization::reason_recorded_per_bytecode_if_any((DR_t) reason);
 310   if (trap_count(reason) == 0) {
 311     // Impossible for this trap to have occurred, regardless of trap_state.
 312     // Note:  This happens if the MDO is empty.
 313     return 0;
 314   } else if (per_bc_reason == Deoptimization::Reason_none) {
 315     // We cannot conclude anything; a trap happened somewhere, maybe here.
 316     return -1;
 317   } else if (data == NULL) {
 318     // No profile here, not even an extra_data record allocated on the fly.
 319     // If there are empty extra_data records, and there had been a trap,
 320     // there would have been a non-null data pointer.  If there are no


 577   }
 578   out->cr();
 579 }
 580 
 581 #ifndef PRODUCT
 582 void ciMethodData::print() {
 583   print_data_on(tty);
 584 }
 585 
 586 void ciMethodData::print_data_on(outputStream* st) {
 587   ResourceMark rm;
 588   ciProfileData* data;
 589   for (data = first_data(); is_valid(data); data = next_data(data)) {
 590     st->print("%d", dp_to_di(data->dp()));
 591     st->fill_to(6);
 592     data->print_data_on(st);
 593   }
 594   st->print_cr("--- Extra data:");
 595   DataLayout* dp  = data_layout_at(data_size());
 596   DataLayout* end = data_layout_at(data_size() + extra_data_size());
 597   for (;; dp = MethodData::next_extra(dp)) {
 598     assert(dp < end, "moved past end of extra data");
 599     switch (dp->tag()) {
 600     case DataLayout::no_tag:
 601       continue;
 602     case DataLayout::bit_data_tag:
 603       data = new BitData(dp);
 604       break;
 605     case DataLayout::arg_info_data_tag:
 606       data = new ciArgInfoData(dp);
 607       dp = end; // ArgInfoData is at the end of extra data section.
 608       break;
 609     default:
 610       fatal(err_msg("unexpected tag %d", dp->tag()));
 611     }
 612     st->print("%d", dp_to_di(data->dp()));
 613     st->fill_to(6);
 614     data->print_data_on(st);
 615     if (dp >= end) return;
 616   }
 617 }
 618 
 619 void ciTypeEntries::print_ciklass(outputStream* st, intptr_t k) {
 620   if (TypeEntries::is_type_none(k)) {
 621     st->print("none");
 622   } else if (TypeEntries::is_type_unknown(k)) {
 623     st->print("unknown");
 624   } else {
 625     valid_ciklass(k)->print_name_on(st);
 626   }
 627   if (TypeEntries::was_null_seen(k)) {
 628     st->print(" (null seen)");
 629   }
 630 }
 631 
 632 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
 633   for (int i = 0; i < _number_of_entries; i++) {
 634     _pd->tab(st);
 635     st->print("%d: stack (%u) ", i, stack_slot(i));
 636     print_ciklass(st, type(i));
 637     st->cr();
 638   }
 639 }
 640 
 641 void ciReturnTypeEntry::print_data_on(outputStream* st) const {
 642   _pd->tab(st);
 643   st->print("ret ");
 644   print_ciklass(st, type());
 645   st->cr();
 646 }
 647 
 648 void ciCallTypeData::print_data_on(outputStream* st, const char* extra) const {
 649   print_shared(st, "ciCallTypeData", extra);
 650   if (has_arguments()) {
 651     tab(st, true);
 652     st->print("argument types");
 653     args()->print_data_on(st);
 654   }
 655   if (has_return()) {
 656     tab(st, true);
 657     st->print("return type");
 658     ret()->print_data_on(st);
 659   }
 660 }
 661 
 662 void ciReceiverTypeData::print_receiver_data_on(outputStream* st) const {
 663   uint row;
 664   int entries = 0;
 665   for (row = 0; row < row_limit(); row++) {
 666     if (receiver(row) != NULL)  entries++;
 667   }
 668   st->print_cr("count(%u) entries(%u)", count(), entries);
 669   for (row = 0; row < row_limit(); row++) {
 670     if (receiver(row) != NULL) {
 671       tab(st);
 672       receiver(row)->print_name_on(st);
 673       st->print_cr("(%u)", receiver_count(row));
 674     }
 675   }
 676 }
 677 
 678 void ciReceiverTypeData::print_data_on(outputStream* st, const char* extra) const {
 679   print_shared(st, "ciReceiverTypeData", extra);
 680   print_receiver_data_on(st);
 681 }
 682 
 683 void ciVirtualCallData::print_data_on(outputStream* st, const char* extra) const {
 684   print_shared(st, "ciVirtualCallData", extra);
 685   rtd_super()->print_receiver_data_on(st);
 686 }
 687 
 688 void ciVirtualCallTypeData::print_data_on(outputStream* st, const char* extra) const {
 689   print_shared(st, "ciVirtualCallTypeData", extra);
 690   rtd_super()->print_receiver_data_on(st);
 691   if (has_arguments()) {
 692     tab(st, true);
 693     st->print("argument types");
 694     args()->print_data_on(st);
 695   }
 696   if (has_return()) {
 697     tab(st, true);
 698     st->print("return type");
 699     ret()->print_data_on(st);
 700   }
 701 }
 702 
 703 void ciParametersTypeData::print_data_on(outputStream* st, const char* extra) const {
 704   st->print_cr("ciParametersTypeData");
 705   parameters()->print_data_on(st);
 706 }
 707 
 708 void ciSpeculativeTrapData::print_data_on(outputStream* st, const char* extra) const {
 709   st->print_cr("ciSpeculativeTrapData");
 710   tab(st);
 711   method()->print_short_name(st);
 712   st->cr();
 713 }
 714 #endif
src/share/vm/ci/ciMethodData.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File