9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OOPS_OOP_INLINE_HPP
26 #define SHARE_VM_OOPS_OOP_INLINE_HPP
27
28 #include "gc_implementation/shared/ageTable.hpp"
29 #include "gc_implementation/shared/markSweep.inline.hpp"
30 #include "gc_interface/collectedHeap.inline.hpp"
31 #include "memory/barrierSet.inline.hpp"
32 #include "memory/cardTableModRefBS.hpp"
33 #include "memory/genCollectedHeap.hpp"
34 #include "memory/generation.hpp"
35 #include "memory/specialized_oop_closures.hpp"
36 #include "oops/arrayKlass.hpp"
37 #include "oops/arrayOop.hpp"
38 #include "oops/klass.inline.hpp"
39 #include "oops/markOop.inline.hpp"
40 #include "oops/oop.hpp"
41 #include "runtime/atomic.inline.hpp"
42 #include "runtime/orderAccess.inline.hpp"
43 #include "runtime/os.hpp"
44 #include "utilities/macros.hpp"
45
46 // Implementation of all inlined member functions defined in oop.hpp
47 // We need a separate file to avoid circular references
48
49 inline void oopDesc::release_set_mark(markOop m) {
50 OrderAccess::release_store_ptr(&_mark, m);
674 inline intptr_t oopDesc::identity_hash() {
675 // Fast case; if the object is unlocked and the hash value is set, no locking is needed
676 // Note: The mark must be read into local variable to avoid concurrent updates.
677 markOop mrk = mark();
678 if (mrk->is_unlocked() && !mrk->has_no_hash()) {
679 return mrk->hash();
680 } else if (mrk->is_marked()) {
681 return mrk->hash();
682 } else {
683 return slow_identity_hash();
684 }
685 }
686
687 inline int oopDesc::adjust_pointers() {
688 debug_only(int check_size = size());
689 int s = klass()->oop_adjust_pointers(this);
690 assert(s == check_size, "should be the same");
691 return s;
692 }
693
694 #define OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
695 \
696 inline int oopDesc::oop_iterate(OopClosureType* blk) { \
697 SpecializationStats::record_call(); \
698 return klass()->oop_oop_iterate##nv_suffix(this, blk); \
699 } \
700 \
701 inline int oopDesc::oop_iterate(OopClosureType* blk, MemRegion mr) { \
702 SpecializationStats::record_call(); \
703 return klass()->oop_oop_iterate##nv_suffix##_m(this, blk, mr); \
704 }
705
706
707 inline int oopDesc::oop_iterate_no_header(OopClosure* blk) {
708 // The NoHeaderExtendedOopClosure wraps the OopClosure and proxies all
709 // the do_oop calls, but turns off all other features in ExtendedOopClosure.
710 NoHeaderExtendedOopClosure cl(blk);
711 return oop_iterate(&cl);
712 }
713
714 inline int oopDesc::oop_iterate_no_header(OopClosure* blk, MemRegion mr) {
715 NoHeaderExtendedOopClosure cl(blk);
716 return oop_iterate(&cl, mr);
717 }
718
719 ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_DEFN)
720 ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_DEFN)
721
722 #if INCLUDE_ALL_GCS
723 #define OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \
724 \
725 inline int oopDesc::oop_iterate_backwards(OopClosureType* blk) { \
726 SpecializationStats::record_call(); \
727 return klass()->oop_oop_iterate_backwards##nv_suffix(this, blk); \
728 }
729
730 ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_BACKWARDS_DEFN)
731 ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_BACKWARDS_DEFN)
732 #endif // INCLUDE_ALL_GCS
733
734 #endif // SHARE_VM_OOPS_OOP_INLINE_HPP
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OOPS_OOP_INLINE_HPP
26 #define SHARE_VM_OOPS_OOP_INLINE_HPP
27
28 #include "gc_implementation/shared/ageTable.hpp"
29 #include "memory/barrierSet.inline.hpp"
30 #include "memory/cardTableModRefBS.hpp"
31 #include "memory/genCollectedHeap.hpp"
32 #include "memory/generation.hpp"
33 #include "memory/specialized_oop_closures.hpp"
34 #include "oops/arrayKlass.hpp"
35 #include "oops/arrayOop.hpp"
36 #include "oops/klass.inline.hpp"
37 #include "oops/markOop.inline.hpp"
38 #include "oops/oop.hpp"
39 #include "runtime/atomic.inline.hpp"
40 #include "runtime/orderAccess.inline.hpp"
41 #include "runtime/os.hpp"
42 #include "utilities/macros.hpp"
43
44 // Implementation of all inlined member functions defined in oop.hpp
45 // We need a separate file to avoid circular references
46
47 inline void oopDesc::release_set_mark(markOop m) {
48 OrderAccess::release_store_ptr(&_mark, m);
672 inline intptr_t oopDesc::identity_hash() {
673 // Fast case; if the object is unlocked and the hash value is set, no locking is needed
674 // Note: The mark must be read into local variable to avoid concurrent updates.
675 markOop mrk = mark();
676 if (mrk->is_unlocked() && !mrk->has_no_hash()) {
677 return mrk->hash();
678 } else if (mrk->is_marked()) {
679 return mrk->hash();
680 } else {
681 return slow_identity_hash();
682 }
683 }
684
685 inline int oopDesc::adjust_pointers() {
686 debug_only(int check_size = size());
687 int s = klass()->oop_adjust_pointers(this);
688 assert(s == check_size, "should be the same");
689 return s;
690 }
691
692 template <bool nv, typename OopClosureType>
693 inline int oopDesc::oop_iterate(OopClosureType* blk) {
694 CONCRETE_KLASS_DO_AND_RETURN(klass(), oop_oop_iterate<nv>(this,blk));
695 }
696
697 template <bool nv, typename OopClosureType>
698 inline int oopDesc::oop_iterate(OopClosureType* blk, MemRegion mr) {
699 CONCRETE_KLASS_DO_AND_RETURN(klass(), oop_oop_iterate_m<nv>(this,blk,mr));
700 }
701
702 #if INCLUDE_ALL_GCS
703 template <bool nv, typename OopClosureType>
704 inline int oopDesc::oop_iterate_backwards(OopClosureType* blk) {
705 CONCRETE_KLASS_DO_AND_RETURN(klass(), oop_oop_iterate_backwards<nv>(this, blk));
706 }
707 #endif // INCLUDE_ALL_GCS
708
709 inline int oopDesc::oop_iterate_no_header(OopClosure* blk) {
710 // The NoHeaderExtendedOopClosure wraps the OopClosure and proxies all
711 // the do_oop calls, but turns off all other features in ExtendedOopClosure.
712 NoHeaderExtendedOopClosure cl(blk);
713 return oop_iterate(&cl);
714 }
715
716 inline int oopDesc::oop_iterate_no_header(OopClosure* blk, MemRegion mr) {
717 NoHeaderExtendedOopClosure cl(blk);
718 return oop_iterate(&cl, mr);
719 }
720
721 #endif // SHARE_VM_OOPS_OOP_INLINE_HPP
|