Mercurial > hg > truffle
annotate src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp @ 20460:df66e3a3c4c2
8041946: CMM Testing: 8u40 an allocated humongous object at the end of the heap should not prevents shrinking the heap
Summary: New test added
Reviewed-by: jwilhelm, tschatzl
Contributed-by: andrey.x.zakharov@oracle.com
author | jwilhelm |
---|---|
date | Thu, 11 Sep 2014 14:21:13 +0200 |
parents | d635fd1ac81c |
children | c49cd31b6da6 |
rev | line source |
---|---|
0 | 1 /* |
20313
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
2 * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
643
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
643
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
643
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "runtime/os.hpp" | |
27 #include "vm_version_sparc.hpp" | |
0 | 28 |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
29 #include <sys/auxv.h> |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
30 #include <sys/auxv_SPARC.h> |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
31 #include <sys/systeminfo.h> |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
32 #include <kstat.h> |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
33 #include <picl.h> |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
34 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
35 extern "C" static int PICL_get_l1_data_cache_line_size_helper(picl_nodehdl_t nodeh, void *result); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
36 extern "C" static int PICL_get_l2_cache_line_size_helper(picl_nodehdl_t nodeh, void *result); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
37 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
38 class PICL { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
39 // Get a value of the integer property. The value in the tree can be either 32 or 64 bit |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
40 // depending on the platform. The result is converted to int. |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
41 static int get_int_property(picl_nodehdl_t nodeh, const char* name, int* result) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
42 picl_propinfo_t pinfo; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
43 picl_prophdl_t proph; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
44 if (picl_get_prop_by_name(nodeh, name, &proph) != PICL_SUCCESS || |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
45 picl_get_propinfo(proph, &pinfo) != PICL_SUCCESS) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
46 return PICL_FAILURE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
47 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
48 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
49 if (pinfo.type != PICL_PTYPE_INT && pinfo.type != PICL_PTYPE_UNSIGNED_INT) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
50 assert(false, "Invalid property type"); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
51 return PICL_FAILURE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
52 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
53 if (pinfo.size == sizeof(int64_t)) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
54 int64_t val; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
55 if (picl_get_propval(proph, &val, sizeof(int64_t)) != PICL_SUCCESS) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
56 return PICL_FAILURE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
57 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
58 *result = static_cast<int>(val); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
59 } else if (pinfo.size == sizeof(int32_t)) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
60 int32_t val; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
61 if (picl_get_propval(proph, &val, sizeof(int32_t)) != PICL_SUCCESS) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
62 return PICL_FAILURE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
63 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
64 *result = static_cast<int>(val); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
65 } else { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
66 assert(false, "Unexpected integer property size"); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
67 return PICL_FAILURE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
68 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
69 return PICL_SUCCESS; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
70 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
71 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
72 // Visitor and a state machine that visits integer properties and verifies that the |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
73 // values are the same. Stores the unique value observed. |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
74 class UniqueValueVisitor { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
75 enum { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
76 INITIAL, // Start state, no assignments happened |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
77 ASSIGNED, // Assigned a value |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
78 INCONSISTENT // Inconsistent value seen |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
79 } _state; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
80 int _value; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
81 public: |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
82 UniqueValueVisitor() : _state(INITIAL) { } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
83 int value() { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
84 assert(_state == ASSIGNED, "Precondition"); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
85 return _value; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
86 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
87 void set_value(int value) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
88 assert(_state == INITIAL, "Precondition"); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
89 _value = value; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
90 _state = ASSIGNED; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
91 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
92 bool is_initial() { return _state == INITIAL; } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
93 bool is_assigned() { return _state == ASSIGNED; } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
94 bool is_inconsistent() { return _state == INCONSISTENT; } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
95 void set_inconsistent() { _state = INCONSISTENT; } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
96 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
97 static int visit(picl_nodehdl_t nodeh, const char* name, void *arg) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
98 UniqueValueVisitor *state = static_cast<UniqueValueVisitor*>(arg); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
99 assert(!state->is_inconsistent(), "Precondition"); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
100 int curr; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
101 if (PICL::get_int_property(nodeh, name, &curr) == PICL_SUCCESS) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
102 if (!state->is_assigned()) { // first iteration |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
103 state->set_value(curr); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
104 } else if (curr != state->value()) { // following iterations |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
105 state->set_inconsistent(); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
106 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
107 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
108 if (state->is_inconsistent()) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
109 return PICL_WALK_TERMINATE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
110 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
111 return PICL_WALK_CONTINUE; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
112 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
113 }; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
114 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
115 int _L1_data_cache_line_size; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
116 int _L2_cache_line_size; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
117 public: |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
118 static int get_l1_data_cache_line_size(picl_nodehdl_t nodeh, void *state) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
119 return UniqueValueVisitor::visit(nodeh, "l1-dcache-line-size", state); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
120 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
121 static int get_l2_cache_line_size(picl_nodehdl_t nodeh, void *state) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
122 return UniqueValueVisitor::visit(nodeh, "l2-cache-line-size", state); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
123 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
124 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
125 PICL() : _L1_data_cache_line_size(0), _L2_cache_line_size(0) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
126 if (picl_initialize() == PICL_SUCCESS) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
127 picl_nodehdl_t rooth; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
128 if (picl_get_root(&rooth) == PICL_SUCCESS) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
129 UniqueValueVisitor L1_state; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
130 // Visit all "cpu" class instances |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
131 picl_walk_tree_by_class(rooth, "cpu", &L1_state, PICL_get_l1_data_cache_line_size_helper); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
132 if (L1_state.is_initial()) { // Still initial, iteration found no values |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
133 // Try walk all "core" class instances, it might be a Fujitsu machine |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
134 picl_walk_tree_by_class(rooth, "core", &L1_state, PICL_get_l1_data_cache_line_size_helper); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
135 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
136 if (L1_state.is_assigned()) { // Is there a value? |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
137 _L1_data_cache_line_size = L1_state.value(); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
138 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
139 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
140 UniqueValueVisitor L2_state; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
141 picl_walk_tree_by_class(rooth, "cpu", &L2_state, PICL_get_l2_cache_line_size_helper); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
142 if (L2_state.is_initial()) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
143 picl_walk_tree_by_class(rooth, "core", &L2_state, PICL_get_l2_cache_line_size_helper); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
144 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
145 if (L2_state.is_assigned()) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
146 _L2_cache_line_size = L2_state.value(); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
147 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
148 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
149 picl_shutdown(); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
150 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
151 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
152 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
153 unsigned int L1_data_cache_line_size() const { return _L1_data_cache_line_size; } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
154 unsigned int L2_cache_line_size() const { return _L2_cache_line_size; } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
155 }; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
156 |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
157 extern "C" static int PICL_get_l1_data_cache_line_size_helper(picl_nodehdl_t nodeh, void *result) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
158 return PICL::get_l1_data_cache_line_size(nodeh, result); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
159 } |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
160 extern "C" static int PICL_get_l2_cache_line_size_helper(picl_nodehdl_t nodeh, void *result) { |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
161 return PICL::get_l2_cache_line_size(nodeh, result); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
162 } |
0 | 163 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
164 // We need to keep these here as long as we have to build on Solaris |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
165 // versions before 10. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
166 #ifndef SI_ARCHITECTURE_32 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
167 #define SI_ARCHITECTURE_32 516 /* basic 32-bit SI_ARCHITECTURE */ |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
168 #endif |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
169 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
170 #ifndef SI_ARCHITECTURE_64 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
171 #define SI_ARCHITECTURE_64 517 /* basic 64-bit SI_ARCHITECTURE */ |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
172 #endif |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
173 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
174 static void do_sysinfo(int si, const char* string, int* features, int mask) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
175 char tmp; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
176 size_t bufsize = sysinfo(si, &tmp, 1); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
177 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
178 // All SI defines used below must be supported. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
179 guarantee(bufsize != -1, "must be supported"); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
180 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
181 char* buf = (char*) malloc(bufsize); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
182 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
183 if (buf == NULL) |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
184 return; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
185 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
186 if (sysinfo(si, buf, bufsize) == bufsize) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
187 // Compare the string. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
188 if (strcmp(buf, string) == 0) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
189 *features |= mask; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
190 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
191 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
192 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
193 free(buf); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
194 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
195 |
0 | 196 int VM_Version::platform_features(int features) { |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
197 // getisax(2), SI_ARCHITECTURE_32, and SI_ARCHITECTURE_64 are |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
198 // supported on Solaris 10 and later. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
199 if (os::Solaris::supports_getisax()) { |
0 | 200 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
201 // Check 32-bit architecture. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
202 do_sysinfo(SI_ARCHITECTURE_32, "sparc", &features, v8_instructions_m); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
203 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
204 // Check 64-bit architecture. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
205 do_sysinfo(SI_ARCHITECTURE_64, "sparcv9", &features, generic_v9_m); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
206 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
207 // Extract valid instruction set extensions. |
17683
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
208 uint_t avs[2]; |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
209 uint_t avn = os::Solaris::getisax(avs, 2); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
210 assert(avn <= 2, "should return two or less av's"); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
211 uint_t av = avs[0]; |
0 | 212 |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
213 #ifndef PRODUCT |
17683
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
214 if (PrintMiscellaneous && Verbose) { |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
215 tty->print("getisax(2) returned: " PTR32_FORMAT, av); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
216 if (avn > 1) { |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
217 tty->print(", " PTR32_FORMAT, avs[1]); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
218 } |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
219 tty->cr(); |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
220 } |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
221 #endif |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
222 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
223 if (av & AV_SPARC_MUL32) features |= hardware_mul32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
224 if (av & AV_SPARC_DIV32) features |= hardware_div32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
225 if (av & AV_SPARC_FSMULD) features |= hardware_fsmuld_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
226 if (av & AV_SPARC_V8PLUS) features |= v9_instructions_m; |
643
c771b7f43bbf
6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents:
641
diff
changeset
|
227 if (av & AV_SPARC_POPC) features |= hardware_popc_m; |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
228 if (av & AV_SPARC_VIS) features |= vis1_instructions_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
229 if (av & AV_SPARC_VIS2) features |= vis2_instructions_m; |
17683
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
230 if (avn > 1) { |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
231 uint_t av2 = avs[1]; |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
232 #ifndef AV2_SPARC_SPARC5 |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
233 #define AV2_SPARC_SPARC5 0x00000008 /* The 29 new fp and sub instructions */ |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
234 #endif |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
235 if (av2 & AV2_SPARC_SPARC5) features |= sparc5_instructions_m; |
031b06eac1a9
8031290: Adjust call to getisax() for additional words returned
jmasa
parents:
17670
diff
changeset
|
236 } |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
237 |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
238 // Next values are not defined before Solaris 10 |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
239 // but Solaris 8 is used for jdk6 update builds. |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
240 #ifndef AV_SPARC_ASI_BLK_INIT |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
241 #define AV_SPARC_ASI_BLK_INIT 0x0080 /* ASI_BLK_INIT_xxx ASI */ |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
242 #endif |
2080 | 243 if (av & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m; |
244 | |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
245 #ifndef AV_SPARC_FMAF |
2080 | 246 #define AV_SPARC_FMAF 0x0100 /* Fused Multiply-Add */ |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
247 #endif |
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
248 if (av & AV_SPARC_FMAF) features |= fmaf_instructions_m; |
2080 | 249 |
250 #ifndef AV_SPARC_FMAU | |
251 #define AV_SPARC_FMAU 0x0200 /* Unfused Multiply-Add */ | |
252 #endif | |
253 if (av & AV_SPARC_FMAU) features |= fmau_instructions_m; | |
254 | |
255 #ifndef AV_SPARC_VIS3 | |
256 #define AV_SPARC_VIS3 0x0400 /* VIS3 instruction set extensions */ | |
257 #endif | |
258 if (av & AV_SPARC_VIS3) features |= vis3_instructions_m; | |
259 | |
3839 | 260 #ifndef AV_SPARC_CBCOND |
261 #define AV_SPARC_CBCOND 0x10000000 /* compare and branch instrs supported */ | |
262 #endif | |
263 if (av & AV_SPARC_CBCOND) features |= cbcond_instructions_m; | |
264 | |
17670 | 265 #ifndef AV_SPARC_AES |
266 #define AV_SPARC_AES 0x00020000 /* aes instrs supported */ | |
267 #endif | |
268 if (av & AV_SPARC_AES) features |= aes_instructions_m; | |
269 | |
20313
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
270 #ifndef AV_SPARC_SHA1 |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
271 #define AV_SPARC_SHA1 0x00400000 /* sha1 instruction supported */ |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
272 #endif |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
273 if (av & AV_SPARC_SHA1) features |= sha1_instruction_m; |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
274 |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
275 #ifndef AV_SPARC_SHA256 |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
276 #define AV_SPARC_SHA256 0x00800000 /* sha256 instruction supported */ |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
277 #endif |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
278 if (av & AV_SPARC_SHA256) features |= sha256_instruction_m; |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
279 |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
280 #ifndef AV_SPARC_SHA512 |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
281 #define AV_SPARC_SHA512 0x01000000 /* sha512 instruction supported */ |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
282 #endif |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
283 if (av & AV_SPARC_SHA512) features |= sha512_instruction_m; |
b20a35eae442
8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents:
17683
diff
changeset
|
284 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
285 } else { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
286 // getisax(2) failed, use the old legacy code. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
287 #ifndef PRODUCT |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
288 if (PrintMiscellaneous && Verbose) |
1914
ae065c367d93
6987135: Performance regression on Intel platform with 32-bits edition between 6u13 and 6u14.
kvn
parents:
1552
diff
changeset
|
289 tty->print_cr("getisax(2) is not supported."); |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
290 #endif |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
291 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
292 char tmp; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
293 size_t bufsize = sysinfo(SI_ISALIST, &tmp, 1); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
294 char* buf = (char*) malloc(bufsize); |
0 | 295 |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
296 if (buf != NULL) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
297 if (sysinfo(SI_ISALIST, buf, bufsize) == bufsize) { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
298 // Figure out what kind of sparc we have |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
299 char *sparc_string = strstr(buf, "sparc"); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
300 if (sparc_string != NULL) { features |= v8_instructions_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
301 if (sparc_string[5] == 'v') { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
302 if (sparc_string[6] == '8') { |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
303 if (sparc_string[7] == '-') { features |= hardware_mul32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
304 features |= hardware_div32_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
305 } else if (sparc_string[7] == 'p') features |= generic_v9_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
306 else features |= generic_v8_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
307 } else if (sparc_string[6] == '9') features |= generic_v9_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
308 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
309 } |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
310 |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
311 // Check for visualization instructions |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
312 char *vis = strstr(buf, "vis"); |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
313 if (vis != NULL) { features |= vis1_instructions_m; |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
314 if (vis[3] == '2') features |= vis2_instructions_m; |
0 | 315 } |
316 } | |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
317 free(buf); |
0 | 318 } |
319 } | |
320 | |
641
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
321 // Determine the machine type. |
6af0a709d52b
6812587: Use auxv to determine SPARC hardware features on Solaris
twisti
parents:
0
diff
changeset
|
322 do_sysinfo(SI_MACHINE, "sun4v", &features, sun4v_m); |
0 | 323 |
2080 | 324 { |
325 // Using kstat to determine the machine type. | |
326 kstat_ctl_t* kc = kstat_open(); | |
327 kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL); | |
328 const char* implementation = "UNKNOWN"; | |
329 if (ksp != NULL) { | |
330 if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) { | |
331 kstat_named_t* knm = (kstat_named_t *)ksp->ks_data; | |
332 for (int i = 0; i < ksp->ks_ndata; i++) { | |
333 if (strcmp((const char*)&(knm[i].name),"implementation") == 0) { | |
334 #ifndef KSTAT_DATA_STRING | |
335 #define KSTAT_DATA_STRING 9 | |
336 #endif | |
337 if (knm[i].data_type == KSTAT_DATA_CHAR) { | |
338 // VM is running on Solaris 8 which does not have value.str. | |
339 implementation = &(knm[i].value.c[0]); | |
340 } else if (knm[i].data_type == KSTAT_DATA_STRING) { | |
341 // VM is running on Solaris 10. | |
342 #ifndef KSTAT_NAMED_STR_PTR | |
343 // Solaris 8 was used to build VM, define the structure it misses. | |
344 struct str_t { | |
345 union { | |
346 char *ptr; /* NULL-term string */ | |
347 char __pad[8]; /* 64-bit padding */ | |
348 } addr; | |
349 uint32_t len; /* # bytes for strlen + '\0' */ | |
350 }; | |
351 #define KSTAT_NAMED_STR_PTR(knptr) (( (str_t*)&((knptr)->value) )->addr.ptr) | |
352 #endif | |
353 implementation = KSTAT_NAMED_STR_PTR(&knm[i]); | |
354 } | |
355 #ifndef PRODUCT | |
356 if (PrintMiscellaneous && Verbose) { | |
357 tty->print_cr("cpu_info.implementation: %s", implementation); | |
358 } | |
359 #endif | |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
360 // Convert to UPPER case before compare. |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
361 char* impl = strdup(implementation); |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
362 |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
363 for (int i = 0; impl[i] != 0; i++) |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
364 impl[i] = (char)toupper((uint)impl[i]); |
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
365 if (strstr(impl, "SPARC64") != NULL) { |
2080 | 366 features |= sparc64_family_m; |
6269 | 367 } else if (strstr(impl, "SPARC-M") != NULL) { |
368 // M-series SPARC is based on T-series. | |
369 features |= (M_family_m | T_family_m); | |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
370 } else if (strstr(impl, "SPARC-T") != NULL) { |
2080 | 371 features |= T_family_m; |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
372 if (strstr(impl, "SPARC-T1") != NULL) { |
2080 | 373 features |= T1_model_m; |
374 } | |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
375 } else { |
6269 | 376 if (strstr(impl, "SPARC") == NULL) { |
377 #ifndef PRODUCT | |
378 // kstat on Solaris 8 virtual machines (branded zones) | |
379 // returns "(unsupported)" implementation. | |
380 warning("kstat cpu_info implementation = '%s', should contain SPARC", impl); | |
381 #endif | |
382 implementation = "SPARC"; | |
383 } | |
2080 | 384 } |
2247
c52cba2a3359
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
kvn
parents:
2080
diff
changeset
|
385 free((void*)impl); |
2080 | 386 break; |
387 } | |
388 } // for( | |
389 } | |
390 } | |
391 assert(strcmp(implementation, "UNKNOWN") != 0, | |
392 "unknown cpu info (changed kstat interface?)"); | |
393 kstat_close(kc); | |
394 } | |
395 | |
20421
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
396 // Figure out cache line sizes using PICL |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
397 PICL picl; |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
398 _L2_cache_line_size = picl.L2_cache_line_size(); |
d635fd1ac81c
8056124: Hotspot should use PICL interface to get cacheline size on SPARC
iveresov
parents:
20313
diff
changeset
|
399 |
0 | 400 return features; |
401 } |