changeset 59261:86222ee8e248

8223261: JDK-8189208 followup - remove JDK_GetVersionInfo0 and the supporting code Summary: Removed JDK_GetVersionInfo Reviewed-by: redestad, dholmes, mchung, clanger
author gziemski
date Tue, 10 Dec 2019 12:50:50 -0600
parents 8375c9115e6d
children a88e99d92248
files make/hotspot/src/classes/build/tools/projectcreator/WinGammaPlatformVC10.java make/hotspot/symbols/symbols-shared src/hotspot/share/include/jvm.h src/hotspot/share/prims/jvm.cpp src/hotspot/share/runtime/abstract_vm_version.hpp src/hotspot/share/runtime/java.cpp src/java.base/share/native/libjava/jdk_util.c src/java.base/share/native/libjava/jdk_util.h
diffstat 8 files changed, 7 insertions(+), 157 deletions(-) [+]
line wrap: on
line diff
--- a/make/hotspot/src/classes/build/tools/projectcreator/WinGammaPlatformVC10.java	Tue Dec 10 18:32:45 2019 +0000
+++ b/make/hotspot/src/classes/build/tools/projectcreator/WinGammaPlatformVC10.java	Tue Dec 10 12:50:50 2019 -0600
@@ -403,7 +403,6 @@
                     "/export:jio_snprintf /export:jio_printf "+
                     "/export:jio_fprintf /export:jio_vfprintf "+
                     "/export:jio_vsnprintf "+
-                    "/export:JVM_GetVersionInfo "+
                     "/export:JVM_InitAgentProperties");
         }
         addAttr(rv, "AdditionalDependencies", "kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;Wsock32.lib;winmm.lib;psapi.lib;version.lib");
--- a/make/hotspot/symbols/symbols-shared	Tue Dec 10 18:32:45 2019 +0000
+++ b/make/hotspot/symbols/symbols-shared	Tue Dec 10 12:50:50 2019 -0600
@@ -31,5 +31,4 @@
 JNI_GetCreatedJavaVMs
 JNI_GetDefaultJavaVMInitArgs
 JVM_FindClassFromBootLoader
-JVM_GetVersionInfo
 JVM_InitAgentProperties
--- a/src/hotspot/share/include/jvm.h	Tue Dec 10 18:32:45 2019 +0000
+++ b/src/hotspot/share/include/jvm.h	Tue Dec 10 12:50:50 2019 -0600
@@ -1186,76 +1186,6 @@
 JNIEXPORT jobjectArray JNICALL
 JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);
 
