--- a/hotspot/src/share/vm/oops/instanceKlass.hpp Sun Dec 11 12:05:57 2016 -0800
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp Sun Dec 11 19:07:04 2016 -0800
@@ -54,6 +54,7 @@
// indicating where oops are located in instances of this klass.
// [EMBEDDED implementor of the interface] only exist for interface
// [EMBEDDED host klass ] only exist for an anonymous class (JSR 292 enabled)
+// [EMBEDDED fingerprint ] only if should_store_fingerprint()==true
// forward declaration for class -- see below for definition
@@ -215,10 +216,12 @@
_misc_has_nonstatic_concrete_methods = 1 << 7, // class/superclass/implemented interfaces has non-static, concrete methods
_misc_declares_nonstatic_concrete_methods = 1 << 8, // directly declares non-static, concrete methods
_misc_has_been_redefined = 1 << 9, // class has been redefined
- _misc_is_scratch_class = 1 << 10, // class is the redefined scratch class
- _misc_is_shared_boot_class = 1 << 11, // defining class loader is boot class loader
- _misc_is_shared_platform_class = 1 << 12, // defining class loader is platform class loader
- _misc_is_shared_app_class = 1 << 13 // defining class loader is app class loader
+ _misc_has_passed_fingerprint_check = 1 << 10, // when this class was loaded, the fingerprint computed from its
+ // code source was found to be matching the value recorded by AOT.
+ _misc_is_scratch_class = 1 << 11, // class is the redefined scratch class
+ _misc_is_shared_boot_class = 1 << 12, // defining class loader is boot class loader
+ _misc_is_shared_platform_class = 1 << 13, // defining class loader is platform class loader
+ _misc_is_shared_app_class = 1 << 14 // defining class loader is app class loader
};
u2 loader_type_bits() {
return _misc_is_shared_boot_class|_misc_is_shared_platform_class|_misc_is_shared_app_class;
@@ -732,6 +735,23 @@
_misc_flags |= _misc_has_been_redefined;
}
+ bool has_passed_fingerprint_check() const {
+ return (_misc_flags & _misc_has_passed_fingerprint_check) != 0;
+ }
+ void set_has_passed_fingerprint_check(bool b) {
+ if (b) {
+ _misc_flags |= _misc_has_passed_fingerprint_check;
+ } else {
+ _misc_flags &= ~_misc_has_passed_fingerprint_check;
+ }
+ }
+ bool supers_have_passed_fingerprint_checks();
+
+ static bool should_store_fingerprint();
+ bool has_stored_fingerprint() const;
+ uint64_t get_stored_fingerprint() const;
+ void store_fingerprint(uint64_t fingerprint);
+
bool is_scratch_class() const {
return (_misc_flags & _misc_is_scratch_class) != 0;
}
@@ -1028,19 +1048,21 @@
static int size(int vtable_length, int itable_length,
int nonstatic_oop_map_size,
- bool is_interface, bool is_anonymous) {
+ bool is_interface, bool is_anonymous, bool has_stored_fingerprint) {
return align_metadata_size(header_size() +
vtable_length +
itable_length +
nonstatic_oop_map_size +
(is_interface ? (int)sizeof(Klass*)/wordSize : 0) +
- (is_anonymous ? (int)sizeof(Klass*)/wordSize : 0));
+ (is_anonymous ? (int)sizeof(Klass*)/wordSize : 0) +
+ (has_stored_fingerprint ? (int)sizeof(uint64_t*)/wordSize : 0));
}
int size() const { return size(vtable_length(),
itable_length(),
nonstatic_oop_map_size(),
is_interface(),
- is_anonymous());
+ is_anonymous(),
+ has_stored_fingerprint());
}
#if INCLUDE_SERVICES
virtual void collect_statistics(KlassSizeStats *sz) const;
@@ -1083,6 +1105,24 @@
}
}
+ address adr_fingerprint() const {
+ if (has_stored_fingerprint()) {
+ InstanceKlass** adr_host = adr_host_klass();
+ if (adr_host != NULL) {
+ return (address)(adr_host + 1);
+ }
+
+ Klass** adr_impl = adr_implementor();
+ if (adr_impl != NULL) {
+ return (address)(adr_impl + 1);
+ }
+
+ return (address)end_of_nonstatic_oop_maps();
+ } else {
+ return NULL;
+ }
+ }
+
// Use this to return the size of an instance in heap words:
int size_helper() const {
return layout_helper_to_size_helper(layout_helper());