src/hotspot/share/c1/c1_Compiler.cpp
author mchung
Mon, 22 Oct 2018 17:00:04 -0700
changeset 52220 9c260a6b6471
parent 50113 caf115bb98ad
child 52325 0451e0a2f1f5
permissions -rw-r--r--
8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference Reviewed-by: dholmes, thartmann
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49449
diff changeset
     2
 * Copyright (c) 1999, 2018, 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: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
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: 1
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: 5707
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    26
#include "c1/c1_Compilation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    27
#include "c1/c1_Compiler.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    28
#include "c1/c1_FrameMap.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    29
#include "c1/c1_GraphBuilder.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    30
#include "c1/c1_LinearScan.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    31
#include "c1/c1_MacroAssembler.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    32
#include "c1/c1_Runtime1.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    33
#include "c1/c1_ValueType.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    34
#include "compiler/compileBroker.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    35
#include "interpreter/linkResolver.hpp"
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49449
diff changeset
    36
#include "jfr/support/jfrIntrinsics.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    37
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    38
#include "memory/allocation.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    39
#include "memory/resourceArea.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    40
#include "prims/nativeLookup.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    41
#include "runtime/arguments.hpp"
49449
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 47767
diff changeset
    42
#include "runtime/interfaceSupport.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    43
#include "runtime/sharedRuntime.hpp"
46502
116a09d8f142 8180755: Remove use of bitMap.inline.hpp include from instanceKlass.hpp and c1_ValueSet.hpp
tschatzl
parents: 46458
diff changeset
    44
#include "utilities/bitMap.inline.hpp"
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49449
diff changeset
    45
#include "utilities/macros.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
42040
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents: 42037
diff changeset
    48
