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_INLINE2_HPP
26 #define SHARE_VM_OOPS_OOP_INLINE2_HPP
27
28 #include "gc_interface/collectedHeap.hpp"
29 #include "memory/generation.hpp"
30 #include "memory/universe.hpp"
31 #include "oops/oop.hpp"
32
33 // Implementation of all inlined member functions defined in oop.hpp
34 // We need a separate file to avoid circular references
35
36 inline bool oopDesc::is_scavengable() const {
37 return Universe::heap()->is_scavengable(this);
38 }
39 #endif // SHARE_VM_OOPS_OOP_INLINE2_HPP
|
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_INLINE2_HPP
26 #define SHARE_VM_OOPS_OOP_INLINE2_HPP
27
28 #include "gc_interface/collectedHeap.hpp"
29 #include "memory/generation.hpp"
30 #include "memory/universe.hpp"
31 #include "oops/oop.hpp"
32
33 // Implementation of all inlined member functions defined in oop.hpp
34 // We need a separate file to avoid circular references
35
36 inline bool oopDesc::is_scavengable() const {
37 return Universe::heap()->is_scavengable(this);
38 }
39
40 #ifdef ASSERT
41 template <class T> void assert_is_in(T *p) {
42 T heap_oop = oopDesc::load_heap_oop(p);
43 if (!oopDesc::is_null(heap_oop)) {
44 oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
45 assert(Universe::heap()->is_in(o), "should be in heap");
46 }
47 }
48 template <class T> void assert_is_in_closed_subset(T *p) {
49 T heap_oop = oopDesc::load_heap_oop(p);
50 if (!oopDesc::is_null(heap_oop)) {
51 oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
52 assert(Universe::heap()->is_in_closed_subset(o), "should be in closed");
53 }
54 }
55 template <class T> void assert_is_in_reserved(T *p) {
56 T heap_oop = oopDesc::load_heap_oop(p);
57 if (!oopDesc::is_null(heap_oop)) {
58 oop o = oopDesc::decode_heap_oop_not_null(heap_oop);
59 assert(Universe::heap()->is_in_reserved(o), "should be in reserved");
60 }
61 }
62 #endif // ASSERT
63
64 template <bool nv, typename OopClosureType>
65 class Devirtualizer {
66 public:
67 static bool do_metadata(OopClosureType* closure) { ShouldNotReachHere(); return false; }
68 static void do_klass(OopClosureType* closure, Klass* k) { ShouldNotReachHere(); }
69 template <typename T>
70 static void do_oop(OopClosureType* closure, T* p) { ShouldNotReachHere(); }
71 };
72
73 template <typename OopClosureType>
74 class Devirtualizer<true, OopClosureType> {
75 public:
76 static bool do_metadata(OopClosureType* closure) { return closure->do_metadata_nv(); }
77 static void do_klass(OopClosureType* closure, Klass* k) { closure->do_klass_nv(k); }
78 template <typename T>
79 static void do_oop(OopClosureType* closure, T* p) { closure->do_oop_nv(p); }
80 };
81
82 template <typename OopClosureType>
83 class Devirtualizer<false, OopClosureType> {
84 public:
85 static bool do_metadata(OopClosureType* closure) { return closure->do_metadata(); }
86 static void do_klass(OopClosureType* closure, Klass* k) { closure->do_klass(k); }
87 template <typename T>
88 static void do_oop(OopClosureType* closure, T* p) { closure->do_oop(p); }
89 };
90
91 #endif // SHARE_VM_OOPS_OOP_INLINE2_HPP
|