Mercurial > hg > truffle
comparison src/share/vm/oops/klass.hpp @ 4762:069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
Summary: Moved sizeof(klassOopDesc), changed the return type to ByteSize and removed the _in_bytes suffix.
Reviewed-by: never, bdelsart, coleenp, jrose
author | stefank |
---|---|
date | Wed, 07 Dec 2011 11:35:03 +0100 |
parents | c7f3d0b4570f |
children | 4f3ce9284781 |
comparison
equal
deleted
inserted
replaced
4761:65149e74c706 | 4762:069ab3f976d3 |
---|---|
311 } | 311 } |
312 | 312 |
313 // Can this klass be a primary super? False for interfaces and arrays of | 313 // Can this klass be a primary super? False for interfaces and arrays of |
314 // interfaces. False also for arrays or classes with long super chains. | 314 // interfaces. False also for arrays or classes with long super chains. |
315 bool can_be_primary_super() const { | 315 bool can_be_primary_super() const { |
316 const juint secondary_offset = secondary_super_cache_offset_in_bytes() + sizeof(oopDesc); | 316 const juint secondary_offset = in_bytes(secondary_super_cache_offset()); |
317 return super_check_offset() != secondary_offset; | 317 return super_check_offset() != secondary_offset; |
318 } | 318 } |
319 virtual bool can_be_primary_super_slow() const; | 319 virtual bool can_be_primary_super_slow() const; |
320 | 320 |
321 // Returns number of primary supers; may be a number in the inclusive range [0, primary_super_limit]. | 321 // Returns number of primary supers; may be a number in the inclusive range [0, primary_super_limit]. |
322 juint super_depth() const { | 322 juint super_depth() const { |
323 if (!can_be_primary_super()) { | 323 if (!can_be_primary_super()) { |
324 return primary_super_limit(); | 324 return primary_super_limit(); |
325 } else { | 325 } else { |
326 juint d = (super_check_offset() - (primary_supers_offset_in_bytes() + sizeof(oopDesc))) / sizeof(klassOop); | 326 juint d = (super_check_offset() - in_bytes(primary_supers_offset())) / sizeof(klassOop); |
327 assert(d < primary_super_limit(), "oob"); | 327 assert(d < primary_super_limit(), "oob"); |
328 assert(_primary_supers[d] == as_klassOop(), "proper init"); | 328 assert(_primary_supers[d] == as_klassOop(), "proper init"); |
329 return d; | 329 return d; |
330 } | 330 } |
331 } | 331 } |
371 void set_alloc_count(juint n) { _alloc_count = n; } | 371 void set_alloc_count(juint n) { _alloc_count = n; } |
372 virtual juint alloc_size() const = 0; | 372 virtual juint alloc_size() const = 0; |
373 virtual void set_alloc_size(juint n) = 0; | 373 virtual void set_alloc_size(juint n) = 0; |
374 | 374 |
375 // Compiler support | 375 // Compiler support |
376 static int super_offset_in_bytes() { return offset_of(Klass, _super); } | 376 static ByteSize super_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _super)); } |
377 static int super_check_offset_offset_in_bytes() { return offset_of(Klass, _super_check_offset); } | 377 static ByteSize super_check_offset_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _super_check_offset)); } |
378 static int primary_supers_offset_in_bytes(){ return offset_of(Klass, _primary_supers); } | 378 static ByteSize primary_supers_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _primary_supers)); } |
379 static int secondary_super_cache_offset_in_bytes() { return offset_of(Klass, _secondary_super_cache); } | 379 static ByteSize secondary_super_cache_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _secondary_super_cache)); } |
380 static int secondary_supers_offset_in_bytes() { return offset_of(Klass, _secondary_supers); } | 380 static ByteSize secondary_supers_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _secondary_supers)); } |
381 static int java_mirror_offset_in_bytes() { return offset_of(Klass, _java_mirror); } | 381 static ByteSize java_mirror_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _java_mirror)); } |
382 static int modifier_flags_offset_in_bytes(){ return offset_of(Klass, _modifier_flags); } | 382 static ByteSize modifier_flags_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _modifier_flags)); } |
383 static int layout_helper_offset_in_bytes() { return offset_of(Klass, _layout_helper); } | 383 static ByteSize layout_helper_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _layout_helper)); } |
384 static int access_flags_offset_in_bytes() { return offset_of(Klass, _access_flags); } | 384 static ByteSize access_flags_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _access_flags)); } |
385 | 385 |
386 // Unpacking layout_helper: | 386 // Unpacking layout_helper: |
387 enum { | 387 enum { |
388 _lh_neutral_value = 0, // neutral non-array non-instance value | 388 _lh_neutral_value = 0, // neutral non-array non-instance value |
389 _lh_instance_slow_path_bit = 0x01, | 389 _lh_instance_slow_path_bit = 0x01, |
476 bool is_subclass_of(klassOop k) const; | 476 bool is_subclass_of(klassOop k) const; |
477 // subtype check: true if is_subclass_of, or if k is interface and receiver implements it | 477 // subtype check: true if is_subclass_of, or if k is interface and receiver implements it |
478 bool is_subtype_of(klassOop k) const { | 478 bool is_subtype_of(klassOop k) const { |
479 juint off = k->klass_part()->super_check_offset(); | 479 juint off = k->klass_part()->super_check_offset(); |
480 klassOop sup = *(klassOop*)( (address)as_klassOop() + off ); | 480 klassOop sup = *(klassOop*)( (address)as_klassOop() + off ); |
481 const juint secondary_offset = secondary_super_cache_offset_in_bytes() + sizeof(oopDesc); | 481 const juint secondary_offset = in_bytes(secondary_super_cache_offset()); |
482 if (sup == k) { | 482 if (sup == k) { |
483 return true; | 483 return true; |
484 } else if (off != secondary_offset) { | 484 } else if (off != secondary_offset) { |
485 return false; | 485 return false; |
486 } else { | 486 } else { |
672 // reason why it could not be done for arrayKlasses aside from | 672 // reason why it could not be done for arrayKlasses aside from |
673 // wanting to reduce the initial scope of this optimization. There | 673 // wanting to reduce the initial scope of this optimization. There |
674 // are potential problems in setting the bias pattern for | 674 // are potential problems in setting the bias pattern for |
675 // JVM-internal oops. | 675 // JVM-internal oops. |
676 inline void set_prototype_header(markOop header); | 676 inline void set_prototype_header(markOop header); |
677 static int prototype_header_offset_in_bytes() { return offset_of(Klass, _prototype_header); } | 677 static ByteSize prototype_header_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(Klass, _prototype_header)); } |
678 | 678 |
679 int biased_lock_revocation_count() const { return (int) _biased_lock_revocation_count; } | 679 int biased_lock_revocation_count() const { return (int) _biased_lock_revocation_count; } |
680 // Atomically increments biased_lock_revocation_count and returns updated value | 680 // Atomically increments biased_lock_revocation_count and returns updated value |
681 int atomic_incr_biased_lock_revocation_count(); | 681 int atomic_incr_biased_lock_revocation_count(); |
682 void set_biased_lock_revocation_count(int val) { _biased_lock_revocation_count = (jint) val; } | 682 void set_biased_lock_revocation_count(int val) { _biased_lock_revocation_count = (jint) val; } |