61 if (UseSharedSpaces) {
62 assert(map->offset() == java_lang_ref_Reference::queue_offset &&
63 map->count() == 1, "just checking");
64 } else {
65 assert(map->offset() == offset && map->count() == count,
66 "just checking");
67
68 // Update map to (3,1) - point to offset of 3 (words) with 1 map entry.
69 map->set_offset(java_lang_ref_Reference::queue_offset);
70 map->set_count(1);
71 }
72 }
73
74
75 // Verification
76
77 void InstanceRefKlass::oop_verify_on(oop obj, outputStream* st) {
78 InstanceKlass::oop_verify_on(obj, st);
79 // Verify referent field
80 oop referent = java_lang_ref_Reference::referent(obj);
81
82 // We should make this general to all heaps
83 GenCollectedHeap* gch = NULL;
84 if (Universe::heap()->kind() == CollectedHeap::GenCollectedHeap)
85 gch = GenCollectedHeap::heap();
86
87 if (referent != NULL) {
88 guarantee(referent->is_oop(), "referent field heap failed");
89 }
90 // Verify next field
91 oop next = java_lang_ref_Reference::next(obj);
92 if (next != NULL) {
93 guarantee(next->is_oop(), "next field verify failed");
94 guarantee(next->is_instanceRef(), "next field verify failed");
95 }
96 }
97
98 bool InstanceRefKlass::owns_pending_list_lock(JavaThread* thread) {
99 if (java_lang_ref_Reference::pending_list_lock() == NULL) return false;
100 Handle h_lock(thread, java_lang_ref_Reference::pending_list_lock());
101 return ObjectSynchronizer::current_thread_holds_lock(thread, h_lock);
102 }
103
104 void InstanceRefKlass::acquire_pending_list_lock(BasicLock *pending_list_basic_lock) {
105 // we may enter this with pending exception set
106 PRESERVE_EXCEPTION_MARK; // exceptions are never thrown, needed for TRAPS argument
|
61 if (UseSharedSpaces) {
62 assert(map->offset() == java_lang_ref_Reference::queue_offset &&
63 map->count() == 1, "just checking");
64 } else {
65 assert(map->offset() == offset && map->count() == count,
66 "just checking");
67
68 // Update map to (3,1) - point to offset of 3 (words) with 1 map entry.
69 map->set_offset(java_lang_ref_Reference::queue_offset);
70 map->set_count(1);
71 }
72 }
73
74
75 // Verification
76
77 void InstanceRefKlass::oop_verify_on(oop obj, outputStream* st) {
78 InstanceKlass::oop_verify_on(obj, st);
79 // Verify referent field
80 oop referent = java_lang_ref_Reference::referent(obj);
81 if (referent != NULL) {
82 guarantee(referent->is_oop(), "referent field heap failed");
83 }
84 // Verify next field
85 oop next = java_lang_ref_Reference::next(obj);
86 if (next != NULL) {
87 guarantee(next->is_oop(), "next field verify failed");
88 guarantee(next->is_instanceRef(), "next field verify failed");
89 }
90 }
91
92 bool InstanceRefKlass::owns_pending_list_lock(JavaThread* thread) {
93 if (java_lang_ref_Reference::pending_list_lock() == NULL) return false;
94 Handle h_lock(thread, java_lang_ref_Reference::pending_list_lock());
95 return ObjectSynchronizer::current_thread_holds_lock(thread, h_lock);
96 }
97
98 void InstanceRefKlass::acquire_pending_list_lock(BasicLock *pending_list_basic_lock) {
99 // we may enter this with pending exception set
100 PRESERVE_EXCEPTION_MARK; // exceptions are never thrown, needed for TRAPS argument
|