hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp
author neliasso
Tue, 27 Jun 2017 15:31:11 +0200
changeset 46593 97c895b9bec4
parent 46592 6e357e2c8143
child 46595 18a062f9a227
permissions -rw-r--r--
8181852: Remove option 'UseV8InstrsOnly' Summary: Not supported Reviewed-by: kvn Contributed-by: phedlin@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
46381
020219e46c86 8150388: Remove SPARC 32-bit support
gtriantafill
parents: 42642
diff changeset
     2
 * Copyright (c) 1997, 2017, 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"
14631
526804361522 8003250: SPARC: move MacroAssembler into separate file
twisti
parents: 13969
diff changeset
    26
#include "asm/macroAssembler.inline.hpp"
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
    27
#include "logging/log.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7115
diff changeset
    28
#include "memory/resourceArea.hpp"
46560
388aa8d67c80 8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents: 46547
diff changeset
    29
#include "prims/jvm.h"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7115
diff changeset
    30
#include "runtime/java.hpp"
25949
34557722059b 6424123: JVM crashes on failed 'strdup' call
zgu
parents: 25633
diff changeset
    31
#include "runtime/os.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7115
diff changeset
    32
#include "runtime/stubCodeGenerator.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7115
diff changeset
    33
#include "vm_version_sparc.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    35
#include <sys/mman.h>
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    36
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    37
uint VM_Version::_L2_data_cache_line_size = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
void VM_Version::initialize() {
35148
5cfafc99d791 8143072: [JVMCI] Port JVMCI to AArch64
twisti
parents: 35135
diff changeset
    40
  assert(_features != 0, "System pre-initialization is not complete.");
35043
30543d2a0a20 8133023: ParallelGCThreads is not calculated correctly
jmasa
parents: 34205
diff changeset
    41
  guarantee(VM_Version::has_v9(), "only SPARC v9 is supported");
30543d2a0a20 8133023: ParallelGCThreads is not calculated correctly
jmasa
parents: 34205
diff changeset
    42
46591
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    43
  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
    44
  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
    45
  PrefetchFieldsAhead         = prefetch_fields_ahead();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  // Allocation prefetch settings
46591
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    48
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    49
  AllocatePrefetchDistance = allocate_prefetch_distance();
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    50
  AllocatePrefetchStyle    = allocate_prefetch_style();
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    51
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
    52
  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
    53
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    54
  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
    55
    AllocatePrefetchStepSize = MAX2(AllocatePrefetchStepSize, cache_line_size);
46547
e1b926a0b23f 8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents: 46381
diff changeset
    56
  }
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
    57
46591
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    58
  if (AllocatePrefetchInstr == 1) {
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    59
    if (!has_blk_init()) {
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    60
      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
    61
      FLAG_SET_DEFAULT(AllocatePrefetchInstr, 0);
46547
e1b926a0b23f 8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents: 46381
diff changeset
    62
    }
46591
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    63
    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
    64
      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
    65
      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
    66
    }
46547
e1b926a0b23f 8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents: 46381
diff changeset
    67
  }
e1b926a0b23f 8016470: AllocatePrefetchDistance is not changed by command line
rraghavan
parents: 46381
diff changeset
    68
46591
3f3105af599e 8182711: Re/Introduce private interface for HW-specific prefetch options in SPARC VM_Version
neliasso
parents: 46560
diff changeset
    69
  UseSSE = false;                   // Only used on x86 and x64.
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
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
  _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
    72
  _supports_atomic_getset4 = true;  // Using the 'swap' instruction.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    74
  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
    75
    // Indirect and direct branches are cost equivalent.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    76
    FLAG_SET_DEFAULT(UseInlineCaches, false);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    77
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    78
  // 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
    79
  // fetch buffer.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    80
  if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    81
    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
    82
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    83
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    84
  // 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
    85
  // VM has the same registers and smaller objects.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    86
  Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    87
  Universe::set_narrow_klass_shift(LogKlassAlignmentInBytes);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    88
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
#ifdef COMPILER2
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    90
  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
    91
    // Indirect and direct branches are cost equivalent.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    92
    FLAG_SET_DEFAULT(UseJumpTables, true);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    93
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    94
  // 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
    95
  if (FLAG_IS_DEFAULT(InteriorEntryAlignment)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    96
    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
    97
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    98
  if (UseTLAB && cache_line_size > 0 &&
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
    99
      FLAG_IS_DEFAULT(AllocatePrefetchInstr)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   100
    if (has_fast_bis()) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   101
      // Use BIS instruction for TLAB allocation prefetch.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   102
      FLAG_SET_DEFAULT(AllocatePrefetchInstr, 1);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    }
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   104
    else if (has_sparc5()) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   105
      // Use prefetch instruction to avoid partial RAW issue on Core S4 processors,
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   106
      // also use prefetch style 3.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   107
      FLAG_SET_DEFAULT(AllocatePrefetchInstr, 0);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   108
      if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   109
        FLAG_SET_DEFAULT(AllocatePrefetchStyle, 3);
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
   110
      }
