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 // 26 // psPromotionManager is used by a single thread to manage object survival 27 // during a scavenge. The promotion manager contains thread local data only. 28 // 29 // NOTE! Be carefull when allocating the stacks on cheap. If you are going 30 // to use a promotion manager in more than one thread, the stacks MUST be 31 // on cheap. This can lead to memory leaks, though, as they are not auto 32 // deallocated. 33 // 34 // FIX ME FIX ME Add a destructor, and don't rely on the user to drain/flush/deallocate! 35 // 36 37 // Move to some global location 38 #define HAS_BEEN_MOVED 0x1501d01d 39 // End move to some global location 40 41 class MutableSpace; 42 class PSOldGen; 43 class ParCompactionManager; 44 174 drain_stacks_depth(totally_drain); 175 } 176 public: 177 void drain_stacks_cond_depth() { 178 if (claimed_stack_depth()->size() > _target_stack_size) { 179 drain_stacks_depth(false); 180 } 181 } 182 void drain_stacks_depth(bool totally_drain); 183 184 bool stacks_empty() { 185 return claimed_stack_depth()->is_empty(); 186 } 187 188 inline void process_popped_location_depth(StarTask p); 189 190 template <class T> inline void claim_or_forward_depth(T* p); 191 192 TASKQUEUE_STATS_ONLY(inline void record_steal(StarTask& p);) 193 }; | 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_PSPROMOTIONMANAGER_HPP 26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_HPP 27 28 #include "gc_implementation/parallelScavenge/psPromotionLAB.hpp" 29 #include "memory/allocation.hpp" 30 #include "utilities/taskqueue.hpp" 31 32 // 33 // psPromotionManager is used by a single thread to manage object survival 34 // during a scavenge. The promotion manager contains thread local data only. 35 // 36 // NOTE! Be carefull when allocating the stacks on cheap. If you are going 37 // to use a promotion manager in more than one thread, the stacks MUST be 38 // on cheap. This can lead to memory leaks, though, as they are not auto 39 // deallocated. 40 // 41 // FIX ME FIX ME Add a destructor, and don't rely on the user to drain/flush/deallocate! 42 // 43 44 // Move to some global location 45 #define HAS_BEEN_MOVED 0x1501d01d 46 // End move to some global location 47 48 class MutableSpace; 49 class PSOldGen; 50 class ParCompactionManager; 51 181 drain_stacks_depth(totally_drain); 182 } 183 public: 184 void drain_stacks_cond_depth() { 185 if (claimed_stack_depth()->size() > _target_stack_size) { 186 drain_stacks_depth(false); 187 } 188 } 189 void drain_stacks_depth(bool totally_drain); 190 191 bool stacks_empty() { 192 return claimed_stack_depth()->is_empty(); 193 } 194 195 inline void process_popped_location_depth(StarTask p); 196 197 template <class T> inline void claim_or_forward_depth(T* p); 198 199 TASKQUEUE_STATS_ONLY(inline void record_steal(StarTask& p);) 200 }; 201 202 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSPROMOTIONMANAGER_HPP |