494 case OopMapValue::derived_oop_value:
495 st->print("Derived_oop_");
496 optional->print_on(st);
497 break;
498 default:
499 ShouldNotReachHere();
500 }
501 }
502
503 void OopMapValue::print_on(outputStream* st) const {
504 reg()->print_on(st);
505 st->print("=");
506 print_register_type(type(),content_reg(),st);
507 st->print(" ");
508 }
509
510 void OopMapValue::print() const { print_on(tty); }
511
512 void ImmutableOopMap::print_on(outputStream* st) const {
513 OopMapValue omv;
514 st->print("ImmutableOopMap{");
515 for(OopMapStream oms(this); !oms.is_done(); oms.next()) {
516 omv = oms.current();
517 omv.print_on(st);
518 }
519 st->print("}");
520 }
521
522 void ImmutableOopMap::print() const { print_on(tty); }
523
524 void OopMap::print_on(outputStream* st) const {
525 OopMapValue omv;
526 st->print("OopMap{");
527 for(OopMapStream oms((OopMap*)this); !oms.is_done(); oms.next()) {
528 omv = oms.current();
529 omv.print_on(st);
530 }
531 st->print("off=%d}", (int) offset());
532 }
533
534 void OopMap::print() const { print_on(tty); }
535
536 void ImmutableOopMapSet::print_on(outputStream* st) const {
537 const ImmutableOopMap* last = NULL;
538 for (int i = 0; i < _count; ++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 }
550
551 void ImmutableOopMapSet::print() const { print_on(tty); }
552
553 void OopMapSet::print_on(outputStream* st) const {
554 int i, len = om_count();
555
556 st->print_cr("OopMapSet contains %d OopMaps\n",len);
557
558 for( i = 0; i < len; i++) {
559 OopMap* m = at(i);
560 st->print_cr("#%d ",i);
561 m->print_on(st);
562 st->cr();
563 }
564 }
565
566 void OopMapSet::print() const { print_on(tty); }
567
568 bool OopMap::equals(const OopMap* other) const {
569 if (other->_omv_count != _omv_count) {
570 return false;
571 }
572 if (other->write_stream()->position() != write_stream()->position()) {
573 return false;
574 }
575 if (memcmp(other->write_stream()->buffer(), write_stream()->buffer(), write_stream()->position()) != 0) {
576 return false;
577 }
578 return true;
579 }
580
581 const ImmutableOopMap* ImmutableOopMapSet::find_map_at_offset(int pc_offset) const {
582 ImmutableOopMapPair* pairs = get_pairs();
583
584 int i;
585 for (i = 0; i < _count; ++i) {
586 if (pairs[i].pc_offset() >= pc_offset) {
587 break;
588 }
589 }
590 ImmutableOopMapPair* last = &pairs[i];
591
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 }
|
494 case OopMapValue::derived_oop_value:
495 st->print("Derived_oop_");
496 optional->print_on(st);
497 break;
498 default:
499 ShouldNotReachHere();
500 }
501 }
502
503 void OopMapValue::print_on(outputStream* st) const {
504 reg()->print_on(st);
505 st->print("=");
506 print_register_type(type(),content_reg(),st);
507 st->print(" ");
508 }
509
510 void OopMapValue::print() const { print_on(tty); }
511
512 void ImmutableOopMap::print_on(outputStream* st) const {
513 OopMapValue omv;
514 st->print("ImmutableOopMap {");
515 for(OopMapStream oms(this); !oms.is_done(); oms.next()) {
516 omv = oms.current();
517 omv.print_on(st);
518 }
519 st->print("}");
520 }
521
522 void ImmutableOopMap::print() const { print_on(tty); }
523
524 void OopMap::print_on(outputStream* st) const {
525 OopMapValue omv;
526 st->print("OopMap {");
527 for(OopMapStream oms((OopMap*)this); !oms.is_done(); oms.next()) {
528 omv = oms.current();
529 omv.print_on(st);
530 }
531 // Print hex offset in addition.
532 st->print("off=%d/0x%x}", (int) offset(), (int) offset());
533 }
534
535 void OopMap::print() const { print_on(tty); }
536
537 void ImmutableOopMapSet::print_on(outputStream* st) const {
538 const ImmutableOopMap* last = NULL;
539 const int len = count();
540
541 st->print_cr("ImmutableOopMapSet contains %d OopMaps", len);
542
543 for (int i = 0; i < len; i++) {
544 const ImmutableOopMapPair* pair = pair_at(i);
545 const ImmutableOopMap* map = pair->get_from(this);
546 if (map != last) {
547 st->cr();
548 map->print_on(st);
549 st->print(" pc offsets: ");
550 }
551 last = map;
552 st->print("%d ", pair->pc_offset());
553 }
554 st->cr();
555 }
556
557 void ImmutableOopMapSet::print() const { print_on(tty); }
558
559 void OopMapSet::print_on(outputStream* st) const {
560 const int len = om_count();
561
562 st->print_cr("OopMapSet contains %d OopMaps", len);
563
564 for( int i = 0; i < len; i++) {
565 OopMap* m = at(i);
566 st->print_cr("#%d ",i);
567 m->print_on(st);
568 st->cr();
569 }
570 st->cr();
571 }
572
573 void OopMapSet::print() const { print_on(tty); }
574
575 bool OopMap::equals(const OopMap* other) const {
576 if (other->_omv_count != _omv_count) {
577 return false;
578 }
579 if (other->write_stream()->position() != write_stream()->position()) {
580 return false;
581 }
582 if (memcmp(other->write_stream()->buffer(), write_stream()->buffer(), write_stream()->position()) != 0) {
583 return false;
584 }
585 return true;
586 }
587
588 const ImmutableOopMap* ImmutableOopMapSet::find_map_at_offset(int pc_offset) const {
589 ImmutableOopMapPair* pairs = get_pairs();
590 ImmutableOopMapPair* last = NULL;
591
592 for (int i = 0; i < _count; ++i) {
593 if (pairs[i].pc_offset() >= pc_offset) {
594 last = &pairs[i];
595 break;
596 }
597 }
598
599 // Heal Coverity issue: potential index out of bounds access.
600 guarantee(last != NULL, "last may not be null");
601 assert(last->pc_offset() == pc_offset, "oopmap not found");
602 return last->get_from(this);
603 }
604
605 const ImmutableOopMap* ImmutableOopMapPair::get_from(const ImmutableOopMapSet* set) const {
606 return set->oopmap_at_offset(_oopmap_offset);
607 }
608
609 ImmutableOopMap::ImmutableOopMap(const OopMap* oopmap) : _count(oopmap->count()) {
610 address addr = data_addr();
611 oopmap->copy_data_to(addr);
612 }
613
614 #ifdef ASSERT
615 int ImmutableOopMap::nr_of_bytes() const {
616 OopMapStream oms(this);
617
618 while (!oms.is_done()) {
619 oms.next();
620 }
|