38220
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 38054
diff changeset
   111
    }
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   112
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   113
  if (AllocatePrefetchInstr == 1) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   114
    // 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
   115
    // aligned memory addresses.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   116
    FLAG_SET_DEFAULT(AllocatePrefetchStyle, 3);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   117
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   118
  if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   119
    if (AllocatePrefetchInstr == 0) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   120
      // Use different prefetch distance without BIS
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   121
      FLAG_SET_DEFAULT(AllocatePrefetchDistance, 256);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   122
    } else {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   123
      // Use smaller prefetch distance with BIS
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   124
      FLAG_SET_DEFAULT(AllocatePrefetchDistance, 64);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   128
  // 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
   129
  // aggressive approach, when the L2-cache line size is small (32 bytes), or
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   130
  // when running on newer processor implementations, such as the Core S4.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   131
  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
   132
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   133
  if (inc_prefetch) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   134
    // 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
   135
    // 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
   136
    // 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
   137
    if (FLAG_IS_DEFAULT(AllocatePrefetchLines)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   138
      const int ap_lns = AllocatePrefetchLines;
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   139
      const int ap_inc = cache_line_size < 64 ? ap_lns : (ap_lns + 1) / 2;
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   140
      FLAG_SET_ERGO(intx, AllocatePrefetchLines, ap_lns + ap_inc);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   141
    }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   142
    if (FLAG_IS_DEFAULT(AllocateInstancePrefetchLines)) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   143
      const int ip_lns = AllocateInstancePrefetchLines;
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   144
      const int ip_inc = cache_line_size < 64 ? ip_lns : (ip_lns + 1) / 2;
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   145
      FLAG_SET_ERGO(intx, AllocateInstancePrefetchLines, ip_lns + ip_inc);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   146
    }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   147
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   148
#endif /* COMPILER2 */
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   149
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
   150
  // 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
   151
  if (has_popc()) {
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
   152
    if (FLAG_IS_DEFAULT(UsePopCountInstruction)) {
2342
9a1260c3679d 6821700: tune VM flags for peak performance
kvn
parents: 2255
diff changeset
   153
      FLAG_SET_DEFAULT(UsePopCountInstruction, true);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
   154
    }
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   155
  } else if (UsePopCountInstruction) {
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   156
    warning("POPC instruction is not available on this CPU");
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   157
    FLAG_SET_DEFAULT(UsePopCountInstruction, false);
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   158
  }
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   159
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   160
  // Use compare and branch instructions if available.
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   161
  if (has_cbcond()) {
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   162
    if (FLAG_IS_DEFAULT(UseCBCond)) {
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   163
      FLAG_SET_DEFAULT(UseCBCond, true);
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   164
    }
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   165
  } else if (UseCBCond) {
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   166
    warning("CBCOND instruction is not available on this CPU");
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   167
    FLAG_SET_DEFAULT(UseCBCond, false);
2255
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
   168
  }
54abdf3e1055 6378821: bitCount() should use POPC on SPARC processors and AMD+10h
twisti
parents: 2254
diff changeset
   169
10501
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   170
  assert(BlockZeroingLowLimit > 0, "invalid value");
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   171
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   172
  if (has_blk_zeroing() && cache_line_size > 0) {
10501
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   173
    if (FLAG_IS_DEFAULT(UseBlockZeroing)) {
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   174
      FLAG_SET_DEFAULT(UseBlockZeroing, true);
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   175
    }
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   176
  } else if (UseBlockZeroing) {
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   177
    warning("BIS zeroing instructions are not available on this CPU");
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   178
    FLAG_SET_DEFAULT(UseBlockZeroing, false);
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   179
  }
5bce84af0883 7059037: Use BIS for zeroing on T4
kvn
parents: 10267
diff changeset
   180
