< prev index next >

src/share/vm/memory/genOopClosures.hpp

Print this page
rev 7854 : 8073387: Move VerifyOopClosures out from genOopClosures.hpp
   1 /*
   2  * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 170   inline void do_oop_nv(narrowOop* p) { FilteringClosure::do_oop_work(p); }
 171   virtual bool do_metadata()          { return do_metadata_nv(); }
 172   inline bool do_metadata_nv()        { assert(!_cl->do_metadata(), "assumption broken, must change to 'return _cl->do_metadata()'"); return false; }
 173 };
 174 
 175 // Closure for scanning DefNewGeneration's weak references.
 176 // NOTE: very much like ScanClosure but not derived from
 177 //  OopsInGenClosure -- weak references are processed all
 178 //  at once, with no notion of which generation they were in.
 179 class ScanWeakRefClosure: public OopClosure {
 180  protected:
 181   DefNewGeneration* _g;
 182   HeapWord*         _boundary;
 183   template <class T> inline void do_oop_work(T* p);
 184  public:
 185   ScanWeakRefClosure(DefNewGeneration* g);
 186   virtual void do_oop(oop* p);
 187   virtual void do_oop(narrowOop* p);
 188   inline void do_oop_nv(oop* p);
 189   inline void do_oop_nv(narrowOop* p);
 190 };
 191 
 192 class VerifyOopClosure: public OopClosure {
 193  protected:
 194   template <class T> inline void do_oop_work(T* p) {
 195     oop obj = oopDesc::load_decode_heap_oop(p);
 196     guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, p2i((oopDesc*) obj)));
 197   }
 198  public:
 199   virtual void do_oop(oop* p);
 200   virtual void do_oop(narrowOop* p);
 201   static VerifyOopClosure verify_oop;
 202 };
 203 
 204 #endif // SHARE_VM_MEMORY_GENOOPCLOSURES_HPP
   1 /*
   2  * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 170   inline void do_oop_nv(narrowOop* p) { FilteringClosure::do_oop_work(p); }
 171   virtual bool do_metadata()          { return do_metadata_nv(); }
 172   inline bool do_metadata_nv()        { assert(!_cl->do_metadata(), "assumption broken, must change to 'return _cl->do_metadata()'"); return false; }
 173 };
 174 
 175 // Closure for scanning DefNewGeneration's weak references.
 176 // NOTE: very much like ScanClosure but not derived from
 177 //  OopsInGenClosure -- weak references are processed all
 178 //  at once, with no notion of which generation they were in.
 179 class ScanWeakRefClosure: public OopClosure {
 180  protected:
 181   DefNewGeneration* _g;
 182   HeapWord*         _boundary;
 183   template <class T> inline void do_oop_work(T* p);
 184  public:
 185   ScanWeakRefClosure(DefNewGeneration* g);
 186   virtual void do_oop(oop* p);
 187   virtual void do_oop(narrowOop* p);
 188   inline void do_oop_nv(oop* p);
 189   inline void do_oop_nv(narrowOop* p);












 190 };
 191 
 192 #endif // SHARE_VM_MEMORY_GENOOPCLOSURES_HPP
< prev index next >