hotspot/src/share/vm/runtime/java.hpp
author twisti
Mon, 18 Jun 2012 12:29:21 -0700
changeset 13106 cecfb99d6cff
parent 12630 ddf6ee008138
child 13963 e5b53c306fb5
permissions -rw-r--r--
7176856: add the JRE name to the error log Reviewed-by: coleenp, jrose, kvn, twisti Contributed-by: Krystal Mok <sajia@taobao.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
7900
4c7fc6332f7e 6994753: Implement optional hook to a Java method at VM startup.
kevinw
parents: 7397
diff changeset
     2
 * Copyright (c) 1997, 2011, 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
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_RUNTIME_JAVA_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_RUNTIME_JAVA_HPP
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
// Register function to be called by before_exit
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
extern "C" { void register_on_exit_function(void (*func)(void)) ;}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// Execute code before all handles are released and thread is killed; prologue to vm_exit
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
extern void before_exit(JavaThread * thread);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// Forced VM exit (i.e, internal error or JVM_Exit)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
extern void vm_exit(int code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// Wrapper for ::exit()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
extern void vm_direct_exit(int code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// Shutdown the VM but do not exit the process
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
extern void vm_shutdown();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
// Shutdown the VM and abort the process
773
01daf7c809b1 6694099: Hotspot vm_exit_out_of_memory should dump core
poonam
parents: 602
diff changeset
    45
extern void vm_abort(bool dump_core=true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
// Trigger any necessary notification of the VM being shutdown
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
extern void notify_vm_shutdown();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// VM exit if error occurs during initialization of VM
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
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
    52
extern void vm_exit_during_initialization(Symbol* exception_name, const char* message);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
extern void vm_exit_during_initialization(const char* error, const char* message = NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
extern void vm_shutdown_during_initialization(const char* error, const char* message = NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    56
/**
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    57
 * Discovering the JDK_Version during initialization is tricky when the
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    58
 * running JDK is less than JDK6.  For JDK6 and greater, a "GetVersion"
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    59
 * function exists in libjava.so and we simply call it during the
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    60
 * 'initialize()' call to find the version.  For JDKs with version < 6, no
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    61
 * such call exists and we have to probe the JDK in order to determine
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    62
 * the exact version.  This probing cannot happen during late in
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    63
 * the VM initialization process so there's a period of time during
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    64
 * initialization when we don't know anything about the JDK version other than
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    65
 * that it less than version 6.  This is the "partially initialized" time,
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    66
 * when we can answer only certain version queries (such as, is the JDK
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    67
 * version greater than 5?  Answer: no).  Once the JDK probing occurs, we
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    68
 * know the version and are considered fully initialized.
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    69
 */
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    70
class JDK_Version VALUE_OBJ_CLASS_SPEC {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  friend class VMStructs;
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    72
  friend class Universe;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    73
  friend void JDK_Version_init();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
 private:
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    75
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    76
  static JDK_Version _current;
13106
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
    77
  static const char* _runtime_name;
950
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
  // In this class, we promote the minor version of release to be the
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    80
  // major version for releases >= 5 in anticipation of the JDK doing the
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    81
  // same thing.  For example, we represent "1.5.0" as major version 5 (we
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    82
  // drop the leading 1 and use 5 as the 'major').
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    83
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    84
  uint8_t _major;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    85
  uint8_t _minor;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    86
  uint8_t _micro;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    87
  uint8_t _update;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    88
  uint8_t _special;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    89
  uint8_t _build;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    90
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    91
  // If partially initialized, the above fields are invalid and we know
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    92
  // that we're less than major version 6.
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    93
  bool _partially_initialized;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    94
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    95
  bool _thread_park_blocker;
10526
3e92f211533f 4965777: GC changes to support use of discovered field for pending references
ysr
parents: 8076
diff changeset
    96
  bool _pending_list_uses_discovered_field;
7900
4c7fc6332f7e 6994753: Implement optional hook to a Java method at VM startup.
kevinw
parents: 7397
diff changeset
    97
  bool _post_vm_init_hook_enabled;
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    98
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
    99
  bool is_valid() const {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   100
    return (_major != 0 || _partially_initialized);
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   101
  }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   102
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   103
  // initializes or partially initializes the _current static field
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   104
  static void initialize();
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   105
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   106
  // Completes initialization for a pre-JDK6 version.
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   107
  static void fully_initialize(uint8_t major, uint8_t minor = 0,
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   108
                               uint8_t micro = 0, uint8_t update = 0);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
 public:
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   111
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   112
  // Returns true if the the current version has only been partially initialized
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   113
  static bool is_partially_initialized() {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   114
    return _current._partially_initialized;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   115
  }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   116
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   117
  JDK_Version() : _major(0), _minor(0), _micro(0), _update(0),
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   118
                  _special(0), _build(0), _partially_initialized(false),
10526
3e92f211533f 4965777: GC changes to support use of discovered field for pending references
ysr
parents: 8076
diff changeset
   119
                  _thread_park_blocker(false), _post_vm_init_hook_enabled(false),
3e92f211533f 4965777: GC changes to support use of discovered field for pending references
ysr
parents: 8076
diff changeset
   120
                  _pending_list_uses_discovered_field(false) {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   122
  JDK_Version(uint8_t major, uint8_t minor = 0, uint8_t micro = 0,
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   123
              uint8_t update = 0, uint8_t special = 0, uint8_t build = 0,
10526
3e92f211533f 4965777: GC changes to support use of discovered field for pending references
ysr
parents: 8076
diff changeset
   124
              bool thread_park_blocker = false, bool post_vm_init_hook_enabled = false,
3e92f211533f 4965777: GC changes to support use of discovered field for pending references
ysr
parents: 8076
diff changeset
   125
              bool pending_list_uses_discovered_field = false) :
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   126
      _major(major), _minor(minor), _micro(micro), _update(update),
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   127
      _special(special), _build(build), _partially_initialized(false),
7900
4c7fc6332f7e 6994753: Implement optional hook to a Java method at VM startup.
kevinw
parents: 7397
diff changeset
   128
      _thread_park_blocker(thread_park_blocker),
10526
3e92f211533f 4965777: GC changes to support use of discovered field for pending references
ysr
parents: 8076
diff changeset
   129
      _post_vm_init_hook_enabled(post_vm_init_hook_enabled),
3e92f211533f 4965777: GC changes to support use of discovered field for pending references
ysr
parents: 8076
diff changeset
   130
      _pending_list_uses_discovered_field(pending_list_uses_discovered_field) {}
602
92e03692ddd6 6705523: Fix for 6695506 will violate spec when used in JDK6
kamg
parents: 1
diff changeset
   131
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   132
  // Returns the current running JDK version
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   133
  static JDK_Version current() { return _current; }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   134
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   135
  // Factory methods for convenience
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   136
  static JDK_Version jdk(uint8_t m) {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   137
    return JDK_Version(m);
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   138
  }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   139
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   140
  static JDK_Version jdk_update(uint8_t major, uint8_t update_number) {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   141
    return JDK_Version(major, 0, 0, update_number);
602
92e03692ddd6 6705523: Fix for 6695506 will violate spec when used in JDK6
kamg
parents: 1
diff changeset
   142
  }
92e03692ddd6 6705523: Fix for 6695506 will violate spec when used in JDK6
kamg
parents: 1
diff changeset
   143
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   144
  uint8_t major_version() const          { return _major; }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   145
  uint8_t minor_version() const          { return _minor; }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   146
  uint8_t micro_version() const          { return _micro; }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   147
  uint8_t update_version() const         { return _update; }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   148
  uint8_t special_update_version() const { return _special; }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   149
  uint8_t build_number() const           { return _build; }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   150
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   151
  bool supports_thread_park_blocker() const {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   152
    return _thread_park_blocker;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   153
  }
7900
4c7fc6332f7e 6994753: Implement optional hook to a Java method at VM startup.
kevinw
parents: 7397
diff changeset
   154
  bool post_vm_init_hook_enabled() const {
4c7fc6332f7e 6994753: Implement optional hook to a Java method at VM startup.
kevinw
parents: 7397
diff changeset
   155
    return _post_vm_init_hook_enabled;
4c7fc6332f7e 6994753: Implement optional hook to a Java method at VM startup.
kevinw
parents: 7397
diff changeset
   156
  }
10526
3e92f211533f 4965777: GC changes to support use of discovered field for pending references
ysr
parents: 8076
diff changeset
   157
  // For compatibility wrt pre-4965777 JDK's
3e92f211533f 4965777: GC changes to support use of discovered field for pending references
ysr
parents: 8076
diff changeset
   158
  bool pending_list_uses_discovered_field() const {
3e92f211533f 4965777: GC changes to support use of discovered field for pending references
ysr
parents: 8076
diff changeset
   159
    return _pending_list_uses_discovered_field;
3e92f211533f 4965777: GC changes to support use of discovered field for pending references
ysr
parents: 8076
diff changeset
   160
  }
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   161
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   162
  // Performs a full ordering comparison using all fields (update, build, etc.)
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   163
  int compare(const JDK_Version& other) const;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   164
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   165
  /**
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   166
   * Performs comparison using only the major version, returning negative
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   167
   * 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
   168
   * equal, and a positive value if it is greater.
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   169
   */
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   170
  int compare_major(int version) const {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   171
    if (_partially_initialized) {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   172
      if (version >= 6) {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   173
        return -1;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   174
      } else {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   175
        assert(false, "Can't make this comparison during init time");
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   176
        return -1; // conservative
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   177
      }
602
92e03692ddd6 6705523: Fix for 6695506 will violate spec when used in JDK6
kamg
parents: 1
diff changeset
   178
    } else {
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   179
      return major_version() - version;
602
92e03692ddd6 6705523: Fix for 6695506 will violate spec when used in JDK6
kamg
parents: 1
diff changeset
   180
    }
92e03692ddd6 6705523: Fix for 6695506 will violate spec when used in JDK6
kamg
parents: 1
diff changeset
   181
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   183
  void to_string(char* buffer, size_t buflen) const;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   184
13106
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   185
  static const char* runtime_name() {
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   186
    return _runtime_name;
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   187
  }
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   188
  static void set_runtime_name(const char* name) {
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   189
    _runtime_name = name;
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   190
  }
cecfb99d6cff 7176856: add the JRE name to the error log
twisti
parents: 12630
diff changeset
   191
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   192
  // Convenience methods for queries on the current major/minor version
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   193
  static bool is_jdk12x_version() {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   194
    return current().compare_major(2) == 0;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   195
  }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   196
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   197
  static bool is_jdk13x_version() {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   198
    return current().compare_major(3) == 0;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   199
  }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   200
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   201
  static bool is_jdk14x_version() {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   202
    return current().compare_major(4) == 0;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   203
  }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   204
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   205
  static bool is_jdk15x_version() {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   206
    return current().compare_major(5) == 0;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   207
  }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   208
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   209
  static bool is_jdk16x_version() {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   210
    return current().compare_major(6) == 0;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   211
  }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   212
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   213
  static bool is_jdk17x_version() {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   214
    return current().compare_major(7) == 0;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   215
  }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   216
12630
ddf6ee008138 7166894: Add gc cause to GC logging for all collectors
brutisso
parents: 10526
diff changeset
   217
  static bool is_jdk18x_version() {
ddf6ee008138 7166894: Add gc cause to GC logging for all collectors
brutisso
parents: 10526
diff changeset
   218
    return current().compare_major(8) == 0;
ddf6ee008138 7166894: Add gc cause to GC logging for all collectors
brutisso
parents: 10526
diff changeset
   219
  }
ddf6ee008138 7166894: Add gc cause to GC logging for all collectors
brutisso
parents: 10526
diff changeset
   220
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   221
  static bool is_gte_jdk13x_version() {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   222
    return current().compare_major(3) >= 0;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   223
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  static bool is_gte_jdk14x_version() {
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   226
    return current().compare_major(4) >= 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  }
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   228
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   229
  static bool is_gte_jdk15x_version() {
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   230
    return current().compare_major(5) >= 0;
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   231
  }
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   232
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  static bool is_gte_jdk16x_version() {
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   234
    return current().compare_major(6) >= 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  static bool is_gte_jdk17x_version() {
950
6112b627bb36 6721093: -XX:AppendRatio=N not supported
kamg
parents: 781
diff changeset
   238
    return current().compare_major(7) >= 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  }
12630
ddf6ee008138 7166894: Add gc cause to GC logging for all collectors
brutisso
parents: 10526
diff changeset
   240
ddf6ee008138 7166894: Add gc cause to GC logging for all collectors
brutisso
parents: 10526
diff changeset
   241
  static bool is_gte_jdk18x_version() {
ddf6ee008138 7166894: Add gc cause to GC logging for all collectors
brutisso
parents: 10526
diff changeset
   242
    return current().compare_major(8) >= 0;
ddf6ee008138 7166894: Add gc cause to GC logging for all collectors
brutisso
parents: 10526
diff changeset
   243
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   245
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   246
#endif // SHARE_VM_RUNTIME_JAVA_HPP