451 // As a sanity check we release blocks pointed to by the pop_frame_link.
452 // This should never happen (only if PopLocalFrame is not called the
453 // correct number of times).
454 release_block(pop_frame_link, thread);
455 }
456 }
457
458
459 void JNIHandleBlock::oops_do(OopClosure* f) {
460 JNIHandleBlock* current_chain = this;
461 // Iterate over chain of blocks, followed by chains linked through the
462 // pop frame links.
463 while (current_chain != NULL) {
464 for (JNIHandleBlock* current = current_chain; current != NULL;
465 current = current->_next) {
466 assert(current == current_chain || current->pop_frame_link() == NULL,
467 "only blocks first in chain should have pop frame link set");
468 for (int index = 0; index < current->_top; index++) {
469 oop* root = &(current->_handles)[index];
470 oop value = *root;
471 assert(!VTBuffer::is_in_vt_buffer(value), "JNIHandles must not point to a buffered value");
472 // traverse heap pointers only, not deleted handles or free list
473 // pointers
474 if (value != NULL && Universe::heap()->is_in_reserved(value)) {
475 f->do_oop(root);
476 }
477 }
478 // the next handle block is valid only if current block is full
479 if (current->_top < block_size_in_oops) {
480 break;
481 }
482 }
483 current_chain = current_chain->pop_frame_link();
484 }
485 }
486
487
488 jobject JNIHandleBlock::allocate_handle(oop obj) {
489 assert(Universe::heap()->is_in_reserved(obj), "sanity check");
490 if (_top == 0) {
491 // This is the first allocation or the initial block got zapped when
|
451 // As a sanity check we release blocks pointed to by the pop_frame_link.
452 // This should never happen (only if PopLocalFrame is not called the
453 // correct number of times).
454 release_block(pop_frame_link, thread);
455 }
456 }
457
458
459 void JNIHandleBlock::oops_do(OopClosure* f) {
460 JNIHandleBlock* current_chain = this;
461 // Iterate over chain of blocks, followed by chains linked through the
462 // pop frame links.
463 while (current_chain != NULL) {
464 for (JNIHandleBlock* current = current_chain; current != NULL;
465 current = current->_next) {
466 assert(current == current_chain || current->pop_frame_link() == NULL,
467 "only blocks first in chain should have pop frame link set");
468 for (int index = 0; index < current->_top; index++) {
469 oop* root = &(current->_handles)[index];
470 oop value = *root;
471 // traverse heap pointers only, not deleted handles or free list
472 // pointers
473 if (value != NULL && Universe::heap()->is_in_reserved(value)) {
474 f->do_oop(root);
475 }
476 }
477 // the next handle block is valid only if current block is full
478 if (current->_top < block_size_in_oops) {
479 break;
480 }
481 }
482 current_chain = current_chain->pop_frame_link();
483 }
484 }
485
486
487 jobject JNIHandleBlock::allocate_handle(oop obj) {
488 assert(Universe::heap()->is_in_reserved(obj), "sanity check");
489 if (_top == 0) {
490 // This is the first allocation or the initial block got zapped when
|