2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2016-01-30 11:02:29 -05: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
|
|
|
#ifndef SHARE_VM_OOPS_ARRAYKLASS_HPP
|
|
|
|
#define SHARE_VM_OOPS_ARRAYKLASS_HPP
|
|
|
|
|
|
|
|
#include "memory/universe.hpp"
|
|
|
|
#include "oops/klass.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
|
|
|
|
2014-05-07 19:38:22 +04:00
|
|
|
class fieldDescriptor;
|
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
|
|
|
class klassVtable;
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2012-09-29 06:40:00 -04:00
|
|
|
// ArrayKlass is the abstract baseclass for all array classes
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2012-09-29 06:40:00 -04:00
|
|
|
class ArrayKlass: public Klass {
|
2007-12-01 00:00:00 +00:00
|
|
|
friend class VMStructs;
|
|
|
|
private:
|
|
|
|
int _dimension; // This is n'th-dimensional array.
|
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* volatile _higher_dimension; // Refers the (n+1)'th-dimensional array (if present).
|
|
|
|
Klass* volatile _lower_dimension; // Refers the (n-1)'th-dimensional array (if present).
|
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
|
|
|
protected:
|
|
|
|
// Constructors
|
|
|
|
// The constructor with the Symbol argument does the real array
|
|
|
|
// initialization, the other is a dummy
|
2012-09-29 06:40:00 -04:00
|
|
|
ArrayKlass(Symbol* name);
|
|
|
|
ArrayKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for cds"); }
|
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
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
public:
|
|
|
|
// Testing operation
|
2015-10-28 09:47:23 -04:00
|
|
|
DEBUG_ONLY(bool is_array_klass_slow() const { return true; })
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Instance variables
|
|
|
|
int dimension() const { return _dimension; }
|
|
|
|
void set_dimension(int dimension) { _dimension = 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
|
|
|
Klass* higher_dimension() const { return _higher_dimension; }
|
|
|
|
void set_higher_dimension(Klass* k) { _higher_dimension = k; }
|
|
|
|
Klass** adr_higher_dimension() { return (Klass**)&this->_higher_dimension;}
|
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* lower_dimension() const { return _lower_dimension; }
|
|
|
|
void set_lower_dimension(Klass* k) { _lower_dimension = k; }
|
|
|
|
Klass** adr_lower_dimension() { return (Klass**)&this->_lower_dimension;}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// offset of first element, including any padding for the sake of alignment
|
|
|
|
int array_header_in_bytes() const { return layout_helper_header_size(layout_helper()); }
|
|
|
|
int log2_element_size() const { return layout_helper_log2_element_size(layout_helper()); }
|
|
|
|
// type of elements (T_OBJECT for both oop arrays and array-arrays)
|
|
|
|
BasicType element_type() const { return layout_helper_element_type(layout_helper()); }
|
|
|
|
|
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* java_super() const;//{ return SystemDictionary::Object_klass(); }
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Allocation
|
|
|
|
// Sizes points to the first dimension of the array, subsequent dimensions
|
|
|
|
// are always in higher memory. The callers of these set that up.
|
|
|
|
virtual oop multi_allocate(int rank, jint* sizes, TRAPS);
|
|
|
|
objArrayOop allocate_arrayArray(int n, int length, TRAPS);
|
|
|
|
|
2014-05-07 19:38:22 +04:00
|
|
|
// find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
|
|
|
|
Klass* find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// Lookup operations
|
2015-12-08 20:04:03 +01:00
|
|
|
Method* uncached_lookup_method(const Symbol* name,
|
|
|
|
const Symbol* signature,
|
|
|
|
OverpassLookupMode overpass_mode) const;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2012-09-29 06:40:00 -04:00
|
|
|
static ArrayKlass* cast(Klass* k) {
|
2015-12-08 20:04:03 +01:00
|
|
|
return const_cast<ArrayKlass*>(cast(const_cast<const Klass*>(k)));
|
|
|
|
}
|
|
|
|
|
|
|
|
static const ArrayKlass* cast(const Klass* k) {
|
2015-10-28 09:47:23 -04:00
|
|
|
assert(k->is_array_klass(), "cast to ArrayKlass");
|
2015-12-08 20:04:03 +01:00
|
|
|
return static_cast<const ArrayKlass*>(k);
|
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
|
|
|
GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
|
|
|
|
bool compute_is_subtype_of(Klass* 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 static_size(int header_size);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2013-01-25 15:06:18 -05:00
|
|
|
#if INCLUDE_SERVICES
|
|
|
|
virtual void collect_statistics(KlassSizeStats *sz) const {
|
|
|
|
Klass::collect_statistics(sz);
|
|
|
|
// Do nothing for now, but remember to modify if you add new
|
|
|
|
// stuff to ArrayKlass.
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
void array_klasses_do(void f(Klass* k));
|
|
|
|
void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// Return a handle.
|
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Harold Seigel <harold.seigel@oracle.com>
Co-authored-by: Lois Foltan <lois.foltan@oracle.com>
Co-authored-by: Calvin Cheung <calvin.cheung@oracle.com>
Co-authored-by: Christian Tornqvist <christian.tornqvist@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: George Triantafillou <george.triantafillou@oracle.com>
Co-authored-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Co-authored-by: Ioi Lam <ioi.lam@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jean-Francois Denise <jean-francois.denise@oracle.com>
Co-authored-by: Jiangli Zhou <jiangli.zhou@oracle.com>
Co-authored-by: Markus Gronlund <markus.gronlund@oracle.com>
Co-authored-by: Serguei Spitsyn <serguei.spitsyn@oracle.com>
Co-authored-by: Staffan Larsen <staffan.larsen@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: acorn, ccheung, coleenp, ctornqvi, dholmes, dsimms, gtriantafill, iklam, jiangli, mgronlun, mseledtsov, cjplummer, sspitsyn, stefank, twisti, hseigel, lfoltan, alanb, mchung, dfazunen
2016-03-17 19:04:01 +00:00
|
|
|
static void complete_create_array_klass(ArrayKlass* k, KlassHandle super_klass, ModuleEntry* module, TRAPS);
|
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
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2010-08-03 08:13:38 -04:00
|
|
|
// jvm support
|
|
|
|
jint compute_modifier_flags(TRAPS) const;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2010-08-03 08:13:38 -04:00
|
|
|
// JVMTI support
|
|
|
|
jint jvmti_class_status() const;
|
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
|
|
|
// CDS support - remove and restore oops from metadata. Oops are not shared.
|
|
|
|
virtual void remove_unshareable_info();
|
2014-08-12 17:29:00 -07:00
|
|
|
virtual void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS);
|
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
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// 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_on(oop obj, outputStream* st);
|
2010-08-03 08:13:38 -04:00
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// Verification
|
2014-02-15 13:03:38 -05:00
|
|
|
void verify_on(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
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
void oop_verify_on(oop obj, outputStream* st);
|
|
|
|
};
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2015-05-25 11:39:43 +02:00
|
|
|
// Array oop iteration macros for declarations.
|
|
|
|
// Used to generate the declarations in the *ArrayKlass header files.
|
|
|
|
|
2015-09-02 09:14:04 +02:00
|
|
|
#define OOP_OOP_ITERATE_DECL_RANGE(OopClosureType, nv_suffix) \
|
|
|
|
void oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* closure, int start, int end);
|
2015-05-25 11:39:43 +02:00
|
|
|
|
|
|
|
#if INCLUDE_ALL_GCS
|
|
|
|
// Named NO_BACKWARDS because the definition used by *ArrayKlass isn't reversed, see below.
|
2015-09-02 09:14:04 +02:00
|
|
|
#define OOP_OOP_ITERATE_DECL_NO_BACKWARDS(OopClosureType, nv_suffix) \
|
|
|
|
void oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure);
|
2015-05-25 11:39:43 +02:00
|
|
|
#endif // INCLUDE_ALL_GCS
|
|
|
|
|
|
|
|
|
|
|
|
// Array oop iteration macros for definitions.
|
|
|
|
// Used to generate the definitions in the *ArrayKlass.inline.hpp files.
|
|
|
|
|
2015-09-02 09:14:04 +02:00
|
|
|
#define OOP_OOP_ITERATE_DEFN_RANGE(KlassType, OopClosureType, nv_suffix) \
|
|
|
|
\
|
|
|
|
void KlassType::oop_oop_iterate_range##nv_suffix(oop obj, OopClosureType* closure, int start, int end) { \
|
|
|
|
oop_oop_iterate_range<nvs_to_bool(nv_suffix)>(obj, closure, start, end); \
|
2015-05-25 11:39:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#if INCLUDE_ALL_GCS
|
2015-09-02 09:14:04 +02:00
|
|
|
#define OOP_OOP_ITERATE_DEFN_NO_BACKWARDS(KlassType, OopClosureType, nv_suffix) \
|
|
|
|
void KlassType::oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \
|
|
|
|
/* No reverse implementation ATM. */ \
|
|
|
|
oop_oop_iterate<nvs_to_bool(nv_suffix)>(obj, closure); \
|
2015-05-25 11:39:43 +02:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define OOP_OOP_ITERATE_DEFN_NO_BACKWARDS(KlassType, OopClosureType, nv_suffix)
|
|
|
|
#endif
|
|
|
|
|
2010-11-23 13:22:55 -08:00
|
|
|
#endif // SHARE_VM_OOPS_ARRAYKLASS_HPP
|