1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/memory/modRefBarrierSet.hpp Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,104 @@ 1.4 +/* 1.5 + * Copyright 2000-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 +// This kind of "BarrierSet" allows a "CollectedHeap" to detect and 1.29 +// enumerate ref fields that have been modified (since the last 1.30 +// enumeration), using a card table. 1.31 + 1.32 +class OopClosure; 1.33 +class Generation; 1.34 + 1.35 +class ModRefBarrierSet: public BarrierSet { 1.36 +public: 1.37 + // Barriers only on ref writes. 1.38 + bool has_read_ref_barrier() { return false; } 1.39 + bool has_read_prim_barrier() { return false; } 1.40 + bool has_write_ref_barrier() { return true; } 1.41 + bool has_write_prim_barrier() { return false; } 1.42 + 1.43 + bool read_ref_needs_barrier(oop* field) { return false; } 1.44 + bool read_prim_needs_barrier(HeapWord* field, size_t bytes) { return false; } 1.45 + virtual bool write_ref_needs_barrier(oop* field, oop new_val) = 0; 1.46 + bool write_prim_needs_barrier(HeapWord* field, size_t bytes, 1.47 + juint val1, juint val2) { return false; } 1.48 + 1.49 + void write_prim_field(oop obj, size_t offset, size_t bytes, 1.50 + juint val1, juint val2) {} 1.51 + 1.52 + void read_ref_field(oop* field) {} 1.53 + void read_prim_field(HeapWord* field, size_t bytes) {} 1.54 +protected: 1.55 + virtual void write_ref_field_work(oop* field, oop new_val) = 0; 1.56 +public: 1.57 + void write_prim_field(HeapWord* field, size_t bytes, 1.58 + juint val1, juint val2) {} 1.59 + 1.60 + bool has_read_ref_array_opt() { return false; } 1.61 + bool has_read_prim_array_opt() { return false; } 1.62 + bool has_write_prim_array_opt() { return false; } 1.63 + 1.64 + bool has_read_region_opt() { return false; } 1.65 + 1.66 + 1.67 + // These operations should assert false unless the correponding operation 1.68 + // above returns true. 1.69 + void read_ref_array(MemRegion mr) { 1.70 + assert(false, "can't call"); 1.71 + } 1.72 + void read_prim_array(MemRegion mr) { 1.73 + assert(false, "can't call"); 1.74 + } 1.75 + void write_prim_array(MemRegion mr) { 1.76 + assert(false, "can't call"); 1.77 + } 1.78 + void read_region(MemRegion mr) { 1.79 + assert(false, "can't call"); 1.80 + } 1.81 + 1.82 + // Invoke "cl->do_oop" on (the address of) every possibly-modifed 1.83 + // reference field in objects in "sp". If "clear" is "true", the oops 1.84 + // are no longer considered possibly modified after application of the 1.85 + // closure. If' "before_save_marks" is true, oops in objects allocated 1.86 + // after the last call to "save_marks" on "sp" will not be considered. 1.87 + virtual void mod_oop_in_space_iterate(Space* sp, OopClosure* cl, 1.88 + bool clear = false, 1.89 + bool before_save_marks = false) = 0; 1.90 + 1.91 + // Causes all refs in "mr" to be assumed to be modified. 1.92 + virtual void invalidate(MemRegion mr) = 0; 1.93 + 1.94 + // The caller guarantees that "mr" contains no references. (Perhaps it's 1.95 + // objects have been moved elsewhere.) 1.96 + virtual void clear(MemRegion mr) = 0; 1.97 + 1.98 + // Pass along the argument to the superclass. 1.99 + ModRefBarrierSet(int max_covered_regions) : 1.100 + BarrierSet(max_covered_regions) {} 1.101 + 1.102 +#ifndef PRODUCT 1.103 + // Verifies that the given region contains no modified references. 1.104 + virtual void verify_clean_region(MemRegion mr) = 0; 1.105 +#endif 1.106 + 1.107 +};