521 |
521 |
522 void ImmutableOopMap::print() const { print_on(tty); } |
522 void ImmutableOopMap::print() const { print_on(tty); } |
523 |
523 |
524 void OopMap::print_on(outputStream* st) const { |
524 void OopMap::print_on(outputStream* st) const { |
525 OopMapValue omv; |
525 OopMapValue omv; |
526 st->print("OopMap{"); |
526 st->print("OopMap {"); |
527 for(OopMapStream oms((OopMap*)this); !oms.is_done(); oms.next()) { |
527 for(OopMapStream oms((OopMap*)this); !oms.is_done(); oms.next()) { |
528 omv = oms.current(); |
528 omv = oms.current(); |
529 omv.print_on(st); |
529 omv.print_on(st); |
530 } |
530 } |
531 st->print("off=%d}", (int) offset()); |
531 // Print hex offset in addition. |
|
532 st->print("off=%d/0x%x}", (int) offset(), (int) offset()); |
532 } |
533 } |
533 |
534 |
534 void OopMap::print() const { print_on(tty); } |
535 void OopMap::print() const { print_on(tty); } |
535 |
536 |
536 void ImmutableOopMapSet::print_on(outputStream* st) const { |
537 void ImmutableOopMapSet::print_on(outputStream* st) const { |
537 const ImmutableOopMap* last = NULL; |
538 const ImmutableOopMap* last = NULL; |
538 for (int i = 0; i < _count; ++i) { |
539 const int len = count(); |
|
540 |
|
541 st->print_cr("ImmutableOopMapSet contains %d OopMaps", len); |
|
542 |
|
543 for (int i = 0; i < len; i++) { |
539 const ImmutableOopMapPair* pair = pair_at(i); |
544 const ImmutableOopMapPair* pair = pair_at(i); |
540 const ImmutableOopMap* map = pair->get_from(this); |
545 const ImmutableOopMap* map = pair->get_from(this); |
541 if (map != last) { |
546 if (map != last) { |
542 st->cr(); |
547 st->cr(); |
543 map->print_on(st); |
548 map->print_on(st); |
544 st->print("pc offsets: "); |
549 st->print(" pc offsets: "); |
545 } |
550 } |
546 last = map; |
551 last = map; |
547 st->print("%d ", pair->pc_offset()); |
552 st->print("%d ", pair->pc_offset()); |
548 } |
553 } |
|
554 st->cr(); |
549 } |
555 } |
550 |
556 |
551 void ImmutableOopMapSet::print() const { print_on(tty); } |
557 void ImmutableOopMapSet::print() const { print_on(tty); } |
552 |
558 |
553 void OopMapSet::print_on(outputStream* st) const { |
559 void OopMapSet::print_on(outputStream* st) const { |
554 int i, len = om_count(); |
560 const int len = om_count(); |
555 |
561 |
556 st->print_cr("OopMapSet contains %d OopMaps\n",len); |
562 st->print_cr("OopMapSet contains %d OopMaps", len); |
557 |
563 |
558 for( i = 0; i < len; i++) { |
564 for( int i = 0; i < len; i++) { |
559 OopMap* m = at(i); |
565 OopMap* m = at(i); |
560 st->print_cr("#%d ",i); |
566 st->print_cr("#%d ",i); |
561 m->print_on(st); |
567 m->print_on(st); |
562 st->cr(); |
568 st->cr(); |
563 } |
569 } |
|
570 st->cr(); |
564 } |
571 } |
565 |
572 |
566 void OopMapSet::print() const { print_on(tty); } |
573 void OopMapSet::print() const { print_on(tty); } |
567 |
574 |
568 bool OopMap::equals(const OopMap* other) const { |
575 bool OopMap::equals(const OopMap* other) const { |
578 return true; |
585 return true; |
579 } |
586 } |
580 |
587 |
581 const ImmutableOopMap* ImmutableOopMapSet::find_map_at_offset(int pc_offset) const { |
588 const ImmutableOopMap* ImmutableOopMapSet::find_map_at_offset(int pc_offset) const { |
582 ImmutableOopMapPair* pairs = get_pairs(); |
589 ImmutableOopMapPair* pairs = get_pairs(); |
583 |
590 ImmutableOopMapPair* last = NULL; |
584 int i; |
591 |
585 for (i = 0; i < _count; ++i) { |
592 for (int i = 0; i < _count; ++i) { |
586 if (pairs[i].pc_offset() >= pc_offset) { |
593 if (pairs[i].pc_offset() >= pc_offset) { |
|
594 last = &pairs[i]; |
587 break; |
595 break; |
588 } |
596 } |
589 } |
597 } |
590 ImmutableOopMapPair* last = &pairs[i]; |
598 |
591 |
599 // Heal Coverity issue: potential index out of bounds access. |
|
600 guarantee(last != NULL, "last may not be null"); |
592 assert(last->pc_offset() == pc_offset, "oopmap not found"); |
601 assert(last->pc_offset() == pc_offset, "oopmap not found"); |
593 return last->get_from(this); |
602 return last->get_from(this); |
594 } |
603 } |
595 |
604 |
596 const ImmutableOopMap* ImmutableOopMapPair::get_from(const ImmutableOopMapSet* set) const { |
605 const ImmutableOopMap* ImmutableOopMapPair::get_from(const ImmutableOopMapSet* set) const { |