159
160 JFR_ONLY(DEFINE_TRACE_ID_FIELD;)
161
162 // Biased locking implementation and statistics
163 // (the 64-bit chunk goes first, to avoid some fragmentation)
164 jlong _last_biased_lock_bulk_revocation_time;
165 markWord _prototype_header; // Used when biased locking is both enabled and disabled for this type
166 jint _biased_lock_revocation_count;
167
168 private:
169 // This is an index into FileMapHeader::_shared_path_table[], to
170 // associate this class with the JAR file where it's loaded from during
171 // dump time. If a class is not loaded from the shared archive, this field is
172 // -1.
173 jshort _shared_class_path_index;
174
175 #if INCLUDE_CDS
176 // Flags of the current shared class.
177 u2 _shared_class_flags;
178 enum {
179 _has_raw_archived_mirror = 1
180 };
181 #endif
182
183 // The _archived_mirror is set at CDS dump time pointing to the cached mirror
184 // in the open archive heap region when archiving java object is supported.
185 CDS_JAVA_HEAP_ONLY(narrowOop _archived_mirror;)
186
187 protected:
188
189 // Constructor
190 Klass(KlassID id);
191 Klass() : _id(KlassID(-1)) { assert(DumpSharedSpaces || UseSharedSpaces, "only for cds"); }
192
193 void* operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw();
194
195 public:
196 int id() { return _id; }
197
198 enum DefaultsLookupMode { find_defaults, skip_defaults };
199 enum OverpassLookupMode { find_overpass, skip_overpass };
276 // modifier flags
277 jint modifier_flags() const { return _modifier_flags; }
278 void set_modifier_flags(jint flags) { _modifier_flags = flags; }
279
280 // size helper
281 int layout_helper() const { return _layout_helper; }
282 void set_layout_helper(int lh) { _layout_helper = lh; }
283
284 // Note: for instances layout_helper() may include padding.
285 // Use InstanceKlass::contains_field_offset to classify field offsets.
286
287 // sub/superklass links
288 Klass* subklass(bool log = false) const;
289 Klass* next_sibling(bool log = false) const;
290
291 InstanceKlass* superklass() const;
292 void append_to_sibling_list(); // add newly created receiver to superklass' subklass list
293
294 void set_next_link(Klass* k) { _next_link = k; }
295 Klass* next_link() const { return _next_link; } // The next klass defined by the class loader.
296
297 // class loader data
298 ClassLoaderData* class_loader_data() const { return _class_loader_data; }
299 void set_class_loader_data(ClassLoaderData* loader_data) { _class_loader_data = loader_data; }
300
301 int shared_classpath_index() const {
302 return _shared_class_path_index;
303 };
304
305 void set_shared_classpath_index(int index) {
306 _shared_class_path_index = index;
307 };
308
309 void set_has_raw_archived_mirror() {
310 CDS_ONLY(_shared_class_flags |= _has_raw_archived_mirror;)
311 }
312 void clear_has_raw_archived_mirror() {
313 CDS_ONLY(_shared_class_flags &= ~_has_raw_archived_mirror;)
314 }
315 bool has_raw_archived_mirror() const {
316 CDS_ONLY(return (_shared_class_flags & _has_raw_archived_mirror) != 0;)
317 NOT_CDS(return false;)
318 }
319
320 // Obtain the module or package for this class
321 virtual ModuleEntry* module() const = 0;
322 virtual PackageEntry* package() const = 0;
323
324 protected: // internal accessors
325 void set_subklass(Klass* s);
326 void set_next_sibling(Klass* s);
327
328 public:
329
330 // Compiler support
331 static ByteSize super_offset() { return in_ByteSize(offset_of(Klass, _super)); }
332 static ByteSize super_check_offset_offset() { return in_ByteSize(offset_of(Klass, _super_check_offset)); }
333 static ByteSize primary_supers_offset() { return in_ByteSize(offset_of(Klass, _primary_supers)); }
334 static ByteSize secondary_super_cache_offset() { return in_ByteSize(offset_of(Klass, _secondary_super_cache)); }
335 static ByteSize secondary_supers_offset() { return in_ByteSize(offset_of(Klass, _secondary_supers)); }
336 static ByteSize java_mirror_offset() { return in_ByteSize(offset_of(Klass, _java_mirror)); }
|
159
160 JFR_ONLY(DEFINE_TRACE_ID_FIELD;)
161
162 // Biased locking implementation and statistics
163 // (the 64-bit chunk goes first, to avoid some fragmentation)
164 jlong _last_biased_lock_bulk_revocation_time;
165 markWord _prototype_header; // Used when biased locking is both enabled and disabled for this type
166 jint _biased_lock_revocation_count;
167
168 private:
169 // This is an index into FileMapHeader::_shared_path_table[], to
170 // associate this class with the JAR file where it's loaded from during
171 // dump time. If a class is not loaded from the shared archive, this field is
172 // -1.
173 jshort _shared_class_path_index;
174
175 #if INCLUDE_CDS
176 // Flags of the current shared class.
177 u2 _shared_class_flags;
178 enum {
179 _has_raw_archived_mirror = 1,
180 _archived_lambda_proxy_is_available = 2
181 };
182 #endif
183
184 // The _archived_mirror is set at CDS dump time pointing to the cached mirror
185 // in the open archive heap region when archiving java object is supported.
186 CDS_JAVA_HEAP_ONLY(narrowOop _archived_mirror;)
187
188 protected:
189
190 // Constructor
191 Klass(KlassID id);
192 Klass() : _id(KlassID(-1)) { assert(DumpSharedSpaces || UseSharedSpaces, "only for cds"); }
193
194 void* operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw();
195
196 public:
197 int id() { return _id; }
198
199 enum DefaultsLookupMode { find_defaults, skip_defaults };
200 enum OverpassLookupMode { find_overpass, skip_overpass };
277 // modifier flags
278 jint modifier_flags() const { return _modifier_flags; }
279 void set_modifier_flags(jint flags) { _modifier_flags = flags; }
280
281 // size helper
282 int layout_helper() const { return _layout_helper; }
283 void set_layout_helper(int lh) { _layout_helper = lh; }
284
285 // Note: for instances layout_helper() may include padding.
286 // Use InstanceKlass::contains_field_offset to classify field offsets.
287
288 // sub/superklass links
289 Klass* subklass(bool log = false) const;
290 Klass* next_sibling(bool log = false) const;
291
292 InstanceKlass* superklass() const;
293 void append_to_sibling_list(); // add newly created receiver to superklass' subklass list
294
295 void set_next_link(Klass* k) { _next_link = k; }
296 Klass* next_link() const { return _next_link; } // The next klass defined by the class loader.
297 Klass** next_link_addr() { return &_next_link; }
298
299 // class loader data
300 ClassLoaderData* class_loader_data() const { return _class_loader_data; }
301 void set_class_loader_data(ClassLoaderData* loader_data) { _class_loader_data = loader_data; }
302
303 int shared_classpath_index() const {
304 return _shared_class_path_index;
305 };
306
307 void set_shared_classpath_index(int index) {
308 _shared_class_path_index = index;
309 };
310
311 void set_has_raw_archived_mirror() {
312 CDS_ONLY(_shared_class_flags |= _has_raw_archived_mirror;)
313 }
314 void clear_has_raw_archived_mirror() {
315 CDS_ONLY(_shared_class_flags &= ~_has_raw_archived_mirror;)
316 }
317 bool has_raw_archived_mirror() const {
318 CDS_ONLY(return (_shared_class_flags & _has_raw_archived_mirror) != 0;)
319 NOT_CDS(return false;)
320 }
321
322 void set_lambda_proxy_is_available() {
323 CDS_ONLY(_shared_class_flags |= _archived_lambda_proxy_is_available;)
324 }
325 void clear_lambda_proxy_is_available() {
326 CDS_ONLY(_shared_class_flags &= ~_archived_lambda_proxy_is_available;)
327 }
328 bool lambda_proxy_is_available() const {
329 CDS_ONLY(return (_shared_class_flags & _archived_lambda_proxy_is_available) != 0;)
330 NOT_CDS(return false;)
331 }
332
333 // Obtain the module or package for this class
334 virtual ModuleEntry* module() const = 0;
335 virtual PackageEntry* package() const = 0;
336
337 protected: // internal accessors
338 void set_subklass(Klass* s);
339 void set_next_sibling(Klass* s);
340
341 public:
342
343 // Compiler support
344 static ByteSize super_offset() { return in_ByteSize(offset_of(Klass, _super)); }
345 static ByteSize super_check_offset_offset() { return in_ByteSize(offset_of(Klass, _super_check_offset)); }
346 static ByteSize primary_supers_offset() { return in_ByteSize(offset_of(Klass, _primary_supers)); }
347 static ByteSize secondary_super_cache_offset() { return in_ByteSize(offset_of(Klass, _secondary_super_cache)); }
348 static ByteSize secondary_supers_offset() { return in_ByteSize(offset_of(Klass, _secondary_supers)); }
349 static ByteSize java_mirror_offset() { return in_ByteSize(offset_of(Klass, _java_mirror)); }
|