annotate src/share/vm/memory/iterator.cpp @ 1483:1a5913bf5e19

6951083: oops and relocations should part of nmethod not CodeBlob Summary: This moves the oops from Codeblob to nmethod. Reviewed-by: kvn, never
author twisti
date Thu, 20 May 2010 06:34:23 -0700
parents a1423fe86a18
children e9ff18c4ace7
rev   line source
duke@0 1 /*
twisti@1483 2 * Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
duke@0 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 21 * have any questions.
duke@0 22 *
duke@0 23 */
duke@0 24
duke@0 25 # include "incls/_precompiled.incl"
duke@0 26 # include "incls/_iterator.cpp.incl"
duke@0 27
jmasa@935 28 #ifdef ASSERT
jmasa@935 29 bool OopClosure::_must_remember_klasses = false;
jmasa@935 30 #endif
jmasa@935 31
duke@0 32 void ObjectToOopClosure::do_object(oop obj) {
duke@0 33 obj->oop_iterate(_cl);
duke@0 34 }
duke@0 35
duke@0 36 void VoidClosure::do_void() {
duke@0 37 ShouldNotCallThis();
duke@0 38 }
jmasa@935 39
jmasa@935 40 #ifdef ASSERT
jmasa@935 41 bool OopClosure::must_remember_klasses() {
jmasa@935 42 return _must_remember_klasses;
jmasa@935 43 }
jmasa@935 44 void OopClosure::set_must_remember_klasses(bool v) {
jmasa@935 45 _must_remember_klasses = v;
jmasa@935 46 }
jmasa@935 47 #endif
jmasa@935 48
jrose@993 49
jrose@989 50 MarkingCodeBlobClosure::MarkScope::MarkScope(bool activate)
jrose@989 51 : _active(activate)
jrose@989 52 {
jrose@989 53 if (_active) nmethod::oops_do_marking_prologue();
jrose@989 54 }
jrose@989 55
jrose@989 56 MarkingCodeBlobClosure::MarkScope::~MarkScope() {
jrose@989 57 if (_active) nmethod::oops_do_marking_epilogue();
jrose@989 58 }
jrose@989 59
jrose@989 60 void MarkingCodeBlobClosure::do_code_blob(CodeBlob* cb) {
twisti@1483 61 nmethod* nm = cb->as_nmethod_or_null();
twisti@1483 62 if (nm == NULL) return;
jrose@989 63 if (!nm->test_set_oops_do_mark()) {
jrose@989 64 NOT_PRODUCT(if (TraceScavenge) nm->print_on(tty, "oops_do, 1st visit\n"));
jrose@989 65 do_newly_marked_nmethod(nm);
jrose@989 66 } else {
jrose@989 67 NOT_PRODUCT(if (TraceScavenge) nm->print_on(tty, "oops_do, skipped on 2nd visit\n"));
jrose@989 68 }
jrose@989 69 }
jrose@989 70
jrose@994 71 void CodeBlobToOopClosure::do_newly_marked_nmethod(nmethod* nm) {
jrose@994 72 nm->oops_do(_cl, /*do_strong_roots_only=*/ true);
jrose@989 73 }
jrose@989 74
jrose@989 75 void CodeBlobToOopClosure::do_code_blob(CodeBlob* cb) {
jrose@989 76 if (!_do_marking) {
twisti@1483 77 nmethod* nm = cb->as_nmethod_or_null();
twisti@1483 78 NOT_PRODUCT(if (TraceScavenge && Verbose && nm != NULL) nm->print_on(tty, "oops_do, unmarked visit\n"));
jrose@989 79 // This assert won't work, since there are lots of mini-passes
jrose@989 80 // (mostly in debug mode) that co-exist with marking phases.
jrose@989 81 //assert(!(cb->is_nmethod() && ((nmethod*)cb)->test_oops_do_mark()), "found marked nmethod during mark-free phase");
twisti@1483 82 if (nm != NULL) {
twisti@1483 83 nm->oops_do(_cl);
twisti@1483 84 }
jrose@989 85 } else {
jrose@989 86 MarkingCodeBlobClosure::do_code_blob(cb);
jrose@989 87 }
jrose@989 88 }
jrose@989 89
jrose@989 90