--- a/hotspot/src/os/posix/vm/os_posix.hpp Mon May 29 20:48:10 2017 +0200
+++ b/hotspot/src/os/posix/vm/os_posix.hpp Tue May 30 17:14:52 2017 -0400
@@ -53,6 +53,9 @@
static size_t _vm_internal_thread_min_stack_allowed;
public:
+ static void init(void); // early initialization - no logging available
+ static void init_2(void);// later initialization - logging available
+
// Return default stack size for the specified thread type
static size_t default_stack_size(os::ThreadType thr_type);
// Check and sets minimum stack sizes
@@ -102,7 +105,6 @@
// On error, it will return NULL and set errno. The content of 'outbuf' is undefined.
// On truncation error ('outbuf' too small), it will return NULL and set errno to ENAMETOOLONG.
static char* realpath(const char* filename, char* outbuf, size_t outbuflen);
-
};
/*
@@ -125,4 +127,67 @@
sigjmp_buf _jmpbuf;
};
+#ifndef SOLARIS
+
+/*
+ * This is the platform-specific implementation underpinning
+ * the ParkEvent class, which itself underpins Java-level monitor
+ * operations. See park.hpp for details.
+ * These event objects are type-stable and immortal - we never delete them.
+ * Events are associated with a thread for the lifetime of the thread.
+ */
+class PlatformEvent : public CHeapObj<mtInternal> {
+ private:
+ double cachePad[4]; // Increase odds that _mutex is sole occupant of cache line
+ volatile int _event; // Event count/permit: -1, 0 or 1
+ volatile int _nParked; // Indicates if associated thread is blocked: 0 or 1
+ pthread_mutex_t _mutex[1]; // Native mutex for locking
+ pthread_cond_t _cond[1]; // Native condition variable for blocking
+ double postPad[2];
+
+ protected: // TODO-FIXME: make dtor private
+ ~PlatformEvent() { guarantee(false, "invariant"); } // immortal so can't delete
+
+ public:
+ PlatformEvent();
+ void park();
+ int park(jlong millis);
+ void unpark();
+
+ // Use caution with reset() and fired() -- they may require MEMBARs
+ void reset() { _event = 0; }
+ int fired() { return _event; }
+};
+
+// JSR166 support
+// PlatformParker provides the platform dependent base class for the
+// Parker class. It basically provides the internal data structures:
+// - mutex and convars
+// which are then used directly by the Parker methods defined in the OS
+// specific implementation files.
+// There is significant overlap between the funcionality supported in the
+// combination of Parker+PlatformParker and PlatformEvent (above). If Parker
+// were more like ObjectMonitor we could use PlatformEvent in both (with some
+// API updates of course). But Parker methods use fastpaths that break that
+// level of encapsulation - so combining the two remains a future project.
+
+class PlatformParker : public CHeapObj<mtInternal> {
+ protected:
+ enum {
+ REL_INDEX = 0,
+ ABS_INDEX = 1
+ };
+ int _cur_index; // which cond is in use: -1, 0, 1
+ pthread_mutex_t _mutex[1];
+ pthread_cond_t _cond[2]; // one for relative times and one for absolute
+
+ public: // TODO-FIXME: make dtor private
+ ~PlatformParker() { guarantee(false, "invariant"); }
+
+ public:
+ PlatformParker();
+};
+
+#endif // !SOLARIS
+
#endif // OS_POSIX_VM_OS_POSIX_HPP