src/share/vm/prims/whitebox.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/prims/whitebox.cpp

src/share/vm/prims/whitebox.cpp

Print this page
rev 7390 : 8064669: compiler/whitebox/AllocationCodeBlobTest.java crashes / asserts
Reviewed-by: kvn, anoll

*** 42,51 **** --- 42,52 ---- #include "runtime/deoptimization.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/os.hpp" #include "runtime/vm_version.hpp" #include "runtime/sweeper.hpp" + #include "runtime/javaCalls.hpp" #include "utilities/array.hpp" #include "utilities/debug.hpp" #include "utilities/macros.hpp" #include "utilities/exceptions.hpp"
*** 740,760 **** MonitorLockerEx mo(Compilation_lock, Mutex::_no_safepoint_check_flag); WhiteBox::compilation_locked = false; mo.notify_all(); WB_END ! void WhiteBox::force_sweep() { ! guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled"); { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); NMethodSweeper::_should_sweep = true; } NMethodSweeper::possibly_sweep(); } ! WB_ENTRY(void, WB_ForceNMethodSweep(JNIEnv* env, jobject o)) ! WhiteBox::force_sweep(); WB_END WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString)) ResourceMark rm(THREAD); int len; --- 741,790 ---- MonitorLockerEx mo(Compilation_lock, Mutex::_no_safepoint_check_flag); WhiteBox::compilation_locked = false; mo.notify_all(); WB_END ! void WhiteBox::sweeper_thread_entry(JavaThread* thread, TRAPS) { ! guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled"); { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); NMethodSweeper::_should_sweep = true; } NMethodSweeper::possibly_sweep(); } ! JavaThread* WhiteBox::create_sweeper_thread(TRAPS) { ! // create sweeper thread w/ custom entry -- one iteration instead of loop ! CodeCacheSweeperThread* sweeper_thread = new CodeCacheSweeperThread(); ! sweeper_thread->set_entry_point(&WhiteBox::sweeper_thread_entry); ! ! // create j.l.Thread object and associate it w/ sweeper thread ! { ! // inherit deamon property from current thread ! bool is_daemon = java_lang_Thread::is_daemon(JavaThread::current()->threadObj()); ! ! HandleMark hm(THREAD); ! Handle thread_group(THREAD, Universe::system_thread_group()); ! const char* name = "WB Sweeper thread"; ! sweeper_thread->allocate_threadObj(thread_group, name, is_daemon, THREAD); ! } ! ! { ! MutexLocker mu(Threads_lock, THREAD); ! Threads::add(sweeper_thread); ! } ! return sweeper_thread; ! } ! ! WB_ENTRY(jobject, WB_ForceNMethodSweep(JNIEnv* env, jobject o)) ! JavaThread* sweeper_thread = WhiteBox::create_sweeper_thread(Thread::current()); ! if (sweeper_thread == NULL) { ! return NULL; ! } ! jobject result = JNIHandles::make_local(env, sweeper_thread->threadObj()); ! Thread::start(sweeper_thread); ! return result; WB_END WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString)) ResourceMark rm(THREAD); int len;
*** 800,815 **** return features_string; WB_END int WhiteBox::get_blob_type(const CodeBlob* code) { ! guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled"); return CodeCache::get_code_heap(code)->code_blob_type(); } CodeHeap* WhiteBox::get_code_heap(int blob_type) { ! guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled"); return CodeCache::get_code_heap(blob_type); } struct CodeBlobStub { CodeBlobStub(const CodeBlob* blob) : --- 830,845 ---- return features_string; WB_END int WhiteBox::get_blob_type(const CodeBlob* code) { ! guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled"); return CodeCache::get_code_heap(code)->code_blob_type(); } CodeHeap* WhiteBox::get_code_heap(int blob_type) { ! guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled"); return CodeCache::get_code_heap(blob_type); } struct CodeBlobStub { CodeBlobStub(const CodeBlob* blob) :
*** 881,903 **** return result; WB_END CodeBlob* WhiteBox::allocate_code_blob(int size, int blob_type) { ! guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled"); BufferBlob* blob; int full_size = CodeBlob::align_code_offset(sizeof(BufferBlob)); if (full_size < size) { full_size += round_to(size - full_size, oopSize); } { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); blob = (BufferBlob*) CodeCache::allocate(full_size, blob_type); } // Track memory usage statistic after releasing CodeCache_lock MemoryService::track_code_cache_memory_usage(); - ::new (blob) BufferBlob("WB::DummyBlob", full_size); return blob; } WB_ENTRY(jlong, WB_AllocateCodeBlob(JNIEnv* env, jobject o, jint size, jint blob_type)) return (jlong) WhiteBox::allocate_code_blob(size, blob_type); --- 911,933 ---- return result; WB_END CodeBlob* WhiteBox::allocate_code_blob(int size, int blob_type) { ! guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled"); BufferBlob* blob; int full_size = CodeBlob::align_code_offset(sizeof(BufferBlob)); if (full_size < size) { full_size += round_to(size - full_size, oopSize); } { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); blob = (BufferBlob*) CodeCache::allocate(full_size, blob_type); + ::new (blob) BufferBlob("WB::DummyBlob", full_size); } // Track memory usage statistic after releasing CodeCache_lock MemoryService::track_code_cache_memory_usage(); return blob; } WB_ENTRY(jlong, WB_AllocateCodeBlob(JNIEnv* env, jobject o, jint size, jint blob_type)) return (jlong) WhiteBox::allocate_code_blob(size, blob_type);
*** 1198,1208 **** {CC"incMetaspaceCapacityUntilGC", CC"(J)J", (void*)&WB_IncMetaspaceCapacityUntilGC }, {CC"metaspaceCapacityUntilGC", CC"()J", (void*)&WB_MetaspaceCapacityUntilGC }, {CC"getCPUFeatures", CC"()Ljava/lang/String;", (void*)&WB_GetCPUFeatures }, {CC"getNMethod", CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;", (void*)&WB_GetNMethod }, ! {CC"forceNMethodSweep", CC"()V", (void*)&WB_ForceNMethodSweep }, {CC"allocateCodeBlob", CC"(II)J", (void*)&WB_AllocateCodeBlob }, {CC"freeCodeBlob", CC"(J)V", (void*)&WB_FreeCodeBlob }, {CC"getCodeHeapEntries", CC"(I)[Ljava/lang/Object;",(void*)&WB_GetCodeHeapEntries }, {CC"getCompilationActivityMode", CC"()I", (void*)&WB_GetCompilationActivityMode}, --- 1228,1238 ---- {CC"incMetaspaceCapacityUntilGC", CC"(J)J", (void*)&WB_IncMetaspaceCapacityUntilGC }, {CC"metaspaceCapacityUntilGC", CC"()J", (void*)&WB_MetaspaceCapacityUntilGC }, {CC"getCPUFeatures", CC"()Ljava/lang/String;", (void*)&WB_GetCPUFeatures }, {CC"getNMethod", CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;", (void*)&WB_GetNMethod }, ! {CC"forceNMethodSweep0", CC"()Ljava/lang/Thread;", (void*)&WB_ForceNMethodSweep }, {CC"allocateCodeBlob", CC"(II)J", (void*)&WB_AllocateCodeBlob }, {CC"freeCodeBlob", CC"(J)V", (void*)&WB_FreeCodeBlob }, {CC"getCodeHeapEntries", CC"(I)[Ljava/lang/Object;",(void*)&WB_GetCodeHeapEntries }, {CC"getCompilationActivityMode", CC"()I", (void*)&WB_GetCompilationActivityMode},
src/share/vm/prims/whitebox.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File