< prev index next >

src/hotspot/share/compiler/oopMap.cpp

Print this page
rev 54763 : 8213084: Rework and enhance Print[Opto]Assembly output
Reviewed-by:


 493     optional->print_on(st);
 494     break;
 495   case OopMapValue::derived_oop_value:
 496     st->print("Derived_oop_");
 497     optional->print_on(st);
 498     break;
 499   default:
 500     ShouldNotReachHere();
 501   }
 502 }
 503 
 504 void OopMapValue::print_on(outputStream* st) const {
 505   reg()->print_on(st);
 506   st->print("=");
 507   print_register_type(type(),content_reg(),st);
 508   st->print(" ");
 509 }
 510 
 511 void ImmutableOopMap::print_on(outputStream* st) const {
 512   OopMapValue omv;
 513   st->print("ImmutableOopMap{");
 514   for(OopMapStream oms(this); !oms.is_done(); oms.next()) {
 515     omv = oms.current();
 516     omv.print_on(st);
 517   }
 518   st->print("}");
 519 }
 520 
 521 void OopMap::print_on(outputStream* st) const {
 522   OopMapValue omv;
 523   st->print("OopMap{");
 524   for(OopMapStream oms((OopMap*)this); !oms.is_done(); oms.next()) {
 525     omv = oms.current();
 526     omv.print_on(st);
 527   }
 528   st->print("off=%d}", (int) offset());

 529 }
 530 
 531 void ImmutableOopMapSet::print_on(outputStream* st) const {
 532   const ImmutableOopMap* last = NULL;
 533   for (int i = 0; i < _count; ++i) {




 534     const ImmutableOopMapPair* pair = pair_at(i);
 535     const ImmutableOopMap* map = pair->get_from(this);
 536     if (map != last) {
 537       st->cr();
 538       map->print_on(st);
 539       st->print("pc offsets: ");
 540     }
 541     last = map;
 542     st->print("%d ", pair->pc_offset());
 543   }

 544 }
 545 
 546 void OopMapSet::print_on(outputStream* st) const {
 547   int i, len = om_count();
 548 
 549   st->print_cr("OopMapSet contains %d OopMaps\n",len);
 550 
 551   for( i = 0; i < len; i++) {
 552     OopMap* m = at(i);
 553     st->print_cr("#%d ",i);
 554     m->print_on(st);
 555     st->cr();
 556   }

 557 }
 558 
 559 bool OopMap::equals(const OopMap* other) const {
 560   if (other->_omv_count != _omv_count) {
 561     return false;
 562   }
 563   if (other->write_stream()->position() != write_stream()->position()) {
 564     return false;
 565   }
 566   if (memcmp(other->write_stream()->buffer(), write_stream()->buffer(), write_stream()->position()) != 0) {
 567     return false;
 568   }
 569   return true;
 570 }
 571 
 572 const ImmutableOopMap* ImmutableOopMapSet::find_map_at_offset(int pc_offset) const {
 573   ImmutableOopMapPair* pairs = get_pairs();

 574 
 575   int i;
 576   for (i = 0; i < _count; ++i) {
 577     if (pairs[i].pc_offset() >= pc_offset) {

 578       break;
 579     }
 580   }
 581   ImmutableOopMapPair* last = &pairs[i];
 582 


 583   assert(last->pc_offset() == pc_offset, "oopmap not found");
 584   return last->get_from(this);
 585 }
 586 
 587 const ImmutableOopMap* ImmutableOopMapPair::get_from(const ImmutableOopMapSet* set) const {
 588   return set->oopmap_at_offset(_oopmap_offset);
 589 }
 590 
 591 ImmutableOopMap::ImmutableOopMap(const OopMap* oopmap) : _count(oopmap->count()) {
 592   address addr = data_addr();
 593   oopmap->copy_data_to(addr);
 594 }
 595 
 596 #ifdef ASSERT
 597 int ImmutableOopMap::nr_of_bytes() const {
 598   OopMapStream oms(this);
 599 
 600   while (!oms.is_done()) {
 601     oms.next();
 602   }




 493     optional->print_on(st);
 494     break;
 495   case OopMapValue::derived_oop_value:
 496     st->print("Derived_oop_");
 497     optional->print_on(st);
 498     break;
 499   default:
 500     ShouldNotReachHere();
 501   }
 502 }
 503 
 504 void OopMapValue::print_on(outputStream* st) const {
 505   reg()->print_on(st);
 506   st->print("=");
 507   print_register_type(type(),content_reg(),st);
 508   st->print(" ");
 509 }
 510 
 511 void ImmutableOopMap::print_on(outputStream* st) const {
 512   OopMapValue omv;
 513   st->print("ImmutableOopMap {");
 514   for(OopMapStream oms(this); !oms.is_done(); oms.next()) {
 515     omv = oms.current();
 516     omv.print_on(st);
 517   }
 518   st->print("}");
 519 }
 520 
 521 void OopMap::print_on(outputStream* st) const {
 522   OopMapValue omv;
 523   st->print("OopMap {");
 524   for(OopMapStream oms((OopMap*)this); !oms.is_done(); oms.next()) {
 525     omv = oms.current();
 526     omv.print_on(st);
 527   }
 528   // Print hex offset in addition.
 529   st->print("off=%d/0x%x}", (int) offset(), (int) offset());
 530 }
 531 
 532 void ImmutableOopMapSet::print_on(outputStream* st) const {
 533   const ImmutableOopMap* last = NULL;
 534   const int len = count();
 535 
 536   st->print_cr("ImmutableOopMapSet contains %d OopMaps", len);
 537 
 538   for (int i = 0; i < len; i++) {
 539     const ImmutableOopMapPair* pair = pair_at(i);
 540     const ImmutableOopMap* map = pair->get_from(this);
 541     if (map != last) {
 542       st->cr();
 543       map->print_on(st);
 544       st->print(" pc offsets: ");
 545     }
 546     last = map;
 547     st->print("%d ", pair->pc_offset());
 548   }
 549   st->cr();
 550 }
 551 
 552 void OopMapSet::print_on(outputStream* st) const {
 553   const int len = om_count();
 554 
 555   st->print_cr("OopMapSet contains %d OopMaps", len);
 556 
 557   for(int i = 0; i < len; i++) {
 558     OopMap* m = at(i);
 559     st->print_cr("#%d ",i);
 560     m->print_on(st);
 561     st->cr();
 562   }
 563   st->cr();
 564 }
 565 
 566 bool OopMap::equals(const OopMap* other) const {
 567   if (other->_omv_count != _omv_count) {
 568     return false;
 569   }
 570   if (other->write_stream()->position() != write_stream()->position()) {
 571     return false;
 572   }
 573   if (memcmp(other->write_stream()->buffer(), write_stream()->buffer(), write_stream()->position()) != 0) {
 574     return false;
 575   }
 576   return true;
 577 }
 578 
 579 const ImmutableOopMap* ImmutableOopMapSet::find_map_at_offset(int pc_offset) const {
 580   ImmutableOopMapPair* pairs = get_pairs();
 581   ImmutableOopMapPair* last  = NULL;
 582 
 583   for (int i = 0; i < _count; ++i) {

 584     if (pairs[i].pc_offset() >= pc_offset) {
 585       last = &pairs[i];
 586       break;
 587     }
 588   }

 589 
 590   // Heal Coverity issue: potential index out of bounds access.
 591   guarantee(last != NULL, "last may not be null");
 592   assert(last->pc_offset() == pc_offset, "oopmap not found");
 593   return last->get_from(this);
 594 }
 595 
 596 const ImmutableOopMap* ImmutableOopMapPair::get_from(const ImmutableOopMapSet* set) const {
 597   return set->oopmap_at_offset(_oopmap_offset);
 598 }
 599 
 600 ImmutableOopMap::ImmutableOopMap(const OopMap* oopmap) : _count(oopmap->count()) {
 601   address addr = data_addr();
 602   oopmap->copy_data_to(addr);
 603 }
 604 
 605 #ifdef ASSERT
 606 int ImmutableOopMap::nr_of_bytes() const {
 607   OopMapStream oms(this);
 608 
 609   while (!oms.is_done()) {
 610     oms.next();
 611   }


< prev index next >