author | shshahma |
Wed, 26 Apr 2017 21:28:22 -0700 | |
changeset 46418 | ddfa5bcf1d7a |
parent 41707 | 7a8490836761 |
child 46592 | 6e357e2c8143 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36346
diff
changeset
|
2 |
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
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 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
37430
fd743dadef12
8151939: VM_Version_init() print buffer is too small
coleenp
parents:
36346
diff
changeset
|
26 |
#include "logging/log.hpp" |
25949 | 27 |
#include "memory/allocation.hpp" |
28 |
#include "memory/allocation.inline.hpp" |
|
7397 | 29 |
#include "runtime/os.hpp" |
30 |
#include "vm_version_sparc.hpp" |
|
1 | 31 |
|
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
32 |
#include <sys/auxv.h> |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
33 |
#include <sys/auxv_SPARC.h> |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
34 |
#include <sys/systeminfo.h> |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
35 |
#include <kstat.h> |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
36 |
#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
|
37 |
#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
|
38 |
#include <link.h> |
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
39 |
|
27456
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
40 |
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
|
41 |
|
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
|
42 |
// 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
|
43 |
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
|
44 |
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
|
45 |
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
|
46 |
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
|
47 |
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
|
48 |
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
|
49 |
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
|
50 |
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
|
51 |
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
|
52 |
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
|
53 |
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
|
54 |
} |
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
|
55 |
|
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
56 |
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
|
57 |
// 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
|
58 |
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
|
59 |
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
|
60 |
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
|
61 |
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
|
62 |
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
|
63 |
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
|
64 |
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
|
65 |
// 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
|
66 |
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
|
67 |
|
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 |
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
|
69 |
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
|
70 |
|
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 |
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
|
72 |
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
|
73 |
|
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
74 |
// 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
|
75 |
// 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
|
76 |
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
|
77 |
picl_propinfo_t pinfo; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
78 |
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
|
79 |
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
|
80 |
_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
|
81 |
return PICL_FAILURE; |
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 |
|
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
84 |
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
|
85 |
assert(false, "Invalid property type"); |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
86 |
return PICL_FAILURE; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
87 |
} |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
88 |
if (pinfo.size == sizeof(int64_t)) { |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
89 |
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
|
90 |
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
|
91 |
return PICL_FAILURE; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
92 |
} |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
93 |
*result = static_cast<int>(val); |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
94 |
} 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
|
95 |
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
|
96 |
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
|
97 |
return PICL_FAILURE; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
98 |
} |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
99 |
*result = static_cast<int>(val); |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
100 |
} else { |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
101 |
assert(false, "Unexpected integer property size"); |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
102 |
return PICL_FAILURE; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
103 |
} |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
104 |
return PICL_SUCCESS; |
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 |
|
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
107 |
// 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
|
108 |
// 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
|
109 |
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
|
110 |
PICL *_picl; |
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
111 |
enum { |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
112 |
INITIAL, // Start state, no assignments happened |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
113 |
ASSIGNED, // Assigned a value |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
114 |
INCONSISTENT // Inconsistent value seen |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
115 |
} _state; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
116 |
int _value; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
117 |
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
|
118 |
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
|
119 |
int value() { |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
120 |
assert(_state == ASSIGNED, "Precondition"); |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
121 |
return _value; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
122 |
} |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
123 |
void set_value(int value) { |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
124 |
assert(_state == INITIAL, "Precondition"); |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
125 |
_value = value; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
126 |
_state = ASSIGNED; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
127 |
} |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
128 |
bool is_initial() { return _state == INITIAL; } |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
129 |
bool is_assigned() { return _state == ASSIGNED; } |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
130 |
bool is_inconsistent() { return _state == INCONSISTENT; } |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
131 |
void set_inconsistent() { _state = INCONSISTENT; } |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
132 |
|
30217
5eb8768d86c4
8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents:
27456
diff
changeset
|
133 |
bool visit(picl_nodehdl_t nodeh, const char* name) { |
27456
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
134 |
assert(!is_inconsistent(), "Precondition"); |
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
135 |
int curr; |
27456
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
136 |
if (_picl->get_int_property(nodeh, name, &curr) == PICL_SUCCESS) { |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
137 |
if (!is_assigned()) { // first iteration |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
138 |
set_value(curr); |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
139 |
} else if (curr != value()) { // following iterations |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
140 |
set_inconsistent(); |
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
141 |
} |
30217
5eb8768d86c4
8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents:
27456
diff
changeset
|
142 |
return true; |
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
143 |
} |
30217
5eb8768d86c4
8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents:
27456
diff
changeset
|
144 |
return false; |
27456
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 |
|
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
148 |
class CPUVisitor { |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
149 |
UniqueValueVisitor _l1_visitor; |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
150 |
UniqueValueVisitor _l2_visitor; |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
151 |
int _limit; // number of times visit() can be run |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
152 |
public: |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
153 |
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
|
154 |
static int visit(picl_nodehdl_t nodeh, void *arg) { |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
155 |
CPUVisitor *cpu_visitor = static_cast<CPUVisitor*>(arg); |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
156 |
UniqueValueVisitor* l1_visitor = cpu_visitor->l1_visitor(); |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
157 |
UniqueValueVisitor* l2_visitor = cpu_visitor->l2_visitor(); |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
158 |
if (!l1_visitor->is_inconsistent()) { |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
159 |
l1_visitor->visit(nodeh, "l1-dcache-line-size"); |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
160 |
} |
30217
5eb8768d86c4
8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents:
27456
diff
changeset
|
161 |
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
|
162 |
// 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
|
163 |
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
|
164 |
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
|
165 |
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
|
166 |
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
|
167 |
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
|
168 |
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
|
169 |
} |
5eb8768d86c4
8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents:
27456
diff
changeset
|
170 |
} else { |
5eb8768d86c4
8076968: PICL based initialization of L2 cache line size on some SPARC systems is incorrect
iveresov
parents:
27456
diff
changeset
|
171 |
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
|
172 |
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
|
173 |
} |
27456
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 |
|
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
176 |
if (l1_visitor->is_inconsistent() && l2_visitor->is_inconsistent()) { |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
177 |
return PICL_WALK_TERMINATE; |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
178 |
} |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
179 |
cpu_visitor->_limit--; |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
180 |
if (cpu_visitor->_limit <= 0) { |
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
181 |
return PICL_WALK_TERMINATE; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
182 |
} |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
183 |
return PICL_WALK_CONTINUE; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
184 |
} |
27456
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
185 |
UniqueValueVisitor* l1_visitor() { return &_l1_visitor; } |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
186 |
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
|
187 |
}; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
188 |
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
|
189 |
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
|
190 |
public: |
27456
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
191 |
static int visit_cpu(picl_nodehdl_t nodeh, void *state) { |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
192 |
return CPUVisitor::visit(nodeh, state); |
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
193 |
} |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
194 |
|
31585
de50b10196d7
8080012: JVM times out with vdbench on SPARC M7-16
iveresov
parents:
31515
diff
changeset
|
195 |
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
|
196 |
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
|
197 |
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
|
198 |
} |
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
|
199 |
if (_picl_initialize() == PICL_SUCCESS) { |
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
200 |
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
|
201 |
if (_picl_get_root(&rooth) == PICL_SUCCESS) { |
27456
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
202 |
const char* cpu_class = "cpu"; |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
203 |
// If it's a Fujitsu machine, it's a "core" |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
204 |
if (is_fujitsu) { |
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
205 |
cpu_class = "core"; |
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
206 |
} |
31585
de50b10196d7
8080012: JVM times out with vdbench on SPARC M7-16
iveresov
parents:
31515
diff
changeset
|
207 |
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
|
208 |
_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
|
209 |
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
|
210 |
_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
|
211 |
} |
27456
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
212 |
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
|
213 |
_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
|
214 |
} |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
215 |
} |
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
|
216 |
_picl_shutdown(); |
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
217 |
} |
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
|
218 |
close_library(); |
26579
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 |
|
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
221 |
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
|
222 |
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
|
223 |
}; |
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
224 |
|
27456
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
225 |
|
854b988388f3
8062591: SPARC PICL causes significantly longer startup times
iveresov
parents:
27426
diff
changeset
|
226 |
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
|
227 |
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
|
228 |
} |
1 | 229 |
|
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
|
230 |
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
|
231 |
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
|
232 |
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
|
233 |
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
|
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 |
|
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 |
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
|
237 |
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
|
238 |
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
|
239 |
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
|
240 |
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
|
241 |
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
|
242 |
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
|
243 |
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
|
244 |
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
|
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 |
|
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 |
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
|
248 |
_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
|
249 |
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
|
250 |
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
|
251 |
} |
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 |
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
|
253 |
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
|
254 |
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
|
255 |
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
|
256 |
} |
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 |
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
|
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 |
|
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 |
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
|
261 |
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
|
262 |
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
|
263 |
_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
|
264 |
} |
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
|
265 |
|
2253
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
266 |
// 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
|
267 |
// versions before 10. |
36346 | 268 |
|
2253
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
269 |
#ifndef SI_ARCHITECTURE_32 |
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
270 |
#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
|
271 |
#endif |
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
272 |
|
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
273 |
#ifndef SI_ARCHITECTURE_64 |
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
274 |
#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
|
275 |
#endif |
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
276 |
|
36346 | 277 |
#ifndef SI_CPUBRAND |
278 |
#define SI_CPUBRAND 523 /* return cpu brand string */ |
|
279 |
#endif |
|
2253
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
280 |
|
36346 | 281 |
class Sysinfo { |
282 |
char* _string; |
|
283 |
public: |
|
284 |
Sysinfo(int si) : _string(NULL) { |
|
285 |
char tmp; |
|
286 |
size_t bufsize = sysinfo(si, &tmp, 1); |
|
2253
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
287 |
|
36346 | 288 |
if (bufsize != -1) { |
289 |
char* buf = (char*) os::malloc(bufsize, mtInternal); |
|
290 |
if (buf != NULL) { |
|
291 |
if (sysinfo(si, buf, bufsize) == bufsize) { |
|
292 |
_string = buf; |
|
293 |
} else { |
|
294 |
os::free(buf); |
|
295 |
} |
|
296 |
} |
|
297 |
} |
|
298 |
} |
|
2253
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
299 |
|
36346 | 300 |
~Sysinfo() { |
301 |
if (_string != NULL) { |
|
302 |
os::free(_string); |
|
2253
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
303 |
} |
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
304 |
} |
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
305 |
|
36346 | 306 |
const char* value() const { |
307 |
return _string; |
|
308 |
} |
|
309 |
||
310 |
bool valid() const { |
|
311 |
return _string != NULL; |
|
312 |
} |
|
313 |
||
314 |
bool match(const char* s) const { |
|
315 |
return valid() ? strcmp(_string, s) == 0 : false; |
|
316 |
} |
|
317 |
||
318 |
bool match_substring(const char* s) const { |
|
319 |
return valid() ? strstr(_string, s) != NULL : false; |
|
320 |
} |
|
321 |
}; |
|
322 |
||
323 |
class Sysconf { |
|
324 |
int _value; |
|
325 |
public: |
|
326 |
Sysconf(int sc) : _value(-1) { |
|
327 |
_value = sysconf(sc); |
|
328 |
} |
|
329 |
bool valid() const { |
|
330 |
return _value != -1; |
|
331 |
} |
|
332 |
int value() const { |
|
333 |
return _value; |
|
334 |
} |
|
335 |
}; |
|
336 |
||
337 |
||
338 |
#ifndef _SC_DCACHE_LINESZ |
|
339 |
#define _SC_DCACHE_LINESZ 508 /* Data cache line size */ |
|
340 |
#endif |
|
341 |
||
342 |
#ifndef _SC_L2CACHE_LINESZ |
|
343 |
#define _SC_L2CACHE_LINESZ 527 /* Size of L2 cache line */ |
|
344 |
#endif |
|
2253
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
345 |
|
41707
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
346 |
// Hardware capability bits that appeared after Solaris 11.1 |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
347 |
#ifndef AV_SPARC_FMAF |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
348 |
#define AV_SPARC_FMAF 0x00000100 /* Fused Multiply-Add */ |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
349 |
#endif |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
350 |
#ifndef AV2_SPARC_SPARC5 |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
351 |
#define AV2_SPARC_SPARC5 0x00000008 /* The 29 new fp and sub instructions */ |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
352 |
#endif |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
353 |
|
1 | 354 |
int VM_Version::platform_features(int features) { |
355 |
||
26168
0011f98755e3
8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents:
24953
diff
changeset
|
356 |
// Check 32-bit architecture. |
36346 | 357 |
if (Sysinfo(SI_ARCHITECTURE_32).match("sparc")) { |
358 |
features |= v8_instructions_m; |
|
359 |
} |
|
2253
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
360 |
|
26168
0011f98755e3
8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents:
24953
diff
changeset
|
361 |
// Check 64-bit architecture. |
36346 | 362 |
if (Sysinfo(SI_ARCHITECTURE_64).match("sparcv9")) { |
363 |
features |= generic_v9_m; |
|
364 |
} |
|
2253
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
365 |
|
26168
0011f98755e3
8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents:
24953
diff
changeset
|
366 |
// Extract valid instruction set extensions. |
41707
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
367 |
uint_t avs[AV_HW2_IDX + 1]; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
368 |
uint_t avn = getisax(avs, ARRAY_SIZE(avs)); |
7115
32300e243300
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
5547
diff
changeset
|
369 |
|
41707
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
370 |
log_info(os, cpu)("getisax(2) returned %d words:", avn); |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
371 |
for (int i = 0; i < avn; i++) { |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
372 |
log_info(os, cpu)(" word %d: " PTR32_FORMAT, i, avs[i]); |
26168
0011f98755e3
8043913: remove legacy code in SPARC's VM_Version::platform_features
anoll
parents:
24953
diff
changeset
|
373 |
} |
7115
32300e243300
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
5547
diff
changeset
|
374 |
|
41707
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
375 |
uint_t av1 = avs[AV_HW1_IDX]; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
376 |
if (av1 & AV_SPARC_MUL32) features |= hardware_mul32_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
377 |
if (av1 & AV_SPARC_DIV32) features |= hardware_div32_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
378 |
if (av1 & AV_SPARC_FSMULD) features |= hardware_fsmuld_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
379 |
if (av1 & AV_SPARC_V8PLUS) features |= v9_instructions_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
380 |
if (av1 & AV_SPARC_POPC) features |= hardware_popc_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
381 |
if (av1 & AV_SPARC_VIS) features |= vis1_instructions_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
382 |
if (av1 & AV_SPARC_VIS2) features |= vis2_instructions_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
383 |
if (av1 & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
384 |
if (av1 & AV_SPARC_FMAF) features |= fmaf_instructions_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
385 |
if (av1 & AV_SPARC_VIS3) features |= vis3_instructions_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
386 |
if (av1 & AV_SPARC_CBCOND) features |= cbcond_instructions_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
387 |
if (av1 & AV_SPARC_CRC32C) features |= crc32c_instruction_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
388 |
if (av1 & AV_SPARC_AES) features |= aes_instructions_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
389 |
if (av1 & AV_SPARC_SHA1) features |= sha1_instruction_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
390 |
if (av1 & AV_SPARC_SHA256) features |= sha256_instruction_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
391 |
if (av1 & AV_SPARC_SHA512) features |= sha512_instruction_m; |
7704 | 392 |
|
41707
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
393 |
if (avn > AV_HW2_IDX) { |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
394 |
uint_t av2 = avs[AV_HW2_IDX]; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
395 |
if (av2 & AV2_SPARC_SPARC5) features |= sparc5_instructions_m; |
7a8490836761
8157141: Fix for JDK-8031290 is unnecessarily fragile
alanbur
parents:
41706
diff
changeset
|
396 |
} |
1 | 397 |
|
2253
30268d00878e
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
1
diff
changeset
|
398 |
// Determine the machine type. |
36346 | 399 |
if (Sysinfo(SI_MACHINE).match("sun4v")) { |
400 |
features |= sun4v_m; |
|
401 |
} |
|
1 | 402 |
|
41706
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
403 |
// If SI_CPUBRAND works, that means Solaris 12 API to get the cache line sizes |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
404 |
// is available to us as well |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
405 |
Sysinfo cpu_info(SI_CPUBRAND); |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
406 |
bool use_solaris_12_api = cpu_info.valid(); |
46418
ddfa5bcf1d7a
8177958: Possible uninitialized char* in vm_version_solaris_sparc.cpp
shshahma
parents:
41707
diff
changeset
|
407 |
const char* impl = "unknown"; |
41706
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
408 |
int impl_m = 0; |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
409 |
if (use_solaris_12_api) { |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
410 |
impl = cpu_info.value(); |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
411 |
log_info(os, cpu)("Parsing CPU implementation from %s", impl); |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
412 |
impl_m = parse_features(impl); |
36346 | 413 |
} else { |
414 |
// Otherwise use kstat to determine the machine type. |
|
7704 | 415 |
kstat_ctl_t* kc = kstat_open(); |
41706
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
416 |
if (kc != NULL) { |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
417 |
kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL); |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
418 |
if (ksp != NULL) { |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
419 |
if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) { |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
420 |
kstat_named_t* knm = (kstat_named_t *)ksp->ks_data; |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
421 |
for (int i = 0; i < ksp->ks_ndata; i++) { |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
422 |
if (strcmp((const char*)&(knm[i].name), "implementation") == 0) { |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
423 |
impl = KSTAT_NAMED_STR_PTR(&knm[i]); |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
424 |
log_info(os, cpu)("Parsing CPU implementation from %s", impl); |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
425 |
impl_m = parse_features(impl); |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
426 |
break; |
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
427 |
} |
7704 | 428 |
} |
41706
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
429 |
} |
7704 | 430 |
} |
41706
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
431 |
kstat_close(kc); |
7704 | 432 |
} |
433 |
} |
|
46418
ddfa5bcf1d7a
8177958: Possible uninitialized char* in vm_version_solaris_sparc.cpp
shshahma
parents:
41707
diff
changeset
|
434 |
assert(impl_m != 0, "Unrecognized CPU implementation: %s", impl); |
41706
eb0fab7b44af
8165482: java in ldoms, with cpu-arch=generic has problems
mwalsh
parents:
37430
diff
changeset
|
435 |
features |= impl_m; |
7704 | 436 |
|
36346 | 437 |
bool is_sun4v = (features & sun4v_m) != 0; |
438 |
if (use_solaris_12_api && is_sun4v) { |
|
439 |
// If Solaris 12 API is supported and it's sun4v use sysconf() to get the cache line sizes |
|
440 |
Sysconf l1_dcache_line_size(_SC_DCACHE_LINESZ); |
|
441 |
if (l1_dcache_line_size.valid()) { |
|
442 |
_L1_data_cache_line_size = l1_dcache_line_size.value(); |
|
443 |
} |
|
26579
522d6486f410
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
26175
diff
changeset
|
444 |
|
36346 | 445 |
Sysconf l2_dcache_line_size(_SC_L2CACHE_LINESZ); |
446 |
if (l2_dcache_line_size.valid()) { |
|
447 |
_L2_data_cache_line_size = l2_dcache_line_size.value(); |
|
448 |
} |
|
449 |
} else { |
|
450 |
// Otherwise figure out the cache line sizes using PICL |
|
451 |
bool is_fujitsu = (features & sparc64_family_m) != 0; |
|
452 |
PICL picl(is_fujitsu, is_sun4v); |
|
453 |
_L1_data_cache_line_size = picl.L1_data_cache_line_size(); |
|
454 |
_L2_data_cache_line_size = picl.L2_data_cache_line_size(); |
|
455 |
} |
|
1 | 456 |
return features; |
457 |
} |