2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2016-03-17 08:07:53 +01:00
|
|
|
* Copyright (c) 1997, 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"
|
|
|
|
#include "classfile/javaClasses.hpp"
|
|
|
|
#include "classfile/systemDictionary.hpp"
|
2015-04-02 10:04:27 +02:00
|
|
|
#include "oops/instanceRefKlass.inline.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "oops/oop.inline.hpp"
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2012-09-07 12:04:16 -04:00
|
|
|
void InstanceRefKlass::update_nonstatic_oop_maps(Klass* k) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// Clear the nonstatic oop-map entries corresponding to referent
|
|
|
|
// and nextPending field. They are treated specially by the
|
|
|
|
// garbage collector.
|
|
|
|
// The discovered field is used only by the garbage collector
|
|
|
|
// and is also treated specially.
|
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
|
|
|
InstanceKlass* ik = InstanceKlass::cast(k);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Check that we have the right class
|
|
|
|
debug_only(static bool first_time = true);
|
2010-01-06 14:22:39 -08:00
|
|
|
assert(k == SystemDictionary::Reference_klass() && first_time,
|
2007-12-01 00:00:00 +00:00
|
|
|
"Invalid update of maps");
|
|
|
|
debug_only(first_time = false);
|
2009-08-11 15:37:23 -07:00
|
|
|
assert(ik->nonstatic_oop_map_count() == 1, "just checking");
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
OopMapBlock* map = ik->start_of_nonstatic_oop_maps();
|
|
|
|
|
|
|
|
// Check that the current map is (2,4) - currently points at field with
|
|
|
|
// offset 2 (words) and has 4 map entries.
|
|
|
|
debug_only(int offset = java_lang_ref_Reference::referent_offset);
|
2009-08-13 16:22:45 -07:00
|
|
|
debug_only(unsigned int count = ((java_lang_ref_Reference::discovered_offset -
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
java_lang_ref_Reference::referent_offset)/heapOopSize) + 1);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
if (UseSharedSpaces) {
|
|
|
|
assert(map->offset() == java_lang_ref_Reference::queue_offset &&
|
2009-08-11 15:37:23 -07:00
|
|
|
map->count() == 1, "just checking");
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
2009-08-11 15:37:23 -07:00
|
|
|
assert(map->offset() == offset && map->count() == count,
|
2007-12-01 00:00:00 +00:00
|
|
|
"just checking");
|
|
|
|
|
|
|
|
// Update map to (3,1) - point to offset of 3 (words) with 1 map entry.
|
|
|
|
map->set_offset(java_lang_ref_Reference::queue_offset);
|
2009-08-11 15:37:23 -07:00
|
|
|
map->set_count(1);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Verification
|
|
|
|
|
2012-09-07 12:04:16 -04:00
|
|
|
void InstanceRefKlass::oop_verify_on(oop obj, outputStream* st) {
|
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
|
|
|
InstanceKlass::oop_verify_on(obj, st);
|
2007-12-01 00:00:00 +00:00
|
|
|
// Verify referent field
|
|
|
|
oop referent = java_lang_ref_Reference::referent(obj);
|
|
|
|
if (referent != NULL) {
|
|
|
|
guarantee(referent->is_oop(), "referent field heap failed");
|
|
|
|
}
|
|
|
|
// Verify next field
|
|
|
|
oop next = java_lang_ref_Reference::next(obj);
|
|
|
|
if (next != NULL) {
|
2015-10-28 09:47:23 -04:00
|
|
|
guarantee(next->is_oop(), "next field should be an oop");
|
|
|
|
guarantee(next->is_instance(), "next field should be an instance");
|
|
|
|
guarantee(InstanceKlass::cast(next->klass())->is_reference_instance_klass(), "next field verify failed");
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|