621 assert (!_active, "should not be active");
622 assert(_list == NULL || _list->length() == 0, "table not empty");
623 if (_list == NULL) {
624 _list = new (ResourceObj::C_HEAP) GrowableArray<DerivedPointerEntry*>(10, true); // Allocated on C heap
625 }
626 _active = true;
627 }
628
629
630 // Returns value of location as an int
631 intptr_t value_of_loc(oop *pointer) { return (intptr_t)(*pointer); }
632
633
634 void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) {
635 assert(Universe::heap()->is_in_or_null(*base_loc), "not an oop");
636 assert(derived_loc != base_loc, "Base and derived in same location");
637 if (_active) {
638 assert(*derived_loc != (oop)base_loc, "location already added");
639 assert(_list != NULL, "list must exist");
640 intptr_t offset = value_of_loc(derived_loc) - value_of_loc(base_loc);
641 assert(offset >= -1000000, "wrong derived pointer info");
642
643 if (TraceDerivedPointers) {
644 tty->print_cr(
645 "Add derived pointer@" INTPTR_FORMAT
646 " - Derived: " INTPTR_FORMAT
647 " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: %d)",
648 derived_loc, (address)*derived_loc, (address)*base_loc, base_loc, offset
649 );
650 }
651 // Set derived oop location to point to base.
652 *derived_loc = (oop)base_loc;
653 assert_lock_strong(DerivedPointerTableGC_lock);
654 DerivedPointerEntry *entry = new DerivedPointerEntry(derived_loc, offset);
655 _list->append(entry);
656 }
657 }
658
659
660 void DerivedPointerTable::update_pointers() {
661 assert(_list != NULL, "list must exist");
|
621 assert (!_active, "should not be active");
622 assert(_list == NULL || _list->length() == 0, "table not empty");
623 if (_list == NULL) {
624 _list = new (ResourceObj::C_HEAP) GrowableArray<DerivedPointerEntry*>(10, true); // Allocated on C heap
625 }
626 _active = true;
627 }
628
629
630 // Returns value of location as an int
631 intptr_t value_of_loc(oop *pointer) { return (intptr_t)(*pointer); }
632
633
634 void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) {
635 assert(Universe::heap()->is_in_or_null(*base_loc), "not an oop");
636 assert(derived_loc != base_loc, "Base and derived in same location");
637 if (_active) {
638 assert(*derived_loc != (oop)base_loc, "location already added");
639 assert(_list != NULL, "list must exist");
640 intptr_t offset = value_of_loc(derived_loc) - value_of_loc(base_loc);
641 // This assert is invalid because derived pointers can be
642 // arbitrarily far away from their base.
643 // assert(offset >= -1000000, "wrong derived pointer info");
644
645 if (TraceDerivedPointers) {
646 tty->print_cr(
647 "Add derived pointer@" INTPTR_FORMAT
648 " - Derived: " INTPTR_FORMAT
649 " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: %d)",
650 derived_loc, (address)*derived_loc, (address)*base_loc, base_loc, offset
651 );
652 }
653 // Set derived oop location to point to base.
654 *derived_loc = (oop)base_loc;
655 assert_lock_strong(DerivedPointerTableGC_lock);
656 DerivedPointerEntry *entry = new DerivedPointerEntry(derived_loc, offset);
657 _list->append(entry);
658 }
659 }
660
661
662 void DerivedPointerTable::update_pointers() {
663 assert(_list != NULL, "list must exist");
|