src/share/vm/gc_implementation/parallelScavenge/psScavenge.hpp

Print this page


   1 /*
   2  * Copyright (c) 2002, 2008, 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  *
  23  */
  24 










  25 class GCTaskManager;
  26 class GCTaskQueue;
  27 class OopStack;
  28 class ReferenceProcessor;
  29 class ParallelScavengeHeap;
  30 class PSIsAliveClosure;
  31 class PSRefProcTaskExecutor;
  32 
  33 class PSScavenge: AllStatic {
  34   friend class PSIsAliveClosure;
  35   friend class PSKeepAliveClosure;
  36   friend class PSPromotionManager;
  37 
  38  enum ScavengeSkippedCause {
  39    not_skipped = 0,
  40    to_space_not_empty,
  41    promoted_too_large,
  42    full_follows_scavenge
  43  };
  44 


 118 
 119   template <class T> static inline bool should_scavenge(T* p);
 120 
 121   // These call should_scavenge() above and, if it returns true, also check that
 122   // the object was not newly copied into to_space.  The version with the bool
 123   // argument is a convenience wrapper that fetches the to_space pointer from
 124   // the heap and calls the other version (if the arg is true).
 125   template <class T> static inline bool should_scavenge(T* p, MutableSpace* to_space);
 126   template <class T> static inline bool should_scavenge(T* p, bool check_to_space);
 127 
 128   template <class T> inline static void copy_and_push_safe_barrier(PSPromotionManager* pm, T* p);
 129 
 130   // Is an object in the young generation
 131   // This assumes that the HeapWord argument is in the heap,
 132   // so it only checks one side of the complete predicate.
 133   inline static bool is_obj_in_young(HeapWord* o) {
 134     const bool result = (o >= _young_generation_boundary);
 135     return result;
 136   }
 137 };


   1 /*
   2  * Copyright (c) 2002, 2010, 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  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_HPP
  27 
  28 #include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
  29 #include "gc_implementation/parallelScavenge/psVirtualspace.hpp"
  30 #include "gc_implementation/shared/collectorCounters.hpp"
  31 #include "memory/allocation.hpp"
  32 #include "oops/oop.hpp"
  33 #include "utilities/stack.hpp"
  34 
  35 class GCTaskManager;
  36 class GCTaskQueue;
  37 class OopStack;
  38 class ReferenceProcessor;
  39 class ParallelScavengeHeap;
  40 class PSIsAliveClosure;
  41 class PSRefProcTaskExecutor;
  42 
  43 class PSScavenge: AllStatic {
  44   friend class PSIsAliveClosure;
  45   friend class PSKeepAliveClosure;
  46   friend class PSPromotionManager;
  47 
  48  enum ScavengeSkippedCause {
  49    not_skipped = 0,
  50    to_space_not_empty,
  51    promoted_too_large,
  52    full_follows_scavenge
  53  };
  54 


 128 
 129   template <class T> static inline bool should_scavenge(T* p);
 130 
 131   // These call should_scavenge() above and, if it returns true, also check that
 132   // the object was not newly copied into to_space.  The version with the bool
 133   // argument is a convenience wrapper that fetches the to_space pointer from
 134   // the heap and calls the other version (if the arg is true).
 135   template <class T> static inline bool should_scavenge(T* p, MutableSpace* to_space);
 136   template <class T> static inline bool should_scavenge(T* p, bool check_to_space);
 137 
 138   template <class T> inline static void copy_and_push_safe_barrier(PSPromotionManager* pm, T* p);
 139 
 140   // Is an object in the young generation
 141   // This assumes that the HeapWord argument is in the heap,
 142   // so it only checks one side of the complete predicate.
 143   inline static bool is_obj_in_young(HeapWord* o) {
 144     const bool result = (o >= _young_generation_boundary);
 145     return result;
 146   }
 147 };
 148 
 149 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSSCAVENGE_HPP