8223261: JDK-8189208 followup - remove JDK_GetVersionInfo0 and the supporting code

Removed JDK_GetVersionInfo

Reviewed-by: redestad, dholmes, mchung, clanger
This commit is contained in:
Gerard Ziemski 2019-12-10 12:50:50 -06:00
parent 769a1f9187
commit b467629bd6
8 changed files with 7 additions and 157 deletions

View File

@ -403,7 +403,6 @@ class CompilerInterfaceVC10 extends CompilerInterface {
"/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");

View File

@ -31,5 +31,4 @@ JNI_CreateJavaVM
JNI_GetCreatedJavaVMs
JNI_GetDefaultJavaVMInitArgs
JVM_FindClassFromBootLoader
JVM_GetVersionInfo
JVM_InitAgentProperties

View File

@ -1186,76 +1186,6 @@ JVM_GetTemporaryDirectory(JNIEnv *env);
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

View File

@ -3645,20 +3645,6 @@ JVM_ENTRY(jobjectArray, JVM_GetEnclosingMethodInfo(JNIEnv *env, jclass ofClass))
}
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);

View File

@ -109,7 +109,7 @@ class Abstract_VM_Version: AllStatic {
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

View File

@ -694,23 +694,14 @@ const char* JDK_Version::_runtime_vendor_version;
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() {

View File

@ -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;
}

View File

@ -39,12 +39,6 @@ extern "C" {
*-------------------------------------------------------
*/
/*
*
*/
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.