55 assert(thread == Thread::current(), "sanity check");
56 if (obj == NULL) {
57 _handle = NULL;
58 } else {
59 _handle = thread->handle_area()->allocate_handle(obj);
60 }
61 }
62
63 #endif
64
65 static uintx chunk_oops_do(OopClosure* f, Chunk* chunk, char* chunk_top) {
66 oop* bottom = (oop*) chunk->bottom();
67 oop* top = (oop*) chunk_top;
68 uintx handles_visited = top - bottom;
69 assert(top >= bottom && top <= (oop*) chunk->top(), "just checking");
70 // during GC phase 3, a handle may be a forward pointer that
71 // is not yet valid, so loosen the assertion
72 while (bottom < top) {
73 // This test can be moved up but for now check every oop.
74
75 assert((*bottom)->is_oop(), "handle should point to oop");
76
77 f->do_oop(bottom++);
78 }
79 return handles_visited;
80 }
81
82 // Used for debugging handle allocation.
83 NOT_PRODUCT(jint _nof_handlemarks = 0;)
84
85 void HandleArea::oops_do(OopClosure* f) {
86 uintx handles_visited = 0;
87 // First handle the current chunk. It is filled to the high water mark.
88 handles_visited += chunk_oops_do(f, _chunk, _hwm);
89 // Then handle all previous chunks. They are completely filled.
90 Chunk* k = _first;
91 while(k != _chunk) {
92 handles_visited += chunk_oops_do(f, k, k->top());
93 k = k->next();
94 }
95
|
55 assert(thread == Thread::current(), "sanity check");
56 if (obj == NULL) {
57 _handle = NULL;
58 } else {
59 _handle = thread->handle_area()->allocate_handle(obj);
60 }
61 }
62
63 #endif
64
65 static uintx chunk_oops_do(OopClosure* f, Chunk* chunk, char* chunk_top) {
66 oop* bottom = (oop*) chunk->bottom();
67 oop* top = (oop*) chunk_top;
68 uintx handles_visited = top - bottom;
69 assert(top >= bottom && top <= (oop*) chunk->top(), "just checking");
70 // during GC phase 3, a handle may be a forward pointer that
71 // is not yet valid, so loosen the assertion
72 while (bottom < top) {
73 // This test can be moved up but for now check every oop.
74
75 // JFR is known to set mark word to 0 for duration of leak analysis VM operaiton
76 assert((*bottom)->is_oop(INCLUDE_JFR), "handle should point to oop");
77
78 f->do_oop(bottom++);
79 }
80 return handles_visited;
81 }
82
83 // Used for debugging handle allocation.
84 NOT_PRODUCT(jint _nof_handlemarks = 0;)
85
86 void HandleArea::oops_do(OopClosure* f) {
87 uintx handles_visited = 0;
88 // First handle the current chunk. It is filled to the high water mark.
89 handles_visited += chunk_oops_do(f, _chunk, _hwm);
90 // Then handle all previous chunks. They are completely filled.
91 Chunk* k = _first;
92 while(k != _chunk) {
93 handles_visited += chunk_oops_do(f, k, k->top());
94 k = k->next();
95 }
96
|