2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2016-08-21 20:56:37 -04:00
|
|
|
* Copyright (c) 1998, 2016, 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"
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
#include "oops/compiledICHolder.hpp"
|
|
|
|
#include "oops/klass.hpp"
|
|
|
|
#include "oops/method.hpp"
|
2016-08-21 20:56:37 -04:00
|
|
|
#include "runtime/atomic.hpp"
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
|
|
|
|
volatile int CompiledICHolder::_live_count;
|
|
|
|
volatile int CompiledICHolder::_live_not_claimed_count;
|
|
|
|
|
|
|
|
|
2017-05-26 18:39:27 +03:00
|
|
|
CompiledICHolder::CompiledICHolder(Metadata* metadata, Klass* klass)
|
|
|
|
: _holder_metadata(metadata), _holder_klass(klass) {
|
2014-06-04 11:56:44 +02:00
|
|
|
#ifdef ASSERT
|
|
|
|
Atomic::inc(&_live_count);
|
|
|
|
Atomic::inc(&_live_not_claimed_count);
|
|
|
|
#endif // ASSERT
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef ASSERT
|
|
|
|
CompiledICHolder::~CompiledICHolder() {
|
|
|
|
assert(_live_count > 0, "underflow");
|
|
|
|
Atomic::dec(&_live_count);
|
|
|
|
}
|
|
|
|
#endif // ASSERT
|
|
|
|
|
2017-05-26 18:39:27 +03:00
|
|
|
bool CompiledICHolder::is_loader_alive(BoolObjectClosure* is_alive) {
|
|
|
|
if (_holder_metadata->is_method()) {
|
|
|
|
if (!((Method*)_holder_metadata)->method_holder()->is_loader_alive(is_alive)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else if (_holder_metadata->is_klass()) {
|
|
|
|
if (!((Klass*)_holder_metadata)->is_loader_alive(is_alive)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!_holder_klass->is_loader_alive(is_alive)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// Printing
|
|
|
|
|
|
|
|
void CompiledICHolder::print_on(outputStream* st) const {
|
|
|
|
st->print("%s", internal_name());
|
2017-05-26 18:39:27 +03:00
|
|
|
st->print(" - metadata: "); holder_metadata()->print_value_on(st); st->cr();
|
|
|
|
st->print(" - klass: "); holder_klass()->print_value_on(st); st->cr();
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void CompiledICHolder::print_value_on(outputStream* st) const {
|
|
|
|
st->print("%s", internal_name());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Verification
|
|
|
|
|
|
|
|
void CompiledICHolder::verify_on(outputStream* st) {
|
2017-05-26 18:39:27 +03:00
|
|
|
guarantee(holder_metadata()->is_method() || holder_metadata()->is_klass(), "should be method or klass");
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
guarantee(holder_klass()->is_klass(), "should be klass");
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2014-06-04 11:56:44 +02:00
|
|
|
|
|
|
|
#ifdef ASSERT
|
|
|
|
|
|
|
|
void CompiledICHolder::claim() {
|
|
|
|
Atomic::dec(&_live_not_claimed_count);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // ASSERT
|