comparison src/share/vm/gc_implementation/shared/markSweep.inline.hpp @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children ba764ed4b6f2
comparison
equal deleted inserted replaced
-1:000000000000 0:a61af66fc99e
1 /*
2 * Copyright 2000-2006 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 inline void MarkSweep::_adjust_pointer(oop* p, bool isroot) {
26 oop obj = *p;
27 VALIDATE_MARK_SWEEP_ONLY(oop saved_new_pointer = NULL);
28 if (obj != NULL) {
29 oop new_pointer = oop(obj->mark()->decode_pointer());
30 assert(new_pointer != NULL || // is forwarding ptr?
31 obj->mark() == markOopDesc::prototype() || // not gc marked?
32 (UseBiasedLocking && obj->mark()->has_bias_pattern()) || // not gc marked?
33 obj->is_shared(), // never forwarded?
34 "should contain a forwarding pointer");
35 if (new_pointer != NULL) {
36 *p = new_pointer;
37 assert(Universe::heap()->is_in_reserved(new_pointer),
38 "should be in object space");
39 VALIDATE_MARK_SWEEP_ONLY(saved_new_pointer = new_pointer);
40 }
41 }
42 VALIDATE_MARK_SWEEP_ONLY(track_adjusted_pointer(p, saved_new_pointer, isroot));
43 }
44
45 inline void MarkSweep::mark_object(oop obj) {
46
47 #ifndef SERIALGC
48 if (UseParallelOldGC && VerifyParallelOldWithMarkSweep) {
49 assert(PSParallelCompact::mark_bitmap()->is_marked(obj),
50 "Should be marked in the marking bitmap");
51 }
52 #endif // SERIALGC
53
54 // some marks may contain information we need to preserve so we store them away
55 // and overwrite the mark. We'll restore it at the end of markSweep.
56 markOop mark = obj->mark();
57 obj->set_mark(markOopDesc::prototype()->set_marked());
58
59 if (mark->must_be_preserved(obj)) {
60 preserve_mark(obj, mark);
61 }
62 }