src/hotspot/cpu/sparc/vm_version_sparc.cpp
author lucy
Mon, 18 Nov 2019 17:11:06 +0100
changeset 59122 5d73255c2d52
parent 54983 81becad91321
permissions -rw-r--r--
8233787: Break cycle in vm_version* includes Reviewed-by: kbarrett, mdoerr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
59122
5d73255c2d52 8233787: Break cycle in vm_version* includes
lucy
parents: 54983
diff changeset
     2
 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5431
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5431
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: 5431
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7115
diff changeset
    25
#include "precompiled.hpp"
47765
b7c7428eaab9 8189610: Reconcile jvm.h and all jvm_md.h between java.base and hotspot
coleenp
parents: 47562
diff changeset
    26
#include "jvm.h"
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents: 13969
diff changeset
    27
#include "asm/macroAssembler.inline.hpp"
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
    28
#include "logging/log.hpp"
46701
f559541c0daa 8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents: 46597
diff changeset
    29
#include "logging/logStream.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7115
diff changeset
    30
#include "memory/resourceArea.hpp"
54780
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents: 52904
diff changeset
    31
#include "oops/compressedOops.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7115
diff changeset
    32
#include "runtime/java.hpp"
25949
34557722059b 6424123: JVM crashes on failed 'strdup' call
zgu
parents: 25633
diff changeset
    33
#include "runtime/os.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7115
diff changeset
    34
#include "runtime/stubCodeGenerator.hpp"
59122
5d73255c2d52 8233787: Break cycle in vm_version* includes
lucy
parents: 54983
diff changeset
    35