10512
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   181
  assert(BlockCopyLowLimit > 0, "invalid value");
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   182
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   183
  if (has_blk_zeroing() && cache_line_size > 0) {
10512
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   184
    if (FLAG_IS_DEFAULT(UseBlockCopy)) {
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   185
      FLAG_SET_DEFAULT(UseBlockCopy, true);
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   186
    }
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   187
  } else if (UseBlockCopy) {
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   188
    warning("BIS instructions are not available or expensive on this CPU");
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   189
    FLAG_SET_DEFAULT(UseBlockCopy, false);
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   190
  }
935fc9d89f08 7039731: arraycopy could use prefetch on SPARC
kvn
parents: 10501
diff changeset
   191
6272
94a20ad0e9de 6978249: spill between cpu and fpu registers when those moves are fast
never
parents: 5702
diff changeset
   192
#ifdef COMPILER2
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   193
  if (has_fast_rdpc() && FLAG_IS_DEFAULT(UseRDPCForConstantTableBase)) {
10977
4726185d3e93 7104561: UseRDPCForConstantTableBase doesn't work after shorten branches changes
twisti
parents: 10512
diff changeset
   194
    FLAG_SET_DEFAULT(UseRDPCForConstantTableBase, true);
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   195
  }
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 10027
diff changeset
   196
6272
94a20ad0e9de 6978249: spill between cpu and fpu registers when those moves are fast
never
parents: 5702
diff changeset
   197
  // Currently not supported anywhere.
94a20ad0e9de 6978249: spill between cpu and fpu registers when those moves are fast
never
parents: 5702
diff changeset
   198
  FLAG_SET_DEFAULT(UseFPUForSpilling, false);
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10252
diff changeset
   199
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10977
diff changeset
   200
  MaxVectorSize = 8;
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 10977
diff changeset
   201
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10252
diff changeset
   202
  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
   203
