< prev index next >

src/hotspot/share/compiler/oopMap.cpp

Print this page




 333       if (UseJVMCICompiler) {
 334         ShouldNotReachHere();
 335       }
 336 #endif
 337 #endif // !TIERED
 338       // Protect the operation on the derived pointers.  This
 339       // protects the addition of derived pointers to the shared
 340       // derived pointer table in DerivedPointerTable::add().
 341       MutexLockerEx x(DerivedPointerTableGC_lock, Mutex::_no_safepoint_check_flag);
 342       do {
 343         omv = oms.current();
 344         oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
 345         guarantee(loc != NULL, "missing saved register");
 346         oop *derived_loc = loc;
 347         oop *base_loc    = fr->oopmapreg_to_location(omv.content_reg(), reg_map);
 348         // Ignore NULL oops and decoded NULL narrow oops which
 349         // equal to Universe::narrow_oop_base when a narrow oop
 350         // implicit null check is used in compiled code.
 351         // The narrow_oop_base could be NULL or be the address
 352         // of the page below heap depending on compressed oops mode.
 353         if (base_loc != NULL && *base_loc != (oop)NULL && !Universe::is_narrow_oop_base(*base_loc)) {
 354           derived_oop_fn(base_loc, derived_loc);
 355         }
 356         oms.next();
 357       }  while (!oms.is_done());
 358     }
 359   }
 360 
 361   // We want coop and oop oop_types
 362   int mask = OopMapValue::oop_value | OopMapValue::narrowoop_value;
 363   {
 364     for (OopMapStream oms(map,mask); !oms.is_done(); oms.next()) {
 365       omv = oms.current();
 366       oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
 367       // It should be an error if no location can be found for a
 368       // register mentioned as contained an oop of some kind.  Maybe
 369       // this was allowed previously because value_value items might
 370       // be missing?
 371       guarantee(loc != NULL, "missing saved register");
 372       if ( omv.type() == OopMapValue::oop_value ) {
 373         oop val = *loc;
 374         if (val == (oop)NULL || Universe::is_narrow_oop_base(val)) {
 375           // Ignore NULL oops and decoded NULL narrow oops which
 376           // equal to Universe::narrow_oop_base when a narrow oop
 377           // implicit null check is used in compiled code.
 378           // The narrow_oop_base could be NULL or be the address
 379           // of the page below heap depending on compressed oops mode.
 380           continue;
 381         }
 382 #ifdef ASSERT
 383         // We can not verify the oop here if we are using ZGC, the oop
 384         // will be bad in case we had a safepoint between a load and a
 385         // load barrier.
 386         if (!UseZGC &&
 387             ((((uintptr_t)loc & (sizeof(*loc)-1)) != 0) ||
 388              !Universe::heap()->is_in_or_null(*loc))) {
 389           tty->print_cr("# Found non oop pointer.  Dumping state at failure");
 390           // try to dump out some helpful debugging information
 391           trace_codeblob_maps(fr, reg_map);
 392           omv.print();
 393           tty->print_cr("register r");
 394           omv.reg()->print();


 752   // The first time, we create the list.  Otherwise it should be
 753   // empty.  If not, then we have probably forgotton to call
 754   // update_pointers after last GC/Scavenge.
 755   assert (!_active, "should not be active");
 756   assert(_list == NULL || _list->length() == 0, "table not empty");
 757   if (_list == NULL) {
 758     _list = new (ResourceObj::C_HEAP, mtCompiler) GrowableArray<DerivedPointerEntry*>(10, true); // Allocated on C heap
 759   }
 760   _active = true;
 761 }
 762 
 763 
 764 // Returns value of location as an int
 765 intptr_t value_of_loc(oop *pointer) { return cast_from_oop<intptr_t>((*pointer)); }
 766 
 767 
 768 void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) {
 769   assert(Universe::heap()->is_in_or_null(*base_loc), "not an oop");
 770   assert(derived_loc != base_loc, "Base and derived in same location");
 771   if (_active) {
 772     assert(*derived_loc != (oop)base_loc, "location already added");
 773     assert(_list != NULL, "list must exist");
 774     intptr_t offset = value_of_loc(derived_loc) - value_of_loc(base_loc);
 775     // This assert is invalid because derived pointers can be
 776     // arbitrarily far away from their base.
 777     // assert(offset >= -1000000, "wrong derived pointer info");
 778 
 779     if (TraceDerivedPointers) {
 780       tty->print_cr(
 781         "Add derived pointer@" INTPTR_FORMAT
 782         " - Derived: " INTPTR_FORMAT
 783         " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: " INTX_FORMAT ")",
 784         p2i(derived_loc), p2i((address)*derived_loc), p2i((address)*base_loc), p2i(base_loc), offset
 785       );
 786     }
 787     // Set derived oop location to point to base.
 788     *derived_loc = (oop)base_loc;
 789     assert_lock_strong(DerivedPointerTableGC_lock);
 790     DerivedPointerEntry *entry = new DerivedPointerEntry(derived_loc, offset);
 791     _list->append(entry);
 792   }




 333       if (UseJVMCICompiler) {
 334         ShouldNotReachHere();
 335       }
 336 #endif
 337 #endif // !TIERED
 338       // Protect the operation on the derived pointers.  This
 339       // protects the addition of derived pointers to the shared
 340       // derived pointer table in DerivedPointerTable::add().
 341       MutexLockerEx x(DerivedPointerTableGC_lock, Mutex::_no_safepoint_check_flag);
 342       do {
 343         omv = oms.current();
 344         oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
 345         guarantee(loc != NULL, "missing saved register");
 346         oop *derived_loc = loc;
 347         oop *base_loc    = fr->oopmapreg_to_location(omv.content_reg(), reg_map);
 348         // Ignore NULL oops and decoded NULL narrow oops which
 349         // equal to Universe::narrow_oop_base when a narrow oop
 350         // implicit null check is used in compiled code.
 351         // The narrow_oop_base could be NULL or be the address
 352         // of the page below heap depending on compressed oops mode.
 353         if (base_loc != NULL && *base_loc != NULL && !Universe::is_narrow_oop_base(*base_loc)) {
 354           derived_oop_fn(base_loc, derived_loc);
 355         }
 356         oms.next();
 357       }  while (!oms.is_done());
 358     }
 359   }
 360 
 361   // We want coop and oop oop_types
 362   int mask = OopMapValue::oop_value | OopMapValue::narrowoop_value;
 363   {
 364     for (OopMapStream oms(map,mask); !oms.is_done(); oms.next()) {
 365       omv = oms.current();
 366       oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
 367       // It should be an error if no location can be found for a
 368       // register mentioned as contained an oop of some kind.  Maybe
 369       // this was allowed previously because value_value items might
 370       // be missing?
 371       guarantee(loc != NULL, "missing saved register");
 372       if ( omv.type() == OopMapValue::oop_value ) {
 373         oop val = *loc;
 374         if (val == NULL || Universe::is_narrow_oop_base(val)) {
 375           // Ignore NULL oops and decoded NULL narrow oops which
 376           // equal to Universe::narrow_oop_base when a narrow oop
 377           // implicit null check is used in compiled code.
 378           // The narrow_oop_base could be NULL or be the address
 379           // of the page below heap depending on compressed oops mode.
 380           continue;
 381         }
 382 #ifdef ASSERT
 383         // We can not verify the oop here if we are using ZGC, the oop
 384         // will be bad in case we had a safepoint between a load and a
 385         // load barrier.
 386         if (!UseZGC &&
 387             ((((uintptr_t)loc & (sizeof(*loc)-1)) != 0) ||
 388              !Universe::heap()->is_in_or_null(*loc))) {
 389           tty->print_cr("# Found non oop pointer.  Dumping state at failure");
 390           // try to dump out some helpful debugging information
 391           trace_codeblob_maps(fr, reg_map);
 392           omv.print();
 393           tty->print_cr("register r");
 394           omv.reg()->print();


 752   // The first time, we create the list.  Otherwise it should be
 753   // empty.  If not, then we have probably forgotton to call
 754   // update_pointers after last GC/Scavenge.
 755   assert (!_active, "should not be active");
 756   assert(_list == NULL || _list->length() == 0, "table not empty");
 757   if (_list == NULL) {
 758     _list = new (ResourceObj::C_HEAP, mtCompiler) GrowableArray<DerivedPointerEntry*>(10, true); // Allocated on C heap
 759   }
 760   _active = true;
 761 }
 762 
 763 
 764 // Returns value of location as an int
 765 intptr_t value_of_loc(oop *pointer) { return cast_from_oop<intptr_t>((*pointer)); }
 766 
 767 
 768 void DerivedPointerTable::add(oop *derived_loc, oop *base_loc) {
 769   assert(Universe::heap()->is_in_or_null(*base_loc), "not an oop");
 770   assert(derived_loc != base_loc, "Base and derived in same location");
 771   if (_active) {
 772     assert(*derived_loc != (void*)base_loc, "location already added");
 773     assert(_list != NULL, "list must exist");
 774     intptr_t offset = value_of_loc(derived_loc) - value_of_loc(base_loc);
 775     // This assert is invalid because derived pointers can be
 776     // arbitrarily far away from their base.
 777     // assert(offset >= -1000000, "wrong derived pointer info");
 778 
 779     if (TraceDerivedPointers) {
 780       tty->print_cr(
 781         "Add derived pointer@" INTPTR_FORMAT
 782         " - Derived: " INTPTR_FORMAT
 783         " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: " INTX_FORMAT ")",
 784         p2i(derived_loc), p2i((address)*derived_loc), p2i((address)*base_loc), p2i(base_loc), offset
 785       );
 786     }
 787     // Set derived oop location to point to base.
 788     *derived_loc = (oop)base_loc;
 789     assert_lock_strong(DerivedPointerTableGC_lock);
 790     DerivedPointerEntry *entry = new DerivedPointerEntry(derived_loc, offset);
 791     _list->append(entry);
 792   }


< prev index next >