< prev index next >

src/hotspot/share/gc/shared/genOopClosures.hpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2017, 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  *


 134 
 135 class CLDScanClosure: public CLDClosure {
 136   OopsInClassLoaderDataOrGenClosure*   _scavenge_closure;
 137   // true if the the modified oops state should be saved.
 138   bool                                 _accumulate_modified_oops;
 139  public:
 140   CLDScanClosure(OopsInClassLoaderDataOrGenClosure* scavenge_closure,
 141                  bool accumulate_modified_oops) :
 142        _scavenge_closure(scavenge_closure), _accumulate_modified_oops(accumulate_modified_oops) {}
 143   void do_cld(ClassLoaderData* cld);
 144 };
 145 
 146 class FilteringClosure: public ExtendedOopClosure {
 147  private:
 148   HeapWord*   _boundary;
 149   ExtendedOopClosure* _cl;
 150  protected:
 151   template <class T> inline void do_oop_work(T* p);
 152  public:
 153   FilteringClosure(HeapWord* boundary, ExtendedOopClosure* cl) :
 154     ExtendedOopClosure(cl->ref_processor()), _boundary(boundary),
 155     _cl(cl) {}
 156   virtual void do_oop(oop* p);
 157   virtual void do_oop(narrowOop* p);
 158   inline void do_oop_nv(oop* p);
 159   inline void do_oop_nv(narrowOop* p);
 160   virtual bool do_metadata()          { return do_metadata_nv(); }
 161   inline bool do_metadata_nv()        { assert(!_cl->do_metadata(), "assumption broken, must change to 'return _cl->do_metadata()'"); return false; }
 162 };
 163 
 164 // Closure for scanning DefNewGeneration's weak references.
 165 // NOTE: very much like ScanClosure but not derived from
 166 //  OopsInGenClosure -- weak references are processed all
 167 //  at once, with no notion of which generation they were in.
 168 class ScanWeakRefClosure: public OopClosure {
 169  protected:
 170   DefNewGeneration* _g;
 171   HeapWord*         _boundary;
 172   template <class T> inline void do_oop_work(T* p);
 173  public:
 174   ScanWeakRefClosure(DefNewGeneration* g);
   1 /*
   2  * Copyright (c) 2001, 2018, 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  *


 134 
 135 class CLDScanClosure: public CLDClosure {
 136   OopsInClassLoaderDataOrGenClosure*   _scavenge_closure;
 137   // true if the the modified oops state should be saved.
 138   bool                                 _accumulate_modified_oops;
 139  public:
 140   CLDScanClosure(OopsInClassLoaderDataOrGenClosure* scavenge_closure,
 141                  bool accumulate_modified_oops) :
 142        _scavenge_closure(scavenge_closure), _accumulate_modified_oops(accumulate_modified_oops) {}
 143   void do_cld(ClassLoaderData* cld);
 144 };
 145 
 146 class FilteringClosure: public ExtendedOopClosure {
 147  private:
 148   HeapWord*   _boundary;
 149   ExtendedOopClosure* _cl;
 150  protected:
 151   template <class T> inline void do_oop_work(T* p);
 152  public:
 153   FilteringClosure(HeapWord* boundary, ExtendedOopClosure* cl) :
 154     ExtendedOopClosure(cl->ref_discoverer()), _boundary(boundary),
 155     _cl(cl) {}
 156   virtual void do_oop(oop* p);
 157   virtual void do_oop(narrowOop* p);
 158   inline void do_oop_nv(oop* p);
 159   inline void do_oop_nv(narrowOop* p);
 160   virtual bool do_metadata()          { return do_metadata_nv(); }
 161   inline bool do_metadata_nv()        { assert(!_cl->do_metadata(), "assumption broken, must change to 'return _cl->do_metadata()'"); return false; }
 162 };
 163 
 164 // Closure for scanning DefNewGeneration's weak references.
 165 // NOTE: very much like ScanClosure but not derived from
 166 //  OopsInGenClosure -- weak references are processed all
 167 //  at once, with no notion of which generation they were in.
 168 class ScanWeakRefClosure: public OopClosure {
 169  protected:
 170   DefNewGeneration* _g;
 171   HeapWord*         _boundary;
 172   template <class T> inline void do_oop_work(T* p);
 173  public:
 174   ScanWeakRefClosure(DefNewGeneration* g);
< prev index next >