src/share/vm/memory/referenceProcessor.cpp

Print this page




   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  *
  23  */
  24 
  25 # include "incls/_precompiled.incl"
  26 # include "incls/_referenceProcessor.cpp.incl"








  27 
  28 ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL;
  29 ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy      = NULL;
  30 oop              ReferenceProcessor::_sentinelRef = NULL;
  31 const int        subclasses_of_ref                = REF_PHANTOM - REF_OTHER;
  32 
  33 // List of discovered references.
  34 class DiscoveredList {
  35 public:
  36   DiscoveredList() : _len(0), _compressed_head(0), _oop_head(NULL) { }
  37   oop head() const     {
  38      return UseCompressedOops ?  oopDesc::decode_heap_oop_not_null(_compressed_head) :
  39                                 _oop_head;
  40   }
  41   HeapWord* adr_head() {
  42     return UseCompressedOops ? (HeapWord*)&_compressed_head :
  43                                (HeapWord*)&_oop_head;
  44   }
  45   void   set_head(oop o) {
  46     if (UseCompressedOops) {




   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/javaClasses.hpp"
  27 #include "classfile/systemDictionary.hpp"
  28 #include "gc_interface/collectedHeap.hpp"
  29 #include "gc_interface/collectedHeap.inline.hpp"
  30 #include "memory/referencePolicy.hpp"
  31 #include "memory/referenceProcessor.hpp"
  32 #include "oops/oop.inline.hpp"
  33 #include "runtime/java.hpp"
  34 #include "runtime/jniHandles.hpp"
  35 
  36 ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL;
  37 ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy      = NULL;
  38 oop              ReferenceProcessor::_sentinelRef = NULL;
  39 const int        subclasses_of_ref                = REF_PHANTOM - REF_OTHER;
  40 
  41 // List of discovered references.
  42 class DiscoveredList {
  43 public:
  44   DiscoveredList() : _len(0), _compressed_head(0), _oop_head(NULL) { }
  45   oop head() const     {
  46      return UseCompressedOops ?  oopDesc::decode_heap_oop_not_null(_compressed_head) :
  47                                 _oop_head;
  48   }
  49   HeapWord* adr_head() {
  50     return UseCompressedOops ? (HeapWord*)&_compressed_head :
  51                                (HeapWord*)&_oop_head;
  52   }
  53   void   set_head(oop o) {
  54     if (UseCompressedOops) {