#endif
94a20ad0e9de 6978249: spill between cpu and fpu registers when those moves are fast
never
parents: 5702
diff changeset
   204
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10252
diff changeset
   205
  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
   206
  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
   207
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  char buf[512];
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   209
  jio_snprintf(buf, sizeof(buf),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   210
               "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   211
               (has_v9()          ? "v9" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   212
               (has_popc()        ? ", popc" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   213
               (has_vis1()        ? ", vis1" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   214
               (has_vis2()        ? ", vis2" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   215
               (has_blk_init()    ? ", blk_init" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   216
               (has_fmaf()        ? ", fmaf" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   217
               (has_hpc()         ? ", hpc" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   218
               (has_ima()         ? ", ima" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   219
               (has_aes()         ? ", aes" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   220
               (has_des()         ? ", des" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   221
               (has_kasumi()      ? ", kas" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   222
               (has_camellia()    ? ", cam" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   223
               (has_md5()         ? ", md5" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   224
               (has_sha1()        ? ", sha1" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   225
               (has_sha256()      ? ", sha256" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   226
               (has_sha512()      ? ", sha512" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   227
               (has_mpmul()       ? ", mpmul" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   228
               (has_mont()        ? ", mont" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   229
               (has_pause()       ? ", pause" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   230
               (has_cbcond()      ? ", cbcond" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   231
               (has_crc32c()      ? ", crc32c" : ""),
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   233
               (has_athena_plus() ? ", athena_plus" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   234
               (has_vis3b()       ? ", vis3b" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   235
               (has_adi()         ? ", adi" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   236
               (has_sparc5()      ? ", sparc5" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   237
               (has_mwait()       ? ", mwait" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   238
               (has_xmpmul()      ? ", xmpmul" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   239
               (has_xmont()       ? ", xmont" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   240
               (has_pause_nsec()  ? ", pause_nsec" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   241
               (has_vamask()      ? ", vamask" : ""),
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   243
               (has_fast_idiv()   ? ", *idiv" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   244
               (has_fast_rdpc()   ? ", *rdpc" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   245
               (has_fast_bis()    ? ", *bis" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   246
               (has_fast_ld()     ? ", *ld" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   247
               (has_fast_cmove()  ? ", *cmove" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   248
               (has_fast_fxtof()  ? ", *fxtof" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   249
               (has_fast_ind_br() ? ", *ind_br" : ""),
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   250
               (has_blk_zeroing() ? ", *blk_zeroing" : ""));
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   251
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   252
  assert(strlen(buf) >= 2, "must be");
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   253
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   254
  _features_string = os::strdup(buf);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   255
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   256
  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
   257
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   258
  // 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
   259
  // 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
   260
  // not support it.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   261
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   262
  if (UseVIS > 3) UseVIS = 3;
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   263
  if (UseVIS < 0) UseVIS = 0;
10027
20cd71f29262 7059034: Use movxtod/movdtox on T4
kvn
parents: 7704
diff changeset
   264
  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
   265
    UseVIS = MIN2((intx)2, UseVIS);
10027
20cd71f29262 7059034: Use movxtod/movdtox on T4
kvn
parents: 7704
diff changeset
   266
  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
   267
    UseVIS = MIN2((intx)1, UseVIS);
10027
20cd71f29262 7059034: Use movxtod/movdtox on T4
kvn
parents: 7704
diff changeset
   268
  if (!has_vis1()) // Drop to 0 if no VIS1 support
20cd71f29262 7059034: Use movxtod/movdtox on T4
kvn
parents: 7704
diff changeset
   269
    UseVIS = 0;
20cd71f29262 7059034: Use movxtod/movdtox on T4
kvn
parents: 7704
diff changeset
   270
22505
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   271
  if (has_aes()) {
34176
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   272
    if (FLAG_IS_DEFAULT(UseAES)) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   273
      FLAG_SET_DEFAULT(UseAES, true);
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   274
    }
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   275
    if (!UseAES) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   276
      if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   277
        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
   278
      }
34176
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   279
      FLAG_SET_DEFAULT(UseAESIntrinsics, false);
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   280
    } else {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   281
      // 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
   282
      // 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
   283
      if (UseVIS > 2) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   284
        if (FLAG_IS_DEFAULT(UseAESIntrinsics)) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   285
          FLAG_SET_DEFAULT(UseAESIntrinsics, true);
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   286
        }
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   287
      } else {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   288
        if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   289
          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
   290
        }
22505
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   291
        FLAG_SET_DEFAULT(UseAESIntrinsics, false);
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   292
      }
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   293
    }
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   294
  } else if (UseAES || UseAESIntrinsics) {
34176
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   295
    if (UseAES && !FLAG_IS_DEFAULT(UseAES)) {
c1b52e665b47 8131778: java disables UseAES flag when using VIS=2 on sparc
kshefov
parents: 34174
diff changeset
   296
      warning("AES instructions are not available on this CPU");
22505
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   297
      FLAG_SET_DEFAULT(UseAES, false);
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   298
    }
34176
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 are not available on this CPU");
22505
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   301
      FLAG_SET_DEFAULT(UseAESIntrinsics, false);
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   302
    }
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   303
  }
4523090c9674 8002074: Support for AES on SPARC
kvn
parents: 22234
diff changeset
   304
35154
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35148
diff changeset
   305
  if (UseAESCTRIntrinsics) {
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35148
diff changeset
   306
    warning("AES/CTR intrinsics are not available on this CPU");
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35148
diff changeset
   307
    FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false);
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35148
diff changeset
   308
  }
a9b3c1984a01 8143925: Enhancing CounterMode.crypt() for AES
kvn
parents: 35148
diff changeset
   309
31404
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   310
  // GHASH/GCM intrinsics
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   311
  if (has_vis3() && (UseVIS > 2)) {
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   312
    if (FLAG_IS_DEFAULT(UseGHASHIntrinsics)) {
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   313
      UseGHASHIntrinsics = true;
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   314
    }
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   315
  } else if (UseGHASHIntrinsics) {
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   316
    if (!FLAG_IS_DEFAULT(UseGHASHIntrinsics))
31774
c30034f09367 8131078: typos in ghash cpu message
ascarpino
parents: 31588
diff changeset
   317
      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
   318
    FLAG_SET_DEFAULT(UseGHASHIntrinsics, false);
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   319
  }
63e8fcd70bfc 8073108: Use x86 and SPARC CPU instructions for GHASH acceleration
ascarpino
parents: 30217
diff changeset
   320
41323
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38304
diff changeset
   321
  if (UseFMA) {
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38304
diff changeset
   322
    warning("FMA instructions are not available on this CPU");
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38304
diff changeset
   323
    FLAG_SET_DEFAULT(UseFMA, false);
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38304
diff changeset
   324
  }
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38304
diff changeset
   325
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   326
  // 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
   327
  if (has_sha1() || has_sha256() || has_sha512()) {
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   328
    if (UseVIS > 0) { // SHA intrinsics use VIS1 instructions
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   329
      if (FLAG_IS_DEFAULT(UseSHA)) {
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   330
        FLAG_SET_DEFAULT(UseSHA, true);
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   331
      }
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   332
    } else {
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   333
      if (UseSHA) {
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   334
        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
   335
        FLAG_SET_DEFAULT(UseSHA, false);
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   336
      }
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   337
    }
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   338
  } else if (UseSHA) {
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   339
    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
   340
    FLAG_SET_DEFAULT(UseSHA, false);
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   341
  }
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   342
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   343
  if (UseSHA && has_sha1()) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   344
    if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   345
      FLAG_SET_DEFAULT(UseSHA1Intrinsics, true);
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   346
    }
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   347
  } else if (UseSHA1Intrinsics) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   348
    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
   349
    FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   350
  }
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   351
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   352
  if (UseSHA && has_sha256()) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   353
    if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   354
      FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
24953
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   355
    }
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   356
  } else if (UseSHA256Intrinsics) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   357
    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
   358
    FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   359
  }
24953
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   360
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   361
  if (UseSHA && has_sha512()) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   362
    if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   363
      FLAG_SET_DEFAULT(UseSHA512Intrinsics, true);
24953
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   364
    }
31588
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   365
  } else if (UseSHA512Intrinsics) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   366
    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
   367
    FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   368
  }
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   369
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   370
  if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
2a864a4a414c 8130120: Handling of SHA intrinsics inconsistent across platforms
zmajo
parents: 31515
diff changeset
   371
    FLAG_SET_DEFAULT(UseSHA, false);
24953
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   372
  }
9680119572be 8035968: Leverage CPU Instructions to Improve SHA Performance on SPARC
kvn
parents: 24424
diff changeset
   373
31515
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   374
  if (has_crc32c()) {
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   375
    if (UseVIS > 2) { // CRC32C intrinsics use VIS3 instructions
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   376
      if (FLAG_IS_DEFAULT(UseCRC32CIntrinsics)) {
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   377
        FLAG_SET_DEFAULT(UseCRC32CIntrinsics, true);
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   378
      }
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   379
    } else {
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   380
      if (UseCRC32CIntrinsics) {
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   381
        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
   382
        FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   383
      }
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   384
    }
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   385
  } else if (UseCRC32CIntrinsics) {
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   386
    warning("CRC32C instruction is not available on this CPU");
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   387
    FLAG_SET_DEFAULT(UseCRC32CIntrinsics, false);
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   388
  }
6aed85dadbe6 8073583: C2 support for CRC32C on SPARC
kvn
parents: 31404
diff changeset
   389
32581
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   390
  if (UseVIS > 2) {
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   391
    if (FLAG_IS_DEFAULT(UseAdler32Intrinsics)) {
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   392
      FLAG_SET_DEFAULT(UseAdler32Intrinsics, true);
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   393
    }
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   394
  } else if (UseAdler32Intrinsics) {
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   395
    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
   396
    FLAG_SET_DEFAULT(UseAdler32Intrinsics, false);
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   397
  }
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32580
diff changeset
   398
34205
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   399
  if (UseVIS > 2) {
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   400
    if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) {
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   401
      FLAG_SET_DEFAULT(UseCRC32Intrinsics, true);
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   402
    }
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   403
  } else if (UseCRC32Intrinsics) {
42580
56304dee97f3 8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents: 42024
diff changeset
   404
    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
   405
    FLAG_SET_DEFAULT(UseCRC32Intrinsics, false);
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   406
  }
9ec51d30a11e 8143012: CRC32 Intrinsics support on SPARC
kvn
parents: 34176
diff changeset
   407
35110
f19bcdf40799 8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents: 34205
diff changeset
   408
  if (UseVectorizedMismatchIntrinsic) {
f19bcdf40799 8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents: 34205
diff changeset
   409
    warning("UseVectorizedMismatchIntrinsic specified, but not available on this CPU.");
f19bcdf40799 8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents: 34205
diff changeset
   410
    FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false);
f19bcdf40799 8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents: 34205
diff changeset
   411
  }
f19bcdf40799 8143355: Update for addition of vectorizedMismatch intrinsic for x86
kvn
parents: 34205
diff changeset
   412
15193
8e6b5694267f 8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents: 14631
diff changeset
   413
  if (FLAG_IS_DEFAULT(ContendedPaddingWidth) &&
8e6b5694267f 8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents: 14631
diff changeset
   414
    (cache_line_size > ContendedPaddingWidth))
8e6b5694267f 8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents: 14631
diff changeset
   415
    ContendedPaddingWidth = cache_line_size;
8e6b5694267f 8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents: 14631
diff changeset
   416
30209
8ea30dc99369 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents: 26579
diff changeset
   417
  // This machine does not allow unaligned memory accesses
8ea30dc99369 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents: 26579
diff changeset
   418
  if (UseUnalignedAccesses) {
8ea30dc99369 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents: 26579
diff changeset
   419
    if (!FLAG_IS_DEFAULT(UseUnalignedAccesses))
8ea30dc99369 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents: 26579
diff changeset
   420
      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
   421
    FLAG_SET_DEFAULT(UseUnalignedAccesses, false);
8ea30dc99369 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents: 26579
diff changeset
   422
  }
8ea30dc99369 8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents: 26579
diff changeset
   423
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   424
  if (log_is_enabled(Info, os, cpu)) {
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   425
    ResourceMark rm;
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   426
    outputStream* log = Log(os, cpu)::info_stream();
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   427
    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
   428
    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
   429
    log->print("Allocation");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
    if (AllocatePrefetchStyle <= 0) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   431
      log->print(": no prefetching");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
    } else {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   433
      log->print(" prefetching: ");
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
   434
      if (AllocatePrefetchInstr == 0) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   435
          log->print("PREFETCH");
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
   436
      } else if (AllocatePrefetchInstr == 1) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   437
          log->print("BIS");
10267
8bdeec886dc4 7079329: Adjust allocation prefetching for T4
kvn
parents: 10264
diff changeset
   438
      }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
      if (AllocatePrefetchLines > 1) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   440
        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
   441
      } else {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   442
        log->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
    if (PrefetchCopyIntervalInBytes > 0) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   446
      log->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
    if (PrefetchScanIntervalInBytes > 0) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   449
      log->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
    if (PrefetchFieldsAhead > 0) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   452
      log->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
    }
15193
8e6b5694267f 8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents: 14631
diff changeset
   454
    if (ContendedPaddingWidth > 0) {
37430
fd743dadef12 8151939: VM_Version_init() print buffer is too small
coleenp
parents: 36346
diff changeset
   455
      log->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth);
15193
8e6b5694267f 8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents: 14631
diff changeset
   456
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
void VM_Version::print_features() {
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   461
  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
   462
  if (_features_string != NULL) {
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   463
    tty->print(" %s", _features_string);
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   464
  }
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   465
  tty->cr();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   468
void VM_Version::determine_features() {
46593
97c895b9bec4 8181852: Remove option 'UseV8InstrsOnly'
neliasso
parents: 46592
diff changeset
   469
  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
   470
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   471
  assert(has_v9(), "must be");
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   472
46593
97c895b9bec4 8181852: Remove option 'UseV8InstrsOnly'
neliasso
parents: 46592
diff changeset
   473
  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
   474
    _features &= niagara1_msk;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
35148
5cfafc99d791 8143072: [JVMCI] Port JVMCI to AArch64
twisti
parents: 35135
diff changeset
   478
static uint64_t saved_features = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
void VM_Version::allow_all() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
  saved_features = _features;
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   482
  _features      = full_feature_msk;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
void VM_Version::revert() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
  _features = saved_features;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
}
183
ba55c7f3fd45 6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents: 1
diff changeset
   488
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   489
/* Determine a suitable number of threads on this particular machine.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   490
 *
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   491
 * FIXME: Simply checking the processor family is insufficient.
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   492
 */
183
ba55c7f3fd45 6362677: Change parallel GC collector default number of parallel GC threads.
jmasa
parents: 1
diff changeset
   493
unsigned int VM_Version::calc_parallel_worker_threads() {
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   494
  const int num = 5;
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   495
  const int den = is_post_niagara() ? 16 : 8;
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   496
  const int threshold = 8;
36346
0a02e923ec29 8134119: Use new API to get cache line sizes
iveresov
parents: 35751
diff changeset
   497
46592
6e357e2c8143 8172231: SPARC ISA/CPU feature detection is broken/insufficient (on Solaris)
neliasso
parents: 46591
diff changeset
   498
  return nof_parallel_worker_threads(num, den, threshold);
36346
0a02e923ec29 8134119: Use new API to get cache line sizes
iveresov
parents: 35751
diff changeset
   499
}