6914050: jvm assertion "guard pages must be in use" in -Xcomp mode
authorcoleenp
Tue, 02 Mar 2010 12:09:40 -0800
changeset 5041 5bce37d77dde
parent 5038 de3fb1c2d510
child 5042 f86707fd195a
6914050: jvm assertion "guard pages must be in use" in -Xcomp mode Summary: Move creating stack guard pages in jni attach thread before potential java call rather than after. Also cleanup stack guard pages when jni attach fails Reviewed-by: never, dholmes
hotspot/src/share/vm/prims/jni.cpp
hotspot/src/share/vm/runtime/thread.cpp
--- a/hotspot/src/share/vm/prims/jni.cpp	Fri Feb 26 16:40:55 2010 -0500
+++ b/hotspot/src/share/vm/prims/jni.cpp	Tue Mar 02 12:09:40 2010 -0800
@@ -3401,12 +3401,16 @@
   thread->set_thread_state(_thread_in_vm);
   // Must do this before initialize_thread_local_storage
   thread->record_stack_base_and_size();
+
   thread->initialize_thread_local_storage();
 
   if (!os::create_attached_thread(thread)) {
     delete thread;
     return JNI_ERR;
   }
+  // Enable stack overflow checks
+  thread->create_stack_guard_pages();
+
   thread->initialize_tlab();
 
   // Crucial that we do not have a safepoint check for this thread, since it has
@@ -3452,9 +3456,6 @@
   // to regrab the threads_lock
   thread->set_attached();
 
-  // Enable stack overflow checks
-  thread->create_stack_guard_pages();
-
   // Set java thread status.
   java_lang_Thread::set_thread_status(thread->threadObj(),
               java_lang_Thread::RUNNABLE);
--- a/hotspot/src/share/vm/runtime/thread.cpp	Fri Feb 26 16:40:55 2010 -0500
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Tue Mar 02 12:09:40 2010 -0800
@@ -1637,6 +1637,9 @@
     JNIHandleBlock::release_block(block);
   }
 
+  // These have to be removed while this is still a valid thread.
+  remove_stack_guard_pages();
+
   if (UseTLAB) {
     tlab().make_parsable(true);  // retire TLAB, if any
   }