2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2017-04-12 17:52:04 -04:00
|
|
|
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "precompiled.hpp"
|
2012-12-06 09:57:41 -08:00
|
|
|
#include "asm/macroAssembler.inline.hpp"
|
2016-04-07 16:37:35 -04:00
|
|
|
#include "logging/log.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "memory/resourceArea.hpp"
|
|
|
|
#include "runtime/java.hpp"
|
2014-08-11 10:18:09 -07:00
|
|
|
#include "runtime/os.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "runtime/stubCodeGenerator.hpp"
|
|
|
|
#include "vm_version_sparc.hpp"
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2015-04-06 20:20:17 -07:00
|
|
|
unsigned int VM_Version::_L2_data_cache_line_size = 0;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
void VM_Version::initialize() {
|
2015-12-23 20:19:42 -10:00
|
|
|
assert(_features != 0, "System pre-initialization is not complete.");
|
2015-11-24 15:56:40 -08:00
|
|
|
guarantee(VM_Version::has_v9(), "only SPARC v9 is supported");
|
|
|
|
|
2017-06-19 01:23:58 -07:00
|
|
|
if (FLAG_IS_DEFAULT(PrefetchCopyIntervalInBytes)) {
|
|
|
|
FLAG_SET_DEFAULT(PrefetchCopyIntervalInBytes, prefetch_copy_interval_in_bytes());
|
|
|
|
}
|
|
|
|
if (FLAG_IS_DEFAULT(PrefetchScanIntervalInBytes)) {
|
|
|
|
FLAG_SET_DEFAULT(PrefetchScanIntervalInBytes, prefetch_scan_interval_in_bytes());
|
|
|
|
}
|
|
|
|
if (FLAG_IS_DEFAULT(PrefetchFieldsAhead)) {
|
|
|
|
FLAG_SET_DEFAULT(PrefetchFieldsAhead, prefetch_fields_ahead());
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Allocation prefetch settings
|
2011-08-16 16:59:46 -07:00
|
|
|
intx cache_line_size = prefetch_data_size();
|
2017-06-19 01:23:58 -07:00
|
|
|
if (FLAG_IS_DEFAULT(AllocatePrefetchStepSize) &&
|
|
|
|
(cache_line_size > AllocatePrefetchStepSize)) {
|
|
|
|
FLAG_SET_DEFAULT(AllocatePrefetchStepSize, cache_line_size);
|
|
|
|
}
|
2011-08-16 16:59:46 -07:00
|
|
|
|
2017-06-19 01:23:58 -07:00
|
|
|
if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
|
|
|
|
FLAG_SET_DEFAULT(AllocatePrefetchDistance, 512);
|
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2017-06-19 01:23:58 -07:00
|
|
|
if ((AllocatePrefetchDistance == 0) && (AllocatePrefetchStyle != 0)) {
|
|
|
|
assert(!FLAG_IS_DEFAULT(AllocatePrefetchDistance), "default value should not be 0");
|
|
|
|
if (!FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
|
|
|
|
warning("AllocatePrefetchDistance is set to 0 which disable prefetching. Ignoring AllocatePrefetchStyle flag.");
|
|
|
|
}
|
|
|
|
FLAG_SET_DEFAULT(AllocatePrefetchStyle, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((AllocatePrefetchInstr == 1) && (!has_blk_init() || cache_line_size <= 0)) {
|
|
|
|
if (!FLAG_IS_DEFAULT(AllocatePrefetchInstr)) {
|
2016-04-29 08:32:42 +02:00
|
|
|
warning("BIS instructions required for AllocatePrefetchInstr 1 unavailable");
|
|
|
|
}
|
2017-06-19 01:23:58 -07:00
|
|
|
FLAG_SET_DEFAULT(AllocatePrefetchInstr, 0);
|
2011-07-21 11:25:07 -07:00
|
|
|
}
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
UseSSE = 0; // Only on x86 and x64
|
|
|
|
|
2011-08-16 16:59:46 -07:00
|
|
|
_supports_cx8 = has_v9();
|
2012-09-20 16:49:17 +02:00
|
|
|
_supports_atomic_getset4 = true; // swap instruction
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2010-12-16 14:15:12 -08:00
|
|
|
if (is_niagara()) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// Indirect branch is the same cost as direct
|
|
|
|
if (FLAG_IS_DEFAULT(UseInlineCaches)) {
|
2009-03-30 18:19:31 -07:00
|
|
|
FLAG_SET_DEFAULT(UseInlineCaches, false);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2010-12-16 14:15:12 -08:00
|
|
|
// Align loops on a single instruction boundary.
|
|
|
|
if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
|
|
|
|
FLAG_SET_DEFAULT(OptoLoopAlignment, 4);
|
|
|
|
}
|
2009-03-12 10:37:46 -07:00
|
|
|
// 32-bit oops don't make sense for the 64-bit VM on sparc
|
|
|
|
// since the 32-bit VM has the same registers and smaller objects.
|
|
|
|
Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
|
2012-10-09 10:11:38 +02:00
|
|
|
Universe::set_narrow_klass_shift(LogKlassAlignmentInBytes);
|
2007-12-01 00:00:00 +00:00
|
|
|
#ifdef COMPILER2
|
|
|
|
// Indirect branch is the same cost as direct
|
|
|
|
if (FLAG_IS_DEFAULT(UseJumpTables)) {
|
2009-03-30 18:19:31 -07:00
|
|
|
FLAG_SET_DEFAULT(UseJumpTables, true);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
// Single-issue, so entry and loop tops are
|
|
|
|
// aligned on a single instruction boundary
|
|
|
|
if (FLAG_IS_DEFAULT(InteriorEntryAlignment)) {
|
2009-03-30 18:19:31 -07:00
|
|
|
FLAG_SET_DEFAULT(InteriorEntryAlignment, 4);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2010-12-16 14:15:12 -08:00
|
|
|
if (is_niagara_plus()) {
|
2016-05-19 11:01:38 -07:00
|
|
|
if (has_blk_init() && (cache_line_size > 0) && UseTLAB &&
|
2011-08-16 16:59:46 -07:00
|
|
|
FLAG_IS_DEFAULT(AllocatePrefetchInstr)) {
|
2016-12-07 09:29:28 -08:00
|
|
|
if (!has_sparc5_instr()) {
|
|
|
|
// Use BIS instruction for TLAB allocation prefetch
|
|
|
|
// on Niagara plus processors other than those based on CoreS4
|
|
|
|
FLAG_SET_DEFAULT(AllocatePrefetchInstr, 1);
|
|
|
|
} else {
|
|
|
|
// On CoreS4 processors use prefetch instruction
|
|
|
|
// to avoid partial RAW issue, also use prefetch style 3
|
|
|
|
FLAG_SET_DEFAULT(AllocatePrefetchInstr, 0);
|
|
|
|
if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
|
|
|
|
FLAG_SET_DEFAULT(AllocatePrefetchStyle, 3);
|
|
|
|
}
|
|
|
|
}
|
2016-04-29 08:32:42 +02:00
|
|
|
}
|
|
|
|
if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
|
|
|
|
if (AllocatePrefetchInstr == 0) {
|
|
|
|
// Use different prefetch distance without BIS
|
|
|
|
FLAG_SET_DEFAULT(AllocatePrefetchDistance, 256);
|
|
|
|
} else {
|
2011-08-16 16:59:46 -07:00
|
|
|
// Use smaller prefetch distance with BIS
|
2010-04-07 12:39:27 -07:00
|
|
|
FLAG_SET_DEFAULT(AllocatePrefetchDistance, 64);
|
|
|
|
}
|
|
|
|
}
|
2011-08-16 16:59:46 -07:00
|
|
|
if (is_T4()) {
|
|
|
|
// Double number of prefetched cache lines on T4
|
|
|
|
// since L2 cache line size is smaller (32 bytes).
|
|
|
|
if (FLAG_IS_DEFAULT(AllocatePrefetchLines)) {
|
|
|
|
FLAG_SET_ERGO(intx, AllocatePrefetchLines, AllocatePrefetchLines*2);
|
|
|
|
}
|
|
|
|
if (FLAG_IS_DEFAULT(AllocateInstancePrefetchLines)) {
|
|
|
|
FLAG_SET_ERGO(intx, AllocateInstancePrefetchLines, AllocateInstancePrefetchLines*2);
|
|
|
|
}
|
|
|
|
}
|
2016-04-29 08:32:42 +02:00
|
|
|
}
|
2011-08-16 16:59:46 -07:00
|
|
|
|
2017-06-19 01:23:58 -07:00
|
|
|
if ((AllocatePrefetchInstr == 1) && (AllocatePrefetchStyle != 3)) {
|
|
|
|
if (!FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
|
|
|
|
warning("AllocatePrefetchStyle set to 3 because BIS instructions require aligned memory addresses");
|
|
|
|
}
|
2016-04-29 08:32:42 +02:00
|
|
|
FLAG_SET_DEFAULT(AllocatePrefetchStyle, 3);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2016-04-29 08:32:42 +02:00
|
|
|
#endif /* COMPILER2 */
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2009-03-13 11:35:17 -07:00
|
|
|
// Use hardware population count instruction if available.
|
|
|
|
if (has_hardware_popc()) {
|
|
|
|
if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
|
2009-03-30 18:19:31 -07:00
|
|
|
FLAG_SET_DEFAULT(UsePopCountInstruction, true);
|
2009-03-13 11:35:17 -07:00
|
|
|
}
|
2011-07-21 11:25:07 -07:00
|
|
|
} else if (UsePopCountInstruction) {
|
|
|
|
warning("POPC instruction is not available on this CPU");
|
|
|
|
FLAG_SET_DEFAULT(UsePopCountInstruction, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// T4 and newer Sparc cpus have new compare and branch instruction.
|
|
|
|
if (has_cbcond()) {
|
|
|
|
if (FLAG_IS_DEFAULT(UseCBCond)) {
|
|
|
|
FLAG_SET_DEFAULT(UseCBCond, true);
|
|
|
|
}
|
|
|
|
} else if (UseCBCond) {
|
|
|
|
warning("CBCOND instruction is not available on this CPU");
|
|
|
|
FLAG_SET_DEFAULT(UseCBCond, false);
|
2009-03-13 11:35:17 -07:00
|
|
|
}
|
|
|
|
|
2011-08-26 08:52:22 -07:00
|
|
|
assert(BlockZeroingLowLimit > 0, "invalid value");
|
2014-09-05 11:23:47 -07:00
|
|
|
if (has_block_zeroing() && cache_line_size > 0) {
|
2011-08-26 08:52:22 -07:00
|
|
|
if (FLAG_IS_DEFAULT(UseBlockZeroing)) {
|
|
|
|
FLAG_SET_DEFAULT(UseBlockZeroing, true);
|
|
|
|
}
|
|
|
|
} else if (UseBlockZeroing) {
|
|
|
|
warning("BIS zeroing instructions are not available on this CPU");
|
|
|
|
FLAG_SET_DEFAULT(UseBlockZeroing, false);
|
|
|
|
}
|
|
|
|
|
2011-09-02 12:13:33 -07:00
|
|
|
assert(BlockCopyLowLimit > 0, "invalid value");
|
2014-09-05 11:23:47 -07:00
|
|
|
if (has_block_zeroing() && cache_line_size > 0) { // has_blk_init() && is_T4(): core's local L2 cache
|
2011-09-02 12:13:33 -07:00
|
|
|
if (FLAG_IS_DEFAULT(UseBlockCopy)) {
|
|
|
|
FLAG_SET_DEFAULT(UseBlockCopy, true);
|
|
|
|
}
|
|
|
|
} else if (UseBlockCopy) {
|
|
|
|
warning("BIS instructions are not available or expensive on this CPU");
|
|
|
|
FLAG_SET_DEFAULT(UseBlockCopy, false);
|
|
|
|
}
|
|
|
|
|
2010-08-19 14:51:47 -07:00
|
|
|
#ifdef COMPILER2
|
2011-07-21 11:25:07 -07:00
|
|
|
// T4 and newer Sparc cpus have fast RDPC.
|
|
|
|
if (has_fast_rdpc() && FLAG_IS_DEFAULT(UseRDPCForConstantTableBase)) {
|
2011-10-31 03:06:42 -07:00
|
|
|
FLAG_SET_DEFAULT(UseRDPCForConstantTableBase, true);
|
2011-07-21 11:25:07 -07:00
|
|
|
}
|
|
|
|
|
2015-09-03 14:29:08 -07:00
|
|
|
// Currently not supported anywhere.
|
|
|
|
FLAG_SET_DEFAULT(UseFPUForSpilling, false);
|
|
|
|
|
2012-06-15 01:25:19 -07:00
|
|
|
MaxVectorSize = 8;
|
|
|
|
|
2011-08-11 12:08:11 -07:00
|
|
|
assert((InteriorEntryAlignment % relocInfo::addr_unit()) == 0, "alignment is not a multiple of NOP size");
|
2010-08-19 14:51:47 -07:00
|
|
|
#endif
|
|
|
|
|
2011-08-11 12:08:11 -07:00
|
|
|
assert((CodeEntryAlignment % relocInfo::addr_unit()) == 0, "alignment is not a multiple of NOP size");
|
|
|
|
assert((OptoLoopAlignment % relocInfo::addr_unit()) == 0, "alignment is not a multiple of NOP size");
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
char buf[512];
|
2016-10-17 19:12:28 -04:00
|
|
|
jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
|
2011-07-21 11:25:07 -07:00
|
|
|
(has_v9() ? ", v9" : (has_v8() ? ", v8" : "")),
|
2009-03-13 11:35:17 -07:00
|
|
|
(has_hardware_popc() ? ", popc" : ""),
|
2011-07-21 11:25:07 -07:00
|
|
|
(has_vis1() ? ", vis1" : ""),
|
|
|
|
(has_vis2() ? ", vis2" : ""),
|
|
|
|
(has_vis3() ? ", vis3" : ""),
|
|
|
|
(has_blk_init() ? ", blk_init" : ""),
|
|
|
|
(has_cbcond() ? ", cbcond" : ""),
|
2014-01-14 17:46:48 -08:00
|
|
|
(has_aes() ? ", aes" : ""),
|
2014-06-11 11:05:10 -07:00
|
|
|
(has_sha1() ? ", sha1" : ""),
|
|
|
|
(has_sha256() ? ", sha256" : ""),
|
|
|
|
(has_sha512() ? ", sha512" : ""),
|
2015-06-29 00:10:01 -07:00
|
|
|
(has_crc32c() ? ", crc32c" : ""),
|
2011-07-21 11:25:07 -07:00
|
|
|
(is_ultra3() ? ", ultra3" : ""),
|
2016-10-17 19:12:28 -04:00
|
|
|
(has_sparc5_instr() ? ", sparc5" : ""),
|
2011-07-21 11:25:07 -07:00
|
|
|
(is_sun4v() ? ", sun4v" : ""),
|
|
|
|
(is_niagara_plus() ? ", niagara_plus" : (is_niagara() ? ", niagara" : "")),
|
|
|
|
(is_sparc64() ? ", sparc64" : ""),
|
2009-03-11 14:16:13 -07:00
|
|
|
(!has_hardware_mul32() ? ", no-mul32" : ""),
|
|
|
|
(!has_hardware_div32() ? ", no-div32" : ""),
|
2007-12-01 00:00:00 +00:00
|
|
|
(!has_hardware_fsmuld() ? ", no-fsmuld" : ""));
|
|
|
|
|
|
|
|
// buf is started with ", " or is empty
|
2015-12-23 20:19:42 -10:00
|
|
|
_features_string = os::strdup(strlen(buf) > 2 ? buf + 2 : buf);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2011-07-08 09:38:48 -07:00
|
|
|
// UseVIS is set to the smallest of what hardware supports and what
|
|
|
|
// the command line requires. I.e., you cannot set UseVIS to 3 on
|
|
|
|
// older UltraSparc which do not support it.
|
|
|
|
if (UseVIS > 3) UseVIS=3;
|
|
|
|
if (UseVIS < 0) UseVIS=0;
|
|
|
|
if (!has_vis3()) // Drop to 2 if no VIS3 support
|
|
|
|
UseVIS = MIN2((intx)2,UseVIS);
|
|
|
|
if (!has_vis2()) // Drop to 1 if no VIS2 support
|
|
|
|
UseVIS = MIN2((intx)1,UseVIS);
|
|
|
|
if (!has_vis1()) // Drop to 0 if no VIS1 support
|
|
|
|
UseVIS = 0;
|
|
|
|
|
2014-04-30 14:14:01 -07:00
|
|
|
// SPARC T4 and above should have support for AES instructions
|
2014-01-14 17:46:48 -08:00
|
|
|
if (has_aes()) {
|
2015-11-13 18:14:41 +03:00
|
|
|
if (FLAG_IS_DEFAULT(UseAES)) {
|
|
|
|
FLAG_SET_DEFAULT(UseAES, true);
|
|
|
|
}
|
|
|
|
if (!UseAES) {
|
|
|
|
if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) {
|
|
|
|
warning("AES intrinsics require UseAES flag to be enabled. Intrinsics will be disabled.");
|
2014-01-14 17:46:48 -08:00
|
|
|
}
|
2015-11-13 18:14:41 +03:00
|
|
|
FLAG_SET_DEFAULT(UseAESIntrinsics, false);
|
2014-01-14 17:46:48 -08:00
|
|
|
} else {
|
2015-11-13 18:14:41 +03:00
|
|
|
// The AES intrinsic stubs require AES instruction support (of course)
|
|
|
|
// but also require VIS3 mode or higher for instructions it use.
|
|
|
|
if (UseVIS > 2) {
|
|
|
|
if (FLAG_IS_DEFAULT(UseAESIntrinsics)) {
|
|
|
|
FLAG_SET_DEFAULT(UseAESIntrinsics, true);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) {
|
|
|
|
warning("SPARC AES intrinsics require VIS3 instructions. Intrinsics will be disabled.");
|
2014-01-14 17:46:48 -08:00
|
|
|
}
|
2015-11-13 18:14:41 +03:00
|
|
|
FLAG_SET_DEFAULT(UseAESIntrinsics, false);
|
|
|
|
}
|
2014-01-14 17:46:48 -08:00
|
|
|
}
|
|
|
|
} else if (UseAES || UseAESIntrinsics) {
|
2015-11-13 18:14:41 +03:00
|
|
|
if (UseAES && !FLAG_IS_DEFAULT(UseAES)) {
|
|
|
|
warning("AES instructions are not available on this CPU");
|
2014-01-14 17:46:48 -08:00
|
|
|
FLAG_SET_DEFAULT(UseAES, false);
|
|
|
|
}
|
2015-11-13 18:14:41 +03:00
|
|
|
if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) {
|
|
|
|
warning("AES intrinsics are not available on this CPU");
|
2014-01-14 17:46:48 -08:00
|
|
|
FLAG_SET_DEFAULT(UseAESIntrinsics, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-28 23:11:01 -08:00
|
|
|
if (UseAESCTRIntrinsics) {
|
|
|
|
warning("AES/CTR intrinsics are not available on this CPU");
|
|
|
|
FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false);
|
|
|
|
}
|
|
|
|
|
2015-06-17 17:48:25 -07:00
|
|
|
// GHASH/GCM intrinsics
|
|
|
|
if (has_vis3() && (UseVIS > 2)) {
|
|
|
|
if (FLAG_IS_DEFAULT(UseGHASHIntrinsics)) {
|
|
|
|
UseGHASHIntrinsics = true;
|
|
|
|
}
|
|
|
|
} else if (UseGHASHIntrinsics) {
|
|
|
|
if (!FLAG_IS_DEFAULT(UseGHASHIntrinsics))
|
2015-07-13 13:22:21 -07:00
|
|
|
warning("GHASH intrinsics require VIS3 instruction support. Intrinsics will be disabled");
|
2015-06-17 17:48:25 -07:00
|
|
|
FLAG_SET_DEFAULT(UseGHASHIntrinsics, false);
|
|
|
|
}
|
|
|
|
|
2016-08-26 12:17:50 -07:00
|
|
|
if (UseFMA) {
|
|
|
|
warning("FMA instructions are not available on this CPU");
|
|
|
|
FLAG_SET_DEFAULT(UseFMA, false);
|
|
|
|
}
|
|
|
|
|
2014-06-11 11:05:10 -07:00
|
|
|
// SHA1, SHA256, and SHA512 instructions were added to SPARC T-series at different times
|
|
|
|
if (has_sha1() || has_sha256() || has_sha512()) {
|
|
|
|
if (UseVIS > 0) { // SHA intrinsics use VIS1 instructions
|
|
|
|
if (FLAG_IS_DEFAULT(UseSHA)) {
|
|
|
|
FLAG_SET_DEFAULT(UseSHA, true);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (UseSHA) {
|
|
|
|
warning("SPARC SHA intrinsics require VIS1 instruction support. Intrinsics will be disabled.");
|
|
|
|
FLAG_SET_DEFAULT(UseSHA, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (UseSHA) {
|
|
|
|
warning("SHA instructions are not available on this CPU");
|
|
|
|
FLAG_SET_DEFAULT(UseSHA, false);
|
|
|
|
}
|
|
|
|
|
2015-07-03 09:33:04 +02:00
|
|
|
if (UseSHA && has_sha1()) {
|
|
|
|
if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) {
|
|
|
|
FLAG_SET_DEFAULT(UseSHA1Intrinsics, true);
|
2014-06-11 11:05:10 -07:00
|
|
|
}
|
2015-07-03 09:33:04 +02:00
|
|
|
} else if (UseSHA1Intrinsics) {
|
|
|
|
warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU.");
|
|
|
|
FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
|
|
|
|
}
|
2014-06-11 11:05:10 -07:00
|
|
|
|
2015-07-03 09:33:04 +02:00
|
|
|
if (UseSHA && has_sha256()) {
|
|
|
|
if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
|
|
|
|
FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
|
2014-06-11 11:05:10 -07:00
|
|
|
}
|
2015-07-03 09:33:04 +02:00
|
|
|
} else if (UseSHA256Intrinsics) {
|
|
|
|
warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.");
|
|
|
|
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (UseSHA && has_sha512()) {
|
|
|
|
if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) {
|
|
|
|
FLAG_SET_DEFAULT(UseSHA512Intrinsics, true);
|
2014-06-11 11:05:10 -07:00
|
|
|
}
|
2015-07-03 09:33:04 +02:00
|
|
|
} else if (UseSHA512Intrinsics) {
|
|
|
|
warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU.");
|
|
|
|
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
|
|
|
|
FLAG_SET_DEFAULT(UseSHA, false);
|
2014-06-11 11:05:10 -07:00
|
|
|
}
|
|
|
|
|
2015-06-29 00:10:01 -07:00
|
|
|
// SPARC T4 and above should have support for CRC32C instruction
|
|
|
|
if (has_crc32c()) {
|
|
|
|
if (UseVIS > 2) { // CRC32C intrinsics use VIS3 instructions
|
|
|
|
if (FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) {
|
|
|
|
FLAG_SET_DEFAULT(UseCRC32CIntrinsics, true);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (UseCRC32CIntrinsics) {
|
|
|
|
warning("SPARC CRC32C intrinsics require VIS3 instruction support. Intrinsics will be disabled.");
|
|
|
|
FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (UseCRC32CIntrinsics) {
|
|
|
|
warning("CRC32C instruction is not available on this CPU");
|
|
|
|
FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
|
|
|
|
}
|
|
|
|
|
2015-09-03 15:03:12 -07:00
|
|
|
if (UseVIS > 2) {
|
|
|
|
if (FLAG_IS_DEFAULT(UseAdler32Intrinsics)) {
|
|
|
|
FLAG_SET_DEFAULT(UseAdler32Intrinsics, true);
|
|
|
|
}
|
|
|
|
} else if (UseAdler32Intrinsics) {
|
|
|
|
warning("SPARC Adler32 intrinsics require VIS3 instruction support. Intrinsics will be disabled.");
|
|
|
|
FLAG_SET_DEFAULT(UseAdler32Intrinsics, false);
|
|
|
|
}
|
|
|
|
|
2015-11-20 08:29:10 -08:00
|
|
|
if (UseVIS > 2) {
|
|
|
|
if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) {
|
|
|
|
FLAG_SET_DEFAULT(UseCRC32Intrinsics, true);
|
|
|
|
}
|
|
|
|
} else if (UseCRC32Intrinsics) {
|
2016-11-21 08:27:10 +01:00
|
|
|
warning("SPARC CRC32 intrinsics require VIS3 instructions support. Intrinsics will be disabled");
|
2015-11-20 08:29:10 -08:00
|
|
|
FLAG_SET_DEFAULT(UseCRC32Intrinsics, false);
|
|
|
|
}
|
|
|
|
|
2015-12-07 16:35:07 -08:00
|
|
|
if (UseVectorizedMismatchIntrinsic) {
|
|
|
|
warning("UseVectorizedMismatchIntrinsic specified, but not available on this CPU.");
|
|
|
|
FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false);
|
|
|
|
}
|
|
|
|
|
2013-01-14 15:17:47 +01:00
|
|
|
if (FLAG_IS_DEFAULT(ContendedPaddingWidth) &&
|
|
|
|
(cache_line_size > ContendedPaddingWidth))
|
|
|
|
ContendedPaddingWidth = cache_line_size;
|
|
|
|
|
2015-03-31 12:31:18 -07:00
|
|
|
// This machine does not allow unaligned memory accesses
|
|
|
|
if (UseUnalignedAccesses) {
|
|
|
|
if (!FLAG_IS_DEFAULT(UseUnalignedAccesses))
|
|
|
|
warning("Unaligned memory access is not available on this CPU");
|
|
|
|
FLAG_SET_DEFAULT(UseUnalignedAccesses, false);
|
|
|
|
}
|
|
|
|
|
2016-04-07 16:37:35 -04:00
|
|
|
if (log_is_enabled(Info, os, cpu)) {
|
|
|
|
ResourceMark rm;
|
|
|
|
outputStream* log = Log(os, cpu)::info_stream();
|
|
|
|
log->print_cr("L1 data cache line size: %u", L1_data_cache_line_size());
|
|
|
|
log->print_cr("L2 data cache line size: %u", L2_data_cache_line_size());
|
|
|
|
log->print("Allocation");
|
2007-12-01 00:00:00 +00:00
|
|
|
if (AllocatePrefetchStyle <= 0) {
|
2016-04-07 16:37:35 -04:00
|
|
|
log->print(": no prefetching");
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
2016-04-07 16:37:35 -04:00
|
|
|
log->print(" prefetching: ");
|
2011-08-16 16:59:46 -07:00
|
|
|
if (AllocatePrefetchInstr == 0) {
|
2016-04-07 16:37:35 -04:00
|
|
|
log->print("PREFETCH");
|
2011-08-16 16:59:46 -07:00
|
|
|
} else if (AllocatePrefetchInstr == 1) {
|
2016-04-07 16:37:35 -04:00
|
|
|
log->print("BIS");
|
2011-08-16 16:59:46 -07:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
if (AllocatePrefetchLines > 1) {
|
2016-04-07 16:37:35 -04:00
|
|
|
log->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize);
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
2016-04-07 16:37:35 -04:00
|
|
|
log->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (PrefetchCopyIntervalInBytes > 0) {
|
2016-04-07 16:37:35 -04:00
|
|
|
log->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
if (PrefetchScanIntervalInBytes > 0) {
|
2016-04-07 16:37:35 -04:00
|
|
|
log->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
if (PrefetchFieldsAhead > 0) {
|
2016-04-07 16:37:35 -04:00
|
|
|
log->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
2013-01-14 15:17:47 +01:00
|
|
|
if (ContendedPaddingWidth > 0) {
|
2016-04-07 16:37:35 -04:00
|
|
|
log->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth);
|
2013-01-14 15:17:47 +01:00
|
|
|
}
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void VM_Version::print_features() {
|
2015-12-23 20:19:42 -10:00
|
|
|
tty->print_cr("Version:%s", _features);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int VM_Version::determine_features() {
|
|
|
|
if (UseV8InstrsOnly) {
|
2016-04-07 16:37:35 -04:00
|
|
|
log_info(os, cpu)("Version is Forced-V8");
|
2007-12-01 00:00:00 +00:00
|
|
|
return generic_v8_m;
|
|
|
|
}
|
|
|
|
|
|
|
|
int features = platform_features(unknown_m); // platform_features() is os_arch specific
|
|
|
|
|
|
|
|
if (features == unknown_m) {
|
|
|
|
features = generic_v9_m;
|
2016-04-07 16:37:35 -04:00
|
|
|
log_info(os)("Cannot recognize SPARC version. Default to V9");
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2010-12-16 14:15:12 -08:00
|
|
|
assert(is_T_family(features) == is_niagara(features), "Niagara should be T series");
|
|
|
|
if (UseNiagaraInstrs) { // Force code generation for Niagara
|
|
|
|
if (is_T_family(features)) {
|
2007-12-01 00:00:00 +00:00
|
|
|
// Happy to accomodate...
|
|
|
|
} else {
|
2016-04-07 16:37:35 -04:00
|
|
|
log_info(os, cpu)("Version is Forced-Niagara");
|
2010-12-16 14:15:12 -08:00
|
|
|
features |= T_family_m;
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
} else {
|
2010-12-16 14:15:12 -08:00
|
|
|
if (is_T_family(features) && !FLAG_IS_DEFAULT(UseNiagaraInstrs)) {
|
2016-04-07 16:37:35 -04:00
|
|
|
log_info(os, cpu)("Version is Forced-Not-Niagara");
|
2010-12-16 14:15:12 -08:00
|
|
|
features &= ~(T_family_m | T1_model_m);
|
2007-12-01 00:00:00 +00:00
|
|
|
} else {
|
|
|
|
// Happy to accomodate...
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return features;
|
|
|
|
}
|
|
|
|
|
2015-12-23 20:19:42 -10:00
|
|
|
static uint64_t saved_features = 0;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
void VM_Version::allow_all() {
|
|
|
|
saved_features = _features;
|
|
|
|
_features = all_features_m;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VM_Version::revert() {
|
|
|
|
_features = saved_features;
|
|
|
|
}
|
2008-02-22 17:17:14 -08:00
|
|
|
|
|
|
|
unsigned int VM_Version::calc_parallel_worker_threads() {
|
|
|
|
unsigned int result;
|
2016-10-19 10:48:48 -07:00
|
|
|
if (is_M_series() || is_S_series()) {
|
|
|
|
// for now, use same gc thread calculation for M-series and S-series as for
|
|
|
|
// niagara-plus. In future, we may want to tweak parameters for
|
|
|
|
// nof_parallel_worker_thread
|
2012-09-24 11:07:03 -07:00
|
|
|
result = nof_parallel_worker_threads(5, 16, 8);
|
|
|
|
} else if (is_niagara_plus()) {
|
2008-02-22 17:17:14 -08:00
|
|
|
result = nof_parallel_worker_threads(5, 16, 8);
|
|
|
|
} else {
|
|
|
|
result = nof_parallel_worker_threads(5, 8, 8);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
2016-03-01 12:35:21 -08:00
|
|
|
|
|
|
|
|
|
|
|
int VM_Version::parse_features(const char* implementation) {
|
|
|
|
int features = unknown_m;
|
|
|
|
// Convert to UPPER case before compare.
|
|
|
|
char* impl = os::strdup_check_oom(implementation);
|
|
|
|
|
|
|
|
for (int i = 0; impl[i] != 0; i++)
|
|
|
|
impl[i] = (char)toupper((uint)impl[i]);
|
|
|
|
|
|
|
|
if (strstr(impl, "SPARC64") != NULL) {
|
|
|
|
features |= sparc64_family_m;
|
|
|
|
} else if (strstr(impl, "SPARC-M") != NULL) {
|
|
|
|
// M-series SPARC is based on T-series.
|
|
|
|
features |= (M_family_m | T_family_m);
|
2016-10-19 10:48:48 -07:00
|
|
|
} else if (strstr(impl, "SPARC-S") != NULL) {
|
|
|
|
// S-series SPARC is based on T-series.
|
|
|
|
features |= (S_family_m | T_family_m);
|
2016-03-01 12:35:21 -08:00
|
|
|
} else if (strstr(impl, "SPARC-T") != NULL) {
|
|
|
|
features |= T_family_m;
|
|
|
|
if (strstr(impl, "SPARC-T1") != NULL) {
|
|
|
|
features |= T1_model_m;
|
|
|
|
}
|
2016-10-17 19:12:28 -04:00
|
|
|
} else if (strstr(impl, "SUN4V-CPU") != NULL) {
|
|
|
|
// Generic or migration class LDOM
|
|
|
|
features |= T_family_m;
|
2016-03-01 12:35:21 -08:00
|
|
|
} else {
|
2016-10-17 19:12:28 -04:00
|
|
|
log_info(os, cpu)("Failed to parse CPU implementation = '%s'", impl);
|
2016-03-01 12:35:21 -08:00
|
|
|
}
|
|
|
|
os::free((void*)impl);
|
|
|
|
return features;
|
|
|
|
}
|