hotspot/src/os/solaris/vm/os_solaris.hpp
changeset 26683 a02753d5a0b2
parent 25472 381638db28e6
child 26684 d1221849ea3d
equal deleted inserted replaced
26331:8f17e084029b 26683:a02753d5a0b2
    59 
    59 
    60   typedef uintptr_t       lgrp_cookie_t;
    60   typedef uintptr_t       lgrp_cookie_t;
    61   typedef id_t            lgrp_id_t;
    61   typedef id_t            lgrp_id_t;
    62   typedef int             lgrp_rsrc_t;
    62   typedef int             lgrp_rsrc_t;
    63   typedef enum lgrp_view {
    63   typedef enum lgrp_view {
    64         LGRP_VIEW_CALLER,       /* what's available to the caller */
    64     LGRP_VIEW_CALLER,       /* what's available to the caller */
    65         LGRP_VIEW_OS            /* what's available to operating system */
    65     LGRP_VIEW_OS            /* what's available to operating system */
    66   } lgrp_view_t;
    66   } lgrp_view_t;
    67 
    67 
    68   typedef uint_t (*getisax_func_t)(uint32_t* array, uint_t n);
    68   typedef uint_t (*getisax_func_t)(uint32_t* array, uint_t n);
    69 
    69 
    70   typedef lgrp_id_t (*lgrp_home_func_t)(idtype_t idtype, id_t id);
    70   typedef lgrp_id_t (*lgrp_home_func_t)(idtype_t idtype, id_t id);
    72   typedef int (*lgrp_fini_func_t)(lgrp_cookie_t cookie);
    72   typedef int (*lgrp_fini_func_t)(lgrp_cookie_t cookie);
    73   typedef lgrp_id_t (*lgrp_root_func_t)(lgrp_cookie_t cookie);
    73   typedef lgrp_id_t (*lgrp_root_func_t)(lgrp_cookie_t cookie);
    74   typedef int (*lgrp_children_func_t)(lgrp_cookie_t  cookie,  lgrp_id_t  parent,
    74   typedef int (*lgrp_children_func_t)(lgrp_cookie_t  cookie,  lgrp_id_t  parent,
    75                                       lgrp_id_t *lgrp_array, uint_t lgrp_array_size);
    75                                       lgrp_id_t *lgrp_array, uint_t lgrp_array_size);
    76   typedef int (*lgrp_resources_func_t)(lgrp_cookie_t  cookie,  lgrp_id_t  lgrp,
    76   typedef int (*lgrp_resources_func_t)(lgrp_cookie_t  cookie,  lgrp_id_t  lgrp,
    77                                       lgrp_id_t *lgrp_array, uint_t lgrp_array_size,
    77                                        lgrp_id_t *lgrp_array, uint_t lgrp_array_size,
    78                                       lgrp_rsrc_t type);
    78                                        lgrp_rsrc_t type);
    79   typedef int (*lgrp_nlgrps_func_t)(lgrp_cookie_t cookie);
    79   typedef int (*lgrp_nlgrps_func_t)(lgrp_cookie_t cookie);
    80   typedef int (*lgrp_cookie_stale_func_t)(lgrp_cookie_t cookie);
    80   typedef int (*lgrp_cookie_stale_func_t)(lgrp_cookie_t cookie);
    81   typedef int (*meminfo_func_t)(const uint64_t inaddr[],   int addr_count,
    81   typedef int (*meminfo_func_t)(const uint64_t inaddr[],   int addr_count,
    82                                 const uint_t  info_req[],  int info_count,
    82                                 const uint_t  info_req[],  int info_count,
    83                                 uint64_t  outdata[], uint_t validity[]);
    83                                 uint64_t  outdata[], uint_t validity[]);
   126   static address handler_start, handler_end; // start and end pc of thr_sighndlrinfo
   126   static address handler_start, handler_end; // start and end pc of thr_sighndlrinfo
   127 
   127 
   128   static bool valid_stack_address(Thread* thread, address sp);
   128   static bool valid_stack_address(Thread* thread, address sp);
   129   static bool valid_ucontext(Thread* thread, ucontext_t* valid, ucontext_t* suspect);
   129   static bool valid_ucontext(Thread* thread, ucontext_t* valid, ucontext_t* suspect);
   130   static ucontext_t* get_valid_uc_in_signal_handler(Thread* thread,
   130   static ucontext_t* get_valid_uc_in_signal_handler(Thread* thread,
   131     ucontext_t* uc);
   131                                                     ucontext_t* uc);
   132 
   132 
   133   static ExtendedPC  ucontext_get_ExtendedPC(ucontext_t* uc);
   133   static ExtendedPC  ucontext_get_ExtendedPC(ucontext_t* uc);
   134   static intptr_t*   ucontext_get_sp(ucontext_t* uc);
   134   static intptr_t*   ucontext_get_sp(ucontext_t* uc);
   135   // ucontext_get_fp() is only used by Solaris X86 (see note below)
   135   // ucontext_get_fp() is only used by Solaris X86 (see note below)
   136   static intptr_t*   ucontext_get_fp(ucontext_t* uc);
   136   static intptr_t*   ucontext_get_fp(ucontext_t* uc);
   141   //
   141   //
   142   // We should have different declarations of this interface in
   142   // We should have different declarations of this interface in
   143   // os_solaris_i486.hpp and os_solaris_sparc.hpp, but that file
   143   // os_solaris_i486.hpp and os_solaris_sparc.hpp, but that file
   144   // provides extensions to the os class and not the Solaris class.
   144   // provides extensions to the os class and not the Solaris class.
   145   static ExtendedPC fetch_frame_from_ucontext(Thread* thread, ucontext_t* uc,
   145   static ExtendedPC fetch_frame_from_ucontext(Thread* thread, ucontext_t* uc,
   146     intptr_t** ret_sp, intptr_t** ret_fp);
   146                                               intptr_t** ret_sp, intptr_t** ret_fp);
   147 
   147 
   148   static void hotspot_sigmask(Thread* thread);
   148   static void hotspot_sigmask(Thread* thread);
   149 
   149 
   150   // SR_handler
   150   // SR_handler
   151   static void SR_handler(Thread* thread, ucontext_t* uc);
   151   static void SR_handler(Thread* thread, ucontext_t* uc);
   247   static id_t lgrp_home(idtype_t type, id_t id)      { return _lgrp_home != NULL ? _lgrp_home(type, id) : -1; }
   247   static id_t lgrp_home(idtype_t type, id_t id)      { return _lgrp_home != NULL ? _lgrp_home(type, id) : -1; }
   248   static lgrp_cookie_t lgrp_init(lgrp_view_t view)   { return _lgrp_init != NULL ? _lgrp_init(view) : 0; }
   248   static lgrp_cookie_t lgrp_init(lgrp_view_t view)   { return _lgrp_init != NULL ? _lgrp_init(view) : 0; }
   249   static int lgrp_fini(lgrp_cookie_t cookie)         { return _lgrp_fini != NULL ? _lgrp_fini(cookie) : -1; }
   249   static int lgrp_fini(lgrp_cookie_t cookie)         { return _lgrp_fini != NULL ? _lgrp_fini(cookie) : -1; }
   250   static lgrp_id_t lgrp_root(lgrp_cookie_t cookie)   { return _lgrp_root != NULL ? _lgrp_root(cookie) : -1; };
   250   static lgrp_id_t lgrp_root(lgrp_cookie_t cookie)   { return _lgrp_root != NULL ? _lgrp_root(cookie) : -1; };
   251   static int lgrp_children(lgrp_cookie_t  cookie,  lgrp_id_t  parent,
   251   static int lgrp_children(lgrp_cookie_t  cookie,  lgrp_id_t  parent,
   252                     lgrp_id_t *lgrp_array, uint_t lgrp_array_size) {
   252                            lgrp_id_t *lgrp_array, uint_t lgrp_array_size) {
   253     return _lgrp_children != NULL ? _lgrp_children(cookie, parent, lgrp_array, lgrp_array_size) : -1;
   253     return _lgrp_children != NULL ? _lgrp_children(cookie, parent, lgrp_array, lgrp_array_size) : -1;
   254   }
   254   }
   255   static int lgrp_resources(lgrp_cookie_t  cookie,  lgrp_id_t  lgrp,
   255   static int lgrp_resources(lgrp_cookie_t  cookie,  lgrp_id_t  lgrp,
   256                             lgrp_id_t *lgrp_array, uint_t lgrp_array_size,
   256                             lgrp_id_t *lgrp_array, uint_t lgrp_array_size,
   257                             lgrp_rsrc_t type) {
   257                             lgrp_rsrc_t type) {
   267   static bool supports_getisax()                     { return _getisax != NULL; }
   267   static bool supports_getisax()                     { return _getisax != NULL; }
   268   static uint_t getisax(uint32_t* array, uint_t n);
   268   static uint_t getisax(uint32_t* array, uint_t n);
   269 
   269 
   270   static void set_meminfo(meminfo_func_t func)       { _meminfo = func; }
   270   static void set_meminfo(meminfo_func_t func)       { _meminfo = func; }
   271   static int meminfo (const uint64_t inaddr[],   int addr_count,
   271   static int meminfo (const uint64_t inaddr[],   int addr_count,
   272                      const uint_t  info_req[],  int info_count,
   272                       const uint_t  info_req[],  int info_count,
   273                      uint64_t  outdata[], uint_t validity[]) {
   273                       uint64_t  outdata[], uint_t validity[]) {
   274     return _meminfo != NULL ? _meminfo(inaddr, addr_count, info_req, info_count,
   274     return _meminfo != NULL ? _meminfo(inaddr, addr_count, info_req, info_count,
   275                                        outdata, validity) : -1;
   275                                        outdata, validity) : -1;
   276   }
   276   }
   277 
   277 
   278   static sigset_t* unblocked_signals();
   278   static sigset_t* unblocked_signals();
   298   // none present
   298   // none present
   299 
   299 
   300 };
   300 };
   301 
   301 
   302 class PlatformEvent : public CHeapObj<mtInternal> {
   302 class PlatformEvent : public CHeapObj<mtInternal> {
   303   private:
   303  private:
   304     double CachePad[4];   // increase odds that _mutex is sole occupant of cache line
   304   double CachePad[4];   // increase odds that _mutex is sole occupant of cache line
   305     volatile int _Event;
   305   volatile int _Event;
   306     int _nParked;
   306   int _nParked;
   307     int _pipev[2];
   307   int _pipev[2];
   308     mutex_t _mutex[1];
   308   mutex_t _mutex[1];
   309     cond_t  _cond[1];
   309   cond_t  _cond[1];
   310     double PostPad[2];
   310   double PostPad[2];
   311 
   311 
   312   protected:
   312  protected:
   313     // Defining a protected ctor effectively gives us an abstract base class.
   313   // Defining a protected ctor effectively gives us an abstract base class.
   314     // That is, a PlatformEvent can never be instantiated "naked" but only
   314   // That is, a PlatformEvent can never be instantiated "naked" but only
   315     // as a part of a ParkEvent (recall that ParkEvent extends PlatformEvent).
   315   // as a part of a ParkEvent (recall that ParkEvent extends PlatformEvent).
   316     // TODO-FIXME: make dtor private
   316   // TODO-FIXME: make dtor private
   317     ~PlatformEvent() { guarantee(0, "invariant"); }
   317   ~PlatformEvent() { guarantee(0, "invariant"); }
   318     PlatformEvent() {
   318   PlatformEvent() {
   319       int status;
   319     int status;
   320       status = os::Solaris::cond_init(_cond);
   320     status = os::Solaris::cond_init(_cond);
   321       assert_status(status == 0, status, "cond_init");
   321     assert_status(status == 0, status, "cond_init");
   322       status = os::Solaris::mutex_init(_mutex);
   322     status = os::Solaris::mutex_init(_mutex);
   323       assert_status(status == 0, status, "mutex_init");
   323     assert_status(status == 0, status, "mutex_init");
   324       _Event   = 0;
   324     _Event   = 0;
   325       _nParked = 0;
   325     _nParked = 0;
   326       _pipev[0] = _pipev[1] = -1;
   326     _pipev[0] = _pipev[1] = -1;
   327     }
   327   }
   328 
   328 
   329   public:
   329  public:
   330     // Exercise caution using reset() and fired() -- they may require MEMBARs
   330   // Exercise caution using reset() and fired() -- they may require MEMBARs
   331     void reset() { _Event = 0; }
   331   void reset() { _Event = 0; }
   332     int  fired() { return _Event; }
   332   int  fired() { return _Event; }
   333     void park();
   333   void park();
   334     int  park(jlong millis);
   334   int  park(jlong millis);
   335     void unpark();
   335   void unpark();
   336 };
   336 };
   337 
   337 
   338 class PlatformParker : public CHeapObj<mtInternal> {
   338 class PlatformParker : public CHeapObj<mtInternal> {
   339   protected:
   339  protected:
   340     mutex_t _mutex[1];
   340   mutex_t _mutex[1];
   341     cond_t  _cond[1];
   341   cond_t  _cond[1];
   342 
   342 
   343   public:       // TODO-FIXME: make dtor private
   343  public:       // TODO-FIXME: make dtor private
   344     ~PlatformParker() { guarantee(0, "invariant"); }
   344   ~PlatformParker() { guarantee(0, "invariant"); }
   345 
   345 
   346   public:
   346  public:
   347     PlatformParker() {
   347   PlatformParker() {
   348       int status;
   348     int status;
   349       status = os::Solaris::cond_init(_cond);
   349     status = os::Solaris::cond_init(_cond);
   350       assert_status(status == 0, status, "cond_init");
   350     assert_status(status == 0, status, "cond_init");
   351       status = os::Solaris::mutex_init(_mutex);
   351     status = os::Solaris::mutex_init(_mutex);
   352       assert_status(status == 0, status, "mutex_init");
   352     assert_status(status == 0, status, "mutex_init");
   353     }
   353   }
   354 };
   354 };
   355 
   355 
   356 #endif // OS_SOLARIS_VM_OS_SOLARIS_HPP
   356 #endif // OS_SOLARIS_VM_OS_SOLARIS_HPP