< prev index next >

src/share/vm/memory/iterator.hpp

Print this page
rev 12851 : 8138737: Remove oop_ms_adjust_pointers and use oop_iterate instead
Reviewed-by:
rev 12852 : [mq]: 8138737-remove-oop-ms-adjust-kbarrett-rev1
   1 /*
   2  * Copyright (c) 1997, 2016, 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  *


  52 // This is needed by the GC and is extracted to a separate type to not
  53 // pollute the OopClosure interface.
  54 class ExtendedOopClosure : public OopClosure {
  55  private:
  56   ReferenceProcessor* _ref_processor;
  57 
  58  protected:
  59   ExtendedOopClosure(ReferenceProcessor* rp) : _ref_processor(rp) { }
  60   ExtendedOopClosure() : _ref_processor(NULL) { }
  61   ~ExtendedOopClosure() { }
  62 
  63   void set_ref_processor_internal(ReferenceProcessor* rp) { _ref_processor = rp; }
  64 
  65  public:
  66   ReferenceProcessor* ref_processor() const { return _ref_processor; }
  67 
  68   // Iteration of InstanceRefKlasses differ depending on the closure,
  69   // the below enum describes the different alternatives.
  70   enum ReferenceIterationMode {
  71     DO_DISCOVERY, // Tries to discover references
  72     DO_FIELDS     // No discovery, just apply closure to all fields
  73   };
  74 
  75   // The current default iteration mode is to do discovery.
  76   virtual ReferenceIterationMode reference_iteration_mode() { return DO_DISCOVERY; }
  77 
  78   // If the do_metadata functions return "true",
  79   // we invoke the following when running oop_iterate():
  80   //
  81   // 1) do_klass on the header klass pointer.
  82   // 2) do_klass on the klass pointer in the mirrors.
  83   // 3) do_cld   on the class loader data in class loaders.
  84   //
  85   // The virtual (without suffix) and the non-virtual (with _nv suffix) need
  86   // to be updated together, or else the devirtualization will break.
  87   //
  88   // Providing default implementations of the _nv functions unfortunately
  89   // removes the compile-time safeness, but reduces the clutter for the
  90   // ExtendedOopClosures that don't need to walk the metadata.
  91   // Currently, only CMS and G1 need these.
  92 


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


  52 // This is needed by the GC and is extracted to a separate type to not
  53 // pollute the OopClosure interface.
  54 class ExtendedOopClosure : public OopClosure {
  55  private:
  56   ReferenceProcessor* _ref_processor;
  57 
  58  protected:
  59   ExtendedOopClosure(ReferenceProcessor* rp) : _ref_processor(rp) { }
  60   ExtendedOopClosure() : _ref_processor(NULL) { }
  61   ~ExtendedOopClosure() { }
  62 
  63   void set_ref_processor_internal(ReferenceProcessor* rp) { _ref_processor = rp; }
  64 
  65  public:
  66   ReferenceProcessor* ref_processor() const { return _ref_processor; }
  67 
  68   // Iteration of InstanceRefKlasses differ depending on the closure,
  69   // the below enum describes the different alternatives.
  70   enum ReferenceIterationMode {
  71     DO_DISCOVERY, // Tries to discover references
  72     DO_FIELDS     // Apply closure to all fields
  73   };
  74 
  75   // The current default iteration mode is to do discovery.
  76   virtual ReferenceIterationMode reference_iteration_mode() { return DO_DISCOVERY; }
  77 
  78   // If the do_metadata functions return "true",
  79   // we invoke the following when running oop_iterate():
  80   //
  81   // 1) do_klass on the header klass pointer.
  82   // 2) do_klass on the klass pointer in the mirrors.
  83   // 3) do_cld   on the class loader data in class loaders.
  84   //
  85   // The virtual (without suffix) and the non-virtual (with _nv suffix) need
  86   // to be updated together, or else the devirtualization will break.
  87   //
  88   // Providing default implementations of the _nv functions unfortunately
  89   // removes the compile-time safeness, but reduces the clutter for the
  90   // ExtendedOopClosures that don't need to walk the metadata.
  91   // Currently, only CMS and G1 need these.
  92 


< prev index next >