< prev index next >

src/os/windows/vm/os_windows.hpp

Print this page
rev 13142 : 8183198: Factor out thread state serialization into a proper helper function
Reviewed-by:

@@ -121,10 +121,25 @@
     _thread_ptr_offset = offset;
   }
   static inline int get_thread_ptr_offset() { return _thread_ptr_offset; }
 };
 
+static void write_memory_serialize_page_with_handler(JavaThread* thread) {
+  // Due to chained nature of SEH handlers we have to be sure
+  // that our handler is always last handler before an attempt to write
+  // into serialization page - it can fault if we access this page
+  // right in the middle of protect/unprotect sequence by remote
+  // membar logic.
+  // __try/__except are very lightweight operations (only several
+  // instructions not affecting control flow directly on x86)
+  // so we can use it here, on very time critical path
+  __try {
+    write_memory_serialize_page(thread);
+  } __except (win32::serialize_fault_filter((_EXCEPTION_POINTERS*)_exception_info()))
+    {}
+}
+
 /*
  * Crash protection for the watcher thread. Wrap the callback
  * with a __try { call() }
  * To be able to use this - don't take locks, don't rely on destructors,
  * don't make OS library calls, don't allocate memory, don't print,
< prev index next >