#include "runtime/vm_version.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    37
#include <sys/mman.h>
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    38
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    39
uint VM_Version::_L2_data_cache_line_size = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
void VM_Version::initialize() {
35148
5cfafc99d791 8143072: [JVMCI] Port JVMCI to AArch64
twisti
parents: 35135
diff changeset
    42
  assert(_features != 0, "System pre-initialization is not complete.");
35043
30543d2a0a20 8133023: ParallelGCThreads is not calculated correctly
jmasa
parents: 34205
diff changeset
    43
  guarantee(VM_Version::has_v9(), "only SPARC v9 is supported");
30543d2a0a20 8133023: ParallelGCThreads is not calculated correctly
jmasa
parents: 34205
diff changeset
    44
46591
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    45
  PrefetchCopyIntervalInBytes = prefetch_copy_interval_in_bytes();
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    46
  PrefetchScanIntervalInBytes = prefetch_scan_interval_in_bytes();
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    47
  PrefetchFieldsAhead         = prefetch_fields_ahead();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  // Allocation prefetch settings
46591
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    50
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    51
  AllocatePrefetchDistance = allocate_prefetch_distance();
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    52
  AllocatePrefetchStyle    = allocate_prefetch_style();
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    53
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
    54
  intx cache_line_size = prefetch_data_size();
46591
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    55
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    56
  if (FLAG_IS_DEFAULT(AllocatePrefetchStepSize)) {
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    57
    AllocatePrefetchStepSize = MAX2(AllocatePrefetchStepSize, cache_line_size);
46547
e1b926a0b23f 8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents: 46381
diff changeset
    58
  }
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
    59
46591
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    60
  if (AllocatePrefetchInstr == 1) {
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    61
    if (!has_blk_init()) {
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    62
      warning("BIS instructions required for AllocatePrefetchInstr 1 unavailable");
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    63
      FLAG_SET_DEFAULT(AllocatePrefetchInstr, 0);
46547
e1b926a0b23f 8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents: 46381
diff changeset
    64
    }
46591
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    65
    if (cache_line_size <= 0) {
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    66
      warning("Cache-line size must be known for AllocatePrefetchInstr 1 to work");
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    67
      FLAG_SET_DEFAULT(AllocatePrefetchInstr, 0);
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    68
    }
46547
e1b926a0b23f 8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents: 46381
diff changeset
    69
  }
e1b926a0b23f 8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents: 46381
diff changeset
    70
46591
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    71
  UseSSE = false;                   // Only used on x86 and x64.
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
    72
46591
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    73
  _supports_cx8 = true;             // All SPARC V9 implementations.
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    74
  _supports_atomic_getset4 = true;  // Using the 'swap' instruction.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    76
  if (has_fast_ind_br() && FLAG_IS_DEFAULT(UseInlineCaches)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    77
    // Indirect and direct branches are cost equivalent.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    78
    FLAG_SET_DEFAULT(UseInlineCaches, false);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    79
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    80
  // Align loops on the proper instruction boundary to fill the instruction
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    81
  // fetch buffer.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    82
  if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    83
    FLAG_SET_DEFAULT(OptoLoopAlignment, VM_Version::insn_fetch_alignment);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    84
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    85
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    86
  // 32-bit oops don't make sense for the 64-bit VM on SPARC since the 32-bit
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    87
  // VM has the same registers and smaller objects.
54780
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents: 52904
diff changeset
    88
  CompressedOops::set_shift(LogMinObjAlignmentInBytes);
f8d182aedc92 8223136: Move compressed oops functions to CompressedOops class
stefank
parents: 52904
diff changeset
    89
  CompressedKlassPointers::set_shift(LogKlassAlignmentInBytes);
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    90
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
#ifdef COMPILER2
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    92
  if (has_fast_ind_br() && FLAG_IS_DEFAULT(UseJumpTables)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    93
    // Indirect and direct branches are cost equivalent.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    94
    FLAG_SET_DEFAULT(UseJumpTables, true);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    95
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    96
  // Entry and loop tops are aligned to fill the instruction fetch buffer.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    97
  if (FLAG_IS_DEFAULT(InteriorEntryAlignment)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    98
    FLAG_SET_DEFAULT(InteriorEntryAlignment, VM_Version::insn_fetch_alignment);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    99
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   100
  if (UseTLAB && cache_line_size > 0 &&
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   101
      FLAG_IS_DEFAULT(AllocatePrefetchInstr)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   102
    if (has_fast_bis()) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   103
      // Use BIS instruction for TLAB allocation prefetch.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   104
      FLAG_SET_DEFAULT(AllocatePrefetchInstr, 1);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    }
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   106
    else if (has_sparc5()) {
47562
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   107
      // Use prefetch instruction to avoid partial RAW issue on Core C4 processors,
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   108
      // also use prefetch style 3.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   109
      FLAG_SET_DEFAULT(AllocatePrefetchInstr, 0);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   110
      if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   111
        FLAG_SET_DEFAULT(AllocatePrefetchStyle, 3);
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
   112
      }
38220
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 38054
diff changeset
   113
    }
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   114
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   115
  if (AllocatePrefetchInstr == 1) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   116
    // Use allocation prefetch style 3 because BIS instructions require
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   117
    // aligned memory addresses.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   118
    FLAG_SET_DEFAULT(AllocatePrefetchStyle, 3);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   119
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   120
  if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   121
    if (AllocatePrefetchInstr == 0) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   122
      // Use different prefetch distance without BIS
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   123
      FLAG_SET_DEFAULT(AllocatePrefetchDistance, 256);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   124
    } else {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   125
      // Use smaller prefetch distance with BIS
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   126
      FLAG_SET_DEFAULT(AllocatePrefetchDistance, 64);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   130
  // We increase the number of prefetched cache lines, to use just a bit more
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   131
  // aggressive approach, when the L2-cache line size is small (32 bytes), or
47562
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   132
  // when running on newer processor implementations, such as the Core C4.
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   133
  bool inc_prefetch = cache_line_size > 0 && (cache_line_size < 64 || has_sparc5());
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   134
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   135
  if (inc_prefetch) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   136
    // We use a factor two for small cache line sizes (as before) but a slightly
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   137
    // more conservative increase when running on more recent hardware that will
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   138
    // benefit from just a bit more aggressive prefetching.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   139
    if (FLAG_IS_DEFAULT(AllocatePrefetchLines)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   140
      const int ap_lns = AllocatePrefetchLines;
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   141
      const int ap_inc = cache_line_size < 64 ? ap_lns : (ap_lns + 1) / 2;
54983
81becad91321 8224203: Remove need to specify type when using FLAG_SET macros
stefank
parents: 54780
diff changeset
   142
      FLAG_SET_ERGO(AllocatePrefetchLines, ap_lns + ap_inc);
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   143
    }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   144
    if (FLAG_IS_DEFAULT(AllocateInstancePrefetchLines)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   145
      const int ip_lns = AllocateInstancePrefetchLines;
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   146
      const int ip_inc = cache_line_size < 64 ? ip_lns : (ip_lns + 1) / 2;
54983
81becad91321 8224203: Remove need to specify type when using FLAG_SET macros
stefank
parents: 54780
diff changeset
   147
      FLAG_SET_ERGO(AllocateInstancePrefetchLines, ip_lns + ip_inc);
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   148
    }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   149
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   150
#endif /* COMPILER2 */
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   151
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
   152
  // Use hardware population count instruction if available.
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   153
  if (has_popc()) {
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
   154
    if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
2342
9a1260c3679d 6821700: tune VM flags for peak performance
kvn
parents: 2255
diff changeset
   155
      FLAG_SET_DEFAULT(UsePopCountInstruction, true);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
   156
    }
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   157
  } else if (UsePopCountInstruction) {
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   158
    warning("POPC instruction is not available on this CPU");
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   159
    FLAG_SET_DEFAULT(UsePopCountInstruction, false);
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   160
  }
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   161
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   162
  // Use compare and branch instructions if available.
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   163
  if (has_cbcond()) {
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   164
    if (FLAG_IS_DEFAULT(UseCBCond)) {
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   165
      FLAG_SET_DEFAULT(UseCBCond, true);
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   166
    }
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   167
  } else if (UseCBCond) {
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   168
    warning("CBCOND instruction is not available on this CPU");
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   169
    FLAG_SET_DEFAULT(UseCBCond, false);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
   170
  }
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
   171
47561
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   172
  // Use 'mpmul' instruction if available.
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   173
  if (has_mpmul()) {
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   174
    if (FLAG_IS_DEFAULT(UseMPMUL)) {
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   175
      FLAG_SET_DEFAULT(UseMPMUL, true);
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   176
    }
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   177
  } else if (UseMPMUL) {
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   178
    warning("MPMUL instruction is not available on this CPU");
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   179
    FLAG_SET_DEFAULT(UseMPMUL, false);
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   180
  }
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   181
10501
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   182
  assert(BlockZeroingLowLimit > 0, "invalid value");
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   183
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   184
  if (has_blk_zeroing() && cache_line_size > 0) {
10501
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   185
    if (FLAG_IS_DEFAULT(UseBlockZeroing)) {
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   186
      FLAG_SET_DEFAULT(UseBlockZeroing, true);
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   187
    }
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   188
  } else if (UseBlockZeroing) {
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   189
    warning("BIS zeroing instructions are not available on this CPU");
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   190
    FLAG_SET_DEFAULT(UseBlockZeroing, false);
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   191
  }
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   192
10512
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   193
  assert(BlockCopyLowLimit > 0, "invalid value");
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   194
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   195
  if (has_blk_zeroing() && cache_line_size > 0) {
10512
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   196
    if (FLAG_IS_DEFAULT(UseBlockCopy)) {
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   197
      FLAG_SET_DEFAULT(UseBlockCopy, true);
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   198
    }
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   199
  } else if (UseBlockCopy) {
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   200
    warning("BIS instructions are not available or expensive on this CPU");
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   201
    FLAG_SET_DEFAULT(UseBlockCopy, false);
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   202
  }
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   203
6272
94a20ad0e9de 6978249: spill between cpu and fpu registers when those moves are fast
never
parents: 5702
diff changeset
   204
#ifdef COMPILER2
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   205
  if (has_fast_rdpc() && FLAG_IS_DEFAULT(UseRDPCForConstantTableBase)) {
10977
4726185d3e93 7104561: UseRDPCForConstantTableBase doesn't work after shorten branches changes
twisti
parents: 10512
diff changeset
   206
    FLAG_SET_DEFAULT(UseRDPCForConstantTableBase, true);
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   207
  }
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   208
6272
94a20ad0e9de 6978249: spill between cpu and fpu registers when those moves are fast
never
parents: 5702
diff changeset
   209
  // Currently not supported anywhere.
94a20ad0e9de 6978249: spill between cpu and fpu registers when those moves are fast
never
parents: 5702
diff changeset
   210
  FLAG_SET_DEFAULT(UseFPUForSpilling, false);
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10252
diff changeset
   211
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10977
diff changeset
   212
  MaxVectorSize = 8;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10977
diff changeset
   213
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10252
diff changeset
   214
  assert((InteriorEntryAlignment % relocInfo::addr_unit()) == 0, "alignment is not a multiple of NOP size");
6272
94a20ad0e9de 6978249: spill between cpu and fpu registers when those moves are fast
never
parents: 5702
diff changeset
   215
#endif
94a20ad0e9de 6978249: spill between cpu and fpu registers when those moves are fast
never
parents: 5702
diff changeset
   216
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10252
diff changeset
   217
  assert((CodeEntryAlignment % relocInfo::addr_unit()) == 0, "alignment is not a multiple of NOP size");
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10252
diff changeset
   218
  assert((OptoLoopAlignment % relocInfo::addr_unit()) == 0, "alignment is not a multiple of NOP size");
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10252
diff changeset
   219
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  char buf[512];
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   221
  jio_snprintf(buf, sizeof(buf),
47562
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   222
               "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   223
               "%s%s%s%s%s%s%s%s%s" "%s%s%s%s%s%s%s%s%s"
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   224
               "%s%s%s%s%s%s%s",
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   225
               (has_v9()          ? "v9" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   226
               (has_popc()        ? ", popc" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   227
               (has_vis1()        ? ", vis1" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   228
               (has_vis2()        ? ", vis2" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   229
               (has_blk_init()    ? ", blk_init" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   230
               (has_fmaf()        ? ", fmaf" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   231
               (has_hpc()         ? ", hpc" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   232
               (has_ima()         ? ", ima" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   233
               (has_aes()         ? ", aes" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   234
               (has_des()         ? ", des" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   235
               (has_kasumi()      ? ", kas" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   236
               (has_camellia()    ? ", cam" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   237
               (has_md5()         ? ", md5" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   238
               (has_sha1()        ? ", sha1" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   239
               (has_sha256()      ? ", sha256" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   240
               (has_sha512()      ? ", sha512" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   241
               (has_mpmul()       ? ", mpmul" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   242
               (has_mont()        ? ", mont" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   243
               (has_pause()       ? ", pause" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   244
               (has_cbcond()      ? ", cbcond" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   245
               (has_crc32c()      ? ", crc32c" : ""),
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   247
               (has_athena_plus() ? ", athena_plus" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   248
               (has_vis3b()       ? ", vis3b" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   249
               (has_adi()         ? ", adi" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   250
               (has_sparc5()      ? ", sparc5" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   251
               (has_mwait()       ? ", mwait" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   252
               (has_xmpmul()      ? ", xmpmul" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   253
               (has_xmont()       ? ", xmont" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   254
               (has_pause_nsec()  ? ", pause_nsec" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   255
               (has_vamask()      ? ", vamask" : ""),
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
47562
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   257
               (has_sparc6()      ? ", sparc6" : ""),
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   258
               (has_dictunp()     ? ", dictunp" : ""),
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   259
               (has_fpcmpshl()    ? ", fpcmpshl" : ""),
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   260
               (has_rle()         ? ", rle" : ""),
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   261
               (has_sha3()        ? ", sha3" : ""),
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   262
               (has_athena_plus2()? ", athena_plus2" : ""),
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   263
               (has_vis3c()       ? ", vis3c" : ""),
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   264
               (has_sparc5b()     ? ", sparc5b" : ""),
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   265
               (has_mme()         ? ", mme" : ""),
f789ccebcfe4 8182279: Updating SPARC feature/capability detection to support Core C5.
neliasso
parents: 47561
diff changeset
   266
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   267
               (has_fast_idiv()   ? ", *idiv" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   268
               (has_fast_rdpc()   ? ", *rdpc" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   269
               (has_fast_bis()    ? ", *bis" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   270
               (has_fast_ld()     ? ", *ld" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   271
               (has_fast_cmove()  ? ", *cmove" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   272
               (has_fast_ind_br() ? ", *ind_br" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   273
               (has_blk_zeroing() ? ", *blk_zeroing" : ""));
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   274
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   275
  assert(strlen(buf) >= 2, "must be");
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   276
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   277
  _features_string = os::strdup(buf);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   278
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   279
  log_info(os, cpu)("SPARC features detected: %s", _features_string);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   280
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   281
  // UseVIS is set to the smallest of what hardware supports and what the command
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   282
  // line requires, i.e. you cannot set UseVIS to 3 on older UltraSparc which do
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   283
  // not support it.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   284
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   285
  if (UseVIS > 3) UseVIS = 3;
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   286
  if (UseVIS < 0) UseVIS = 0;
10027
20cd71f29262 7059034: Use movxtod/movdtox on T4
kvn
parents: 7704
diff changeset
   287
  if (!has_vis3()) // Drop to 2 if no VIS3 support
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   288
    UseVIS = MIN2((intx)2, UseVIS);
10027
20cd71f29262 7059034: Use movxtod/movdtox on T4
kvn
parents: 7704
diff changeset
   289
  if (!has_vis2()) // Drop to 1 if no VIS2 support
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   290
    UseVIS = MIN2((intx)1, UseVIS);
10027
20cd71f29262 7059034: Use movxtod/movdtox on T4
kvn
parents: 7704
diff changeset
   291
  if (!has_vis1()) // Drop to 0 if no VIS1 support
20cd71f29262 7059034: Use movxtod/movdtox on T4
kvn
parents: 7704
diff changeset
   292
    UseVIS = 0;
20cd71f29262 7059034: Use movxtod/movdtox on T4
kvn
parents: 7704
diff changeset
   293
22505
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   294
  if (has_aes()) {
34176
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   295
    if (FLAG_IS_DEFAULT(UseAES)) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   296
      FLAG_SET_DEFAULT(UseAES, true);
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   297
    }
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   298
    if (!UseAES) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   299
      if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   300
        warning("AES intrinsics require UseAES flag to be enabled. Intrinsics will be disabled.");
22505
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   301
      }
34176
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   302
      FLAG_SET_DEFAULT(UseAESIntrinsics, false);
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   303
    } else {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   304
      // The AES intrinsic stubs require AES instruction support (of course)
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   305
      // but also require VIS3 mode or higher for instructions it use.
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   306
      if (UseVIS > 2) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   307
        if (FLAG_IS_DEFAULT(UseAESIntrinsics)) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   308
          FLAG_SET_DEFAULT(UseAESIntrinsics, true);
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   309
        }
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   310
      } else {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   311
        if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   312
          warning("SPARC AES intrinsics require VIS3 instructions. Intrinsics will be disabled.");
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   313
        }
22505
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   314
        FLAG_SET_DEFAULT(UseAESIntrinsics, false);
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   315
      }
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   316
    }
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   317
  } else if (UseAES || UseAESIntrinsics) {
34176
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   318
    if (UseAES && !FLAG_IS_DEFAULT(UseAES)) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   319
      warning("AES instructions are not available on this CPU");
22505
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   320
      FLAG_SET_DEFAULT(UseAES, false);
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   321
    }
34176
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   322
    if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   323
      warning("AES intrinsics are not available on this CPU");
22505
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   324
      FLAG_SET_DEFAULT(UseAESIntrinsics, false);
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   325
    }
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   326
  }
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   327
35154
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35148
diff changeset
   328
  if (UseAESCTRIntrinsics) {
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35148
diff changeset
   329
    warning("AES/CTR intrinsics are not available on this CPU");
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35148
diff changeset
   330
    FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35148
diff changeset
   331
  }
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35148
diff changeset
   332
31404
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   333
  // GHASH/GCM intrinsics
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   334
  if (has_vis3() && (UseVIS > 2)) {
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   335
    if (FLAG_IS_DEFAULT(UseGHASHIntrinsics)) {
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   336
      UseGHASHIntrinsics = true;
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   337
    }
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   338
  } else if (UseGHASHIntrinsics) {
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   339
    if (!FLAG_IS_DEFAULT(UseGHASHIntrinsics))
31774
c30034f09367 8131078: typos in ghash cpu message
ascarpino
parents: 31588
diff changeset
   340
      warning("GHASH intrinsics require VIS3 instruction support. Intrinsics will be disabled");
31404
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   341
    FLAG_SET_DEFAULT(UseGHASHIntrinsics, false);
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   342
  }
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   343
46597
d669fb842ae3 8164888: Intrinsify fused mac operations on SPARC
neliasso
parents: 46595
diff changeset
   344
  if (has_fmaf()) {
d669fb842ae3 8164888: Intrinsify fused mac operations on SPARC
neliasso
parents: 46595
diff changeset
   345
    if (FLAG_IS_DEFAULT(UseFMA)) {
d669fb842ae3 8164888: Intrinsify fused mac operations on SPARC
neliasso
parents: 46595
diff changeset
   346
      UseFMA = true;
d669fb842ae3 8164888: Intrinsify fused mac operations on SPARC
neliasso
parents: 46595
diff changeset
   347
    }
d669fb842ae3 8164888: Intrinsify fused mac operations on SPARC
neliasso
parents: 46595
diff changeset
   348
  } else if (UseFMA) {
41323
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38304
diff changeset
   349
    warning("FMA instructions are not available on this CPU");
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38304
diff changeset
   350
    FLAG_SET_DEFAULT(UseFMA, false);
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38304
diff changeset
   351
  }
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38304
diff changeset
   352
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   353
  // SHA1, SHA256, and SHA512 instructions were added to SPARC at different times
24953
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   354
  if (has_sha1() || has_sha256() || has_sha512()) {
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   355
    if (UseVIS > 0) { // SHA intrinsics use VIS1 instructions
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   356
      if (FLAG_IS_DEFAULT(UseSHA)) {
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   357
        FLAG_SET_DEFAULT(UseSHA, true);
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   358
      }
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   359
    } else {
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   360
      if (UseSHA) {
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   361
        warning("SPARC SHA intrinsics require VIS1 instruction support. Intrinsics will be disabled.");
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   362
        FLAG_SET_DEFAULT(UseSHA, false);
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   363
      }
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   364
    }
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   365
  } else if (UseSHA) {
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   366
    warning("SHA instructions are not available on this CPU");
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   367
    FLAG_SET_DEFAULT(UseSHA, false);
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   368
  }
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   369
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   370
  if (UseSHA && has_sha1()) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   371
    if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   372
      FLAG_SET_DEFAULT(UseSHA1Intrinsics, true);
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   373
    }
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   374
  } else if (UseSHA1Intrinsics) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   375
    warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU.");
24953
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   376
    FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   377
  }
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   378
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   379
  if (UseSHA && has_sha256()) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   380
    if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   381
      FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
24953
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   382
    }
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   383
  } else if (UseSHA256Intrinsics) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   384
    warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.");
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   385
    FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   386
  }
24953
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   387
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   388
  if (UseSHA && has_sha512()) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   389
    if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   390
      FLAG_SET_DEFAULT(UseSHA512Intrinsics, true);
24953
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   391
    }
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   392
  } else if (UseSHA512Intrinsics) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   393
    warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU.");
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   394
    FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   395
  }
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   396
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   397
  if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   398
    FLAG_SET_DEFAULT(UseSHA, false);
24953
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   399
  }
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   400
31515
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   401
  if (has_crc32c()) {
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   402
    if (UseVIS > 2) { // CRC32C intrinsics use VIS3 instructions
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   403
      if (FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) {
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   404
        FLAG_SET_DEFAULT(UseCRC32CIntrinsics, true);
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   405
      }
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   406
    } else {
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   407
      if (UseCRC32CIntrinsics) {
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   408
        warning("SPARC CRC32C intrinsics require VIS3 instruction support. Intrinsics will be disabled.");
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   409
        FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   410
      }
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   411
    }
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   412
  } else if (UseCRC32CIntrinsics) {
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   413
    warning("CRC32C instruction is not available on this CPU");
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   414
    FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   415
  }
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   416
32581
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   417
  if (UseVIS > 2) {
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   418
    if (FLAG_IS_DEFAULT(UseAdler32Intrinsics)) {
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   419
      FLAG_SET_DEFAULT(UseAdler32Intrinsics, true);
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   420
    }
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   421
  } else if (UseAdler32Intrinsics) {
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   422
    warning("SPARC Adler32 intrinsics require VIS3 instruction support. Intrinsics will be disabled.");
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   423
    FLAG_SET_DEFAULT(UseAdler32Intrinsics, false);
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   424
  }
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   425
34205
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   426
  if (UseVIS > 2) {
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   427
    if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) {
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   428
      FLAG_SET_DEFAULT(UseCRC32Intrinsics, true);
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   429
    }
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   430
  } else if (UseCRC32Intrinsics) {
42580
56304dee97f3 8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents: 42024
diff changeset
   431
    warning("SPARC CRC32 intrinsics require VIS3 instructions support. Intrinsics will be disabled");
34205
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   432
    FLAG_SET_DEFAULT(UseCRC32Intrinsics, false);
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   433
  }
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   434
47561
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   435
  if (UseVIS > 2) {
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   436
    if (FLAG_IS_DEFAULT(UseMultiplyToLenIntrinsic)) {
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   437
      FLAG_SET_DEFAULT(UseMultiplyToLenIntrinsic, true);
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   438
    }
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   439
  } else if (UseMultiplyToLenIntrinsic) {
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   440
    warning("SPARC multiplyToLen intrinsics require VIS3 instructions support. Intrinsics will be disabled");
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   441
    FLAG_SET_DEFAULT(UseMultiplyToLenIntrinsic, false);
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   442
  }
f59f0e51ef8a 8167199: Add C2 SPARC intrinsic for BigInteger::multiplyToLen() method.
neliasso
parents: 47216
diff changeset
   443
35110
f19bcdf40799 8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents: 34205
diff changeset
   444
  if (UseVectorizedMismatchIntrinsic) {
f19bcdf40799 8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents: 34205
diff changeset
   445
    warning("UseVectorizedMismatchIntrinsic specified, but not available on this CPU.");
f19bcdf40799 8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents: 34205
diff changeset
   446
    FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false);
f19bcdf40799 8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents: 34205
diff changeset
   447
  }
f19bcdf40799 8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents: 34205
diff changeset
   448
15193
8e6b5694267f 8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents: 14631
diff changeset
   449
  if (FLAG_IS_DEFAULT(ContendedPaddingWidth) &&
8e6b5694267f 8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents: 14631
diff changeset
   450
    (cache_line_size > ContendedPaddingWidth))
8e6b5694267f 8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents: 14631
diff changeset
   451
    ContendedPaddingWidth = cache_line_size;
8e6b5694267f 8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents: 14631
diff changeset
   452
30209
8ea30dc99369 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents: 26579
diff changeset
   453
  // This machine does not allow unaligned memory accesses
8ea30dc99369 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents: 26579
diff changeset
   454
  if (UseUnalignedAccesses) {
8ea30dc99369 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents: 26579
diff changeset
   455
    if (!FLAG_IS_DEFAULT(UseUnalignedAccesses))
8ea30dc99369 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents: 26579
diff changeset
   456
      warning("Unaligned memory access is not available on this CPU");
8ea30dc99369 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents: 26579
diff changeset
   457
    FLAG_SET_DEFAULT(UseUnalignedAccesses, false);
8ea30dc99369 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents: 26579
diff changeset
   458
  }
8ea30dc99369 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents: 26579
diff changeset
   459
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   460
  if (log_is_enabled(Info, os, cpu)) {
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   461
    ResourceMark rm;
46701
f559541c0daa 8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents: 46597
diff changeset
   462
    LogStream ls(Log(os, cpu)::info());
f559541c0daa 8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents: 46597
diff changeset
   463
    outputStream* log = &ls;
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   464
    log->print_cr("L1 data cache line size: %u", L1_data_cache_line_size());
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   465
    log->print_cr("L2 data cache line size: %u", L2_data_cache_line_size());
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   466
    log->print("Allocation");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
    if (AllocatePrefetchStyle <= 0) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   468
      log->print(": no prefetching");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
    } else {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   470
      log->print(" prefetching: ");
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
   471
      if (AllocatePrefetchInstr == 0) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   472
          log->print("PREFETCH");
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
   473
      } else if (AllocatePrefetchInstr == 1) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   474
          log->print("BIS");
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
   475
      }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
      if (AllocatePrefetchLines > 1) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   477
        log->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
      } else {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   479
        log->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
    if (PrefetchCopyIntervalInBytes > 0) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   483
      log->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
    if (PrefetchScanIntervalInBytes > 0) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   486
      log->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
    if (PrefetchFieldsAhead > 0) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   489
      log->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
    }
15193
8e6b5694267f 8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents: 14631
diff changeset
   491
    if (ContendedPaddingWidth > 0) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   492
      log->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth);
15193
8e6b5694267f 8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents: 14631
diff changeset
   493
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
void VM_Version::print_features() {
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   498
  tty->print("ISA features [0x%0" PRIx64 "]:", _features);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   499
  if (_features_string != NULL) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   500
    tty->print(" %s", _features_string);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   501
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   502
  tty->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   505
void VM_Version::determine_features() {
46593
97c895b9bec4 8181852: Remove option 'UseV8InstrsOnly'
neliasso
parents: 46592
diff changeset
   506
  platform_features();      // platform_features() is os_arch specific.
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   507
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   508
  assert(has_v9(), "must be");
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   509
46593
97c895b9bec4 8181852: Remove option 'UseV8InstrsOnly'
neliasso
parents: 46592
diff changeset
   510
  if (UseNiagaraInstrs) {   // Limit code generation to Niagara.
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   511
    _features &= niagara1_msk;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
35148
5cfafc99d791 8143072: [JVMCI] Port JVMCI to AArch64
twisti
parents: 35135
diff changeset
   515
static uint64_t saved_features = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
void VM_Version::allow_all() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
  saved_features = _features;
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   519
  _features      = full_feature_msk;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
void VM_Version::revert() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
  _features = saved_features;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
}