src/hotspot/share/gc/z/zBarrier.inline.hpp
changeset 54488 25199b48f34f
parent 52939 9a8585f60c32
child 55555 9a5e9537fe1a
child 58678 9cf78a70fa4f
equal deleted inserted replaced
54487:4fa1fd8bc21e 54488:25199b48f34f
    35   uintptr_t addr = ZOop::to_address(o);
    35   uintptr_t addr = ZOop::to_address(o);
    36 
    36 
    37 retry:
    37 retry:
    38   // Fast path
    38   // Fast path
    39   if (fast_path(addr)) {
    39   if (fast_path(addr)) {
    40     return ZOop::to_oop(addr);
    40     return ZOop::from_address(addr);
    41   }
    41   }
    42 
    42 
    43   // Slow path
    43   // Slow path
    44   const uintptr_t good_addr = slow_path(addr);
    44   const uintptr_t good_addr = slow_path(addr);
    45 
    45 
    54       addr = prev_addr;
    54       addr = prev_addr;
    55       goto retry;
    55       goto retry;
    56     }
    56     }
    57   }
    57   }
    58 
    58 
    59   return ZOop::to_oop(good_addr);
    59   return ZOop::from_address(good_addr);
    60 }
    60 }
    61 
    61 
    62 template <ZBarrierFastPath fast_path, ZBarrierSlowPath slow_path>
    62 template <ZBarrierFastPath fast_path, ZBarrierSlowPath slow_path>
    63 inline oop ZBarrier::weak_barrier(volatile oop* p, oop o) {
    63 inline oop ZBarrier::weak_barrier(volatile oop* p, oop o) {
    64   const uintptr_t addr = ZOop::to_address(o);
    64   const uintptr_t addr = ZOop::to_address(o);
    65 
    65 
    66   // Fast path
    66   // Fast path
    67   if (fast_path(addr)) {
    67   if (fast_path(addr)) {
    68     // Return the good address instead of the weak good address
    68     // Return the good address instead of the weak good address
    69     // to ensure that the currently active heap view is used.
    69     // to ensure that the currently active heap view is used.
    70     return ZOop::to_oop(ZAddress::good_or_null(addr));
    70     return ZOop::from_address(ZAddress::good_or_null(addr));
    71   }
    71   }
    72 
    72 
    73   // Slow path
    73   // Slow path
    74   uintptr_t good_addr = slow_path(addr);
    74   uintptr_t good_addr = slow_path(addr);
    75 
    75 
    93       // to ensure that the currently active heap view is used.
    93       // to ensure that the currently active heap view is used.
    94       good_addr = ZAddress::good_or_null(prev_addr);
    94       good_addr = ZAddress::good_or_null(prev_addr);
    95     }
    95     }
    96   }
    96   }
    97 
    97 
    98   return ZOop::to_oop(good_addr);
    98   return ZOop::from_address(good_addr);
    99 }
    99 }
   100 
   100 
   101 template <ZBarrierFastPath fast_path, ZBarrierSlowPath slow_path>
   101 template <ZBarrierFastPath fast_path, ZBarrierSlowPath slow_path>
   102 inline void ZBarrier::root_barrier(oop* p, oop o) {
   102 inline void ZBarrier::root_barrier(oop* p, oop o) {
   103   const uintptr_t addr = ZOop::to_address(o);
   103   const uintptr_t addr = ZOop::to_address(o);
   115   // which ensures we are never racing with mutators modifying roots while
   115   // which ensures we are never racing with mutators modifying roots while
   116   // we are healing them. It's also safe in case multiple GC threads try
   116   // we are healing them. It's also safe in case multiple GC threads try
   117   // to heal the same root if it is aligned, since they would always heal
   117   // to heal the same root if it is aligned, since they would always heal
   118   // the root in the same way and it does not matter in which order it
   118   // the root in the same way and it does not matter in which order it
   119   // happens. For misaligned oops, there needs to be mutual exclusion.
   119   // happens. For misaligned oops, there needs to be mutual exclusion.
   120   *p = ZOop::to_oop(good_addr);
   120   *p = ZOop::from_address(good_addr);
   121 }
   121 }
   122 
   122 
   123 inline bool ZBarrier::is_null_fast_path(uintptr_t addr) {
   123 inline bool ZBarrier::is_null_fast_path(uintptr_t addr) {
   124   return ZAddress::is_null(addr);
   124   return ZAddress::is_null(addr);
   125 }
   125 }