< prev index next > src/hotspot/share/prims/upcallStubs.cpp
Print this page
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "precompiled.hpp"
- #include "runtime/jniHandles.inline.hpp"
- #include "runtime/interfaceSupport.inline.hpp"
+ #include "code/codeBlob.hpp"
#include "code/codeCache.hpp"
- #include "runtime/vmOperations.hpp"
+ #include "runtime/interfaceSupport.inline.hpp"
JVM_ENTRY(static jboolean, UH_FreeUpcallStub0(JNIEnv *env, jobject _unused, jlong addr))
- //acquire code cache lock
- MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- //find code blob
+ // safe to call 'find_blob' without code cache lock, because stub is always alive
CodeBlob* cb = CodeCache::find_blob((char*)addr);
- if (cb == NULL) {
+ if (cb == nullptr) {
return false;
}
- //free global JNI handle
- jobject handle = NULL;
- if (cb->is_optimized_entry_blob()) {
- handle = ((OptimizedEntryBlob*)cb)->receiver();
- } else {
- jobject* handle_ptr = (jobject*)(void*)cb->content_begin();
- handle = *handle_ptr;
- }
- JNIHandles::destroy_global(handle);
- //free code blob
- CodeCache::free(cb);
+ OptimizedEntryBlob::free(cb->as_optimized_entry_blob());
return true;
JVM_END
#define CC (char*) /*cast a literal from (const char*)*/
#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f)
< prev index next >