2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2013-12-24 11:48:39 -08:00
|
|
|
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "precompiled.hpp"
|
|
|
|
#include "memory/iterator.hpp"
|
|
|
|
#include "oops/oop.inline.hpp"
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2012-09-11 14:59:23 +02:00
|
|
|
void KlassToOopClosure::do_klass(Klass* k) {
|
2014-06-24 16:20:15 +02:00
|
|
|
assert(_oop_closure != NULL, "Not initialized?");
|
2012-09-11 14:59:23 +02:00
|
|
|
k->oops_do(_oop_closure);
|
|
|
|
}
|
|
|
|
|
2012-11-27 10:13:20 +01:00
|
|
|
void CLDToOopClosure::do_cld(ClassLoaderData* cld) {
|
|
|
|
cld->oops_do(_oop_closure, &_klass_closure, _must_claim_cld);
|
|
|
|
}
|
|
|
|
|
2014-07-07 10:12:40 +02:00
|
|
|
void CLDToKlassAndOopClosure::do_cld(ClassLoaderData* cld) {
|
|
|
|
cld->oops_do(_oop_closure, _klass_closure, _must_claim_cld);
|
|
|
|
}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
void ObjectToOopClosure::do_object(oop obj) {
|
|
|
|
obj->oop_iterate(_cl);
|
|
|
|
}
|
|
|
|
|
|
|
|
void VoidClosure::do_void() {
|
|
|
|
ShouldNotCallThis();
|
|
|
|
}
|
2009-08-24 10:36:31 -07:00
|
|
|
|
2014-07-07 10:12:40 +02:00
|
|
|
void CodeBlobToOopClosure::do_nmethod(nmethod* nm) {
|
|
|
|
nm->oops_do(_cl);
|
|
|
|
if (_fix_relocations) {
|
|
|
|
nm->fix_oop_relocations();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CodeBlobToOopClosure::do_code_blob(CodeBlob* cb) {
|
|
|
|
nmethod* nm = cb->as_nmethod_or_null();
|
|
|
|
if (nm != NULL) {
|
|
|
|
do_nmethod(nm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-15 21:53:47 -07:00
|
|
|
MarkingCodeBlobClosure::MarkScope::MarkScope(bool activate)
|
|
|
|
: _active(activate)
|
|
|
|
{
|
|
|
|
if (_active) nmethod::oops_do_marking_prologue();
|
|
|
|
}
|
|
|
|
|
|
|
|
MarkingCodeBlobClosure::MarkScope::~MarkScope() {
|
|
|
|
if (_active) nmethod::oops_do_marking_epilogue();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MarkingCodeBlobClosure::do_code_blob(CodeBlob* cb) {
|
2010-05-20 06:34:23 -07:00
|
|
|
nmethod* nm = cb->as_nmethod_or_null();
|
2014-07-07 10:12:40 +02:00
|
|
|
if (nm != NULL && !nm->test_set_oops_do_mark()) {
|
|
|
|
do_nmethod(nm);
|
2009-09-15 21:53:47 -07:00
|
|
|
}
|
|
|
|
}
|