< prev index next >

src/hotspot/share/memory/metaspaceClosure.cpp

Print this page

*** 1,7 **** /* ! * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * 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. --- 1,7 ---- /* ! * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * 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.
*** 35,46 **** --- 35,49 ---- } void MetaspaceClosure::push_impl(MetaspaceClosure::Ref* ref) { if (_nest_level < MAX_NEST_LEVEL) { do_push(ref); + if (!ref->keep_after_pushing()) { delete ref; + } } else { + do_pending_ref(ref); ref->set_next(_pending_refs); _pending_refs = ref; } }
*** 57,69 **** --- 60,78 ---- break; default: assert(w == _default, "must be"); read_only = ref->is_read_only_by_default(); } + if (_nest_level == 0) { + assert(_enclosing_ref == NULL, "must be"); + } _nest_level ++; if (do_ref(ref, read_only)) { // true means we want to iterate the embedded pointer in <ref> + Ref* saved = _enclosing_ref; + _enclosing_ref = ref; ref->metaspace_pointers_do(this); + _enclosing_ref = saved; } _nest_level --; } }
*** 71,82 **** --- 80,93 ---- assert(_nest_level == 0, "must be"); while (_pending_refs != NULL) { Ref* ref = _pending_refs; _pending_refs = _pending_refs->next(); do_push(ref); + if (!ref->keep_after_pushing()) { delete ref; } + } } MetaspaceClosure::~MetaspaceClosure() { assert(_pending_refs == NULL, "you must explicitly call MetaspaceClosure::finish() to process all refs!");
< prev index next >