hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp
author kevinw
Mon, 08 Feb 2016 15:46:25 +0530
changeset 36093 82506a4dacdd
parent 31585 de50b10196d7
child 36346 0a02e923ec29
permissions -rw-r--r--
8144957: Remove PICL warning message Summary: There is no need to print any error/warning message when a library needed for performance optimization is not found on the system Reviewed-by: poonam, kvn Contributed-by: Shafi Ahmad <shafi.s.ahmad@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
31515
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 30217
diff changeset
     2
 * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2255
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2255
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2255
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7115
diff changeset
    25
#include "precompiled.hpp"
25949
34557722059b 6424123: JVM crashes on failed 'strdup' call
zgu
parents: 24953
diff changeset
    26
#include "memory/allocation.hpp"
34557722059b 6424123: JVM crashes on failed 'strdup' call
zgu
parents: 24953
diff changeset
    27
#include "memory/allocation.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7115
diff changeset
    28
#include "runtime/os.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7115
diff changeset
    29
#include "vm_version_sparc.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    31
#include <sys/auxv.h>
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    32
#include <sys/auxv_SPARC.h>
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    33
#include <sys/systeminfo.h>
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    34
#include <kstat.h>
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    35
#include <picl.h>
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    36
#include <dlfcn.h>
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    37
#include <link.h>
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    38
27456
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
    39