-/* =========================================================================
- * The following defines a private JVM interface that the JDK can query
- * for the JVM version and capabilities.  sun.misc.Version defines
- * the methods for getting the VM version and its capabilities.
- *
- * When a new bit is added, the following should be updated to provide
- * access to the new capability:
- *    HS:   JVM_GetVersionInfo and Abstract_VM_Version class
- *    SDK:  Version class
- *
- * Similary, a private JDK interface JDK_GetVersionInfo0 is defined for
- * JVM to query for the JDK version and capabilities.
- *
- * When a new bit is added, the following should be updated to provide
- * access to the new capability:
- *    HS:   JDK_Version class
- *    SDK:  JDK_GetVersionInfo0
- *
- * ==========================================================================
- */
-typedef struct {
-    unsigned int jvm_version;  /* Encoded $VNUM as specified by JEP-223 */
-    unsigned int patch_version : 8; /* JEP-223 patch version */
-    unsigned int reserved3 : 8;
-    unsigned int reserved1 : 16;
-    unsigned int reserved2;
-
-    /* The following bits represents JVM supports that JDK has dependency on.
-     * JDK can use these bits to determine which JVM 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 is_attach_supported : 1;
-    unsigned int : 31;
-    unsigned int : 32;
-    unsigned int : 32;
-} jvm_version_info;
-
-#define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
-#define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
-#define JVM_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
-#define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
-
-JNIEXPORT void JNICALL
-JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size);
-
-typedef struct {
-    unsigned int jdk_version; /* Encoded $VNUM as specified by JEP-223 */
-    unsigned int patch_version : 8; /* JEP-223 patch version */
-    unsigned int reserved3 : 8;
-    unsigned int reserved1 : 16;
-    unsigned int reserved2;
-    unsigned int : 32;
-    unsigned int : 32;
-    unsigned int : 32;
-} jdk_version_info;
-
-#define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
-#define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
-#define JDK_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
-#define JDK_VERSION_BUILD(version) ((version & 0x000000FF))
-
-/*
- * This is the function JDK_GetVersionInfo0 defined in libjava.so
- * that is dynamically looked up by JVM.
- */
-typedef void (*jdk_version_info_fn_t)(jdk_version_info* info, size_t info_size);
-
 /*
  * This structure is used by the launcher to get the default thread
  * stack size from the VM using JNI_GetDefaultJavaVMInitArgs() with a
--- a/src/hotspot/share/prims/jvm.cpp	Tue Dec 10 18:32:45 2019 +0000
+++ b/src/hotspot/share/prims/jvm.cpp	Tue Dec 10 12:50:50 2019 -0600
@@ -3645,20 +3645,6 @@
 }
 JVM_END
 
-JVM_ENTRY(void, JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size))
-{
-  memset(info, 0, info_size);
-
-  info->jvm_version = VM_Version::jvm_version();
-  info->patch_version = VM_Version::vm_patch_version();
-
-  // when we add a new capability in the jvm_version_info struct, we should also
-  // consider to expose this new capability in the sun.rt.jvmCapabilities jvmstat
-  // counter defined in runtimeService.cpp.
-  info->is_attach_supported = AttachListener::is_attach_supported();
-}
-JVM_END
-
 // Returns an array of java.lang.String objects containing the input arguments to the VM.
 JVM_ENTRY(jobjectArray, JVM_GetVmArguments(JNIEnv *env))
   ResourceMark rm(THREAD);
--- a/src/hotspot/share/runtime/abstract_vm_version.hpp	Tue Dec 10 18:32:45 2019 +0000
+++ b/src/hotspot/share/runtime/abstract_vm_version.hpp	Tue Dec 10 12:50:50 2019 -0600
@@ -109,7 +109,7 @@
   static int vm_patch_version()               { return _vm_patch_version; }
   static int vm_build_number()                { return _vm_build_number; }
 
-  // Gets the jvm_version_info.jvm_version defined in jvm.h
+  // Gets the jvm_version_info.jvm_version
   static unsigned int jvm_version();
 
   // Internal version providing additional build information
--- a/src/hotspot/share/runtime/java.cpp	Tue Dec 10 18:32:45 2019 +0000
+++ b/src/hotspot/share/runtime/java.cpp	Tue Dec 10 12:50:50 2019 -0600
@@ -694,23 +694,14 @@
 const char* JDK_Version::_runtime_vendor_vm_bug_url;
 
 void JDK_Version::initialize() {
-  jdk_version_info info;
   assert(!_current.is_valid(), "Don't initialize twice");
 
-  void *lib_handle = os::native_java_library();
-  jdk_version_info_fn_t func = CAST_TO_FN_PTR(jdk_version_info_fn_t,
-     os::dll_lookup(lib_handle, "JDK_GetVersionInfo0"));
-
-  assert(func != NULL, "Support for JDK 1.5 or older has been removed after JEP-223");
-
-  (*func)(&info, sizeof(info));
-
-  int major = JDK_VERSION_MAJOR(info.jdk_version);
-  int minor = JDK_VERSION_MINOR(info.jdk_version);
-  int security = JDK_VERSION_SECURITY(info.jdk_version);
-  int build = JDK_VERSION_BUILD(info.jdk_version);
-
-  _current = JDK_Version(major, minor, security, info.patch_version, build);
+  int major = VM_Version::vm_major_version();
+  int minor = VM_Version::vm_minor_version();
+  int security = VM_Version::vm_security_version();
+  int build = VM_Version::vm_build_number();
+  int patch = VM_Version::vm_patch_version();
+  _current = JDK_Version(major, minor, security, patch, build);
 }
 
 void JDK_Version_init() {
--- a/src/java.base/share/native/libjava/jdk_util.c	Tue Dec 10 18:32:45 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include "jvm.h"
-#include "jdk_util.h"
-
-JNIEXPORT void
-JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size) {
-    /* These VERSION_* macros are given by the build system */
-    const unsigned int version_major = VERSION_FEATURE;
-    const unsigned int version_minor = VERSION_INTERIM;
-    const unsigned int version_security = VERSION_UPDATE;
-    const unsigned int version_patch = VERSION_PATCH;
-    const unsigned int version_build = VERSION_BUILD;
-
-    memset(info, 0, info_size);
-    info->jdk_version = ((version_major & 0xFF) << 24) |
-                        ((version_minor & 0xFF) << 16) |
-                        ((version_security & 0xFF) << 8)  |
-                        (version_build & 0xFF);
-    info->patch_version = version_patch;
-}
--- a/src/java.base/share/native/libjava/jdk_util.h	Tue Dec 10 18:32:45 2019 +0000
+++ b/src/java.base/share/native/libjava/jdk_util.h	Tue Dec 10 12:50:50 2019 -0600
@@ -40,12 +40,6 @@
  */
 
 /*
- *
- */
-JNIEXPORT void
-JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size);
-
-/*
  * Export the platform dependent path canonicalization so that
  * the VM can find it when loading system classes.
  * This function is also used by the instrumentation agent.