Compiler::Compiler() : AbstractCompiler(compiler_c1) {
22236
44508442b8da 8029305: add type tag to AbstractCompiler
twisti
parents: 22234
diff changeset
    49
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
20707
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    51
void Compiler::init_c1_runtime() {
5707
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    52
  BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
25946
1572c9f03fb9 8046598: Scalable Native memory tracking development
zgu
parents: 22236
diff changeset
    53
  Arena* arena = new (mtCompiler) Arena(mtCompiler);
5707
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    54
  Runtime1::initialize(buffer_blob);
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    55
  FrameMap::initialize();
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    56
  // initialize data structures
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    57
  ValueType::initialize(arena);
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    58
  GraphBuilder::initialize();
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    59
  // note: to use more than one instance of LinearScan at a time this function call has to
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    60
  //       be moved somewhere outside of this constructor:
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    61
  Interval::initialize(arena);
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    62
}
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    63
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    64
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
void Compiler::initialize() {
20707
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    66
  // Buffer blob must be allocated per C1 compiler thread at startup
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    67
  BufferBlob* buffer_blob = init_buffer_blob();
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    68
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    69
  if (should_perform_init()) {
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    70
    if (buffer_blob == NULL) {
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    71
      // When we come here we are in state 'initializing'; entire C1 compilation
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    72
      // can be shut down.
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    73
      set_state(failed);
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    74
    } else {
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    75
      init_c1_runtime();
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    76
      set_state(initialized);
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    77
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
26796
666464578742 8015774: Add support for multiple code heaps
thartmann
parents: 25946
diff changeset
    81
int Compiler::code_buffer_size() {
666464578742 8015774: Add support for multiple code heaps
thartmann
parents: 25946
diff changeset
    82
  assert(SegmentedCodeCache, "Should be only used with a segmented code cache");
666464578742 8015774: Add support for multiple code heaps
thartmann
parents: 25946
diff changeset
    83
  return Compilation::desired_max_code_buffer_size() + Compilation::desired_max_constant_size();
666464578742 8015774: Add support for multiple code heaps
thartmann
parents: 25946
diff changeset
    84
}
666464578742 8015774: Add support for multiple code heaps
thartmann
parents: 25946
diff changeset
    85
20707
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    86
BufferBlob* Compiler::init_buffer_blob() {
17623
6295813086d0 8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents: 13963
diff changeset
    87
  // Allocate buffer blob once at startup since allocation for each
6295813086d0 8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents: 13963
diff changeset
    88
  // compilation seems to be too expensive (at least on Intel win32).
20707
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    89
  assert (CompilerThread::current()->get_buffer_blob() == NULL, "Should initialize only once");
17623
6295813086d0 8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents: 13963
diff changeset
    90
5707
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    91
  // setup CodeBuffer.  Preallocate a BufferBlob of size
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    92
  // NMethodSizeLimit plus some extra space for constants.
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    93
  int code_buffer_size = Compilation::desired_max_code_buffer_size() +
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
    94
    Compilation::desired_max_constant_size();
17623
6295813086d0 8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents: 13963
diff changeset
    95
20707
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    96
  BufferBlob* buffer_blob = BufferBlob::create("C1 temporary CodeBuffer", code_buffer_size);
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
    97
  if (buffer_blob != NULL) {
17623
6295813086d0 8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents: 13963
diff changeset
    98
    CompilerThread::current()->set_buffer_blob(buffer_blob);
6295813086d0 8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents: 13963
diff changeset
    99
  }
6295813086d0 8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents: 13963
diff changeset
   100
6295813086d0 8014430: JRE crashes instead of stop compilation on full Code Cache. Internal Error (c1_Compiler.cpp:87)
anoll
parents: 13963
diff changeset
   101
  return buffer_blob;
5707
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
   102
}
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
   103
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 32582
diff changeset
   104
bool Compiler::is_intrinsic_supported(const methodHandle& method) {
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   105
  vmIntrinsics::ID id = method->intrinsic_id();
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   106
  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: 26796
diff changeset
   107
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   108
  if (method->is_synchronized()) {
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   109
    // C1 does not support intrinsification of synchronized methods.
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   110
    return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   111
  }
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   112
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   113
  switch (id) {
45514
0fc9cc73ce45 8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents: 42040
diff changeset
   114
  case vmIntrinsics::_compareAndSetLong:
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   115
    if (!VM_Version::supports_cx8()) return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   116
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   117
  case vmIntrinsics::_getAndAddInt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   118
    if (!VM_Version::supports_atomic_getadd4()) return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   119
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   120
  case vmIntrinsics::_getAndAddLong:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   121
    if (!VM_Version::supports_atomic_getadd8()) return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   122
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   123
  case vmIntrinsics::_getAndSetInt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   124
    if (!VM_Version::supports_atomic_getset4()) return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   125
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   126
  case vmIntrinsics::_getAndSetLong:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   127
    if (!VM_Version::supports_atomic_getset8()) return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   128
    break;
52220
9c260a6b6471 8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents: 50113
diff changeset
   129
  case vmIntrinsics::_getAndSetReference:
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   130
#ifdef _LP64
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   131
    if (!UseCompressedOops && !VM_Version::supports_atomic_getset8()) return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   132
    if (UseCompressedOops && !VM_Version::supports_atomic_getset4()) return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   133
#else
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   134
    if (!VM_Version::supports_atomic_getset4()) return false;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   135
#endif
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   136
    break;
38017
55047d16f141 8147844: new method j.l.Runtime.onSpinWait() and the corresponding x86 hotspot instrinsic
ikrylov
parents: 36827
diff changeset
   137
  case vmIntrinsics::_onSpinWait:
55047d16f141 8147844: new method j.l.Runtime.onSpinWait() and the corresponding x86 hotspot instrinsic
ikrylov
parents: 36827
diff changeset
   138
    if (!VM_Version::supports_on_spin_wait()) return false;
55047d16f141 8147844: new method j.l.Runtime.onSpinWait() and the corresponding x86 hotspot instrinsic
ikrylov
parents: 36827
diff changeset
   139
    break;
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   140
  case vmIntrinsics::_arraycopy:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   141
  case vmIntrinsics::_currentTimeMillis:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   142
  case vmIntrinsics::_nanoTime:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   143
  case vmIntrinsics::_Reference_get:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   144
    // Use the intrinsic version of Reference.get() so that the value in
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   145
    // the referent field can be registered by the G1 pre-barrier code.
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   146
    // Also to prevent commoning reads from this field across safepoint
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   147
    // since GC can change its value.
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   148
  case vmIntrinsics::_loadFence:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   149
  case vmIntrinsics::_storeFence:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   150
  case vmIntrinsics::_fullFence:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   151
  case vmIntrinsics::_floatToRawIntBits:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   152
  case vmIntrinsics::_intBitsToFloat:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   153
  case vmIntrinsics::_doubleToRawLongBits:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   154
  case vmIntrinsics::_longBitsToDouble:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   155
  case vmIntrinsics::_getClass:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   156
  case vmIntrinsics::_isInstance:
36552
0db9be43cebb 8150669: C1 intrinsic for Class.isPrimitive
shade
parents: 33638
diff changeset
   157
  case vmIntrinsics::_isPrimitive:
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   158
  case vmIntrinsics::_currentThread:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   159
  case vmIntrinsics::_dabs:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   160
  case vmIntrinsics::_dsqrt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   161
  case vmIntrinsics::_dsin:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   162
  case vmIntrinsics::_dcos:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   163
  case vmIntrinsics::_dtan:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   164
  case vmIntrinsics::_dlog:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   165
  case vmIntrinsics::_dlog10:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   166
  case vmIntrinsics::_dexp:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   167
  case vmIntrinsics::_dpow:
41323
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38246
diff changeset
   168
  case vmIntrinsics::_fmaD:
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38246
diff changeset
   169
  case vmIntrinsics::_fmaF:
52220
9c260a6b6471 8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents: 50113
diff changeset
   170
  case vmIntrinsics::_getReference:
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   171
  case vmIntrinsics::_getBoolean:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   172
  case vmIntrinsics::_getByte:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   173
  case vmIntrinsics::_getShort:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   174
  case vmIntrinsics::_getChar:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   175
  case vmIntrinsics::_getInt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   176
  case vmIntrinsics::_getLong:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   177
  case vmIntrinsics::_getFloat:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   178
  case vmIntrinsics::_getDouble:
52220
9c260a6b6471 8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents: 50113
diff changeset
   179
  case vmIntrinsics::_putReference:
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   180
  case vmIntrinsics::_putBoolean:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   181
  case vmIntrinsics::_putByte:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   182
  case vmIntrinsics::_putShort:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   183
  case vmIntrinsics::_putChar:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   184
  case vmIntrinsics::_putInt:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   185
  case vmIntrinsics::_putLong:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   186
  case vmIntrinsics::_putFloat:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   187
  case vmIntrinsics::_putDouble:
52220
9c260a6b6471 8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents: 50113
diff changeset
   188
  case vmIntrinsics::_getReferenceVolatile:
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   189
  case vmIntrinsics::_getBooleanVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   190
  case vmIntrinsics::_getByteVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   191
  case vmIntrinsics::_getShortVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   192
  case vmIntrinsics::_getCharVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   193
  case vmIntrinsics::_getIntVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   194
  case vmIntrinsics::_getLongVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   195
  case vmIntrinsics::_getFloatVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   196
  case vmIntrinsics::_getDoubleVolatile:
52220
9c260a6b6471 8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents: 50113
diff changeset
   197
  case vmIntrinsics::_putReferenceVolatile:
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   198
  case vmIntrinsics::_putBooleanVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   199
  case vmIntrinsics::_putByteVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   200
  case vmIntrinsics::_putShortVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   201
  case vmIntrinsics::_putCharVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   202
  case vmIntrinsics::_putIntVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   203
  case vmIntrinsics::_putLongVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   204
  case vmIntrinsics::_putFloatVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   205
  case vmIntrinsics::_putDoubleVolatile:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   206
  case vmIntrinsics::_getShortUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   207
  case vmIntrinsics::_getCharUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   208
  case vmIntrinsics::_getIntUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   209
  case vmIntrinsics::_getLongUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   210
  case vmIntrinsics::_putShortUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   211
  case vmIntrinsics::_putCharUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   212
  case vmIntrinsics::_putIntUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   213
  case vmIntrinsics::_putLongUnaligned:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   214
  case vmIntrinsics::_checkIndex:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   215
  case vmIntrinsics::_updateCRC32:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   216
  case vmIntrinsics::_updateBytesCRC32:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   217
  case vmIntrinsics::_updateByteBufferCRC32:
47767
107622f2695c 8189745: AARCH64: Use CRC32C intrinsic code in interpreter and C1
dchuyko
parents: 47216
diff changeset
   218
#if defined(SPARC) || defined(S390) || defined(PPC64) || defined(AARCH64)
38237
d972e3a2df53 8155162: java.util.zip.CRC32C Interpreter/C1 intrinsics support on SPARC
kvn
parents: 38017
diff changeset
   219
  case vmIntrinsics::_updateBytesCRC32C:
d972e3a2df53 8155162: java.util.zip.CRC32C Interpreter/C1 intrinsics support on SPARC
kvn
parents: 38017
diff changeset
   220
  case vmIntrinsics::_updateDirectByteBufferCRC32C:
d972e3a2df53 8155162: java.util.zip.CRC32C Interpreter/C1 intrinsics support on SPARC
kvn
parents: 38017
diff changeset
   221
#endif
38238
1bbcc430c78d 8151268: Wire up the x86 _vectorizedMismatch stub routine in C1
psandoz
parents: 38237
diff changeset
   222
  case vmIntrinsics::_vectorizedMismatch:
45514
0fc9cc73ce45 8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
psandoz
parents: 42040
diff changeset
   223
  case vmIntrinsics::_compareAndSetInt:
52220
9c260a6b6471 8207146: Rename jdk.internal.misc.Unsafe::xxxObject to xxxReference
mchung
parents: 50113
diff changeset
   224
  case vmIntrinsics::_compareAndSetReference:
33628
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33451
diff changeset
   225
  case vmIntrinsics::_getCharStringU:
09241459a8b8 8141132: JEP 254: Compact Strings
thartmann
parents: 33451
diff changeset
   226
  case vmIntrinsics::_putCharStringU:
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49449
diff changeset
   227
#ifdef JFR_HAVE_INTRINSICS
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   228
  case vmIntrinsics::_counterTime:
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49449
diff changeset
   229
  case vmIntrinsics::_getEventWriter:
caf115bb98ad 8199712: Flight Recorder
egahlin
parents: 49449
diff changeset
   230
#if defined(_LP64) || !defined(TRACE_ID_SHIFT)
40899
d7140c75c2c6 8163589: Add back class id intrinsic method for event based tracing
rehn
parents: 38246
diff changeset
   231
  case vmIntrinsics::_getClassId:
d7140c75c2c6 8163589: Add back class id intrinsic method for event based tracing
rehn
parents: 38246
diff changeset
   232
#endif
31962
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   233
#endif
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   234
    break;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   235
  default:
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   236
    return false; // Intrinsics not on the previous list are not available.
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   237
  }
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   238
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   239
  return true;
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   240
}
d05e0a4d1b43 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 26796
diff changeset
   241
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 32582
diff changeset
   242
void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci, DirectiveSet* directive) {
20707
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
   243
  BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
b3b658c6d1f8 8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents: 17623
diff changeset
   244
  assert(buffer_blob != NULL, "Must exist");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  // invoke compilation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
    // We are nested here because we need for the destructor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
    // of Compilation to occur before we release the any
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
    // competing compiler thread
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
    ResourceMark rm;
33451
0712796e4039 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 32582
diff changeset
   251
    Compilation c(this, env, method, entry_bci, buffer_blob, directive);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
void Compiler::print_timers() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  Compilation::print_timers();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
}