8189208: Cleanup ancient argument processing code
authorgziemski
Thu, 09 May 2019 12:04:20 -0500
changeset 54795 fd08f5a976e6
parent 54794 019b3db480f4
child 54796 3c16c876b094
8189208: Cleanup ancient argument processing code Summary: Remove bits thread_park_blocker, post_vm_init_hook_enabled and pending_list_uses_discovered_fields Reviewed-by: hseigel, dholmes
src/hotspot/share/classfile/javaClasses.cpp
src/hotspot/share/include/jvm.h
src/hotspot/share/runtime/arguments.cpp
src/hotspot/share/runtime/java.cpp
src/hotspot/share/runtime/java.hpp
src/hotspot/share/runtime/thread.cpp
src/hotspot/share/services/threadService.cpp
src/java.base/share/native/libjava/jdk_util.c
--- a/src/hotspot/share/classfile/javaClasses.cpp	Thu May 09 12:56:15 2019 -0400
+++ b/src/hotspot/share/classfile/javaClasses.cpp	Thu May 09 12:04:20 2019 -0500
@@ -1738,9 +1738,6 @@
 }
 
 oop java_lang_Thread::park_blocker(oop java_thread) {
-  assert(JDK_Version::current().supports_thread_park_blocker(),
-         "Must support parkBlocker field");
-
   return java_thread->obj_field(_park_blocker_offset);
 }
 
--- a/src/hotspot/share/include/jvm.h	Thu May 09 12:56:15 2019 -0400
+++ b/src/hotspot/share/include/jvm.h	Thu May 09 12:04:20 2019 -0500
@@ -1280,18 +1280,7 @@
     unsigned int reserved3 : 8;
     unsigned int reserved1 : 16;
     unsigned int reserved2;
-
-    /* The following bits represents new JDK supports that VM has dependency on.
-     * VM implementation can use these bits to determine which JDK version
-     * and support it has to maintain runtime compatibility.
-     *
-     * When a new bit is added in a minor or update release, make sure
-     * the new bit is also added in the main/baseline.
-     */
-    unsigned int thread_park_blocker : 1;
-    unsigned int post_vm_init_hook_enabled : 1;
-    unsigned int pending_list_uses_discovered_field : 1;
-    unsigned int : 29;
+    unsigned int : 32;
     unsigned int : 32;
     unsigned int : 32;
 } jdk_version_info;
--- a/src/hotspot/share/runtime/arguments.cpp	Thu May 09 12:56:15 2019 -0400
+++ b/src/hotspot/share/runtime/arguments.cpp	Thu May 09 12:04:20 2019 -0500
@@ -2959,14 +2959,6 @@
     LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, path));
   }
 
-  // Change the default value for flags  which have different default values
-  // when working with older JDKs.
-#ifdef LINUX
- if (JDK_Version::current().compare_major(6) <= 0 &&
-      FLAG_IS_DEFAULT(UseLinuxPosixThreadCPUClocks)) {
-    FLAG_SET_DEFAULT(UseLinuxPosixThreadCPUClocks, false);
-  }
-#endif // LINUX
   fix_appclasspath();
 
   return JNI_OK;
--- a/src/hotspot/share/runtime/java.cpp	Thu May 09 12:56:15 2019 -0400
+++ b/src/hotspot/share/runtime/java.cpp	Thu May 09 12:04:20 2019 -0500
@@ -710,14 +710,7 @@
   int security = JDK_VERSION_SECURITY(info.jdk_version);
   int build = JDK_VERSION_BUILD(info.jdk_version);
 
