< prev index next >

src/os/windows/vm/os_windows.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  94 
  95 #ifndef _WIN64
  96   // A wrapper to install a structured exception handler for fast JNI accesors.
  97   static address fast_jni_accessor_wrapper(BasicType);
  98 #endif
  99 
 100   static void call_test_func_with_wrapper(void (*funcPtr)(void));
 101 
 102   // filter function to ignore faults on serializations page
 103   static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e);
 104 };
 105 
 106 /*
 107  * Crash protection for the watcher thread. Wrap the callback
 108  * with a __try { call() }
 109  * To be able to use this - don't take locks, don't rely on destructors,
 110  * don't make OS library calls, don't allocate memory, don't print,
 111  * don't call code that could leave the heap / memory in an inconsistent state,
 112  * or anything else where we are not in control if we suddenly jump out.
 113  */
 114 class WatcherThreadCrashProtection : public StackObj {
 115 public:
 116   WatcherThreadCrashProtection();




 117   bool call(os::CrashProtectionCallback& cb);




 118 };
 119 
 120 class PlatformEvent : public CHeapObj<mtInternal> {
 121   private:
 122     double CachePad [4] ;   // increase odds that _Event is sole occupant of cache line
 123     volatile int _Event ;
 124     HANDLE _ParkHandle ;
 125 
 126   public:       // TODO-FIXME: make dtor private
 127     ~PlatformEvent() { guarantee (0, "invariant") ; }
 128 
 129   public:
 130     PlatformEvent() {
 131       _Event   = 0 ;
 132       _ParkHandle = CreateEvent (NULL, false, false, NULL) ;
 133       guarantee (_ParkHandle != NULL, "invariant") ;
 134     }
 135 
 136     // Exercise caution using reset() and fired() - they may require MEMBARs
 137     void reset() { _Event = 0 ; }


   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  94 
  95 #ifndef _WIN64
  96   // A wrapper to install a structured exception handler for fast JNI accesors.
  97   static address fast_jni_accessor_wrapper(BasicType);
  98 #endif
  99 
 100   static void call_test_func_with_wrapper(void (*funcPtr)(void));
 101 
 102   // filter function to ignore faults on serializations page
 103   static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e);
 104 };
 105 
 106 /*
 107  * Crash protection for the watcher thread. Wrap the callback
 108  * with a __try { call() }
 109  * To be able to use this - don't take locks, don't rely on destructors,
 110  * don't make OS library calls, don't allocate memory, don't print,
 111  * don't call code that could leave the heap / memory in an inconsistent state,
 112  * or anything else where we are not in control if we suddenly jump out.
 113  */
 114 class ThreadCrashProtection : public StackObj {
 115 public:
 116   static bool is_crash_protected(Thread* thr) {
 117     return _crash_protection != NULL && _protected_thread == thr;
 118   }
 119 
 120   ThreadCrashProtection();
 121   bool call(os::CrashProtectionCallback& cb);
 122 private:
 123   static Thread* _protected_thread;
 124   static ThreadCrashProtection* _crash_protection;
 125   static volatile intptr_t _crash_mux;
 126 };
 127 
 128 class PlatformEvent : public CHeapObj<mtInternal> {
 129   private:
 130     double CachePad [4] ;   // increase odds that _Event is sole occupant of cache line
 131     volatile int _Event ;
 132     HANDLE _ParkHandle ;
 133 
 134   public:       // TODO-FIXME: make dtor private
 135     ~PlatformEvent() { guarantee (0, "invariant") ; }
 136 
 137   public:
 138     PlatformEvent() {
 139       _Event   = 0 ;
 140       _ParkHandle = CreateEvent (NULL, false, false, NULL) ;
 141       guarantee (_ParkHandle != NULL, "invariant") ;
 142     }
 143 
 144     // Exercise caution using reset() and fired() - they may require MEMBARs
 145     void reset() { _Event = 0 ; }


< prev index next >