< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp

Print this page




   6  * published by the Free Software Foundation.
   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_INLINE_HPP
  24 #define SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_INLINE_HPP
  25 

  26 #include "gc/shenandoah/shenandoahAsserts.hpp"
  27 #include "gc/shenandoah/shenandoahClosures.hpp"
  28 #include "gc/shenandoah/shenandoahHeap.inline.hpp"

  29 #include "gc/shenandoah/shenandoahTraversalGC.hpp"
  30 #include "oops/compressedOops.inline.hpp"
  31 #include "runtime/thread.hpp"
  32 
  33 ShenandoahForwardedIsAliveClosure::ShenandoahForwardedIsAliveClosure() :
  34   _mark_context(ShenandoahHeap::heap()->marking_context()) {
  35 }
  36 
  37 bool ShenandoahForwardedIsAliveClosure::do_object_b(oop obj) {
  38   if (CompressedOops::is_null(obj)) {
  39     return false;
  40   }
  41   obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
  42   shenandoah_assert_not_forwarded_if(NULL, obj,
  43                                      (ShenandoahHeap::heap()->is_concurrent_mark_in_progress() ||
  44                                      ShenandoahHeap::heap()->is_concurrent_traversal_in_progress()));
  45   return _mark_context->is_marked(obj);
  46 }
  47 
  48 ShenandoahIsAliveClosure::ShenandoahIsAliveClosure() :


 137 
 138 void ShenandoahEvacUpdateOopStorageRootsClosure::do_oop(oop* p) {
 139   assert(_heap->is_evacuation_in_progress(), "Only do this when evacuation is in progress");
 140 
 141   oop obj = RawAccess<>::oop_load(p);
 142   if (! CompressedOops::is_null(obj)) {
 143     if (_heap->in_collection_set(obj)) {
 144       shenandoah_assert_marked(p, obj);
 145       oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
 146       if (resolved == obj) {
 147         resolved = _heap->evacuate_object(obj, _thread);
 148       }
 149 
 150       Atomic::cmpxchg(resolved, p, obj);
 151     }
 152   }
 153 }
 154 
 155 void ShenandoahEvacUpdateOopStorageRootsClosure::do_oop(narrowOop* p) {
 156   ShouldNotReachHere();














 157 }
 158 
 159 #ifdef ASSERT
 160 template <class T>
 161 void ShenandoahAssertNotForwardedClosure::do_oop_work(T* p) {
 162   T o = RawAccess<>::oop_load(p);
 163   if (!CompressedOops::is_null(o)) {
 164     oop obj = CompressedOops::decode_not_null(o);
 165     shenandoah_assert_not_forwarded(p, obj);
 166   }
 167 }
 168 
 169 void ShenandoahAssertNotForwardedClosure::do_oop(narrowOop* p) { do_oop_work(p); }
 170 void ShenandoahAssertNotForwardedClosure::do_oop(oop* p)       { do_oop_work(p); }
 171 #endif
 172 
 173 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP


   6  * published by the Free Software Foundation.
   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_INLINE_HPP
  24 #define SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_INLINE_HPP
  25 
  26 #include "gc/shared/barrierSetNMethod.hpp"
  27 #include "gc/shenandoah/shenandoahAsserts.hpp"
  28 #include "gc/shenandoah/shenandoahClosures.hpp"
  29 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
  30 #include "gc/shenandoah/shenandoahNMethod.inline.hpp"
  31 #include "gc/shenandoah/shenandoahTraversalGC.hpp"
  32 #include "oops/compressedOops.inline.hpp"
  33 #include "runtime/thread.hpp"
  34 
  35 ShenandoahForwardedIsAliveClosure::ShenandoahForwardedIsAliveClosure() :
  36   _mark_context(ShenandoahHeap::heap()->marking_context()) {
  37 }
  38 
  39 bool ShenandoahForwardedIsAliveClosure::do_object_b(oop obj) {
  40   if (CompressedOops::is_null(obj)) {
  41     return false;
  42   }
  43   obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
  44   shenandoah_assert_not_forwarded_if(NULL, obj,
  45                                      (ShenandoahHeap::heap()->is_concurrent_mark_in_progress() ||
  46                                      ShenandoahHeap::heap()->is_concurrent_traversal_in_progress()));
  47   return _mark_context->is_marked(obj);
  48 }
  49 
  50 ShenandoahIsAliveClosure::ShenandoahIsAliveClosure() :


 139 
 140 void ShenandoahEvacUpdateOopStorageRootsClosure::do_oop(oop* p) {
 141   assert(_heap->is_evacuation_in_progress(), "Only do this when evacuation is in progress");
 142 
 143   oop obj = RawAccess<>::oop_load(p);
 144   if (! CompressedOops::is_null(obj)) {
 145     if (_heap->in_collection_set(obj)) {
 146       shenandoah_assert_marked(p, obj);
 147       oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
 148       if (resolved == obj) {
 149         resolved = _heap->evacuate_object(obj, _thread);
 150       }
 151 
 152       Atomic::cmpxchg(resolved, p, obj);
 153     }
 154   }
 155 }
 156 
 157 void ShenandoahEvacUpdateOopStorageRootsClosure::do_oop(narrowOop* p) {
 158   ShouldNotReachHere();
 159 }
 160 
 161 ShenandoahCodeBlobAndDisarmClosure::ShenandoahCodeBlobAndDisarmClosure(OopClosure* cl) :
 162   CodeBlobToOopClosure(cl, true /* fix_relocations */),
 163    _bs(BarrierSet::barrier_set()->barrier_set_nmethod()) {
 164 }
 165 
 166 void ShenandoahCodeBlobAndDisarmClosure::do_code_blob(CodeBlob* cb) {
 167   nmethod* const nm = cb->as_nmethod_or_null();
 168   if (nm != NULL && !nm->test_set_oops_do_mark()) {
 169     assert(!ShenandoahNMethod::gc_data(nm)->is_unregistered(), "Should not be here");
 170     CodeBlobToOopClosure::do_code_blob(cb);
 171     _bs->disarm(nm);
 172   }
 173 }
 174 
 175 #ifdef ASSERT
 176 template <class T>
 177 void ShenandoahAssertNotForwardedClosure::do_oop_work(T* p) {
 178   T o = RawAccess<>::oop_load(p);
 179   if (!CompressedOops::is_null(o)) {
 180     oop obj = CompressedOops::decode_not_null(o);
 181     shenandoah_assert_not_forwarded(p, obj);
 182   }
 183 }
 184 
 185 void ShenandoahAssertNotForwardedClosure::do_oop(narrowOop* p) { do_oop_work(p); }
 186 void ShenandoahAssertNotForwardedClosure::do_oop(oop* p)       { do_oop_work(p); }
 187 #endif
 188 
 189 #endif // SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_HPP
< prev index next >