< prev index next >
src/hotspot/share/runtime/jniHandles.cpp
Print this page
*** 53,75 ****
JNIHandles::_global_handles = OopStorageSet::create_strong("JNI Global");
JNIHandles::_weak_global_handles = OopStorageSet::create_weak("JNI Weak");
}
jobject JNIHandles::make_local(oop obj) {
! if (obj == NULL) {
! return NULL; // ignore null handles
! } else {
! Thread* thread = Thread::current();
! assert(oopDesc::is_oop(obj), "not an oop");
! assert(!current_thread_in_native(), "must not be in native");
! return thread->active_handles()->allocate_handle(obj);
! }
}
- // optimized versions
-
jobject JNIHandles::make_local(Thread* thread, oop obj) {
if (obj == NULL) {
return NULL; // ignore null handles
} else {
assert(oopDesc::is_oop(obj), "not an oop");
--- 53,66 ----
JNIHandles::_global_handles = OopStorageSet::create_strong("JNI Global");
JNIHandles::_weak_global_handles = OopStorageSet::create_weak("JNI Weak");
}
jobject JNIHandles::make_local(oop obj) {
! return make_local(Thread::current(), obj);
}
jobject JNIHandles::make_local(Thread* thread, oop obj) {
if (obj == NULL) {
return NULL; // ignore null handles
} else {
assert(oopDesc::is_oop(obj), "not an oop");
*** 77,99 ****
assert(!current_thread_in_native(), "must not be in native");
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(oopDesc::is_oop(obj), "not an oop");
- assert(!current_thread_in_native(), "must not be in native");
- return thread->active_handles()->allocate_handle(obj);
- }
- }
-
-
static void report_handle_allocation_failure(AllocFailType alloc_failmode,
const char* handle_kind) {
if (alloc_failmode == AllocFailStrategy::EXIT_OOM) {
// Fake size value, since we don't know the min allocation size here.
vm_exit_out_of_memory(sizeof(oop), OOM_MALLOC_ERROR,
--- 68,77 ----
< prev index next >