< prev index next >

src/share/vm/compiler/oopMap.cpp

Print this page




 379     OopMapStream oms(map,OopMapValue::derived_oop_value);
 380     if (!oms.is_done()) {
 381 #ifndef TIERED
 382       COMPILER1_PRESENT(ShouldNotReachHere();)
 383 #endif // !TIERED
 384       // Protect the operation on the derived pointers.  This
 385       // protects the addition of derived pointers to the shared
 386       // derived pointer table in DerivedPointerTable::add().
 387       MutexLockerEx x(DerivedPointerTableGC_lock, Mutex::_no_safepoint_check_flag);
 388       do {
 389         omv = oms.current();
 390         oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
 391         if ( loc != NULL ) {
 392           oop *derived_loc = loc;
 393           oop *base_loc    = fr->oopmapreg_to_location(omv.content_reg(), reg_map);
 394           // Ignore NULL oops and decoded NULL narrow oops which
 395           // equal to Universe::narrow_oop_base when a narrow oop
 396           // implicit null check is used in compiled code.
 397           // The narrow_oop_base could be NULL or be the address
 398           // of the page below heap depending on compressed oops mode.
 399           if (base_loc != NULL && *base_loc != (oop)NULL && !Universe::is_narrow_oop_base(*base_loc)) {
 400             derived_oop_fn(base_loc, derived_loc);
 401           }
 402         }
 403         oms.next();
 404       }  while (!oms.is_done());
 405     }
 406   }
 407 
 408   // We want coop, value and oop oop_types
 409   int mask = OopMapValue::oop_value | OopMapValue::value_value | OopMapValue::narrowoop_value;
 410   {
 411     for (OopMapStream oms(map,mask); !oms.is_done(); oms.next()) {
 412       omv = oms.current();
 413       oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
 414       if ( loc != NULL ) {
 415         if ( omv.type() == OopMapValue::oop_value ) {
 416           oop val = *loc;
 417           if (val == (oop)NULL || Universe::is_narrow_oop_base(val)) {
 418             // Ignore NULL oops and decoded NULL narrow oops which
 419             // equal to Universe::narrow_oop_base when a narrow oop
 420             // implicit null check is used in compiled code.
 421             // The narrow_oop_base could be NULL or be the address
 422             // of the page below heap depending on compressed oops mode.
 423             continue;
 424           }
 425 #ifdef ASSERT
 426           if ((((uintptr_t)loc & (sizeof(*loc)-1)) != 0) ||
 427              !Universe::heap()->is_in_or_null(*loc)) {
 428             tty->print_cr("# Found non oop pointer.  Dumping state at failure");
 429             // try to dump out some helpful debugging information
 430             trace_codeblob_maps(fr, reg_map);
 431             omv.print();
 432             tty->print_cr("register r");
 433             omv.reg()->print();
 434             tty->print_cr("loc = %p *loc = %p\n", loc, (address)*loc);
 435             // do the real assert.
 436             assert(Universe::heap()->is_in_or_null(*loc), "found non oop pointer");
 437           }


 604   // The first time, we create the list.  Otherwise it should be
 605   // empty.  If not, then we have probably forgotton to call
 606   // update_pointers after last GC/Scavenge.
 607   assert (!_active, "should not be active");
 608   assert(_list == NULL || _list->length() == 0, "table not empty");
 609   if (_list == NULL) {
 610     _list = new (ResourceObj::C_HEAP, mtCompiler) GrowableArray<DerivedPointerEntry*>(10, true); // Allocated on C heap
 611   }
 612   _active = true;
 613 }
 614 
 615 
 616 // Returns value of location as an int
 617 intptr_t value_of_loc(oop *pointer) { return cast_from_oop<intptr_t>((*pointer)); }
 618 
 619 
 620 void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) {
 621   assert(Universe::heap()->is_in_or_null(*base_loc), "not an oop");
 622   assert(derived_loc != base_loc, "Base and derived in same location");
 623   if (_active) {
 624     assert(*derived_loc != (oop)base_loc, "location already added");
 625     assert(_list != NULL, "list must exist");
 626     intptr_t offset = value_of_loc(derived_loc) - value_of_loc(base_loc);
 627     // This assert is invalid because derived pointers can be
 628     // arbitrarily far away from their base.
 629     // assert(offset >= -1000000, "wrong derived pointer info");
 630 
 631     if (TraceDerivedPointers) {
 632       tty->print_cr(
 633         "Add derived pointer@" INTPTR_FORMAT
 634         " - Derived: " INTPTR_FORMAT
 635         " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: " INTX_FORMAT ")",
 636         p2i(derived_loc), p2i((address)*derived_loc), p2i((address)*base_loc), p2i(base_loc), offset
 637       );
 638     }
 639     // Set derived oop location to point to base.
 640     *derived_loc = (oop)base_loc;
 641     assert_lock_strong(DerivedPointerTableGC_lock);
 642     DerivedPointerEntry *entry = new DerivedPointerEntry(derived_loc, offset);
 643     _list->append(entry);
 644   }




 379     OopMapStream oms(map,OopMapValue::derived_oop_value);
 380     if (!oms.is_done()) {
 381 #ifndef TIERED
 382       COMPILER1_PRESENT(ShouldNotReachHere();)
 383 #endif // !TIERED
 384       // Protect the operation on the derived pointers.  This
 385       // protects the addition of derived pointers to the shared
 386       // derived pointer table in DerivedPointerTable::add().
 387       MutexLockerEx x(DerivedPointerTableGC_lock, Mutex::_no_safepoint_check_flag);
 388       do {
 389         omv = oms.current();
 390         oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
 391         if ( loc != NULL ) {
 392           oop *derived_loc = loc;
 393           oop *base_loc    = fr->oopmapreg_to_location(omv.content_reg(), reg_map);
 394           // Ignore NULL oops and decoded NULL narrow oops which
 395           // equal to Universe::narrow_oop_base when a narrow oop
 396           // implicit null check is used in compiled code.
 397           // The narrow_oop_base could be NULL or be the address
 398           // of the page below heap depending on compressed oops mode.
 399           if (base_loc != NULL && *base_loc != NULL && !Universe::is_narrow_oop_base(*base_loc)) {
 400             derived_oop_fn(base_loc, derived_loc);
 401           }
 402         }
 403         oms.next();
 404       }  while (!oms.is_done());
 405     }
 406   }
 407 
 408   // We want coop, value and oop oop_types
 409   int mask = OopMapValue::oop_value | OopMapValue::value_value | OopMapValue::narrowoop_value;
 410   {
 411     for (OopMapStream oms(map,mask); !oms.is_done(); oms.next()) {
 412       omv = oms.current();
 413       oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
 414       if ( loc != NULL ) {
 415         if ( omv.type() == OopMapValue::oop_value ) {
 416           oop val = *loc;
 417           if (val == NULL || Universe::is_narrow_oop_base(val)) {
 418             // Ignore NULL oops and decoded NULL narrow oops which
 419             // equal to Universe::narrow_oop_base when a narrow oop
 420             // implicit null check is used in compiled code.
 421             // The narrow_oop_base could be NULL or be the address
 422             // of the page below heap depending on compressed oops mode.
 423             continue;
 424           }
 425 #ifdef ASSERT
 426           if ((((uintptr_t)loc & (sizeof(*loc)-1)) != 0) ||
 427              !Universe::heap()->is_in_or_null(*loc)) {
 428             tty->print_cr("# Found non oop pointer.  Dumping state at failure");
 429             // try to dump out some helpful debugging information
 430             trace_codeblob_maps(fr, reg_map);
 431             omv.print();
 432             tty->print_cr("register r");
 433             omv.reg()->print();
 434             tty->print_cr("loc = %p *loc = %p\n", loc, (address)*loc);
 435             // do the real assert.
 436             assert(Universe::heap()->is_in_or_null(*loc), "found non oop pointer");
 437           }


 604   // The first time, we create the list.  Otherwise it should be
 605   // empty.  If not, then we have probably forgotton to call
 606   // update_pointers after last GC/Scavenge.
 607   assert (!_active, "should not be active");
 608   assert(_list == NULL || _list->length() == 0, "table not empty");
 609   if (_list == NULL) {
 610     _list = new (ResourceObj::C_HEAP, mtCompiler) GrowableArray<DerivedPointerEntry*>(10, true); // Allocated on C heap
 611   }
 612   _active = true;
 613 }
 614 
 615 
 616 // Returns value of location as an int
 617 intptr_t value_of_loc(oop *pointer) { return cast_from_oop<intptr_t>((*pointer)); }
 618 
 619 
 620 void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) {
 621   assert(Universe::heap()->is_in_or_null(*base_loc), "not an oop");
 622   assert(derived_loc != base_loc, "Base and derived in same location");
 623   if (_active) {
 624     assert(*derived_loc != (void*)base_loc, "location already added");
 625     assert(_list != NULL, "list must exist");
 626     intptr_t offset = value_of_loc(derived_loc) - value_of_loc(base_loc);
 627     // This assert is invalid because derived pointers can be
 628     // arbitrarily far away from their base.
 629     // assert(offset >= -1000000, "wrong derived pointer info");
 630 
 631     if (TraceDerivedPointers) {
 632       tty->print_cr(
 633         "Add derived pointer@" INTPTR_FORMAT
 634         " - Derived: " INTPTR_FORMAT
 635         " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: " INTX_FORMAT ")",
 636         p2i(derived_loc), p2i((address)*derived_loc), p2i((address)*base_loc), p2i(base_loc), offset
 637       );
 638     }
 639     // Set derived oop location to point to base.
 640     *derived_loc = (oop)base_loc;
 641     assert_lock_strong(DerivedPointerTableGC_lock);
 642     DerivedPointerEntry *entry = new DerivedPointerEntry(derived_loc, offset);
 643     _list->append(entry);
 644   }


< prev index next >