src/hotspot/share/compiler/compilerDefinitions.hpp
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 43455 hotspot/src/share/vm/compiler/compilerDefinitions.hpp@96560cffef4d
child 47687 fb290fd1f9d4
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42040
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     1
/*
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     4
 *
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     7
 * published by the Free Software Foundation.
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     8
 *
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    13
 * accompanied this code).
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    14
 *
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    18
 *
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    21
 * questions.
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    22
 *
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    23
 */
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    24
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    25
#ifndef SHARE_VM_COMPILER_COMPILERDEFINITIONS_HPP
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    26
#define SHARE_VM_COMPILER_COMPILERDEFINITIONS_HPP
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    27
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    28
#include "utilities/globalDefinitions.hpp"
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    29
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    30
// The (closed set) of concrete compiler classes.
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    31
enum CompilerType {
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    32
  compiler_none,
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    33
  compiler_c1,
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    34
  compiler_c2,
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    35
  compiler_jvmci,
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    36
  compiler_shark,
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    37
  compiler_number_of_types
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    38
};
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    39
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    40
extern const char* compilertype2name_tab[compiler_number_of_types];     // Map CompilerType to its name
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    41
inline const char* compilertype2name(CompilerType t) { return (uint)t < compiler_number_of_types ? compilertype2name_tab[t] : NULL; }
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    42
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    43
// Handy constants for deciding which compiler mode to use.
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    44
enum MethodCompilation {
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    45
  InvocationEntryBci = -1     // i.e., not a on-stack replacement compilation
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    46
};
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    47
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    48
// Enumeration to distinguish tiers of compilation
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    49
enum CompLevel {
42650
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42040
diff changeset
    50
  CompLevel_any               = -2,
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42040
diff changeset
    51
  CompLevel_all               = -2,
1f304d0c888b 8171008: Integrate AOT compiler into JDK
kvn
parents: 42040
diff changeset
    52
  CompLevel_aot               = -1,
42040
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    53
  CompLevel_none              = 0,         // Interpreter
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    54
  CompLevel_simple            = 1,         // C1
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    55
  CompLevel_limited_profile   = 2,         // C1, invocation & backedge counters
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    56
  CompLevel_full_profile      = 3,         // C1, invocation & backedge counters + mdo
43455
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    57
  CompLevel_full_optimization = 4          // C2, Shark or JVMCI
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    58
};
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    59
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    60
extern CompLevel CompLevel_highest_tier;
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    61
extern CompLevel CompLevel_initial_compile;
42040
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    62
43455
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    63
enum CompMode {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    64
  CompMode_none = 0,
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    65
  CompMode_client = 1,
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    66
  CompMode_server = 2
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    67
};
42040
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    68
43455
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    69
extern CompMode Compilation_mode;
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    70
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    71
inline bool is_server_compilation_mode_vm() {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    72
  return Compilation_mode == CompMode_server;
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    73
}
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    74
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    75
inline bool is_client_compilation_mode_vm() {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    76
  return Compilation_mode == CompMode_client;
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    77
}
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    78
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42650
diff changeset
    79
extern void set_client_compilation_mode();
42040
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    80
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    81
inline bool is_c1_compile(int comp_level) {
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    82
  return comp_level > CompLevel_none && comp_level < CompLevel_full_optimization;
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    83
}
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    84
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    85
inline bool is_c2_compile(int comp_level) {
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    86
  return comp_level == CompLevel_full_optimization;
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    87
}
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    88
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    89
inline bool is_highest_tier_compile(int comp_level) {
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    90
  return comp_level == CompLevel_highest_tier;
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    91
}
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    92
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    93
inline bool is_compile(int comp_level) {
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    94
  return is_c1_compile(comp_level) || is_c2_compile(comp_level);
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    95
}
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    96
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    97
// States of Restricted Transactional Memory usage.
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    98
enum RTMState {
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    99
  NoRTM      = 0x2, // Don't use RTM
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   100
  UseRTM     = 0x1, // Use RTM
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   101
  ProfileRTM = 0x0  // Use RTM with abort ratio calculation
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   102
};
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   103
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   104
#ifndef INCLUDE_RTM_OPT
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   105
#define INCLUDE_RTM_OPT 0
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   106
#endif
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   107
#if INCLUDE_RTM_OPT
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   108
#define RTM_OPT_ONLY(code) code
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   109
#else
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   110
#define RTM_OPT_ONLY(code)
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   111
#endif
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   112
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
   113
#endif // SHARE_VM_COMPILER_COMPILERDEFINITIONS_HPP