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 5771 : 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 5772 : imported patch chris


  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


 503             }
 504           }
 505         }
 506       }
 507     }
 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 = MethodData::next_extra(dp)) {
 249     assert(dp < end, "moved past end of extra data");
 250     switch(dp->tag()) {
 251     case DataLayout::no_tag:
 252       _saw_free_extra_data = true;  // observed an empty slot (common case)
 253       two_free_slots = (MethodData::next_extra(dp)->tag() == DataLayout::no_tag);
 254       return NULL;
 255     case DataLayout::arg_info_data_tag:
 256       return NULL; // ArgInfoData is at the end of extra data section.
 257     case DataLayout::bit_data_tag:
 258       if (m == NULL && dp->bci() == bci) {
 259         return new ciBitData(dp);
 260       }
 261       break;
 262     case DataLayout::speculative_trap_data_tag: {
 263       ciSpeculativeTrapData* data = new ciSpeculativeTrapData(dp);
 264       // data->method() might be null if the MDO is snapshotted
 265       // concurrently with a trap
 266       if (m != NULL && data->method() == m && dp->bci() == bci) {
 267         return data;
 268       }
 269       break;
 270     }
 271     default:
 272       fatal(err_msg("bad tag = %d", dp->tag()));
 273     }
 274   }
 275   return NULL;
 276 }
 277 
 278 // Translate a bci to its corresponding data, or NULL.
 279 ciProfileData* ciMethodData::bci_to_data(int bci, ciMethod* m) {
 280   // If m is not NULL we look for a SpeculativeTrapData entry
 281   if (m == NULL) {
 282     ciProfileData* data = data_before(bci);
 283     for ( ; is_valid(data); data = next_data(data)) {
 284       if (data->bci() == bci) {
 285         set_hint_di(dp_to_di(data->dp()));
 286         return data;
 287       } else if (data->bci() > bci) {
 288         break;
 289       }
 290     }














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


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