Mercurial > hg > truffle
comparison src/share/vm/oops/klass.hpp @ 4970:33df1aeaebbf
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Mon, 27 Feb 2012 13:10:13 +0100 |
parents | 7d9469b37f1f 34e2e90e7182 |
children | 5e9f38419819 |
comparison
equal
deleted
inserted
replaced
4703:2cfb7fb2dce7 | 4970:33df1aeaebbf |
---|---|
31 #include "memory/specialized_oop_closures.hpp" | 31 #include "memory/specialized_oop_closures.hpp" |
32 #include "oops/klassOop.hpp" | 32 #include "oops/klassOop.hpp" |
33 #include "oops/klassPS.hpp" | 33 #include "oops/klassPS.hpp" |
34 #include "oops/oop.hpp" | 34 #include "oops/oop.hpp" |
35 #include "runtime/orderAccess.hpp" | 35 #include "runtime/orderAccess.hpp" |
36 #include "trace/traceMacros.hpp" | |
36 #include "utilities/accessFlags.hpp" | 37 #include "utilities/accessFlags.hpp" |
37 #ifndef SERIALGC | 38 #ifndef SERIALGC |
38 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp" | 39 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp" |
39 #include "gc_implementation/g1/g1OopClosures.hpp" | 40 #include "gc_implementation/g1/g1OopClosures.hpp" |
40 #include "gc_implementation/parNew/parOopClosures.hpp" | 41 #include "gc_implementation/parNew/parOopClosures.hpp" |
78 // [verify_count ] - not in product | 79 // [verify_count ] - not in product |
79 // [alloc_count ] | 80 // [alloc_count ] |
80 // [last_biased_lock_bulk_revocation_time] (64 bits) | 81 // [last_biased_lock_bulk_revocation_time] (64 bits) |
81 // [prototype_header] | 82 // [prototype_header] |
82 // [biased_lock_revocation_count] | 83 // [biased_lock_revocation_count] |
84 // [trace_id] | |
83 | 85 |
84 | 86 |
85 // Forward declarations. | 87 // Forward declarations. |
86 class klassVtable; | 88 class klassVtable; |
87 class KlassHandle; | 89 class KlassHandle; |
263 // (the 64-bit chunk goes first, to avoid some fragmentation) | 265 // (the 64-bit chunk goes first, to avoid some fragmentation) |
264 jlong _last_biased_lock_bulk_revocation_time; | 266 jlong _last_biased_lock_bulk_revocation_time; |
265 markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type | 267 markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type |
266 jint _biased_lock_revocation_count; | 268 jint _biased_lock_revocation_count; |
267 | 269 |
270 TRACE_DEFINE_KLASS_TRACE_ID; | |
268 public: | 271 public: |
269 | 272 |
270 // returns the enclosing klassOop | 273 // returns the enclosing klassOop |
271 klassOop as_klassOop() const { | 274 klassOop as_klassOop() const { |
272 // see klassOop.hpp for layout. | 275 // see klassOop.hpp for layout. |
313 } | 316 } |
314 | 317 |
315 // Can this klass be a primary super? False for interfaces and arrays of | 318 // Can this klass be a primary super? False for interfaces and arrays of |
316 // interfaces. False also for arrays or classes with long super chains. | 319 // interfaces. False also for arrays or classes with long super chains. |
317 bool can_be_primary_super() const { | 320 bool can_be_primary_super() const { |
318 const juint secondary_offset = secondary_super_cache_offset_in_bytes() + sizeof(oopDesc); | 321 const juint secondary_offset = in_bytes(secondary_super_cache_offset()); |
319 return super_check_offset() != secondary_offset; | 322 return super_check_offset() != secondary_offset; |
320 } | 323 } |
321 virtual bool can_be_primary_super_slow() const; | 324 virtual bool can_be_primary_super_slow() const; |
322 | 325 |
323 // Returns number of primary supers; may be a number in the inclusive range [0, primary_super_limit]. | 326 // Returns number of primary supers; may be a number in the inclusive range [0, primary_super_limit]. |
324 juint super_depth() const { | 327 juint super_depth() const { |
325 if (!can_be_primary_super()) { | 328 if (!can_be_primary_super()) { |
326 return primary_super_limit(); | 329 return primary_super_limit(); |
327 } else { | 330 } else { |
328 juint d = (super_check_offset() - (primary_supers_offset_in_bytes() + sizeof(oopDesc))) / sizeof(klassOop); | 331 juint d = (super_check_offset() - in_bytes(primary_supers_offset())) / sizeof(klassOop); |
329 assert(d < primary_super_limit(), "oob"); | 332 assert(d < primary_super_limit(), "oob"); |
330 assert(_primary_supers[d] == as_klassOop(), "proper init"); | 333 assert(_primary_supers[d] == as_klassOop(), "proper init"); |
331 return d; | 334 return d; |
332 } | 335 } |
333 } | 336 } |
378 void set_alloc_count(juint n) { _alloc_count = n; } | 381 void set_alloc_count(juint n) { _alloc_count = n; } |
379 virtual juint alloc_size() const = 0; | 382 virtual juint alloc_size() const = 0; |
380 virtual void set_alloc_size(juint n) = 0; | 383 virtual void set_alloc_size(juint n) = 0; |
381 | 384 |
382 // Compiler support | 385 // Compiler support |
383 static int super_offset_in_bytes() { return offset_of(Klass, _super); } | 386 static ByteSize super_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _super)); } |
384 static int super_check_offset_offset_in_bytes() { return offset_of(Klass, _super_check_offset); } | 387 static ByteSize super_check_offset_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _super_check_offset)); } |
385 static int primary_supers_offset_in_bytes(){ return offset_of(Klass, _primary_supers); } | 388 static ByteSize primary_supers_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _primary_supers)); } |
386 static int secondary_super_cache_offset_in_bytes() { return offset_of(Klass, _secondary_super_cache); } | 389 static ByteSize secondary_super_cache_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _secondary_super_cache)); } |
387 static int secondary_supers_offset_in_bytes() { return offset_of(Klass, _secondary_supers); } | 390 static ByteSize secondary_supers_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _secondary_supers)); } |
388 static int java_mirror_offset_in_bytes() { return offset_of(Klass, _java_mirror); } | 391 static ByteSize java_mirror_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _java_mirror)); } |
389 static int graal_mirror_offset_in_bytes() { return offset_of(Klass, _graal_mirror); } | 392 static ByteSize modifier_flags_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _modifier_flags)); } |
390 static int modifier_flags_offset_in_bytes(){ return offset_of(Klass, _modifier_flags); } | 393 static ByteSize layout_helper_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _layout_helper)); } |
391 static int layout_helper_offset_in_bytes() { return offset_of(Klass, _layout_helper); } | 394 static ByteSize access_flags_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _access_flags)); } |
392 static int access_flags_offset_in_bytes() { return offset_of(Klass, _access_flags); } | 395 static ByteSize graal_mirror_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _graal_mirror)); } |
393 | 396 |
394 // Unpacking layout_helper: | 397 // Unpacking layout_helper: |
395 enum { | 398 enum { |
396 _lh_neutral_value = 0, // neutral non-array non-instance value | 399 _lh_neutral_value = 0, // neutral non-array non-instance value |
397 _lh_instance_slow_path_bit = 0x01, | 400 _lh_instance_slow_path_bit = 0x01, |
484 bool is_subclass_of(klassOop k) const; | 487 bool is_subclass_of(klassOop k) const; |
485 // subtype check: true if is_subclass_of, or if k is interface and receiver implements it | 488 // subtype check: true if is_subclass_of, or if k is interface and receiver implements it |
486 bool is_subtype_of(klassOop k) const { | 489 bool is_subtype_of(klassOop k) const { |
487 juint off = k->klass_part()->super_check_offset(); | 490 juint off = k->klass_part()->super_check_offset(); |
488 klassOop sup = *(klassOop*)( (address)as_klassOop() + off ); | 491 klassOop sup = *(klassOop*)( (address)as_klassOop() + off ); |
489 const juint secondary_offset = secondary_super_cache_offset_in_bytes() + sizeof(oopDesc); | 492 const juint secondary_offset = in_bytes(secondary_super_cache_offset()); |
490 if (sup == k) { | 493 if (sup == k) { |
491 return true; | 494 return true; |
492 } else if (off != secondary_offset) { | 495 } else if (off != secondary_offset) { |
493 return false; | 496 return false; |
494 } else { | 497 } else { |
680 // reason why it could not be done for arrayKlasses aside from | 683 // reason why it could not be done for arrayKlasses aside from |
681 // wanting to reduce the initial scope of this optimization. There | 684 // wanting to reduce the initial scope of this optimization. There |
682 // are potential problems in setting the bias pattern for | 685 // are potential problems in setting the bias pattern for |
683 // JVM-internal oops. | 686 // JVM-internal oops. |
684 inline void set_prototype_header(markOop header); | 687 inline void set_prototype_header(markOop header); |
685 static int prototype_header_offset_in_bytes() { return offset_of(Klass, _prototype_header); } | 688 static ByteSize prototype_header_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _prototype_header)); } |
686 | 689 |
687 int biased_lock_revocation_count() const { return (int) _biased_lock_revocation_count; } | 690 int biased_lock_revocation_count() const { return (int) _biased_lock_revocation_count; } |
688 // Atomically increments biased_lock_revocation_count and returns updated value | 691 // Atomically increments biased_lock_revocation_count and returns updated value |
689 int atomic_incr_biased_lock_revocation_count(); | 692 int atomic_incr_biased_lock_revocation_count(); |
690 void set_biased_lock_revocation_count(int val) { _biased_lock_revocation_count = (jint) val; } | 693 void set_biased_lock_revocation_count(int val) { _biased_lock_revocation_count = (jint) val; } |
691 jlong last_biased_lock_bulk_revocation_time() { return _last_biased_lock_bulk_revocation_time; } | 694 jlong last_biased_lock_bulk_revocation_time() { return _last_biased_lock_bulk_revocation_time; } |
692 void set_last_biased_lock_bulk_revocation_time(jlong cur_time) { _last_biased_lock_bulk_revocation_time = cur_time; } | 695 void set_last_biased_lock_bulk_revocation_time(jlong cur_time) { _last_biased_lock_bulk_revocation_time = cur_time; } |
693 | 696 |
697 TRACE_DEFINE_KLASS_METHODS; | |
694 | 698 |
695 // garbage collection support | 699 // garbage collection support |
696 virtual void follow_weak_klass_links( | 700 virtual void follow_weak_klass_links( |
697 BoolObjectClosure* is_alive, OopClosure* keep_alive); | 701 BoolObjectClosure* is_alive, OopClosure* keep_alive); |
698 | 702 |