< prev index next >
src/share/vm/runtime/jniHandles.cpp
Print this page
rev 12906 : [mq]: gc_interface
*** 26,46 ****
#include "classfile/systemDictionary.hpp"
#include "logging/log.hpp"
#include "memory/iterator.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/jniHandles.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/thread.inline.hpp"
- #if INCLUDE_ALL_GCS
- #include "gc/g1/g1SATBCardTableModRefBS.hpp"
- #endif
JNIHandleBlock* JNIHandles::_global_handles = NULL;
JNIHandleBlock* JNIHandles::_weak_global_handles = NULL;
oop JNIHandles::_deleted_handle = NULL;
jobject JNIHandles::make_local(oop obj) {
if (obj == NULL) {
return NULL; // ignore null handles
} else {
--- 26,52 ----
#include "classfile/systemDictionary.hpp"
#include "logging/log.hpp"
#include "memory/iterator.hpp"
#include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp"
+ #include "runtime/access.inline.hpp"
#include "runtime/jniHandles.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/thread.inline.hpp"
JNIHandleBlock* JNIHandles::_global_handles = NULL;
JNIHandleBlock* JNIHandles::_weak_global_handles = NULL;
oop JNIHandles::_deleted_handle = NULL;
+ oop JNIHandles::resolve_handle(jobject handle) {
+ oop* addr = oop_addr(handle);
+ if (is_jweak(handle)) {
+ return RootAccess<GC_ACCESS_ON_PHANTOM>::oop_load(addr);
+ } else {
+ return RootAccess<GC_ACCESS_ON_STRONG>::oop_load(addr);
+ }
+ }
jobject JNIHandles::make_local(oop obj) {
if (obj == NULL) {
return NULL; // ignore null handles
} else {
*** 48,58 ****
assert(Universe::heap()->is_in_reserved(obj), "sanity check");
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
--- 54,63 ----
*** 108,144 ****
CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
}
return res;
}
- template<bool external_guard>
- oop JNIHandles::resolve_jweak(jweak handle) {
- assert(is_jweak(handle), "precondition");
- oop result = jweak_ref(handle);
- result = guard_value<external_guard>(result);
- #if INCLUDE_ALL_GCS
- if (result != NULL && UseG1GC) {
- G1SATBCardTableModRefBS::enqueue(result);
- }
- #endif // INCLUDE_ALL_GCS
- return result;
- }
-
- template oop JNIHandles::resolve_jweak<true>(jweak);
- template oop JNIHandles::resolve_jweak<false>(jweak);
-
void JNIHandles::destroy_global(jobject handle) {
if (handle != NULL) {
assert(is_global_handle(handle), "Invalid delete of global JNI handle");
! jobject_ref(handle) = deleted_handle();
}
}
void JNIHandles::destroy_weak_global(jobject handle) {
if (handle != NULL) {
! jweak_ref(handle) = deleted_handle();
}
}
void JNIHandles::oops_do(OopClosure* f) {
--- 113,133 ----
CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
}
return res;
}
void JNIHandles::destroy_global(jobject handle) {
if (handle != NULL) {
assert(is_global_handle(handle), "Invalid delete of global JNI handle");
! *oop_addr(handle) = deleted_handle();
}
}
void JNIHandles::destroy_weak_global(jobject handle) {
if (handle != NULL) {
! *oop_addr(handle) = deleted_handle();
}
}
void JNIHandles::oops_do(OopClosure* f) {
< prev index next >