1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,73 @@ 1.4 +/* 1.5 + * Copyright 2001-2002 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.24 + * have any questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +// 1.29 +// A PSMarkSweepDecorator is used to add "ParallelScavenge" style mark sweep operations 1.30 +// to a MutableSpace. 1.31 +// 1.32 + 1.33 +class ObjectStartArray; 1.34 + 1.35 +class PSMarkSweepDecorator: public CHeapObj { 1.36 + private: 1.37 + static PSMarkSweepDecorator* _destination_decorator; 1.38 + 1.39 + protected: 1.40 + MutableSpace* _space; 1.41 + ObjectStartArray* _start_array; 1.42 + HeapWord* _first_dead; 1.43 + HeapWord* _end_of_live; 1.44 + HeapWord* _compaction_top; 1.45 + unsigned int _allowed_dead_ratio; 1.46 + 1.47 + bool insert_deadspace(ssize_t& allowed_deadspace_words, HeapWord* q, size_t word_len); 1.48 + 1.49 + public: 1.50 + PSMarkSweepDecorator(MutableSpace* space, ObjectStartArray* start_array, 1.51 + unsigned int allowed_dead_ratio) : 1.52 + _space(space), _start_array(start_array), _allowed_dead_ratio(allowed_dead_ratio) { } 1.53 + 1.54 + // During a compacting collection, we need to collapse objects into 1.55 + // spaces in a given order. We want to fill space A, space B, and so 1.56 + // on. The code that controls that order is in the following methods. 1.57 + static void set_destination_decorator_tenured(); 1.58 + static void set_destination_decorator_perm_gen(); 1.59 + static void advance_destination_decorator(); 1.60 + static PSMarkSweepDecorator* destination_decorator(); 1.61 + 1.62 + // Accessors 1.63 + MutableSpace* space() { return _space; } 1.64 + ObjectStartArray* start_array() { return _start_array; } 1.65 + 1.66 + HeapWord* compaction_top() { return _compaction_top; } 1.67 + void set_compaction_top(HeapWord* value) { _compaction_top = value; } 1.68 + 1.69 + unsigned int allowed_dead_ratio() { return _allowed_dead_ratio; } 1.70 + void set_allowed_dead_ratio(unsigned int value) { _allowed_dead_ratio = value; } 1.71 + 1.72 + // Work methods 1.73 + void adjust_pointers(); 1.74 + void precompact(); 1.75 + void compact(bool mangle_free_space); 1.76 +};