< prev index next >

src/share/vm/runtime/java.hpp

Print this page
rev 8203 : imported patch remove_config
   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  74   static const char* _runtime_name;
  75   static const char* _runtime_version;
  76 
  77   // In this class, we promote the minor version of release to be the
  78   // major version for releases >= 5 in anticipation of the JDK doing the
  79   // same thing.  For example, we represent "1.5.0" as major version 5 (we
  80   // drop the leading 1 and use 5 as the 'major').
  81 
  82   uint8_t _major;
  83   uint8_t _minor;
  84   uint8_t _micro;
  85   uint8_t _update;
  86   uint8_t _special;
  87   uint8_t _build;
  88 
  89   // If partially initialized, the above fields are invalid and we know
  90   // that we're less than major version 6.
  91   bool _partially_initialized;
  92 
  93   bool _thread_park_blocker;
  94   bool _pending_list_uses_discovered_field;
  95   bool _post_vm_init_hook_enabled;
  96 
  97   bool is_valid() const {
  98     return (_major != 0 || _partially_initialized);
  99   }
 100 
 101   // initializes or partially initializes the _current static field
 102   static void initialize();
 103 
 104   // Completes initialization for a pre-JDK6 version.
 105   static void fully_initialize(uint8_t major, uint8_t minor = 0,
 106                                uint8_t micro = 0, uint8_t update = 0);
 107 
 108  public:
 109 
 110   // Returns true if the the current version has only been partially initialized
 111   static bool is_partially_initialized() {
 112     return _current._partially_initialized;
 113   }
 114 
 115   JDK_Version() : _major(0), _minor(0), _micro(0), _update(0),
 116                   _special(0), _build(0), _partially_initialized(false),
 117                   _thread_park_blocker(false), _post_vm_init_hook_enabled(false),
 118                   _pending_list_uses_discovered_field(false) {}
 119 
 120   JDK_Version(uint8_t major, uint8_t minor = 0, uint8_t micro = 0,
 121               uint8_t update = 0, uint8_t special = 0, uint8_t build = 0,
 122               bool thread_park_blocker = false, bool post_vm_init_hook_enabled = false,
 123               bool pending_list_uses_discovered_field = false) :
 124       _major(major), _minor(minor), _micro(micro), _update(update),
 125       _special(special), _build(build), _partially_initialized(false),
 126       _thread_park_blocker(thread_park_blocker),
 127       _post_vm_init_hook_enabled(post_vm_init_hook_enabled),
 128       _pending_list_uses_discovered_field(pending_list_uses_discovered_field) {}
 129 
 130   // Returns the current running JDK version
 131   static JDK_Version current() { return _current; }
 132 
 133   // Factory methods for convenience
 134   static JDK_Version jdk(uint8_t m) {
 135     return JDK_Version(m);
 136   }
 137 
 138   static JDK_Version jdk_update(uint8_t major, uint8_t update_number) {
 139     return JDK_Version(major, 0, 0, update_number);
 140   }
 141 
 142   uint8_t major_version() const          { return _major; }
 143   uint8_t minor_version() const          { return _minor; }
 144   uint8_t micro_version() const          { return _micro; }
 145   uint8_t update_version() const         { return _update; }
 146   uint8_t special_update_version() const { return _special; }
 147   uint8_t build_number() const           { return _build; }
 148 
 149   bool supports_thread_park_blocker() const {
 150     return _thread_park_blocker;
 151   }
 152   bool post_vm_init_hook_enabled() const {
 153     return _post_vm_init_hook_enabled;
 154   }
 155   // For compatibility wrt pre-4965777 JDK's
 156   bool pending_list_uses_discovered_field() const {
 157     return _pending_list_uses_discovered_field;
 158   }
 159 
 160   // Performs a full ordering comparison using all fields (update, build, etc.)
 161   int compare(const JDK_Version& other) const;
 162 
 163   /**
 164    * Performs comparison using only the major version, returning negative
 165    * if the major version of 'this' is less than the parameter, 0 if it is
 166    * equal, and a positive value if it is greater.
 167    */
 168   int compare_major(int version) const {
 169     if (_partially_initialized) {
 170       if (version >= 6) {
 171         return -1;
 172       } else {
 173         assert(false, "Can't make this comparison during init time");
 174         return -1; // conservative
 175       }
 176     } else {
 177       return major_version() - version;


   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  74   static const char* _runtime_name;
  75   static const char* _runtime_version;
  76 
  77   // In this class, we promote the minor version of release to be the
  78   // major version for releases >= 5 in anticipation of the JDK doing the
  79   // same thing.  For example, we represent "1.5.0" as major version 5 (we
  80   // drop the leading 1 and use 5 as the 'major').
  81 
  82   uint8_t _major;
  83   uint8_t _minor;
  84   uint8_t _micro;
  85   uint8_t _update;
  86   uint8_t _special;
  87   uint8_t _build;
  88 
  89   // If partially initialized, the above fields are invalid and we know
  90   // that we're less than major version 6.
  91   bool _partially_initialized;
  92 
  93   bool _thread_park_blocker;

  94   bool _post_vm_init_hook_enabled;
  95 
  96   bool is_valid() const {
  97     return (_major != 0 || _partially_initialized);
  98   }
  99 
 100   // initializes or partially initializes the _current static field
 101   static void initialize();
 102 
 103   // Completes initialization for a pre-JDK6 version.
 104   static void fully_initialize(uint8_t major, uint8_t minor = 0,
 105                                uint8_t micro = 0, uint8_t update = 0);
 106 
 107  public:
 108 
 109   // Returns true if the the current version has only been partially initialized
 110   static bool is_partially_initialized() {
 111     return _current._partially_initialized;
 112   }
 113 
 114   JDK_Version() : _major(0), _minor(0), _micro(0), _update(0),
 115                   _special(0), _build(0), _partially_initialized(false),
 116                   _thread_park_blocker(false), _post_vm_init_hook_enabled(false)
 117                   {}
 118 
 119   JDK_Version(uint8_t major, uint8_t minor = 0, uint8_t micro = 0,
 120               uint8_t update = 0, uint8_t special = 0, uint8_t build = 0,
 121               bool thread_park_blocker = false, bool post_vm_init_hook_enabled = false) :

 122       _major(major), _minor(minor), _micro(micro), _update(update),
 123       _special(special), _build(build), _partially_initialized(false),
 124       _thread_park_blocker(thread_park_blocker),
 125       _post_vm_init_hook_enabled(post_vm_init_hook_enabled)
 126       {}
 127 
 128   // Returns the current running JDK version
 129   static JDK_Version current() { return _current; }
 130 
 131   // Factory methods for convenience
 132   static JDK_Version jdk(uint8_t m) {
 133     return JDK_Version(m);
 134   }
 135 
 136   static JDK_Version jdk_update(uint8_t major, uint8_t update_number) {
 137     return JDK_Version(major, 0, 0, update_number);
 138   }
 139 
 140   uint8_t major_version() const          { return _major; }
 141   uint8_t minor_version() const          { return _minor; }
 142   uint8_t micro_version() const          { return _micro; }
 143   uint8_t update_version() const         { return _update; }
 144   uint8_t special_update_version() const { return _special; }
 145   uint8_t build_number() const           { return _build; }
 146 
 147   bool supports_thread_park_blocker() const {
 148     return _thread_park_blocker;
 149   }
 150   bool post_vm_init_hook_enabled() const {
 151     return _post_vm_init_hook_enabled;




 152   }
 153 
 154   // Performs a full ordering comparison using all fields (update, build, etc.)
 155   int compare(const JDK_Version& other) const;
 156 
 157   /**
 158    * Performs comparison using only the major version, returning negative
 159    * if the major version of 'this' is less than the parameter, 0 if it is
 160    * equal, and a positive value if it is greater.
 161    */
 162   int compare_major(int version) const {
 163     if (_partially_initialized) {
 164       if (version >= 6) {
 165         return -1;
 166       } else {
 167         assert(false, "Can't make this comparison during init time");
 168         return -1; // conservative
 169       }
 170     } else {
 171       return major_version() - version;


< prev index next >