-  // Incompatible with pre-4243978 JDK.
-  if (info.pending_list_uses_discovered_field == 0) {
-    vm_exit_during_initialization(
-      "Incompatible JDK is not using Reference.discovered field for pending list");
-  }
-  _current = JDK_Version(major, minor, security, info.patch_version, build,
-                         info.thread_park_blocker == 1,
-                         info.post_vm_init_hook_enabled == 1);
+  _current = JDK_Version(major, minor, security, info.patch_version, build);
 }
 
 void JDK_Version_init() {
--- a/src/hotspot/share/runtime/java.hpp	Thu May 09 12:56:15 2019 -0400
+++ b/src/hotspot/share/runtime/java.hpp	Thu May 09 12:04:20 2019 -0500
@@ -74,9 +74,6 @@
   uint8_t _patch;
   uint8_t _build;
 
-  bool _thread_park_blocker;
-  bool _post_vm_init_hook_enabled;
-
   bool is_valid() const {
     return (_major != 0);
   }
@@ -86,16 +83,13 @@
 
  public:
 
-  JDK_Version() : _major(0), _minor(0), _security(0), _patch(0), _build(0),
-                  _thread_park_blocker(false), _post_vm_init_hook_enabled(false)
-                  {}
+  JDK_Version() :
+      _major(0), _minor(0), _security(0), _patch(0), _build(0)
+      {}
 
   JDK_Version(uint8_t major, uint8_t minor = 0, uint8_t security = 0,
-              uint8_t patch = 0, uint8_t build = 0,
-              bool thread_park_blocker = false, bool post_vm_init_hook_enabled = false) :
-      _major(major), _minor(minor), _security(security), _patch(patch), _build(build),
-      _thread_park_blocker(thread_park_blocker),
-      _post_vm_init_hook_enabled(post_vm_init_hook_enabled)
+              uint8_t patch = 0, uint8_t build = 0) :
+      _major(major), _minor(minor), _security(security), _patch(patch), _build(build)
       {}
 
   // Returns the current running JDK version
@@ -120,13 +114,6 @@
   uint8_t patch_version() const          { return _patch; }
   uint8_t build_number() const           { return _build; }
 
-  bool supports_thread_park_blocker() const {
-    return _thread_park_blocker;
-  }
-  bool post_vm_init_hook_enabled() const {
-    return _post_vm_init_hook_enabled;
-  }
-
   // Performs a full ordering comparison using all fields (patch, build, etc.)
   int compare(const JDK_Version& other) const;
 
--- a/src/hotspot/share/runtime/thread.cpp	Thu May 09 12:56:15 2019 -0400
+++ b/src/hotspot/share/runtime/thread.cpp	Thu May 09 12:04:20 2019 -0500
@@ -3190,8 +3190,7 @@
 oop JavaThread::current_park_blocker() {
   // Support for JSR-166 locks
   oop thread_oop = threadObj();
-  if (thread_oop != NULL &&
-      JDK_Version::current().supports_thread_park_blocker()) {
+  if (thread_oop != NULL) {
     return java_lang_Thread::park_blocker(thread_oop);
   }
   return NULL;
@@ -4007,13 +4006,11 @@
   RTMLockingCounters::init();
 #endif
 
-  if (JDK_Version::current().post_vm_init_hook_enabled()) {
-    call_postVMInitHook(THREAD);
-    // The Java side of PostVMInitHook.run must deal with all
-    // exceptions and provide means of diagnosis.
-    if (HAS_PENDING_EXCEPTION) {
-      CLEAR_PENDING_EXCEPTION;
-    }
+  call_postVMInitHook(THREAD);
+  // The Java side of PostVMInitHook.run must deal with all
+  // exceptions and provide means of diagnosis.
+  if (HAS_PENDING_EXCEPTION) {
+    CLEAR_PENDING_EXCEPTION;
   }
 
   {
--- a/src/hotspot/share/services/threadService.cpp	Thu May 09 12:56:15 2019 -0400
+++ b/src/hotspot/share/services/threadService.cpp	Thu May 09 12:04:20 2019 -0500
@@ -893,10 +893,7 @@
   }
 
   // Support for JSR-166 locks
-  if (JDK_Version::current().supports_thread_park_blocker() &&
-        (_thread_status == java_lang_Thread::PARKED ||
-         _thread_status == java_lang_Thread::PARKED_TIMED)) {
-
+  if (_thread_status == java_lang_Thread::PARKED || _thread_status == java_lang_Thread::PARKED_TIMED) {
     _blocker_object = thread->current_park_blocker();
     if (_blocker_object != NULL && _blocker_object->is_a(SystemDictionary::java_util_concurrent_locks_AbstractOwnableSynchronizer_klass())) {
       _blocker_object_owner = java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(_blocker_object);
--- a/src/java.base/share/native/libjava/jdk_util.c	Thu May 09 12:56:15 2019 -0400
+++ b/src/java.base/share/native/libjava/jdk_util.c	Thu May 09 12:04:20 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,9 +46,4 @@
                         ((version_security & 0xFF) << 8)  |
                         (version_build & 0xFF);
     info->patch_version = version_patch;
-    info->thread_park_blocker = 1;
-    // Advertise presence of PostVMInitHook:
-    // future optimization: detect if this is enabled.
-    info->post_vm_init_hook_enabled = 1;
-    info->pending_list_uses_discovered_field = 1;
 }