< prev index next >

src/hotspot/share/gc/z/zMark.cpp

Print this page

 402   // Decode object address and additional flags
 403   const zaddress addr = ZOffset::address(to_zoffset(entry.object_address()));
 404   const bool mark = entry.mark();
 405   bool inc_live = entry.inc_live();
 406   const bool follow = entry.follow();
 407 
 408   ZPage* const page = _page_table->get(addr);
 409   assert(page->is_relocatable(), "Invalid page state");
 410 
 411   // Mark
 412   if (mark && !page->mark_object(addr, finalizable, inc_live)) {
 413     // Already marked
 414     return;
 415   }
 416 
 417   // Increment live
 418   if (inc_live) {
 419     // Update live objects/bytes for page. We use the aligned object
 420     // size since that is the actual number of bytes used on the page
 421     // and alignment paddings can never be reclaimed.

 422     const size_t size = ZUtils::object_size(addr);
 423     const size_t aligned_size = align_up(size, page->object_alignment());
 424     context->cache()->inc_live(page, aligned_size);






 425   }
 426 
 427   // Follow
 428   if (follow) {
 429     if (is_array(addr)) {
 430       follow_array_object(objArrayOop(to_oop(addr)), finalizable);
 431     } else {
 432       follow_object(to_oop(addr), finalizable);
 433     }
 434   }
 435 }
 436 
 437 // This function returns true if we need to stop working to resize threads or
 438 // abort marking
 439 bool ZMark::rebalance_work(ZMarkContext* context) {
 440   const size_t assumed_nstripes = context->nstripes();
 441   const size_t nstripes = _stripes.nstripes();
 442 
 443   if (assumed_nstripes != nstripes) {
 444     // The number of stripes has changed; reflect that change locally

 402   // Decode object address and additional flags
 403   const zaddress addr = ZOffset::address(to_zoffset(entry.object_address()));
 404   const bool mark = entry.mark();
 405   bool inc_live = entry.inc_live();
 406   const bool follow = entry.follow();
 407 
 408   ZPage* const page = _page_table->get(addr);
 409   assert(page->is_relocatable(), "Invalid page state");
 410 
 411   // Mark
 412   if (mark && !page->mark_object(addr, finalizable, inc_live)) {
 413     // Already marked
 414     return;
 415   }
 416 
 417   // Increment live
 418   if (inc_live) {
 419     // Update live objects/bytes for page. We use the aligned object
 420     // size since that is the actual number of bytes used on the page
 421     // and alignment paddings can never be reclaimed.
 422     const oop obj = to_oop(addr);
 423     const size_t size = ZUtils::object_size(addr);
 424     const size_t aligned_size = align_up(size, page->object_alignment());
 425     context->cache()->inc_live(page, aligned_size);
 426     // Track objects that will expand by one HeapWord during relocation due to compact
 427     // identity hashcode: their FROM size is one word smaller than their TO size.
 428     if (UseCompactObjectHeaders && obj->mark().is_hashed_not_expanded()
 429         && obj->klass()->expand_for_hash(obj, obj->mark())) {
 430       page->inc_will_expand(1);
 431     }
 432   }
 433 
 434   // Follow
 435   if (follow) {
 436     if (is_array(addr)) {
 437       follow_array_object(objArrayOop(to_oop(addr)), finalizable);
 438     } else {
 439       follow_object(to_oop(addr), finalizable);
 440     }
 441   }
 442 }
 443 
 444 // This function returns true if we need to stop working to resize threads or
 445 // abort marking
 446 bool ZMark::rebalance_work(ZMarkContext* context) {
 447   const size_t assumed_nstripes = context->nstripes();
 448   const size_t nstripes = _stripes.nstripes();
 449 
 450   if (assumed_nstripes != nstripes) {
 451     // The number of stripes has changed; reflect that change locally
< prev index next >