extern "C" static int PICL_visit_cpu_helper(picl_nodehdl_t nodeh, void *result);
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    40
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    41
// Functions from the library we need (signatures should match those in picl.h)
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    42
extern "C" {
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    43
  typedef int (*picl_initialize_func_t)(void);
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    44
  typedef int (*picl_shutdown_func_t)(void);
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    45
  typedef int (*picl_get_root_func_t)(picl_nodehdl_t *nodehandle);
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    46
  typedef int (*picl_walk_tree_by_class_func_t)(picl_nodehdl_t rooth,
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    47
      const char *classname, void *c_args,
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    48
      int (*callback_fn)(picl_nodehdl_t hdl, void *args));
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    49
  typedef int (*picl_get_prop_by_name_func_t)(picl_nodehdl_t nodeh, const char *nm,
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    50
      picl_prophdl_t *ph);
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    51
  typedef int (*picl_get_propval_func_t)(picl_prophdl_t proph, void *valbuf, size_t sz);
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    52
  typedef int (*picl_get_propinfo_func_t)(picl_prophdl_t proph, picl_propinfo_t *pi);
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    53
}
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    54
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    55
class PICL {
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    56
  // Pointers to functions in the library
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    57
  picl_initialize_func_t _picl_initialize;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    58
  picl_shutdown_func_t _picl_shutdown;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    59
  picl_get_root_func_t _picl_get_root;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    60
  picl_walk_tree_by_class_func_t _picl_walk_tree_by_class;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    61
  picl_get_prop_by_name_func_t _picl_get_prop_by_name;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    62
  picl_get_propval_func_t _picl_get_propval;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    63
  picl_get_propinfo_func_t _picl_get_propinfo;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    64
  // Handle to the library that is returned by dlopen
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    65
  void *_dl_handle;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    66
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    67
  bool open_library();
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    68
  void close_library();
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    69
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    70
  template<typename FuncType> bool bind(FuncType& func, const char* name);
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    71
  bool bind_library_functions();
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    72
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    73
  // Get a value of the integer property. The value in the tree can be either 32 or 64 bit
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    74
  // depending on the platform. The result is converted to int.
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    75
  int get_int_property(picl_nodehdl_t nodeh, const char* name, int* result) {
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    76
    picl_propinfo_t pinfo;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    77
    picl_prophdl_t proph;
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    78
    if (_picl_get_prop_by_name(nodeh, name, &proph) != PICL_SUCCESS ||
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    79
        _picl_get_propinfo(proph, &pinfo) != PICL_SUCCESS) {
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    80
      return PICL_FAILURE;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    81
    }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    82
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    83
    if (pinfo.type != PICL_PTYPE_INT && pinfo.type != PICL_PTYPE_UNSIGNED_INT) {
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    84
      assert(false, "Invalid property type");
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    85
      return PICL_FAILURE;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    86
    }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    87
    if (pinfo.size == sizeof(int64_t)) {
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    88
      int64_t val;
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    89
      if (_picl_get_propval(proph, &val, sizeof(int64_t)) != PICL_SUCCESS) {
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    90
        return PICL_FAILURE;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    91
      }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    92
      *result = static_cast<int>(val);
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    93
    } else if (pinfo.size == sizeof(int32_t)) {
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    94
      int32_t val;
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
    95
      if (_picl_get_propval(proph, &val, sizeof(int32_t)) != PICL_SUCCESS) {
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    96
        return PICL_FAILURE;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    97
      }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    98
      *result = static_cast<int>(val);
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
    99
    } else {
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   100
      assert(false, "Unexpected integer property size");
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   101
      return PICL_FAILURE;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   102
    }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   103
    return PICL_SUCCESS;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   104
  }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   105
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   106
  // Visitor and a state machine that visits integer properties and verifies that the
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   107
  // values are the same. Stores the unique value observed.
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   108
  class UniqueValueVisitor {
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   109
    PICL *_picl;
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   110
    enum {
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   111
      INITIAL,        // Start state, no assignments happened
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   112
      ASSIGNED,       // Assigned a value
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   113
      INCONSISTENT    // Inconsistent value seen
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   114
    } _state;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   115
    int _value;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   116
  public:
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   117
    UniqueValueVisitor(PICL* picl) : _picl(picl), _state(INITIAL) { }
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   118
    int value() {
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   119
      assert(_state == ASSIGNED, "Precondition");
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   120
      return _value;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   121
    }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   122
    void set_value(int value) {
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   123
      assert(_state == INITIAL, "Precondition");
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   124
      _value = value;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   125
      _state = ASSIGNED;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   126
    }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   127
    bool is_initial()       { return _state == INITIAL;      }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   128
    bool is_assigned()      { return _state == ASSIGNED;     }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   129
    bool is_inconsistent()  { return _state == INCONSISTENT; }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   130
    void set_inconsistent() { _state = INCONSISTENT;         }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   131
30217
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   132
    bool visit(picl_nodehdl_t nodeh, const char* name) {
27456
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   133
      assert(!is_inconsistent(), "Precondition");
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   134
      int curr;
27456
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   135
      if (_picl->get_int_property(nodeh, name, &curr) == PICL_SUCCESS) {
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   136
        if (!is_assigned()) { // first iteration
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   137
          set_value(curr);
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   138
        } else if (curr != value()) { // following iterations
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   139
          set_inconsistent();
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   140
        }
30217
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   141
        return true;
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   142
      }
30217
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   143
      return false;
27456
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   144
    }
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   145
  };
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   146
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   147
  class CPUVisitor {
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   148
    UniqueValueVisitor _l1_visitor;
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   149
    UniqueValueVisitor _l2_visitor;
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   150
    int _limit; // number of times visit() can be run
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   151
  public:
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   152
    CPUVisitor(PICL *picl, int limit) : _l1_visitor(picl), _l2_visitor(picl), _limit(limit) {}
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   153
    static int visit(picl_nodehdl_t nodeh, void *arg) {
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   154
      CPUVisitor *cpu_visitor = static_cast<CPUVisitor*>(arg);
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   155
      UniqueValueVisitor* l1_visitor = cpu_visitor->l1_visitor();
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   156
      UniqueValueVisitor* l2_visitor = cpu_visitor->l2_visitor();
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   157
      if (!l1_visitor->is_inconsistent()) {
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   158
        l1_visitor->visit(nodeh, "l1-dcache-line-size");
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   159
      }
30217
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   160
      static const char* l2_data_cache_line_property_name = NULL;
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   161
      // On the first visit determine the name of the l2 cache line size property and memoize it.
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   162
      if (l2_data_cache_line_property_name == NULL) {
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   163
        assert(!l2_visitor->is_inconsistent(), "First iteration cannot be inconsistent");
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   164
        l2_data_cache_line_property_name = "l2-cache-line-size";
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   165
        if (!l2_visitor->visit(nodeh, l2_data_cache_line_property_name)) {
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   166
          l2_data_cache_line_property_name = "l2-dcache-line-size";
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   167
          l2_visitor->visit(nodeh, l2_data_cache_line_property_name);
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   168
        }
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   169
      } else {
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   170
        if (!l2_visitor->is_inconsistent()) {
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   171
          l2_visitor->visit(nodeh, l2_data_cache_line_property_name);
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   172
        }
27456
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   173
      }
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   174
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   175
      if (l1_visitor->is_inconsistent() && l2_visitor->is_inconsistent()) {
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   176
        return PICL_WALK_TERMINATE;
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   177
      }
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   178
      cpu_visitor->_limit--;
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   179
      if (cpu_visitor->_limit <= 0) {
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   180
        return PICL_WALK_TERMINATE;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   181
      }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   182
      return PICL_WALK_CONTINUE;
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   183
    }
27456
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   184
    UniqueValueVisitor* l1_visitor() { return &_l1_visitor; }
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   185
    UniqueValueVisitor* l2_visitor() { return &_l2_visitor; }
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   186
  };
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   187
  int _L1_data_cache_line_size;
30217
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   188
  int _L2_data_cache_line_size;
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   189
public:
27456
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   190
  static int visit_cpu(picl_nodehdl_t nodeh, void *state) {
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   191
    return CPUVisitor::visit(nodeh, state);
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   192
  }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   193
31585
de50b10196d7 8080012: JVM times out with vdbench on SPARC M7-16
iveresov
parents: 31515
diff changeset
   194
  PICL(bool is_fujitsu, bool is_sun4v) : _L1_data_cache_line_size(0), _L2_data_cache_line_size(0), _dl_handle(NULL) {
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   195
    if (!open_library()) {
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   196
      return;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   197
    }
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   198
    if (_picl_initialize() == PICL_SUCCESS) {
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   199
      picl_nodehdl_t rooth;
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   200
      if (_picl_get_root(&rooth) == PICL_SUCCESS) {
27456
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   201
        const char* cpu_class = "cpu";
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   202
        // If it's a Fujitsu machine, it's a "core"
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   203
        if (is_fujitsu) {
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   204
          cpu_class = "core";
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   205
        }
31585
de50b10196d7 8080012: JVM times out with vdbench on SPARC M7-16
iveresov
parents: 31515
diff changeset
   206
        CPUVisitor cpu_visitor(this, (is_sun4v && !is_fujitsu) ? 1 : os::processor_count());
27456
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   207
        _picl_walk_tree_by_class(rooth, cpu_class, &cpu_visitor, PICL_visit_cpu_helper);
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   208
        if (cpu_visitor.l1_visitor()->is_assigned()) { // Is there a value?
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   209
          _L1_data_cache_line_size = cpu_visitor.l1_visitor()->value();
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   210
        }
27456
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   211
        if (cpu_visitor.l2_visitor()->is_assigned()) {
30217
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   212
          _L2_data_cache_line_size = cpu_visitor.l2_visitor()->value();
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   213
        }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   214
      }
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   215
      _picl_shutdown();
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   216
    }
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   217
    close_library();
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   218
  }
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   219
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   220
  unsigned int L1_data_cache_line_size() const { return _L1_data_cache_line_size; }
30217
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   221
  unsigned int L2_data_cache_line_size() const { return _L2_data_cache_line_size; }
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   222
};
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   223
27456
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   224
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   225
extern "C" static int PICL_visit_cpu_helper(picl_nodehdl_t nodeh, void *result) {
854b988388f3 8062591: SPARC PICL causes significantly longer startup times
iveresov
parents: 27426
diff changeset
   226
  return PICL::visit_cpu(nodeh, result);
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   227
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
27426
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   229
template<typename FuncType>
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   230
bool PICL::bind(FuncType& func, const char* name) {
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   231
  func = reinterpret_cast<FuncType>(dlsym(_dl_handle, name));
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   232
  return func != NULL;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   233
}
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   234
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   235
bool PICL::bind_library_functions() {
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   236
  assert(_dl_handle != NULL, "library should be open");
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   237
  return bind(_picl_initialize,         "picl_initialize"        ) &&
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   238
         bind(_picl_shutdown,           "picl_shutdown"          ) &&
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   239
         bind(_picl_get_root,           "picl_get_root"          ) &&
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   240
         bind(_picl_walk_tree_by_class, "picl_walk_tree_by_class") &&
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   241
         bind(_picl_get_prop_by_name,   "picl_get_prop_by_name"  ) &&
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   242
         bind(_picl_get_propval,        "picl_get_propval"       ) &&
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   243
         bind(_picl_get_propinfo,       "picl_get_propinfo"      );
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   244
}
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   245
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   246
bool PICL::open_library() {
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   247
  _dl_handle = dlopen("libpicl.so.1", RTLD_LAZY);
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   248
  if (_dl_handle == NULL) {
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   249
    return false;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   250
  }
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   251
  if (!bind_library_functions()) {
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   252
    assert(false, "unexpected PICL API change");
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   253
    close_library();
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   254
    return false;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   255
  }
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   256
  return true;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   257
}
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   258
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   259
void PICL::close_library() {
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   260
  assert(_dl_handle != NULL, "library should be open");
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   261
  dlclose(_dl_handle);
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   262
  _dl_handle = NULL;
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   263
}
66fc2ab37003 8059200: Promoted JDK9 b31 for Solaris-amd64 fails (Error: dl failure on line 744, no picl library) on Solaris 11.1
iveresov
parents: 26579
diff changeset
   264
2253
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   265
// We need to keep these here as long as we have to build on Solaris
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   266
// versions before 10.
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   267
#ifndef SI_ARCHITECTURE_32
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   268
#define SI_ARCHITECTURE_32      516     /* basic 32-bit SI_ARCHITECTURE */
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   269
#endif
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   270
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   271
#ifndef SI_ARCHITECTURE_64
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   272
#define SI_ARCHITECTURE_64      517     /* basic 64-bit SI_ARCHITECTURE */
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   273
#endif
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   274
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   275
static void do_sysinfo(int si, const char* string, int* features, int mask) {
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   276
  char   tmp;
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   277
  size_t bufsize = sysinfo(si, &tmp, 1);
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   278
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   279
  // All SI defines used below must be supported.
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   280
  guarantee(bufsize != -1, "must be supported");
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   281
25949
34557722059b 6424123: JVM crashes on failed 'strdup' call
zgu
parents: 24953
diff changeset
   282
  char* buf = (char*) os::malloc(bufsize, mtInternal);
2253
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   283
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   284
  if (buf == NULL)
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   285
    return;
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   286
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   287
  if (sysinfo(si, buf, bufsize) == bufsize) {
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   288
    // Compare the string.
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   289
    if (strcmp(buf, string) == 0) {
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   290
      *features |= mask;
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   291
    }
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   292
  }
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   293
25949
34557722059b 6424123: JVM crashes on failed 'strdup' call
zgu
parents: 24953
diff changeset
   294
  os::free(buf);
2253
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   295
}
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   296
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
int VM_Version::platform_features(int features) {
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   298
  assert(os::Solaris::supports_getisax(), "getisax() must be available");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   300
  // Check 32-bit architecture.
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   301
  do_sysinfo(SI_ARCHITECTURE_32, "sparc", &features, v8_instructions_m);
2253
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   302
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   303
  // Check 64-bit architecture.
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   304
  do_sysinfo(SI_ARCHITECTURE_64, "sparcv9", &features, generic_v9_m);
2253
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   305
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   306
  // Extract valid instruction set extensions.
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   307
  uint_t avs[2];
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   308
  uint_t avn = os::Solaris::getisax(avs, 2);
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   309
  assert(avn <= 2, "should return two or less av's");
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   310
  uint_t av = avs[0];
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
7115
32300e243300 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 5547
diff changeset
   312
#ifndef PRODUCT
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   313
  if (PrintMiscellaneous && Verbose) {
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   314
    tty->print("getisax(2) returned: " PTR32_FORMAT, av);
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   315
    if (avn > 1) {
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   316
      tty->print(", " PTR32_FORMAT, avs[1]);
22554
a19b9cf9ffa8 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 22505
diff changeset
   317
    }
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   318
    tty->cr();
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   319
  }
7115
32300e243300 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 5547
diff changeset
   320
#endif
32300e243300 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 5547
diff changeset
   321
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   322
  if (av & AV_SPARC_MUL32)  features |= hardware_mul32_m;
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   323
  if (av & AV_SPARC_DIV32)  features |= hardware_div32_m;
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   324
  if (av & AV_SPARC_FSMULD) features |= hardware_fsmuld_m;
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   325
  if (av & AV_SPARC_V8PLUS) features |= v9_instructions_m;
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   326
  if (av & AV_SPARC_POPC)   features |= hardware_popc_m;
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   327
  if (av & AV_SPARC_VIS)    features |= vis1_instructions_m;
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   328
  if (av & AV_SPARC_VIS2)   features |= vis2_instructions_m;
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   329
  if (avn > 1) {
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   330
    uint_t av2 = avs[1];
22554
a19b9cf9ffa8 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 22505
diff changeset
   331
#ifndef AV2_SPARC_SPARC5
a19b9cf9ffa8 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 22505
diff changeset
   332
#define AV2_SPARC_SPARC5 0x00000008 /* The 29 new fp and sub instructions */
a19b9cf9ffa8 8031290: Adjust call to getisax() for additional words returned
jmasa
parents: 22505
diff changeset
   333
#endif
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   334
    if (av2 & AV2_SPARC_SPARC5)       features |= sparc5_instructions_m;
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   335
  }
7115
32300e243300 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 5547
diff changeset
   336
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   337
  // We only build on Solaris 10 and up, but some of the values below
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   338
  // are not defined on all versions of Solaris 10, so we define them,
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   339
  // if necessary.
7115
32300e243300 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 5547
diff changeset
   340
#ifndef AV_SPARC_ASI_BLK_INIT
32300e243300 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 5547
diff changeset
   341
#define AV_SPARC_ASI_BLK_INIT 0x0080  /* ASI_BLK_INIT_xxx ASI */
32300e243300 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 5547
diff changeset
   342
#endif
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   343
  if (av & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m;
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   344
7115
32300e243300 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 5547
diff changeset
   345
#ifndef AV_SPARC_FMAF
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   346
#define AV_SPARC_FMAF 0x0100        /* Fused Multiply-Add */
7115
32300e243300 6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents: 5547
diff changeset
   347
#endif
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   348
  if (av & AV_SPARC_FMAF)         features |= fmaf_instructions_m;
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   349
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   350
#ifndef AV_SPARC_FMAU
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   351
#define AV_SPARC_FMAU    0x0200  /* Unfused Multiply-Add */
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   352
#endif
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   353
  if (av & AV_SPARC_FMAU)         features |= fmau_instructions_m;
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   354
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   355
#ifndef AV_SPARC_VIS3
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   356
#define AV_SPARC_VIS3    0x0400  /* VIS3 instruction set extensions */
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   357
#endif
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   358
  if (av & AV_SPARC_VIS3)         features |= vis3_instructions_m;
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   359
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 8317
diff changeset
   360
#ifndef AV_SPARC_CBCOND
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 8317
diff changeset
   361
#define AV_SPARC_CBCOND 0x10000000  /* compare and branch instrs supported */
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 8317
diff changeset
   362
#endif
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   363
  if (av & AV_SPARC_CBCOND)       features |= cbcond_instructions_m;
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 8317
diff changeset
   364
31515
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 30217
diff changeset
   365
#ifndef AV_SPARC_CRC32C
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 30217
diff changeset
   366
#define AV_SPARC_CRC32C 0x20000000  /* crc32c instruction supported */
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 30217
diff changeset
   367
#endif
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 30217
diff changeset
   368
  if (av & AV_SPARC_CRC32C)       features |= crc32c_instruction_m;
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 30217
diff changeset
   369
22505
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 13963
diff changeset
   370
#ifndef AV_SPARC_AES
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 13963
diff changeset
   371
#define AV_SPARC_AES 0x00020000  /* aes instrs supported */
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 13963
diff changeset
   372
#endif
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   373
  if (av & AV_SPARC_AES)       features |= aes_instructions_m;
22505
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 13963
diff changeset
   374
24953
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 22554
diff changeset
   375
#ifndef AV_SPARC_SHA1
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 22554
diff changeset
   376
#define AV_SPARC_SHA1   0x00400000  /* sha1 instruction supported */
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 22554
diff changeset
   377
#endif
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   378
  if (av & AV_SPARC_SHA1)         features |= sha1_instruction_m;
24953
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 22554
diff changeset
   379
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 22554
diff changeset
   380
#ifndef AV_SPARC_SHA256
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 22554
diff changeset
   381
#define AV_SPARC_SHA256 0x00800000  /* sha256 instruction supported */
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 22554
diff changeset
   382
#endif
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   383
  if (av & AV_SPARC_SHA256)       features |= sha256_instruction_m;
24953
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 22554
diff changeset
   384
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 22554
diff changeset
   385
#ifndef AV_SPARC_SHA512
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 22554
diff changeset
   386
#define AV_SPARC_SHA512 0x01000000  /* sha512 instruction supported */
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 22554
diff changeset
   387
#endif
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   388
  if (av & AV_SPARC_SHA512)       features |= sha512_instruction_m;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
2253
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   390
  // Determine the machine type.
30268d00878e 6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents: 1
diff changeset
   391
  do_sysinfo(SI_MACHINE, "sun4v", &features, sun4v_m);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   393
  {
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   394
    // Using kstat to determine the machine type.
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   395
    kstat_ctl_t* kc = kstat_open();
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   396
    kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL);
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   397
    const char* implementation = "UNKNOWN";
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   398
    if (ksp != NULL) {
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   399
      if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) {
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   400
        kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   401
        for (int i = 0; i < ksp->ks_ndata; i++) {
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   402
          if (strcmp((const char*)&(knm[i].name),"implementation") == 0) {
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   403
            implementation = KSTAT_NAMED_STR_PTR(&knm[i]);
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   404
#ifndef PRODUCT
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   405
            if (PrintMiscellaneous && Verbose) {
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   406
              tty->print_cr("cpu_info.implementation: %s", implementation);
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   407
            }
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   408
#endif
8317
34de38f6de90 7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents: 7704
diff changeset
   409
            // Convert to UPPER case before compare.
25949
34557722059b 6424123: JVM crashes on failed 'strdup' call
zgu
parents: 24953
diff changeset
   410
            char* impl = os::strdup_check_oom(implementation);
8317
34de38f6de90 7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents: 7704
diff changeset
   411
34de38f6de90 7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents: 7704
diff changeset
   412
            for (int i = 0; impl[i] != 0; i++)
34de38f6de90 7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents: 7704
diff changeset
   413
              impl[i] = (char)toupper((uint)impl[i]);
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   414
8317
34de38f6de90 7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents: 7704
diff changeset
   415
            if (strstr(impl, "SPARC64") != NULL) {
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   416
              features |= sparc64_family_m;
13394
930691003b55 7188227: VM should recognize M-series SPARC
kvn
parents: 10252
diff changeset
   417
            } else if (strstr(impl, "SPARC-M") != NULL) {
930691003b55 7188227: VM should recognize M-series SPARC
kvn
parents: 10252
diff changeset
   418
              // M-series SPARC is based on T-series.
930691003b55 7188227: VM should recognize M-series SPARC
kvn
parents: 10252
diff changeset
   419
              features |= (M_family_m | T_family_m);
8317
34de38f6de90 7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents: 7704
diff changeset
   420
            } else if (strstr(impl, "SPARC-T") != NULL) {
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   421
              features |= T_family_m;
8317
34de38f6de90 7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents: 7704
diff changeset
   422
              if (strstr(impl, "SPARC-T1") != NULL) {
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   423
                features |= T1_model_m;
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   424
              }
8317
34de38f6de90 7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents: 7704
diff changeset
   425
            } else {
13394
930691003b55 7188227: VM should recognize M-series SPARC
kvn
parents: 10252
diff changeset
   426
              if (strstr(impl, "SPARC") == NULL) {
930691003b55 7188227: VM should recognize M-series SPARC
kvn
parents: 10252
diff changeset
   427
#ifndef PRODUCT
930691003b55 7188227: VM should recognize M-series SPARC
kvn
parents: 10252
diff changeset
   428
                // kstat on Solaris 8 virtual machines (branded zones)
26168
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   429
                // returns "(unsupported)" implementation. Solaris 8 is not
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   430
                // supported anymore, but include this check to be on the
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   431
                // safe side.
0011f98755e3 8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents: 24953
diff changeset
   432
                warning("kstat cpu_info implementation = '%s', assume generic SPARC", impl);
13394
930691003b55 7188227: VM should recognize M-series SPARC
kvn
parents: 10252
diff changeset
   433
#endif
930691003b55 7188227: VM should recognize M-series SPARC
kvn
parents: 10252
diff changeset
   434
                implementation = "SPARC";
930691003b55 7188227: VM should recognize M-series SPARC
kvn
parents: 10252
diff changeset
   435
              }
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   436
            }
25949
34557722059b 6424123: JVM crashes on failed 'strdup' call
zgu
parents: 24953
diff changeset
   437
            os::free((void*)impl);
7704
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   438
            break;
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   439
          }
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   440
        } // for(
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   441
      }
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   442
    }
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   443
    assert(strcmp(implementation, "UNKNOWN") != 0,
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   444
           "unknown cpu info (changed kstat interface?)");
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   445
    kstat_close(kc);
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   446
  }
cc9d3ed42704 7006505: Use kstat info to identify SPARC processor
kvn
parents: 7397
diff changeset
   447
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   448
  // Figure out cache line sizes using PICL
31585
de50b10196d7 8080012: JVM times out with vdbench on SPARC M7-16
iveresov
parents: 31515
diff changeset
   449
  PICL picl((features & sparc64_family_m) != 0, (features & sun4v_m) != 0);
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   450
  _L1_data_cache_line_size = picl.L1_data_cache_line_size();
30217
5eb8768d86c4 8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents: 27456
diff changeset
   451
  _L2_data_cache_line_size = picl.L2_data_cache_line_size();
26579
522d6486f410 8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents: 26175
diff changeset
   452
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
  return features;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
}