< prev index next >

src/share/vm/runtime/jniHandles.cpp

Print this page
rev 12854 : [mq]: gcinterface.patch

*** 43,53 **** jobject JNIHandles::make_local(oop obj) { if (obj == NULL) { return NULL; // ignore null handles } else { Thread* thread = Thread::current(); ! assert(Universe::heap()->is_in_reserved(obj), "sanity check"); return thread->active_handles()->allocate_handle(obj); } } --- 43,53 ---- jobject JNIHandles::make_local(oop obj) { if (obj == NULL) { return NULL; // ignore null handles } else { Thread* thread = Thread::current(); ! assert(GC::gc()->heap()->is_in_reserved(obj), "sanity check"); return thread->active_handles()->allocate_handle(obj); } }
*** 55,105 **** jobject JNIHandles::make_local(Thread* thread, oop obj) { if (obj == NULL) { return NULL; // ignore null handles } else { ! assert(Universe::heap()->is_in_reserved(obj), "sanity check"); return thread->active_handles()->allocate_handle(obj); } } jobject JNIHandles::make_local(JNIEnv* env, oop obj) { if (obj == NULL) { return NULL; // ignore null handles } else { JavaThread* thread = JavaThread::thread_from_jni_environment(env); ! assert(Universe::heap()->is_in_reserved(obj), "sanity check"); return thread->active_handles()->allocate_handle(obj); } } jobject JNIHandles::make_global(Handle obj) { ! assert(!Universe::heap()->is_gc_active(), "can't extend the root set during GC"); jobject res = NULL; if (!obj.is_null()) { // ignore null handles MutexLocker ml(JNIGlobalHandle_lock); ! assert(Universe::heap()->is_in_reserved(obj()), "sanity check"); res = _global_handles->allocate_handle(obj()); } else { CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); } return res; } jobject JNIHandles::make_weak_global(Handle obj) { ! assert(!Universe::heap()->is_gc_active(), "can't extend the root set during GC"); jobject res = NULL; if (!obj.is_null()) { // ignore null handles { MutexLocker ml(JNIGlobalHandle_lock); ! assert(Universe::heap()->is_in_reserved(obj()), "sanity check"); res = _weak_global_handles->allocate_handle(obj()); } // Add weak tag. assert(is_ptr_aligned(res, weak_tag_alignment), "invariant"); char* tptr = reinterpret_cast<char*>(res) + weak_tag_value; --- 55,105 ---- jobject JNIHandles::make_local(Thread* thread, oop obj) { if (obj == NULL) { return NULL; // ignore null handles } else { ! assert(GC::gc()->heap()->is_in_reserved(obj), "sanity check"); return thread->active_handles()->allocate_handle(obj); } } jobject JNIHandles::make_local(JNIEnv* env, oop obj) { if (obj == NULL) { return NULL; // ignore null handles } else { JavaThread* thread = JavaThread::thread_from_jni_environment(env); ! assert(GC::gc()->heap()->is_in_reserved(obj), "sanity check"); return thread->active_handles()->allocate_handle(obj); } } jobject JNIHandles::make_global(Handle obj) { ! assert(!GC::gc()->heap()->is_gc_active(), "can't extend the root set during GC"); jobject res = NULL; if (!obj.is_null()) { // ignore null handles MutexLocker ml(JNIGlobalHandle_lock); ! assert(GC::gc()->heap()->is_in_reserved(obj()), "sanity check"); res = _global_handles->allocate_handle(obj()); } else { CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops()); } return res; } jobject JNIHandles::make_weak_global(Handle obj) { ! assert(!GC::gc()->heap()->is_gc_active(), "can't extend the root set during GC"); jobject res = NULL; if (!obj.is_null()) { // ignore null handles { MutexLocker ml(JNIGlobalHandle_lock); ! assert(GC::gc()->heap()->is_in_reserved(obj()), "sanity check"); res = _weak_global_handles->allocate_handle(obj()); } // Add weak tag. assert(is_ptr_aligned(res, weak_tag_alignment), "invariant"); char* tptr = reinterpret_cast<char*>(res) + weak_tag_value;
*** 382,392 **** for (int index = 0; index < current->_top; index++) { oop* root = &(current->_handles)[index]; oop value = *root; // traverse heap pointers only, not deleted handles or free list // pointers ! if (value != NULL && Universe::heap()->is_in_reserved(value)) { f->do_oop(root); } } // the next handle block is valid only if current block is full if (current->_top < block_size_in_oops) { --- 382,392 ---- for (int index = 0; index < current->_top; index++) { oop* root = &(current->_handles)[index]; oop value = *root; // traverse heap pointers only, not deleted handles or free list // pointers ! if (value != NULL && GC::gc()->heap()->is_in_reserved(value)) { f->do_oop(root); } } // the next handle block is valid only if current block is full if (current->_top < block_size_in_oops) {
*** 405,415 **** "blocks holding weak global JNI handles should not have pop frame link set"); for (int index = 0; index < current->_top; index++) { oop* root = &(current->_handles)[index]; oop value = *root; // traverse heap pointers only, not deleted handles or free list pointers ! if (value != NULL && Universe::heap()->is_in_reserved(value)) { if (is_alive->do_object_b(value)) { // The weakly referenced object is alive, update pointer f->do_oop(root); } else { // The weakly referenced object is not alive, clear the reference by storing NULL --- 405,415 ---- "blocks holding weak global JNI handles should not have pop frame link set"); for (int index = 0; index < current->_top; index++) { oop* root = &(current->_handles)[index]; oop value = *root; // traverse heap pointers only, not deleted handles or free list pointers ! if (value != NULL && GC::gc()->heap()->is_in_reserved(value)) { if (is_alive->do_object_b(value)) { // The weakly referenced object is alive, update pointer f->do_oop(root); } else { // The weakly referenced object is not alive, clear the reference by storing NULL
*** 431,441 **** JvmtiExport::weak_oops_do(is_alive, f); } jobject JNIHandleBlock::allocate_handle(oop obj) { ! assert(Universe::heap()->is_in_reserved(obj), "sanity check"); if (_top == 0) { // This is the first allocation or the initial block got zapped when // entering a native function. If we have any following blocks they are // not valid anymore. for (JNIHandleBlock* current = _next; current != NULL; --- 431,441 ---- JvmtiExport::weak_oops_do(is_alive, f); } jobject JNIHandleBlock::allocate_handle(oop obj) { ! assert(GC::gc()->heap()->is_in_reserved(obj), "sanity check"); if (_top == 0) { // This is the first allocation or the initial block got zapped when // entering a native function. If we have any following blocks they are // not valid anymore. for (JNIHandleBlock* current = _next; current != NULL;
< prev index next >