hotspot/src/share/vm/oops/oop.inline.hpp
changeset 30150 d9c940aa42ef
parent 29689 dc72789f83ae
child 30263 ffa31d06cb02
equal deleted inserted replaced
30149:c0f930abe5ed 30150:d9c940aa42ef
    24 
    24 
    25 #ifndef SHARE_VM_OOPS_OOP_INLINE_HPP
    25 #ifndef SHARE_VM_OOPS_OOP_INLINE_HPP
    26 #define SHARE_VM_OOPS_OOP_INLINE_HPP
    26 #define SHARE_VM_OOPS_OOP_INLINE_HPP
    27 
    27 
    28 #include "gc_implementation/shared/ageTable.hpp"
    28 #include "gc_implementation/shared/ageTable.hpp"
    29 #include "gc_implementation/shared/markSweep.inline.hpp"
       
    30 #include "gc_interface/collectedHeap.inline.hpp"
    29 #include "gc_interface/collectedHeap.inline.hpp"
    31 #include "memory/barrierSet.inline.hpp"
    30 #include "memory/barrierSet.inline.hpp"
    32 #include "memory/cardTableModRefBS.hpp"
    31 #include "memory/cardTableModRefBS.hpp"
    33 #include "memory/genCollectedHeap.hpp"
    32 #include "memory/genCollectedHeap.hpp"
    34 #include "memory/generation.hpp"
    33 #include "memory/generation.hpp"
    35 #include "memory/specialized_oop_closures.hpp"
       
    36 #include "oops/arrayKlass.hpp"
    34 #include "oops/arrayKlass.hpp"
    37 #include "oops/arrayOop.hpp"
    35 #include "oops/arrayOop.hpp"
    38 #include "oops/klass.inline.hpp"
    36 #include "oops/klass.inline.hpp"
    39 #include "oops/markOop.inline.hpp"
    37 #include "oops/markOop.inline.hpp"
    40 #include "oops/oop.hpp"
    38 #include "oops/oop.hpp"
   590   if (!Universe::heap()->is_in_reserved(this)) return false;
   588   if (!Universe::heap()->is_in_reserved(this)) return false;
   591   return mark()->is_unlocked();
   589   return mark()->is_unlocked();
   592 }
   590 }
   593 #endif // PRODUCT
   591 #endif // PRODUCT
   594 
   592 
   595 inline void oopDesc::follow_contents(void) {
       
   596   assert (is_gc_marked(), "should be marked");
       
   597   klass()->oop_follow_contents(this);
       
   598 }
       
   599 
       
   600 inline bool oopDesc::is_scavengable() const {
   593 inline bool oopDesc::is_scavengable() const {
   601   return Universe::heap()->is_scavengable(this);
   594   return Universe::heap()->is_scavengable(this);
   602 }
   595 }
   603 
   596 
   604 // Used by scavengers
   597 // Used by scavengers
   704   } else {
   697   } else {
   705     return slow_identity_hash();
   698     return slow_identity_hash();
   706   }
   699   }
   707 }
   700 }
   708 
   701 
   709 inline int oopDesc::adjust_pointers() {
   702 inline void oopDesc::ms_follow_contents() {
       
   703   klass()->oop_ms_follow_contents(this);
       
   704 }
       
   705 
       
   706 inline int oopDesc::ms_adjust_pointers() {
   710   debug_only(int check_size = size());
   707   debug_only(int check_size = size());
   711   int s = klass()->oop_adjust_pointers(this);
   708   int s = klass()->oop_ms_adjust_pointers(this);
   712   assert(s == check_size, "should be the same");
   709   assert(s == check_size, "should be the same");
   713   return s;
   710   return s;
   714 }
   711 }
   715 
   712 
   716 #define OOP_ITERATE_DEFN(OopClosureType, nv_suffix)                        \
   713 #if INCLUDE_ALL_GCS
   717                                                                            \
   714 inline void oopDesc::pc_follow_contents(ParCompactionManager* cm) {
   718 inline int oopDesc::oop_iterate(OopClosureType* blk) {                     \
   715   klass()->oop_pc_follow_contents(this, cm);
   719   return klass()->oop_oop_iterate##nv_suffix(this, blk);               \
   716 }
   720 }                                                                          \
   717 
   721                                                                            \
   718 inline void oopDesc::pc_update_contents() {
   722 inline int oopDesc::oop_iterate(OopClosureType* blk, MemRegion mr) {       \
   719   Klass* k = klass();
   723   return klass()->oop_oop_iterate##nv_suffix##_m(this, blk, mr);       \
   720   if (!k->oop_is_typeArray()) {
       
   721     // It might contain oops beyond the header, so take the virtual call.
       
   722     k->oop_pc_update_pointers(this);
       
   723   }
       
   724   // Else skip it.  The TypeArrayKlass in the header never needs scavenging.
       
   725 }
       
   726 
       
   727 inline void oopDesc::ps_push_contents(PSPromotionManager* pm) {
       
   728   Klass* k = klass();
       
   729   if (!k->oop_is_typeArray()) {
       
   730     // It might contain oops beyond the header, so take the virtual call.
       
   731     k->oop_ps_push_contents(this, pm);
       
   732   }
       
   733   // Else skip it.  The TypeArrayKlass in the header never needs scavenging.
       
   734 }
       
   735 #endif
       
   736 
       
   737 #define OOP_ITERATE_DEFN(OopClosureType, nv_suffix)                   \
       
   738                                                                       \
       
   739 inline int oopDesc::oop_iterate(OopClosureType* blk) {                \
       
   740   return klass()->oop_oop_iterate##nv_suffix(this, blk);              \
       
   741 }                                                                     \
       
   742                                                                       \
       
   743 inline int oopDesc::oop_iterate(OopClosureType* blk, MemRegion mr) {  \
       
   744   return klass()->oop_oop_iterate##nv_suffix##_m(this, blk, mr);      \
   724 }
   745 }
   725 
   746 
   726 
   747 
   727 inline int oopDesc::oop_iterate_no_header(OopClosure* blk) {
   748 inline int oopDesc::oop_iterate_no_header(OopClosure* blk) {
   728   // The NoHeaderExtendedOopClosure wraps the OopClosure and proxies all
   749   // The NoHeaderExtendedOopClosure wraps the OopClosure and proxies all
   734 inline int oopDesc::oop_iterate_no_header(OopClosure* blk, MemRegion mr) {
   755 inline int oopDesc::oop_iterate_no_header(OopClosure* blk, MemRegion mr) {
   735   NoHeaderExtendedOopClosure cl(blk);
   756   NoHeaderExtendedOopClosure cl(blk);
   736   return oop_iterate(&cl, mr);
   757   return oop_iterate(&cl, mr);
   737 }
   758 }
   738 
   759 
   739 ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_DEFN)
       
   740 ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_DEFN)
       
   741 
       
   742 #if INCLUDE_ALL_GCS
   760 #if INCLUDE_ALL_GCS
   743 #define OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix)              \
   761 #define OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix)       \
   744                                                                            \
   762                                                                     \
   745 inline int oopDesc::oop_iterate_backwards(OopClosureType* blk) {           \
   763 inline int oopDesc::oop_iterate_backwards(OopClosureType* blk) {    \
   746   return klass()->oop_oop_iterate_backwards##nv_suffix(this, blk);     \
   764   return klass()->oop_oop_iterate_backwards##nv_suffix(this, blk);  \
   747 }
   765 }
   748 
   766 #else
   749 ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_BACKWARDS_DEFN)
   767 #define OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix)
   750 ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_BACKWARDS_DEFN)
   768 #endif
   751 #endif // INCLUDE_ALL_GCS
   769 
       
   770 #define ALL_OOPDESC_OOP_ITERATE(OopClosureType, nv_suffix)  \
       
   771   OOP_ITERATE_DEFN(OopClosureType, nv_suffix)               \
       
   772   OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix)
       
   773 
       
   774 ALL_OOP_OOP_ITERATE_CLOSURES_1(ALL_OOPDESC_OOP_ITERATE)
       
   775 ALL_OOP_OOP_ITERATE_CLOSURES_2(ALL_OOPDESC_OOP_ITERATE)
   752 
   776 
   753 #endif // SHARE_VM_OOPS_OOP_INLINE_HPP
   777 #endif // SHARE_VM_OOPS_OOP_INLINE_HPP