src/hotspot/share/runtime/java.hpp
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 58842 6c255334120d
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52300
diff changeset
     2
 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 950
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 950
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: 950
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
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52300
diff changeset
    25
#ifndef SHARE_RUNTIME_JAVA_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52300
diff changeset
    26
#define SHARE_RUNTIME_JAVA_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "runtime/os.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
// Execute code before all handles are released and thread is killed; prologue to vm_exit
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
extern void before_exit(JavaThread * thread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// Forced VM exit (i.e, internal error or JVM_Exit)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
extern void vm_exit(int code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// Wrapper for ::exit()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
extern void vm_direct_exit(int code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// Shutdown the VM but do not exit the process
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
extern void vm_shutdown();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// Shutdown the VM and abort the process
773
01daf7c809b1 6694099: Hotspot vm_exit_out_of_memory should dump core
poonam
parents: 602
diff changeset
    42
extern void vm_abort(bool dump_core=true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
// Trigger any necessary notification of the VM being shutdown
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
extern void notify_vm_shutdown();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
// VM exit if error occurs during initialization of VM
44326
6c59cca7ff07 8174823: Module system implementation refresh (3/2017)
alanb
parents: 33975
diff changeset
    48
extern void vm_exit_during_initialization();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
extern void vm_exit_during_initialization(Handle exception);
8076
96d498ec7ae1 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 7900
diff changeset
    50
extern void vm_exit_during_initialization(Symbol* exception_name, const char* message);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
extern void vm_exit_during_initialization(const char* error, const char* message = NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
extern void vm_shutdown_during_initialization(const char* error, const char* message = NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
52300
9e29d8388514 8209598: Clean up how messages are printed when CDS aborts start-up
ccheung
parents: 49364
diff changeset
    54
extern void vm_exit_during_cds_dumping(const char* error, const char* message = NULL);
9e29d8388514 8209598: Clean up how messages are printed when CDS aborts start-up
ccheung
parents: 49364
diff changeset
    55
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    56
/**
33959
36f534ca18c0 8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents: 33957
diff changeset
    57
 * With the integration of the changes to handle the version string
36f534ca18c0 8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents: 33957
diff changeset
    58
 * as defined by JEP-223, most of the code related to handle the version
36f534ca18c0 8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents: 33957
diff changeset
    59
 * string prior to JDK 1.6 was removed (partial initialization)
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    60
 */
49364
601146c66cad 8173070: Remove ValueObj class for allocation subclassing for runtime code
coleenp
parents: 47216
diff changeset
    61
class JDK_Version {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  friend class VMStructs;
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    63
  friend class Universe;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    64
  friend void JDK_Version_init();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
 private:
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    66
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    67
  static JDK_Version _current;
13106
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
    68
  static const char* _runtime_name;
14289
aec758622b4b 8002078: hs_err_pid file should report full JDK version string
sla
parents: 13963
diff changeset
    69
  static const char* _runtime_version;
58842
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
    70
  static const char* _runtime_vendor_version;
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
    71
  static const char* _runtime_vendor_vm_bug_url;
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    72
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    73
  uint8_t _major;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    74
  uint8_t _minor;
33957
39113ae98993 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 30558
diff changeset
    75
  uint8_t _security;
33959
36f534ca18c0 8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents: 33957
diff changeset
    76
  uint8_t _patch;
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    77
  uint8_t _build;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    78
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    79
  bool is_valid() const {
33959
36f534ca18c0 8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents: 33957
diff changeset
    80
    return (_major != 0);
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    81
  }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    82
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    83
  // initializes or partially initializes the _current static field
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    84
  static void initialize();
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    85
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
 public:
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    87
54795
fd08f5a976e6 8189208: Cleanup ancient argument processing code
gziemski
parents: 53244
diff changeset
    88
  JDK_Version() :
fd08f5a976e6 8189208: Cleanup ancient argument processing code
gziemski
parents: 53244
diff changeset
    89
      _major(0), _minor(0), _security(0), _patch(0), _build(0)
fd08f5a976e6 8189208: Cleanup ancient argument processing code
gziemski
parents: 53244
diff changeset
    90
      {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
33957
39113ae98993 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 30558
diff changeset
    92
  JDK_Version(uint8_t major, uint8_t minor = 0, uint8_t security = 0,
54795
fd08f5a976e6 8189208: Cleanup ancient argument processing code
gziemski
parents: 53244
diff changeset
    93
              uint8_t patch = 0, uint8_t build = 0) :
fd08f5a976e6 8189208: Cleanup ancient argument processing code
gziemski
parents: 53244
diff changeset
    94
      _major(major), _minor(minor), _security(security), _patch(patch), _build(build)
30558
baec90a2699f 8031401: Remove unused code in the reference processor
kbarrett
parents: 27157
diff changeset
    95
      {}
602
92e03692ddd6 6705523: Fix for 6695506 will violate spec when used in JDK6
kamg
parents: 1
diff changeset
    96
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    97
  // Returns the current running JDK version
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    98
  static JDK_Version current() { return _current; }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    99
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   100
  // Factory methods for convenience
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   101
  static JDK_Version jdk(uint8_t m) {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   102
    return JDK_Version(m);
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   103
  }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   104
32823
ca8fef4cd57b 8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents: 30558
diff changeset
   105
  static JDK_Version undefined() {
ca8fef4cd57b 8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents: 30558
diff changeset
   106
    return JDK_Version(0);
ca8fef4cd57b 8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents: 30558
diff changeset
   107
  }
ca8fef4cd57b 8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents: 30558
diff changeset
   108
ca8fef4cd57b 8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents: 30558
diff changeset
   109
  bool is_undefined() const {
33975
iris
parents: 32823 33959
diff changeset
   110
    return _major == 0;
32823
ca8fef4cd57b 8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents: 30558
diff changeset
   111
  }
ca8fef4cd57b 8066821: Enhance command line processing to manage deprecating and obsoleting -XX command line arguments
drwhite
parents: 30558
diff changeset
   112
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   113
  uint8_t major_version() const          { return _major; }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   114
  uint8_t minor_version() const          { return _minor; }
33959
36f534ca18c0 8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents: 33957
diff changeset
   115
  uint8_t security_version() const       { return _security; }
36f534ca18c0 8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents: 33957
diff changeset
   116
  uint8_t patch_version() const          { return _patch; }
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   117
  uint8_t build_number() const           { return _build; }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   118
33959
36f534ca18c0 8087202: Add support for PATCH field and remove unused fields of new version string
amurillo
parents: 33957
diff changeset
   119
  // Performs a full ordering comparison using all fields (patch, build, etc.)
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   120
  int compare(const JDK_Version& other) const;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   121
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   122
  /**
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   123
   * Performs comparison using only the major version, returning negative
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   124
   * if the major version of 'this' is less than the parameter, 0 if it is
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   125
   * equal, and a positive value if it is greater.
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   126
   */
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   127
  int compare_major(int version) const {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   128
      return major_version() - version;
602
92e03692ddd6 6705523: Fix for 6695506 will violate spec when used in JDK6
kamg
parents: 1
diff changeset
   129
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   131
  void to_string(char* buffer, size_t buflen) const;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   132
13106
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   133
  static const char* runtime_name() {
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   134
    return _runtime_name;
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   135
  }
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   136
  static void set_runtime_name(const char* name) {
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   137
    _runtime_name = name;
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   138
  }
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   139
14289
aec758622b4b 8002078: hs_err_pid file should report full JDK version string
sla
parents: 13963
diff changeset
   140
  static const char* runtime_version() {
aec758622b4b 8002078: hs_err_pid file should report full JDK version string
sla
parents: 13963
diff changeset
   141
    return _runtime_version;
aec758622b4b 8002078: hs_err_pid file should report full JDK version string
sla
parents: 13963
diff changeset
   142
  }
aec758622b4b 8002078: hs_err_pid file should report full JDK version string
sla
parents: 13963
diff changeset
   143
  static void set_runtime_version(const char* version) {
aec758622b4b 8002078: hs_err_pid file should report full JDK version string
sla
parents: 13963
diff changeset
   144
    _runtime_version = version;
aec758622b4b 8002078: hs_err_pid file should report full JDK version string
sla
parents: 13963
diff changeset
   145
  }
aec758622b4b 8002078: hs_err_pid file should report full JDK version string
sla
parents: 13963
diff changeset
   146
58842
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   147
  static const char* runtime_vendor_version() {
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   148
    return _runtime_vendor_version;
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   149
  }
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   150
  static void set_runtime_vendor_version(const char* vendor_version) {
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   151
    _runtime_vendor_version = vendor_version;
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   152
  }
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   153
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   154
  static const char* runtime_vendor_vm_bug_url() {
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   155
    return _runtime_vendor_vm_bug_url;
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   156
  }
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   157
  static void set_runtime_vendor_vm_bug_url(const char* vendor_vm_bug_url) {
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   158
    _runtime_vendor_vm_bug_url = vendor_vm_bug_url;
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   159
  }
6c255334120d 8232080: jlink plugins for vendor information and run-time options
mr
parents: 54795
diff changeset
   160
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   162
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52300
diff changeset
   163
#endif // SHARE_RUNTIME_JAVA_HPP