hotspot/src/share/vm/classfile/vmSymbols.cpp
author kvn
Thu, 03 Sep 2015 15:03:12 -0700
changeset 32581 632402f18fe6
parent 32085 d869c505b624
child 33451 0712796e4039
child 33593 60764a78fa5c
permissions -rw-r--r--
8132081: C2 support for Adler32 on SPARC Summary: Add C2 instrinsic support for Adler32 checksum on SPARC. Reviewed-by: kvn Contributed-by: ahmed.khawaja@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 22234
diff changeset
     2
 * Copyright (c) 1997, 2014, 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: 4567
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4567
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: 4567
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: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "classfile/vmSymbols.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "memory/oopFactory.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "runtime/handles.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "utilities/xmlstream.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
    33
Symbol* vmSymbols::_symbols[vmSymbols::SID_LIMIT];
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
    35
Symbol* vmSymbols::_type_signatures[T_VOID+1] = { NULL /*, NULL...*/ };
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
    37
inline int compare_symbol(Symbol* a, Symbol* b) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  if (a == b)  return 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  // follow the natural address order:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  return (address)a > (address)b ? +1 : -1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
static vmSymbols::SID vm_symbol_index[vmSymbols::SID_LIMIT];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
extern "C" {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  static int compare_vmsymbol_sid(const void* void_a, const void* void_b) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
    46
    Symbol* a = vmSymbols::symbol_at(*((vmSymbols::SID*) void_a));
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
    47
    Symbol* b = vmSymbols::symbol_at(*((vmSymbols::SID*) void_b));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
    return compare_symbol(a, b);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
17379
fec16b38217a 8012292: optimized build with GCC broken
roland
parents: 14391
diff changeset
    52
#ifdef ASSERT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
#define VM_SYMBOL_ENUM_NAME_BODY(name, string) #name "\0"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
static const char* vm_symbol_enum_names =
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  VM_SYMBOLS_DO(VM_SYMBOL_ENUM_NAME_BODY, VM_ALIAS_IGNORE)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  "\0";
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
static const char* vm_symbol_enum_name(vmSymbols::SID sid) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  const char* string = &vm_symbol_enum_names[0];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  int skip = (int)sid - (int)vmSymbols::FIRST_SID;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  for (; skip != 0; skip--) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    size_t skiplen = strlen(string);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    if (skiplen == 0)  return "<unknown>";  // overflow
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    string += skiplen+1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  return string;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
}
17379
fec16b38217a 8012292: optimized build with GCC broken
roland
parents: 14391
diff changeset
    67
