comparison src/share/vm/oops/klass.hpp @ 4801:4f3ce9284781

Merge
author phh
date Wed, 11 Jan 2012 17:58:26 -0500
parents 94ec88ca68e2 069ab3f976d3
children 34e2e90e7182
comparison
equal deleted inserted replaced
4800:94ec88ca68e2 4801:4f3ce9284781
316 } 316 }
317 317
318 // 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
319 // interfaces. False also for arrays or classes with long super chains. 319 // interfaces. False also for arrays or classes with long super chains.
320 bool can_be_primary_super() const { 320 bool can_be_primary_super() const {
321 const juint secondary_offset = secondary_super_cache_offset_in_bytes() + sizeof(oopDesc); 321 const juint secondary_offset = in_bytes(secondary_super_cache_offset());
322 return super_check_offset() != secondary_offset; 322 return super_check_offset() != secondary_offset;
323 } 323 }
324 virtual bool can_be_primary_super_slow() const; 324 virtual bool can_be_primary_super_slow() const;
325 325
326 // 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].
327 juint super_depth() const { 327 juint super_depth() const {
328 if (!can_be_primary_super()) { 328 if (!can_be_primary_super()) {
329 return primary_super_limit(); 329 return primary_super_limit();
330 } else { 330 } else {
331 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);
332 assert(d < primary_super_limit(), "oob"); 332 assert(d < primary_super_limit(), "oob");
333 assert(_primary_supers[d] == as_klassOop(), "proper init"); 333 assert(_primary_supers[d] == as_klassOop(), "proper init");
334 return d; 334 return d;
335 } 335 }
336 } 336 }
376 void set_alloc_count(juint n) { _alloc_count = n; } 376 void set_alloc_count(juint n) { _alloc_count = n; }
377 virtual juint alloc_size() const = 0; 377 virtual juint alloc_size() const = 0;
378 virtual void set_alloc_size(juint n) = 0; 378 virtual void set_alloc_size(juint n) = 0;
379 379
380 // Compiler support 380 // Compiler support
381 static int super_offset_in_bytes() { return offset_of(Klass, _super); } 381 static ByteSize super_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _super)); }
382 static int super_check_offset_offset_in_bytes() { return offset_of(Klass, _super_check_offset); } 382 static ByteSize super_check_offset_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _super_check_offset)); }
383 static int primary_supers_offset_in_bytes(){ return offset_of(Klass, _primary_supers); } 383 static ByteSize primary_supers_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _primary_supers)); }
384 static int secondary_super_cache_offset_in_bytes() { return offset_of(Klass, _secondary_super_cache); } 384 static ByteSize secondary_super_cache_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _secondary_super_cache)); }
385 static int secondary_supers_offset_in_bytes() { return offset_of(Klass, _secondary_supers); } 385 static ByteSize secondary_supers_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _secondary_supers)); }
386 static int java_mirror_offset_in_bytes() { return offset_of(Klass, _java_mirror); } 386 static ByteSize java_mirror_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _java_mirror)); }
387 static int modifier_flags_offset_in_bytes(){ return offset_of(Klass, _modifier_flags); } 387 static ByteSize modifier_flags_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _modifier_flags)); }
388 static int layout_helper_offset_in_bytes() { return offset_of(Klass, _layout_helper); } 388 static ByteSize layout_helper_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _layout_helper)); }
389 static int access_flags_offset_in_bytes() { return offset_of(Klass, _access_flags); } 389 static ByteSize access_flags_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _access_flags)); }
390 390
391 // Unpacking layout_helper: 391 // Unpacking layout_helper:
392 enum { 392 enum {
393 _lh_neutral_value = 0, // neutral non-array non-instance value 393 _lh_neutral_value = 0, // neutral non-array non-instance value
394 _lh_instance_slow_path_bit = 0x01, 394 _lh_instance_slow_path_bit = 0x01,
481 bool is_subclass_of(klassOop k) const; 481 bool is_subclass_of(klassOop k) const;
482 // subtype check: true if is_subclass_of, or if k is interface and receiver implements it 482 // subtype check: true if is_subclass_of, or if k is interface and receiver implements it
483 bool is_subtype_of(klassOop k) const { 483 bool is_subtype_of(klassOop k) const {
484 juint off = k->klass_part()->super_check_offset(); 484 juint off = k->klass_part()->super_check_offset();
485 klassOop sup = *(klassOop*)( (address)as_klassOop() + off ); 485 klassOop sup = *(klassOop*)( (address)as_klassOop() + off );
486 const juint secondary_offset = secondary_super_cache_offset_in_bytes() + sizeof(oopDesc); 486 const juint secondary_offset = in_bytes(secondary_super_cache_offset());
487 if (sup == k) { 487 if (sup == k) {
488 return true; 488 return true;
489 } else if (off != secondary_offset) { 489 } else if (off != secondary_offset) {
490 return false; 490 return false;
491 } else { 491 } else {
677 // reason why it could not be done for arrayKlasses aside from 677 // reason why it could not be done for arrayKlasses aside from
678 // wanting to reduce the initial scope of this optimization. There 678 // wanting to reduce the initial scope of this optimization. There
679 // are potential problems in setting the bias pattern for 679 // are potential problems in setting the bias pattern for
680 // JVM-internal oops. 680 // JVM-internal oops.
681 inline void set_prototype_header(markOop header); 681 inline void set_prototype_header(markOop header);
682 static int prototype_header_offset_in_bytes() { return offset_of(Klass, _prototype_header); } 682 static ByteSize prototype_header_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _prototype_header)); }
683 683
684 int biased_lock_revocation_count() const { return (int) _biased_lock_revocation_count; } 684 int biased_lock_revocation_count() const { return (int) _biased_lock_revocation_count; }
685 // Atomically increments biased_lock_revocation_count and returns updated value 685 // Atomically increments biased_lock_revocation_count and returns updated value
686 int atomic_incr_biased_lock_revocation_count(); 686 int atomic_incr_biased_lock_revocation_count();
687 void set_biased_lock_revocation_count(int val) { _biased_lock_revocation_count = (jint) val; } 687 void set_biased_lock_revocation_count(int val) { _biased_lock_revocation_count = (jint) val; }