2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2012-04-16 08:57:18 +02:00
|
|
|
* Copyright (c) 1997, 2012, 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
|
|
|
#ifndef SHARE_VM_OOPS_OBJARRAYKLASS_HPP
|
|
|
|
#define SHARE_VM_OOPS_OBJARRAYKLASS_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 "classfile/classLoaderData.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "memory/specialized_oop_closures.hpp"
|
|
|
|
#include "oops/arrayKlass.hpp"
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// objArrayKlass is the klass for objArrays
|
|
|
|
|
|
|
|
class objArrayKlass : public arrayKlass {
|
|
|
|
friend class VMStructs;
|
|
|
|
private:
|
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
|
|
|
Klass* _element_klass; // The klass of the elements of this array type
|
|
|
|
Klass* _bottom_klass; // The one-dimensional type (InstanceKlass or typeArrayKlass)
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
objArrayKlass(int n, KlassHandle element_klass, Symbol* name);
|
|
|
|
static objArrayKlass* allocate(ClassLoaderData* loader_data, int n, KlassHandle klass_handle, Symbol* name, TRAPS);
|
2007-12-01 00:00:00 +00:00
|
|
|
public:
|
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
|
|
|
// For dummy objects
|
|
|
|
objArrayKlass() {}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// Instance variables
|
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
|
|
|
Klass* element_klass() const { return _element_klass; }
|
|
|
|
void set_element_klass(Klass* k) { _element_klass = k; }
|
|
|
|
Klass** element_klass_addr() { return &_element_klass; }
|
2007-12-01 00:00:00 +00:00
|
|
|
|
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
|
|
|
Klass* bottom_klass() const { return _bottom_klass; }
|
|
|
|
void set_bottom_klass(Klass* k) { _bottom_klass = k; }
|
|
|
|
Klass** bottom_klass_addr() { return &_bottom_klass; }
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Compiler/Interpreter offset
|
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
|
|
|
static ByteSize element_klass_offset() { return in_ByteSize(offset_of(objArrayKlass, _element_klass)); }
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Dispatched operation
|
|
|
|
bool can_be_primary_super_slow() const;
|
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
|
|
|
GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
|
|
|
|
bool compute_is_subtype_of(Klass* k);
|
2007-12-01 00:00:00 +00:00
|
|
|
bool oop_is_objArray_slow() const { return true; }
|
|
|
|
int oop_size(oop obj) const;
|
|
|
|
|
|
|
|
// Allocation
|
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
|
|
|
static Klass* allocate_objArray_klass(ClassLoaderData* loader_data,
|
|
|
|
int n, KlassHandle element_klass, TRAPS);
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
objArrayOop allocate(int length, TRAPS);
|
|
|
|
oop multi_allocate(int rank, jint* sizes, TRAPS);
|
|
|
|
|
|
|
|
// Copying
|
|
|
|
void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
|
|
|
|
|
|
|
|
// Compute protection domain
|
|
|
|
oop protection_domain() { return Klass::cast(bottom_klass())->protection_domain(); }
|
|
|
|
|
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
|
|
|
private:
|
|
|
|
// Either oop or narrowOop depending on UseCompressedOops.
|
|
|
|
// must be called from within objArrayKlass.cpp
|
|
|
|
template <class T> void do_copy(arrayOop s, T* src, arrayOop d,
|
|
|
|
T* dst, int length, TRAPS);
|
2007-12-01 00:00:00 +00:00
|
|
|
protected:
|
|
|
|
// Returns the objArrayKlass for n'th dimension.
|
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
|
|
|
virtual Klass* array_klass_impl(bool or_null, int n, TRAPS);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Returns the array class with this class as element type.
|
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
|
|
|
virtual Klass* array_klass_impl(bool or_null, TRAPS);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
public:
|
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
|
|
|
// Casting from Klass*
|
|
|
|
static objArrayKlass* cast(Klass* k) {
|
|
|
|
assert(k->oop_is_objArray(), "cast to objArrayKlass");
|
|
|
|
return (objArrayKlass*) k;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Sizing
|
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
|
|
|
static int header_size() { return sizeof(objArrayKlass)/HeapWordSize; }
|
|
|
|
int size() const { return arrayKlass::static_size(header_size()); }
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Initialization (virtual from Klass)
|
|
|
|
void initialize(TRAPS);
|
|
|
|
|
|
|
|
// Garbage collection
|
|
|
|
void oop_follow_contents(oop obj);
|
2010-03-03 14:48:26 -08:00
|
|
|
inline void oop_follow_contents(oop obj, int index);
|
|
|
|
template <class T> inline void objarray_follow_contents(oop obj, int index);
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
int oop_adjust_pointers(oop obj);
|
|
|
|
|
|
|
|
// Parallel Scavenge and Parallel Old
|
|
|
|
PARALLEL_GC_DECLS
|
2010-03-03 14:48:26 -08:00
|
|
|
#ifndef SERIALGC
|
|
|
|
inline void oop_follow_contents(ParCompactionManager* cm, oop obj, int index);
|
|
|
|
template <class T> inline void
|
|
|
|
objarray_follow_contents(ParCompactionManager* cm, oop obj, int index);
|
|
|
|
#endif // !SERIALGC
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Iterators
|
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
|
|
|
int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
|
2007-12-01 00:00:00 +00:00
|
|
|
return oop_oop_iterate_v(obj, blk);
|
|
|
|
}
|
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
|
|
|
int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
|
2007-12-01 00:00:00 +00:00
|
|
|
return oop_oop_iterate_v_m(obj, blk, mr);
|
|
|
|
}
|
|
|
|
#define ObjArrayKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
|
|
|
|
int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \
|
|
|
|
int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \
|
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
|
|
|
MemRegion mr); \
|
|
|
|
int oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* blk, \
|
|
|
|
int start, int end);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
|
2008-06-05 15:57:56 -07:00
|
|
|
ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DECL)
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// JVM support
|
|
|
|
jint compute_modifier_flags(TRAPS) const;
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Printing
|
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 print_on(outputStream* st) const;
|
|
|
|
void print_value_on(outputStream* st) const;
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
void oop_print_value_on(oop obj, outputStream* st);
|
2010-01-08 13:47:01 -08:00
|
|
|
#ifndef PRODUCT
|
|
|
|
void oop_print_on (oop obj, outputStream* st);
|
|
|
|
#endif //PRODUCT
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
const char* internal_name() const;
|
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
|
|
|
|
|
|
|
// Verification
|
|
|
|
void verify_on(outputStream* st);
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
void oop_verify_on(oop obj, outputStream* st);
|
|
|
|
};
|
2010-11-23 13:22:55 -08:00
|
|
|
|
|
|
|
#endif // SHARE_VM_OOPS_OBJARRAYKLASS_HPP
|