#endif //ASSERT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
// Put all the VM symbol strings in one place.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
// Makes for a more compact libjvm.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
#define VM_SYMBOL_BODY(name, string) string "\0"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
static const char* vm_symbol_bodies = VM_SYMBOLS_DO(VM_SYMBOL_BODY, VM_ALIAS_IGNORE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
void vmSymbols::initialize(TRAPS) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  assert((int)SID_LIMIT <= (1<<log2_SID_LIMIT), "must fit in this bitfield");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  assert((int)SID_LIMIT*5 > (1<<log2_SID_LIMIT), "make the bitfield smaller, please");
4562
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
    77
  assert(vmIntrinsics::FLAG_LIMIT <= (1 << vmIntrinsics::log2_FLAG_LIMIT), "must fit in this bitfield");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  if (!UseSharedSpaces) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    const char* string = &vm_symbol_bodies[0];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
12263
d20640f4f8fe 7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents: 8675
diff changeset
    82
      Symbol* sym = SymbolTable::new_permanent_symbol(string, CHECK);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
      _symbols[index] = sym;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
      string += strlen(string); // skip string body
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
      string += 1;              // skip trailing null
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    _type_signatures[T_BYTE]    = byte_signature();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    _type_signatures[T_CHAR]    = char_signature();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    _type_signatures[T_DOUBLE]  = double_signature();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    _type_signatures[T_FLOAT]   = float_signature();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    _type_signatures[T_INT]     = int_signature();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    _type_signatures[T_LONG]    = long_signature();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    _type_signatures[T_SHORT]   = short_signature();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    _type_signatures[T_BOOLEAN] = bool_signature();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    _type_signatures[T_VOID]    = void_signature();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    // no single signatures for T_OBJECT or T_ARRAY
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  // Check for duplicates:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  for (int i1 = (int)FIRST_SID; i1 < (int)SID_LIMIT; i1++) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   103
    Symbol* sym = symbol_at((SID)i1);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    for (int i2 = (int)FIRST_SID; i2 < i1; i2++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
      if (symbol_at((SID)i2) == sym) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
        tty->print("*** Duplicate VM symbol SIDs %s(%d) and %s(%d): \"",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
                   vm_symbol_enum_name((SID)i2), i2,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
                   vm_symbol_enum_name((SID)i1), i1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
        sym->print_symbol_on(tty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
        tty->print_cr("\"");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
#endif //ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  // Create an index for find_id:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
      vm_symbol_index[index] = (SID)index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    int num_sids = SID_LIMIT-FIRST_SID;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    qsort(&vm_symbol_index[FIRST_SID], num_sids, sizeof(vm_symbol_index[0]),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
          compare_vmsymbol_sid);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    // Spot-check correspondence between strings, symbols, and enums:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    assert(_symbols[NO_SID] == NULL, "must be");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    const char* str = "java/lang/Object";
12263
d20640f4f8fe 7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents: 8675
diff changeset
   131
    TempNewSymbol jlo = SymbolTable::new_permanent_symbol(str, CHECK);
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   132
    assert(strncmp(str, (char*)jlo->base(), jlo->utf8_length()) == 0, "");
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   133
    assert(jlo == java_lang_Object(), "");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    SID sid = VM_SYMBOL_ENUM_NAME(java_lang_Object);
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   135
    assert(find_sid(jlo) == sid, "");
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   136
    assert(symbol_at(sid) == jlo, "");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
    // Make sure find_sid produces the right answer in each case.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   140
      Symbol* sym = symbol_at((SID)index);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
      sid = find_sid(sym);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
      assert(sid == (SID)index, "symbol index works");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
      // Note:  If there are duplicates, this assert will fail.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
      // A "Duplicate VM symbol" message will have already been printed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    // The string "format" happens (at the moment) not to be a vmSymbol,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
    // though it is a method name in java.lang.String.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
    str = "format";
12263
d20640f4f8fe 7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents: 8675
diff changeset
   150
    TempNewSymbol fmt = SymbolTable::new_permanent_symbol(str, CHECK);
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   151
    sid = find_sid(fmt);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    assert(sid == NO_SID, "symbol index works (negative test)");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
const char* vmSymbols::name_for(vmSymbols::SID sid) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  if (sid == NO_SID)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    return "NO_SID";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  const char* string = &vm_symbol_bodies[0];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
    if (index == (int)sid)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
      return string;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
    string += strlen(string); // skip string body
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    string += 1;              // skip trailing null
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  return "BAD_SID";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   175
void vmSymbols::symbols_do(SymbolClosure* f) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   177
    f->do_symbol(&_symbols[index]);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  for (int i = 0; i < T_VOID+1; i++) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   180
    f->do_symbol(&_type_signatures[i]);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   184
void vmSymbols::serialize(SerializeClosure* soc) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   185
  soc->do_region((u_char*)&_symbols[FIRST_SID],
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   186
                 (SID_LIMIT - FIRST_SID) * sizeof(_symbols[0]));
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   187
  soc->do_region((u_char*)_type_signatures, sizeof(_type_signatures));
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   188
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   190
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   191
BasicType vmSymbols::signature_type(Symbol* s) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  assert(s != NULL, "checking");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  for (int i = T_BOOLEAN; i < T_VOID+1; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
    if (s == _type_signatures[i]) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
      return (BasicType)i;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  return T_OBJECT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
static int mid_hint = (int)vmSymbols::FIRST_SID+1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
static int find_sid_calls, find_sid_probes;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
// (Typical counts are calls=7000 and probes=17000.)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   209
vmSymbols::SID vmSymbols::find_sid(Symbol* symbol) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  // Handle the majority of misses by a bounds check.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  // Then, use a binary search over the index.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  // Expected trip count is less than log2_SID_LIMIT, about eight.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  // This is slow but acceptable, given that calls are not
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   214
  // dynamically common.  (Method*::intrinsic_id has a cache.)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  NOT_PRODUCT(find_sid_calls++);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  int min = (int)FIRST_SID, max = (int)SID_LIMIT - 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  SID sid = NO_SID, sid1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  int cmp1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  sid1 = vm_symbol_index[min];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  cmp1 = compare_symbol(symbol, symbol_at(sid1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  if (cmp1 <= 0) {              // before the first
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
    if (cmp1 == 0)  sid = sid1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
    sid1 = vm_symbol_index[max];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    cmp1 = compare_symbol(symbol, symbol_at(sid1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
    if (cmp1 >= 0) {            // after the last
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
      if (cmp1 == 0)  sid = sid1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
      // After checking the extremes, do a binary search.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
      ++min; --max;             // endpoints are done
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
      int mid = mid_hint;       // start at previous success
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
      while (max >= min) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
        assert(mid >= min && mid <= max, "");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
        NOT_PRODUCT(find_sid_probes++);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
        sid1 = vm_symbol_index[mid];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
        cmp1 = compare_symbol(symbol, symbol_at(sid1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
        if (cmp1 == 0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
          mid_hint = mid;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
          sid = sid1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
          break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
        if (cmp1 < 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
          max = mid - 1;        // symbol < symbol_at(sid)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
        else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
          min = mid + 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
        // Pick a new probe point:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
        mid = (max + min) / 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  // Perform the exhaustive self-check the first 1000 calls,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  // and every 100 calls thereafter.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  static int find_sid_check_count = -2000;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  if ((uint)++find_sid_check_count > (uint)100) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
    if (find_sid_check_count > 0)  find_sid_check_count = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
    // Make sure this is the right answer, using linear search.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
    // (We have already proven that there are no duplicates in the list.)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
    SID sid2 = NO_SID;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
    for (int index = (int)FIRST_SID; index < (int)SID_LIMIT; index++) {
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   264
      Symbol* sym2 = symbol_at((SID)index);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
      if (sym2 == symbol) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
        sid2 = (SID)index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
    // Unless it's a duplicate, assert that the sids are the same.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
    if (_symbols[sid] != _symbols[sid2]) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
      assert(sid == sid2, "binary same as linear search");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
#endif //ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  return sid;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
8675
e9fef2a9bef7 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents: 8076
diff changeset
   280
vmSymbols::SID vmSymbols::find_sid(const char* symbol_name) {
e9fef2a9bef7 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents: 8076
diff changeset
   281
  Symbol* symbol = SymbolTable::probe(symbol_name, (int) strlen(symbol_name));
e9fef2a9bef7 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents: 8076
diff changeset
   282
  if (symbol == NULL)  return NO_SID;
e9fef2a9bef7 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents: 8076
diff changeset
   283
  return find_sid(symbol);
e9fef2a9bef7 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents: 8076
diff changeset
   284
}
e9fef2a9bef7 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents: 8076
diff changeset
   285
4562
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   286
static vmIntrinsics::ID wrapper_intrinsic(BasicType type, bool unboxing) {
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   287
#define TYPE2(type, unboxing) ((int)(type)*2 + ((unboxing) ? 1 : 0))
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   288
  switch (TYPE2(type, unboxing)) {
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   289
#define BASIC_TYPE_CASE(type, box, unbox) \
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   290
    case TYPE2(type, false):  return vmIntrinsics::box; \
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   291
    case TYPE2(type, true):   return vmIntrinsics::unbox
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   292
    BASIC_TYPE_CASE(T_BOOLEAN, _Boolean_valueOf,   _booleanValue);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   293
    BASIC_TYPE_CASE(T_BYTE,    _Byte_valueOf,      _byteValue);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   294
    BASIC_TYPE_CASE(T_CHAR,    _Character_valueOf, _charValue);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   295
    BASIC_TYPE_CASE(T_SHORT,   _Short_valueOf,     _shortValue);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   296
    BASIC_TYPE_CASE(T_INT,     _Integer_valueOf,   _intValue);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   297
    BASIC_TYPE_CASE(T_LONG,    _Long_valueOf,      _longValue);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   298
    BASIC_TYPE_CASE(T_FLOAT,   _Float_valueOf,     _floatValue);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   299
    BASIC_TYPE_CASE(T_DOUBLE,  _Double_valueOf,    _doubleValue);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   300
#undef BASIC_TYPE_CASE
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   301
  }
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   302
#undef TYPE2
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   303
  return vmIntrinsics::_none;
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   304
}
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   305
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   306
vmIntrinsics::ID vmIntrinsics::for_boxing(BasicType type) {
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   307
  return wrapper_intrinsic(type, false);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   308
}
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   309
vmIntrinsics::ID vmIntrinsics::for_unboxing(BasicType type) {
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   310
  return wrapper_intrinsic(type, true);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   311
}
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   312
4567
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   313
vmIntrinsics::ID vmIntrinsics::for_raw_conversion(BasicType src, BasicType dest) {
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   314
#define SRC_DEST(s,d) (((int)(s) << 4) + (int)(d))
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   315
  switch (SRC_DEST(src, dest)) {
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   316
  case SRC_DEST(T_INT, T_FLOAT):   return vmIntrinsics::_intBitsToFloat;
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   317
  case SRC_DEST(T_FLOAT, T_INT):   return vmIntrinsics::_floatToRawIntBits;
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   318
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   319
  case SRC_DEST(T_LONG, T_DOUBLE): return vmIntrinsics::_longBitsToDouble;
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   320
  case SRC_DEST(T_DOUBLE, T_LONG): return vmIntrinsics::_doubleToRawLongBits;
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   321
  }
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   322
#undef SRC_DEST
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   323
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   324
  return vmIntrinsics::_none;
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   325
}
7fc02fbe5c7a 6893268: additional dynamic language related optimizations in C2
twisti
parents: 4562
diff changeset
   326
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   327
bool vmIntrinsics::preserves_state(vmIntrinsics::ID id) {
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   328
  assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   329
  switch(id) {
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   330
#ifdef TRACE_HAVE_INTRINSICS
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   331
  case vmIntrinsics::_classID:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   332
  case vmIntrinsics::_threadID:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   333
  case vmIntrinsics::_counterTime:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   334
#endif
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   335
  case vmIntrinsics::_currentTimeMillis:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   336
  case vmIntrinsics::_nanoTime:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   337
  case vmIntrinsics::_floatToRawIntBits:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   338
  case vmIntrinsics::_intBitsToFloat:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   339
  case vmIntrinsics::_doubleToRawLongBits:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   340
  case vmIntrinsics::_longBitsToDouble:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   341
  case vmIntrinsics::_getClass:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   342
  case vmIntrinsics::_isInstance:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   343
  case vmIntrinsics::_currentThread:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   344
  case vmIntrinsics::_dabs:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   345
  case vmIntrinsics::_dsqrt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   346
  case vmIntrinsics::_dsin:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   347
  case vmIntrinsics::_dcos:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   348
  case vmIntrinsics::_dtan:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   349
  case vmIntrinsics::_dlog:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   350
  case vmIntrinsics::_dlog10:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   351
  case vmIntrinsics::_dexp:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   352
  case vmIntrinsics::_dpow:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   353
  case vmIntrinsics::_checkIndex:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   354
  case vmIntrinsics::_Reference_get:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   355
  case vmIntrinsics::_updateCRC32:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   356
  case vmIntrinsics::_updateBytesCRC32:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   357
  case vmIntrinsics::_updateByteBufferCRC32:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   358
    return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   359
  default:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   360
    return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   361
  }
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   362
}
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   363
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   364
bool vmIntrinsics::can_trap(vmIntrinsics::ID id) {
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   365
  assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   366
  switch(id) {
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   367
#ifdef TRACE_HAVE_INTRINSICS
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   368
  case vmIntrinsics::_counterTime:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   369
#endif
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   370
  case vmIntrinsics::_currentTimeMillis:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   371
  case vmIntrinsics::_nanoTime:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   372
  case vmIntrinsics::_floatToRawIntBits:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   373
  case vmIntrinsics::_intBitsToFloat:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   374
  case vmIntrinsics::_doubleToRawLongBits:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   375
  case vmIntrinsics::_longBitsToDouble:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   376
  case vmIntrinsics::_currentThread:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   377
  case vmIntrinsics::_dabs:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   378
  case vmIntrinsics::_dsqrt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   379
  case vmIntrinsics::_dsin:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   380
  case vmIntrinsics::_dcos:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   381
  case vmIntrinsics::_dtan:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   382
  case vmIntrinsics::_dlog:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   383
  case vmIntrinsics::_dlog10:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   384
  case vmIntrinsics::_dexp:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   385
  case vmIntrinsics::_dpow:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   386
  case vmIntrinsics::_updateCRC32:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   387
  case vmIntrinsics::_updateBytesCRC32:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   388
  case vmIntrinsics::_updateByteBufferCRC32:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   389
    return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   390
  default:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   391
    return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   392
  }
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   393
}
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   394
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   395
bool vmIntrinsics::does_virtual_dispatch(vmIntrinsics::ID id) {
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   396
  assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   397
  switch(id) {
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   398
  case vmIntrinsics::_hashCode:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   399
  case vmIntrinsics::_clone:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   400
    return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   401
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   402
  default:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   403
    return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   404
  }
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   405
}
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   406
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   407
int vmIntrinsics::predicates_needed(vmIntrinsics::ID id) {
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   408
  assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   409
  switch (id) {
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   410
  case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   411
  case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   412
    return 1;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   413
  case vmIntrinsics::_digestBase_implCompressMB:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   414
    return 3;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   415
  default:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   416
    return 0;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   417
  }
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   418
}
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   419
32085
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   420
bool vmIntrinsics::is_disabled_by_flags(methodHandle method, methodHandle compilation_context) {
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   421
  vmIntrinsics::ID id = method->intrinsic_id();
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   422
  assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
32085
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   423
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   424
  // Check if the intrinsic corresponding to 'method' has been disabled on
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   425
  // the command line by using the DisableIntrinsic flag (either globally
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   426
  // or on a per-method level, see src/share/vm/compiler/abstractCompiler.hpp
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   427
  // for details).
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   428
  // Usually, the compilation context is the caller of the method 'method'.
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   429
  // The only case when for a non-recursive method 'method' the compilation context
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   430
  // is not the caller of the 'method' (but it is the method itself) is
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   431
  // java.lang.ref.Referene::get.
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   432
  // For java.lang.ref.Reference::get, the intrinsic version is used
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   433
  // instead of the compiled version so that the value in the referent
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   434
  // field can be registered by the G1 pre-barrier code. The intrinsified
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   435
  // version of Reference::get also adds a memory barrier to prevent
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   436
  // commoning reads from the referent field across safepoint since GC
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   437
  // can change the referent field's value. See Compile::Compile()
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   438
  // in src/share/vm/opto/compile.cpp or
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   439
  // GraphBuilder::GraphBuilder() in src/share/vm/c1/c1_GraphBuilder.cpp
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   440
  // for more details.
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   441
  ccstr disable_intr = NULL;
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   442
  if ((DisableIntrinsic[0] != '\0' && strstr(DisableIntrinsic, vmIntrinsics::name_at(id)) != NULL) ||
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   443
      (!compilation_context.is_null() &&
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   444
       CompilerOracle::has_option_value(compilation_context, "DisableIntrinsic", disable_intr) &&
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   445
       strstr(disable_intr, vmIntrinsics::name_at(id)) != NULL)
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   446
  ) {
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   447
    return true;
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   448
  }
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   449
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   450
  // -XX:-InlineNatives disables nearly all intrinsics except the ones listed in
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   451
  // the following switch statement.
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   452
  if (!InlineNatives) {
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   453
    switch (id) {
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   454
    case vmIntrinsics::_indexOf:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   455
    case vmIntrinsics::_compareTo:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   456
    case vmIntrinsics::_equals:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   457
    case vmIntrinsics::_equalsC:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   458
    case vmIntrinsics::_getAndAddInt:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   459
    case vmIntrinsics::_getAndAddLong:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   460
    case vmIntrinsics::_getAndSetInt:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   461
    case vmIntrinsics::_getAndSetLong:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   462
    case vmIntrinsics::_getAndSetObject:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   463
    case vmIntrinsics::_loadFence:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   464
    case vmIntrinsics::_storeFence:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   465
    case vmIntrinsics::_fullFence:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   466
    case vmIntrinsics::_Reference_get:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   467
      break;
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   468
    default:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   469
      return true;
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   470
    }
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   471
  }
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   472
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   473
  switch (id) {
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   474
  case vmIntrinsics::_isInstance:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   475
  case vmIntrinsics::_isAssignableFrom:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   476
  case vmIntrinsics::_getModifiers:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   477
  case vmIntrinsics::_isInterface:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   478
  case vmIntrinsics::_isArray:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   479
  case vmIntrinsics::_isPrimitive:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   480
  case vmIntrinsics::_getSuperclass:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   481
  case vmIntrinsics::_Class_cast:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   482
  case vmIntrinsics::_getLength:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   483
  case vmIntrinsics::_newArray:
32085
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   484
  case vmIntrinsics::_getClass:
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   485
    if (!InlineClassNatives) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   486
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   487
  case vmIntrinsics::_currentThread:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   488
  case vmIntrinsics::_isInterrupted:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   489
    if (!InlineThreadNatives) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   490
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   491
  case vmIntrinsics::_floatToRawIntBits:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   492
  case vmIntrinsics::_intBitsToFloat:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   493
  case vmIntrinsics::_doubleToRawLongBits:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   494
  case vmIntrinsics::_longBitsToDouble:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   495
  case vmIntrinsics::_dabs:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   496
  case vmIntrinsics::_dsqrt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   497
  case vmIntrinsics::_dsin:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   498
  case vmIntrinsics::_dcos:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   499
  case vmIntrinsics::_dtan:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   500
  case vmIntrinsics::_dlog:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   501
  case vmIntrinsics::_dexp:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   502
  case vmIntrinsics::_dpow:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   503
  case vmIntrinsics::_dlog10:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   504
  case vmIntrinsics::_datan2:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   505
  case vmIntrinsics::_min:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   506
  case vmIntrinsics::_max:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   507
  case vmIntrinsics::_floatToIntBits:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   508
  case vmIntrinsics::_doubleToLongBits:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   509
    if (!InlineMathNatives) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   510
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   511
  case vmIntrinsics::_arraycopy:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   512
    if (!InlineArrayCopy) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   513
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   514
  case vmIntrinsics::_updateCRC32:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   515
  case vmIntrinsics::_updateBytesCRC32:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   516
  case vmIntrinsics::_updateByteBufferCRC32:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   517
    if (!UseCRC32Intrinsics) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   518
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   519
  case vmIntrinsics::_getObject:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   520
  case vmIntrinsics::_getBoolean:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   521
  case vmIntrinsics::_getByte:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   522
  case vmIntrinsics::_getShort:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   523
  case vmIntrinsics::_getChar:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   524
  case vmIntrinsics::_getInt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   525
  case vmIntrinsics::_getLong:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   526
  case vmIntrinsics::_getFloat:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   527
  case vmIntrinsics::_getDouble:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   528
  case vmIntrinsics::_putObject:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   529
  case vmIntrinsics::_putBoolean:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   530
  case vmIntrinsics::_putByte:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   531
  case vmIntrinsics::_putShort:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   532
  case vmIntrinsics::_putChar:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   533
  case vmIntrinsics::_putInt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   534
  case vmIntrinsics::_putLong:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   535
  case vmIntrinsics::_putFloat:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   536
  case vmIntrinsics::_putDouble:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   537
  case vmIntrinsics::_getObjectVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   538
  case vmIntrinsics::_getBooleanVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   539
  case vmIntrinsics::_getByteVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   540
  case vmIntrinsics::_getShortVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   541
  case vmIntrinsics::_getCharVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   542
  case vmIntrinsics::_getIntVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   543
  case vmIntrinsics::_getLongVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   544
  case vmIntrinsics::_getFloatVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   545
  case vmIntrinsics::_getDoubleVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   546
  case vmIntrinsics::_putObjectVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   547
  case vmIntrinsics::_putBooleanVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   548
  case vmIntrinsics::_putByteVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   549
  case vmIntrinsics::_putShortVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   550
  case vmIntrinsics::_putCharVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   551
  case vmIntrinsics::_putIntVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   552
  case vmIntrinsics::_putLongVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   553
  case vmIntrinsics::_putFloatVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   554
  case vmIntrinsics::_putDoubleVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   555
  case vmIntrinsics::_getByte_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   556
  case vmIntrinsics::_getShort_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   557
  case vmIntrinsics::_getChar_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   558
  case vmIntrinsics::_getInt_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   559
  case vmIntrinsics::_getLong_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   560
  case vmIntrinsics::_getFloat_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   561
  case vmIntrinsics::_getDouble_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   562
  case vmIntrinsics::_putByte_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   563
  case vmIntrinsics::_putShort_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   564
  case vmIntrinsics::_putChar_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   565
  case vmIntrinsics::_putInt_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   566
  case vmIntrinsics::_putLong_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   567
  case vmIntrinsics::_putFloat_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   568
  case vmIntrinsics::_putDouble_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   569
  case vmIntrinsics::_putOrderedObject:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   570
  case vmIntrinsics::_putOrderedLong:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   571
  case vmIntrinsics::_putOrderedInt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   572
  case vmIntrinsics::_getAndAddInt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   573
  case vmIntrinsics::_getAndAddLong:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   574
  case vmIntrinsics::_getAndSetInt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   575
  case vmIntrinsics::_getAndSetLong:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   576
  case vmIntrinsics::_getAndSetObject:
32085
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   577
  case vmIntrinsics::_loadFence:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   578
  case vmIntrinsics::_storeFence:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   579
  case vmIntrinsics::_fullFence:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   580
  case vmIntrinsics::_compareAndSwapObject:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   581
  case vmIntrinsics::_compareAndSwapLong:
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   582
  case vmIntrinsics::_compareAndSwapInt:
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   583
    if (!InlineUnsafeOps) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   584
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   585
  case vmIntrinsics::_getShortUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   586
  case vmIntrinsics::_getCharUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   587
  case vmIntrinsics::_getIntUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   588
  case vmIntrinsics::_getLongUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   589
  case vmIntrinsics::_putShortUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   590
  case vmIntrinsics::_putCharUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   591
  case vmIntrinsics::_putIntUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   592
  case vmIntrinsics::_putLongUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   593
  case vmIntrinsics::_allocateInstance:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   594
  case vmIntrinsics::_getAddress_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   595
  case vmIntrinsics::_putAddress_raw:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   596
    if (!InlineUnsafeOps || !UseUnalignedAccesses) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   597
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   598
  case vmIntrinsics::_hashCode:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   599
    if (!InlineObjectHash) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   600
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   601
  case vmIntrinsics::_aescrypt_encryptBlock:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   602
  case vmIntrinsics::_aescrypt_decryptBlock:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   603
    if (!UseAESIntrinsics) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   604
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   605
  case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   606
  case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   607
    if (!UseAESIntrinsics) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   608
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   609
  case vmIntrinsics::_sha_implCompress:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   610
    if (!UseSHA1Intrinsics) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   611
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   612
  case vmIntrinsics::_sha2_implCompress:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   613
    if (!UseSHA256Intrinsics) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   614
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   615
  case vmIntrinsics::_sha5_implCompress:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   616
    if (!UseSHA512Intrinsics) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   617
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   618
  case vmIntrinsics::_digestBase_implCompressMB:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   619
    if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   620
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   621
  case vmIntrinsics::_ghash_processBlocks:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   622
    if (!UseGHASHIntrinsics) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   623
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   624
  case vmIntrinsics::_updateBytesCRC32C:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   625
  case vmIntrinsics::_updateDirectByteBufferCRC32C:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   626
    if (!UseCRC32CIntrinsics) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   627
    break;
32581
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32085
diff changeset
   628
  case vmIntrinsics::_updateBytesAdler32:
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32085
diff changeset
   629
  case vmIntrinsics::_updateByteBufferAdler32:
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32085
diff changeset
   630
    if (!UseAdler32Intrinsics) return true;
632402f18fe6 8132081: C2 support for Adler32 on SPARC
kvn
parents: 32085
diff changeset
   631
    break;
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   632
  case vmIntrinsics::_copyMemory:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   633
    if (!InlineArrayCopy || !InlineUnsafeOps) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   634
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   635
#ifdef COMPILER1
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   636
  case vmIntrinsics::_checkIndex:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   637
    if (!InlineNIOCheckIndex) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   638
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   639
#endif // COMPILER1
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   640
#ifdef COMPILER2
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   641
  case vmIntrinsics::_clone:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   642
  case vmIntrinsics::_copyOf:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   643
  case vmIntrinsics::_copyOfRange:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   644
    // These intrinsics use both the objectcopy and the arraycopy
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   645
    // intrinsic mechanism.
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   646
    if (!InlineObjectCopy || !InlineArrayCopy) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   647
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   648
  case vmIntrinsics::_compareTo:
32085
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   649
    if (!SpecialStringCompareTo) return true;
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   650
    break;
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   651
  case vmIntrinsics::_indexOf:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   652
    if (!SpecialStringIndexOf) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   653
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   654
  case vmIntrinsics::_equals:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   655
    if (!SpecialStringEquals) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   656
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   657
  case vmIntrinsics::_equalsC:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   658
    if (!SpecialArraysEquals) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   659
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   660
  case vmIntrinsics::_encodeISOArray:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   661
    if (!SpecialEncodeISOArray) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   662
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   663
  case vmIntrinsics::_getCallerClass:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   664
    if (!InlineReflectionGetCallerClass) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   665
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   666
  case vmIntrinsics::_multiplyToLen:
32085
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   667
    if (!UseMultiplyToLenIntrinsic) return true;
d869c505b624 8132457: Unify command-line flags controlling the usage of compiler intrinsics
zmajo
parents: 31962
diff changeset
   668
    break;
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   669
  case vmIntrinsics::_squareToLen:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   670
    if (!UseSquareToLenIntrinsic) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   671
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   672
  case vmIntrinsics::_mulAdd:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   673
    if (!UseMulAddIntrinsic) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   674
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   675
  case vmIntrinsics::_montgomeryMultiply:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   676
    if (!UseMontgomeryMultiplyIntrinsic) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   677
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   678
  case vmIntrinsics::_montgomerySquare:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   679
    if (!UseMontgomerySquareIntrinsic) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   680
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   681
  case vmIntrinsics::_addExactI:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   682
  case vmIntrinsics::_addExactL:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   683
  case vmIntrinsics::_decrementExactI:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   684
  case vmIntrinsics::_decrementExactL:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   685
  case vmIntrinsics::_incrementExactI:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   686
  case vmIntrinsics::_incrementExactL:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   687
  case vmIntrinsics::_multiplyExactI:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   688
  case vmIntrinsics::_multiplyExactL:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   689
  case vmIntrinsics::_negateExactI:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   690
  case vmIntrinsics::_negateExactL:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   691
  case vmIntrinsics::_subtractExactI:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   692
  case vmIntrinsics::_subtractExactL:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   693
    if (!UseMathExactIntrinsics || !InlineMathNatives) return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   694
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   695
#endif // COMPILER2
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   696
  default:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   697
    return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   698
  }
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   699
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   700
  return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 24424
diff changeset
   701
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   702
489c9b5090e2 Initial load
duke
parents:
diff changeset
   703
#define VM_INTRINSIC_INITIALIZE(id, klass, name, sig, flags) #id "\0"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   704
static const char* vm_intrinsic_name_bodies =
489c9b5090e2 Initial load
duke
parents:
diff changeset
   705
  VM_INTRINSICS_DO(VM_INTRINSIC_INITIALIZE,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   706
                   VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   707
489c9b5090e2 Initial load
duke
parents:
diff changeset
   708
static const char* vm_intrinsic_name_table[vmIntrinsics::ID_LIMIT];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   709
489c9b5090e2 Initial load
duke
parents:
diff changeset
   710
const char* vmIntrinsics::name_at(vmIntrinsics::ID id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   711
  const char** nt = &vm_intrinsic_name_table[0];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   712
  if (nt[_none] == NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   713
    char* string = (char*) &vm_intrinsic_name_bodies[0];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   714
    for (int index = FIRST_ID; index < ID_LIMIT; index++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   715
      nt[index] = string;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   716
      string += strlen(string); // skip string body
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
      string += 1;              // skip trailing null
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   719
    assert(!strcmp(nt[_hashCode], "_hashCode"), "lined up");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
    nt[_none] = "_none";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   722
  if ((uint)id < (uint)ID_LIMIT)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   723
    return vm_intrinsic_name_table[(uint)id];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   724
  else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   725
    return "(unknown intrinsic)";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   726
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   727
489c9b5090e2 Initial load
duke
parents:
diff changeset
   728
// These are flag-matching functions:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   729
inline bool match_F_R(jshort flags) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   730
  const int req = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   731
  const int neg = JVM_ACC_STATIC | JVM_ACC_SYNCHRONIZED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   732
  return (flags & (req | neg)) == req;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   733
}
4450
6d700b859b3e 6892658: C2 should optimize some stringbuilder patterns
never
parents: 670
diff changeset
   734
inline bool match_F_Y(jshort flags) {
6d700b859b3e 6892658: C2 should optimize some stringbuilder patterns
never
parents: 670
diff changeset
   735
  const int req = JVM_ACC_SYNCHRONIZED;
6d700b859b3e 6892658: C2 should optimize some stringbuilder patterns
never
parents: 670
diff changeset
   736
  const int neg = JVM_ACC_STATIC;
6d700b859b3e 6892658: C2 should optimize some stringbuilder patterns
never
parents: 670
diff changeset
   737
  return (flags & (req | neg)) == req;
6d700b859b3e 6892658: C2 should optimize some stringbuilder patterns
never
parents: 670
diff changeset
   738
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   739
inline bool match_F_RN(jshort flags) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   740
  const int req = JVM_ACC_NATIVE;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   741
  const int neg = JVM_ACC_STATIC | JVM_ACC_SYNCHRONIZED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   742
  return (flags & (req | neg)) == req;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   743
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
inline bool match_F_S(jshort flags) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
  const int req = JVM_ACC_STATIC;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   746
  const int neg = JVM_ACC_SYNCHRONIZED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   747
  return (flags & (req | neg)) == req;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   748
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   749
inline bool match_F_SN(jshort flags) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   750
  const int req = JVM_ACC_STATIC | JVM_ACC_NATIVE;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   751
  const int neg = JVM_ACC_SYNCHRONIZED;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   752
  return (flags & (req | neg)) == req;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   753
}
218
a0e996680b05 6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents: 1
diff changeset
   754
inline bool match_F_RNY(jshort flags) {
a0e996680b05 6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents: 1
diff changeset
   755
  const int req = JVM_ACC_NATIVE | JVM_ACC_SYNCHRONIZED;
a0e996680b05 6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents: 1
diff changeset
   756
  const int neg = JVM_ACC_STATIC;
a0e996680b05 6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents: 1
diff changeset
   757
  return (flags & (req | neg)) == req;
a0e996680b05 6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents: 1
diff changeset
   758
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   759
489c9b5090e2 Initial load
duke
parents:
diff changeset
   760
// These are for forming case labels:
4562
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   761
#define ID3(x, y, z) (( jlong)(z) +                                  \
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   762
                      ((jlong)(y) <<    vmSymbols::log2_SID_LIMIT) + \
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   763
                      ((jlong)(x) << (2*vmSymbols::log2_SID_LIMIT))  )
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   764
#define SID_ENUM(n) vmSymbols::VM_SYMBOL_ENUM_NAME(n)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   765
4562
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   766
vmIntrinsics::ID vmIntrinsics::find_id_impl(vmSymbols::SID holder,
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   767
                                            vmSymbols::SID name,
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   768
                                            vmSymbols::SID sig,
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   769
                                            jshort flags) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   770
  assert((int)vmSymbols::SID_LIMIT <= (1<<vmSymbols::log2_SID_LIMIT), "must fit");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   771
489c9b5090e2 Initial load
duke
parents:
diff changeset
   772
  // Let the C compiler build the decision tree.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   773
489c9b5090e2 Initial load
duke
parents:
diff changeset
   774
#define VM_INTRINSIC_CASE(id, klass, name, sig, fcode) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   775
  case ID3(SID_ENUM(klass), SID_ENUM(name), SID_ENUM(sig)): \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   776
    if (!match_##fcode(flags))  break; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   777
    return id;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   778
489c9b5090e2 Initial load
duke
parents:
diff changeset
   779
  switch (ID3(holder, name, sig)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   780
    VM_INTRINSICS_DO(VM_INTRINSIC_CASE,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   781
                     VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   782
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   783
  return vmIntrinsics::_none;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   784
489c9b5090e2 Initial load
duke
parents:
diff changeset
   785
#undef VM_INTRINSIC_CASE
489c9b5090e2 Initial load
duke
parents:
diff changeset
   786
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   787
489c9b5090e2 Initial load
duke
parents:
diff changeset
   788
489c9b5090e2 Initial load
duke
parents:
diff changeset
   789
const char* vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID id, char* buf, int buflen) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   790
  const char* str = name_at(id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   791
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   792
  const char* kname = vmSymbols::name_for(class_for(id));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   793
  const char* mname = vmSymbols::name_for(name_for(id));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   794
  const char* sname = vmSymbols::name_for(signature_for(id));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   795
  const char* fname = "";
489c9b5090e2 Initial load
duke
parents:
diff changeset
   796
  switch (flags_for(id)) {
4450
6d700b859b3e 6892658: C2 should optimize some stringbuilder patterns
never
parents: 670
diff changeset
   797
  case F_Y:  fname = "synchronized ";  break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   798
  case F_RN: fname = "native ";        break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   799
  case F_SN: fname = "native static "; break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   800
  case F_S:  fname = "static ";        break;
218
a0e996680b05 6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents: 1
diff changeset
   801
  case F_RNY:fname = "native synchronized "; break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   802
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   803
  const char* kptr = strrchr(kname, '/');
489c9b5090e2 Initial load
duke
parents:
diff changeset
   804
  if (kptr != NULL)  kname = kptr + 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   805
  int len = jio_snprintf(buf, buflen, "%s: %s%s.%s%s",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   806
                         str, fname, kname, mname, sname);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   807
  if (len < buflen)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   808
    str = buf;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   809
#endif //PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   810
  return str;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   811
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   812
489c9b5090e2 Initial load
duke
parents:
diff changeset
   813
4562
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   814
// These are to get information about intrinsics.
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   815
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   816
#define ID4(x, y, z, f) ((ID3(x, y, z) << vmIntrinsics::log2_FLAG_LIMIT) | (jlong) (f))
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   817
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   818
static const jlong intrinsic_info_array[vmIntrinsics::ID_LIMIT+1] = {
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   819
#define VM_INTRINSIC_INFO(ignore_id, klass, name, sig, fcode) \
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   820
  ID4(SID_ENUM(klass), SID_ENUM(name), SID_ENUM(sig), vmIntrinsics::fcode),
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   821
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   822
  0, VM_INTRINSICS_DO(VM_INTRINSIC_INFO,
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   823
                     VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE)
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   824
    0
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   825
#undef VM_INTRINSIC_INFO
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   826
};
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   827
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   828
inline jlong intrinsic_info(vmIntrinsics::ID id) {
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   829
  return intrinsic_info_array[vmIntrinsics::ID_from((int)id)];
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   830
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   831
489c9b5090e2 Initial load
duke
parents:
diff changeset
   832
vmSymbols::SID vmIntrinsics::class_for(vmIntrinsics::ID id) {
4562
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   833
  jlong info = intrinsic_info(id);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   834
  int shift = 2*vmSymbols::log2_SID_LIMIT + log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   835
  assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1021, "");
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   836
  return vmSymbols::SID( (info >> shift) & mask );
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   837
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   838
489c9b5090e2 Initial load
duke
parents:
diff changeset
   839
vmSymbols::SID vmIntrinsics::name_for(vmIntrinsics::ID id) {
4562
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   840
  jlong info = intrinsic_info(id);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   841
  int shift = vmSymbols::log2_SID_LIMIT + log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   842
  assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1022, "");
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   843
  return vmSymbols::SID( (info >> shift) & mask );
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   844
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   845
489c9b5090e2 Initial load
duke
parents:
diff changeset
   846
vmSymbols::SID vmIntrinsics::signature_for(vmIntrinsics::ID id) {
4562
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   847
  jlong info = intrinsic_info(id);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   848
  int shift = log2_FLAG_LIMIT, mask = right_n_bits(vmSymbols::log2_SID_LIMIT);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   849
  assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 1023, "");
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   850
  return vmSymbols::SID( (info >> shift) & mask );
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   851
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   852
489c9b5090e2 Initial load
duke
parents:
diff changeset
   853
vmIntrinsics::Flags vmIntrinsics::flags_for(vmIntrinsics::ID id) {
4562
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   854
  jlong info = intrinsic_info(id);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   855
  int shift = 0, mask = right_n_bits(log2_FLAG_LIMIT);
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   856
  assert(((ID4(1021,1022,1023,15) >> shift) & mask) == 15, "");
5d93cb2d2090 6894206: JVM needs a way to traverse method handle structures
twisti
parents: 4450
diff changeset
   857
  return Flags( (info >> shift) & mask );
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   858
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   859
489c9b5090e2 Initial load
duke
parents:
diff changeset
   860
489c9b5090e2 Initial load
duke
parents:
diff changeset
   861
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   862
// verify_method performs an extra check on a matched intrinsic method
489c9b5090e2 Initial load
duke
parents:
diff changeset
   863
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   864
static bool match_method(Method* m, Symbol* n, Symbol* s) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   865
  return (m->name() == n &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   866
          m->signature() == s);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   867
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   868
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   869
static vmIntrinsics::ID match_method_with_klass(Method* m, Symbol* mk) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   870
#define VM_INTRINSIC_MATCH(id, klassname, namepart, sigpart, flags) \
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   871
  { Symbol* k = vmSymbols::klassname(); \
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   872
    if (mk == k) { \
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   873
      Symbol* n = vmSymbols::namepart(); \
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7397
diff changeset
   874
      Symbol* s = vmSymbols::sigpart(); \
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   875
      if (match_method(m, n, s)) \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   876
        return vmIntrinsics::id; \
489c9b5090e2 Initial load
duke
parents:
diff changeset
   877
    } }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   878
  VM_INTRINSICS_DO(VM_INTRINSIC_MATCH,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   879
                   VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   880
  return vmIntrinsics::_none;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   881
#undef VM_INTRINSIC_MATCH
489c9b5090e2 Initial load
duke
parents:
diff changeset
   882
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   883
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   884
void vmIntrinsics::verify_method(ID actual_id, Method* m) {
14391
df0a1573d5bd 8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
coleenp
parents: 13968
diff changeset
   885
  Symbol* mk = m->method_holder()->name();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   886
  ID declared_id = match_method_with_klass(m, mk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   887
489c9b5090e2 Initial load
duke
parents:
diff changeset
   888
  if (declared_id == actual_id)  return; // success
489c9b5090e2 Initial load
duke
parents:
diff changeset
   889
489c9b5090e2 Initial load
duke
parents:
diff changeset
   890
  if (declared_id == _none && actual_id != _none && mk == vmSymbols::java_lang_StrictMath()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   891
    // Here are a few special cases in StrictMath not declared in vmSymbols.hpp.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   892
    switch (actual_id) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   893
    case _min:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   894
    case _max:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   895
    case _dsqrt:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   896
      declared_id = match_method_with_klass(m, vmSymbols::java_lang_Math());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   897
      if (declared_id == actual_id)  return; // acceptable alias
489c9b5090e2 Initial load
duke
parents:
diff changeset
   898
      break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   899
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   900
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   901
489c9b5090e2 Initial load
duke
parents:
diff changeset
   902
  const char* declared_name = name_at(declared_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   903
  const char* actual_name   = name_at(actual_id);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   904
  methodHandle mh = m;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   905
  m = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   906
  ttyLocker ttyl;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   907
  if (xtty != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   908
    xtty->begin_elem("intrinsic_misdeclared actual='%s' declared='%s'",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   909
                     actual_name, declared_name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   910
    xtty->method(mh);
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 22234
diff changeset
   911
    xtty->end_elem("%s", "");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   912
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   913
  if (PrintMiscellaneous && (WizardMode || Verbose)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   914
    tty->print_cr("*** misidentified method; %s(%d) should be %s(%d):",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   915
                  declared_name, declared_id, actual_name, actual_id);
218
a0e996680b05 6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents: 1
diff changeset
   916
    mh()->print_short_name(tty);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   917
    tty->cr();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   918
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   919
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   920
#endif //PRODUCT