8219023: Investigate syncing JVMTI spec version with JDK version

Auto sync versions with the jdk versions

Reviewed-by: dholmes, jcbeyler, cjplummer
This commit is contained in:
Serguei Spitsyn 2019-05-14 02:07:13 -07:00
parent e6b1cd1d4b
commit 1c202572d5
8 changed files with 42 additions and 27 deletions

View File

@ -100,12 +100,17 @@ define SetupJvmtiGeneration
endef endef
$(eval $(call SetupJvmtiGeneration, jvmtiEnter.cpp, jvmtiEnter.xsl, \ $(eval $(call SetupJvmtiGeneration, jvmtiEnter.cpp, jvmtiEnter.xsl, \
-PARAM majorversion $(VERSION_FEATURE) \
-PARAM interface jvmti)) -PARAM interface jvmti))
$(eval $(call SetupJvmtiGeneration, jvmtiEnterTrace.cpp, jvmtiEnter.xsl, \ $(eval $(call SetupJvmtiGeneration, jvmtiEnterTrace.cpp, jvmtiEnter.xsl, \
-PARAM majorversion $(VERSION_FEATURE) \
-PARAM interface jvmti -PARAM trace Trace)) -PARAM interface jvmti -PARAM trace Trace))
$(eval $(call SetupJvmtiGeneration, jvmtiEnv.hpp, jvmtiHpp.xsl)) $(eval $(call SetupJvmtiGeneration, jvmtiEnv.hpp, jvmtiHpp.xsl, \
$(eval $(call SetupJvmtiGeneration, jvmti.h, jvmtiH.xsl)) -PARAM majorversion $(VERSION_FEATURE)))
$(eval $(call SetupJvmtiGeneration, jvmti.html, jvmti.xsl)) $(eval $(call SetupJvmtiGeneration, jvmti.h, jvmtiH.xsl, \
-PARAM majorversion $(VERSION_FEATURE)))
$(eval $(call SetupJvmtiGeneration, jvmti.html, jvmti.xsl, \
-PARAM majorversion $(VERSION_FEATURE)))
JVMTI_BC_SRCDIR := $(TOPDIR)/src/hotspot/share/interpreter JVMTI_BC_SRCDIR := $(TOPDIR)/src/hotspot/share/interpreter

View File

@ -26,10 +26,7 @@
<!DOCTYPE specification [ <!DOCTYPE specification [
<!ELEMENT specification (title, intro*, functionsection, errorsection, <!ELEMENT specification (title, intro*, functionsection, errorsection,
eventsection, datasection, issuessection, changehistory)> eventsection, datasection, issuessection, changehistory)>
<!ATTLIST specification label CDATA #REQUIRED <!ATTLIST specification label CDATA #REQUIRED>
majorversion CDATA #REQUIRED
minorversion CDATA #REQUIRED
microversion CDATA #REQUIRED>
<!ELEMENT title (#PCDATA|jvmti|tm)*> <!ELEMENT title (#PCDATA|jvmti|tm)*>
<!ATTLIST title subtitle CDATA #REQUIRED> <!ATTLIST title subtitle CDATA #REQUIRED>
@ -357,10 +354,7 @@
<!ELEMENT li ANY> <!ELEMENT li ANY>
]> ]>
<specification label="JVM(TM) Tool Interface" <specification label="JVM(TM) Tool Interface">
majorversion="11"
minorversion="0"
microversion="0">
<title subtitle="Version"> <title subtitle="Version">
<tm>JVM</tm> Tool Interface <tm>JVM</tm> Tool Interface
</title> </title>

View File

@ -1899,12 +1899,20 @@ typedef struct {
</dd> </dd>
</xsl:template> </xsl:template>
<xsl:template name="lastchangeversion">
<xsl:for-each select="//change">
<xsl:if test="position() = last()">
<xsl:value-of select="@version"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="changehistory"> <xsl:template match="changehistory">
<div class="sep"/> <div class="sep"/>
<hr class="thick"/> <hr class="thick"/>
<h2>Change History</h2> <h2>Change History</h2>
Last update: <xsl:value-of select="@update"/><br/> Last update: <xsl:value-of select="@update"/><br/>
Version: <xsl:call-template name="showversion"/> Version: <xsl:call-template name="lastchangeversion"/>
<div class="sep"/> <div class="sep"/>
<xsl:apply-templates select="intro"/> <xsl:apply-templates select="intro"/>
<div class="sep"/> <div class="sep"/>

View File

@ -383,8 +383,11 @@ JvmtiExport::get_jvmti_interface(JavaVM *jvm, void **penv, jint version) {
} }
break; break;
default: default:
// Starting from 13 we do not care about minor version anymore
if (major < 13 || major > Abstract_VM_Version::vm_major_version()) {
return JNI_EVERSION; // unsupported major version number return JNI_EVERSION; // unsupported major version number
} }
}
if (JvmtiEnv::get_phase() == JVMTI_PHASE_LIVE) { if (JvmtiEnv::get_phase() == JVMTI_PHASE_LIVE) {
JavaThread* current_thread = JavaThread::current(); JavaThread* current_thread = JavaThread::current();

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
@ -117,10 +117,10 @@ enum {
JVMTI_VERSION_11 = 0x300B0000, JVMTI_VERSION_11 = 0x300B0000,
JVMTI_VERSION = 0x30000000 + (</xsl:text> JVMTI_VERSION = 0x30000000 + (</xsl:text>
<xsl:value-of select="//specification/@majorversion"/> <xsl:value-of select="$majorversion"/>
<xsl:text> * 0x10000) + (</xsl:text> <xsl:text> * 0x10000) + (</xsl:text>
<xsl:value-of select="//specification/@minorversion"/> <!-- Now minorversion is always 0 -->
<xsl:text> * 0x100)</xsl:text> <xsl:text> 0 * 0x100)</xsl:text>
<xsl:variable name="micro"> <xsl:variable name="micro">
<xsl:call-template name="microversion"/> <xsl:call-template name="microversion"/>
</xsl:variable> </xsl:variable>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
@ -27,14 +27,17 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"> version="1.0">
<xsl:param name="majorversion"></xsl:param>
<xsl:template name="microversion"> <xsl:template name="microversion">
<xsl:value-of select="//specification/@microversion"/> <!-- Now microversion is always 0 -->
<xsl:text>0</xsl:text>
</xsl:template> </xsl:template>
<xsl:template name="showbasicversion"> <xsl:template name="showbasicversion">
<xsl:value-of select="//specification/@majorversion"/> <xsl:value-of select="$majorversion"/>
<xsl:text>.</xsl:text> <!-- Now minorversion is always 0 -->
<xsl:value-of select="//specification/@minorversion"/> <xsl:text>.0</xsl:text>
</xsl:template> </xsl:template>
<xsl:template name="showversion"> <xsl:template name="showversion">

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManagerService {
private final ThreadGroup mainGroupForJDI; private final ThreadGroup mainGroupForJDI;
private ResourceBundle messages = null; private ResourceBundle messages = null;
private int vmSequenceNumber = 0; private int vmSequenceNumber = 0;
private static final int majorVersion = 11; private static final int majorVersion = Runtime.version().feature();
private static final int minorVersion = 0; private static final int minorVersion = 0;
private static final Object lock = new Object(); private static final Object lock = new Object();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -35,8 +35,6 @@
#include "FrameID.h" #include "FrameID.h"
static char *versionName = "Java Debug Wire Protocol (Reference Implementation)"; static char *versionName = "Java Debug Wire Protocol (Reference Implementation)";
static int majorVersion = 11; /* JDWP major version */
static int minorVersion = 0; /* JDWP minor version */
static jboolean static jboolean
version(PacketInputStream *in, PacketOutputStream *out) version(PacketInputStream *in, PacketOutputStream *out)
@ -46,6 +44,10 @@ version(PacketInputStream *in, PacketOutputStream *out)
char *vmVersion; char *vmVersion;
char *vmInfo; char *vmInfo;
/* Now the JDWP versions are the same as JVMTI versions */
int majorVersion = jvmtiMajorVersion();
int minorVersion = 0;
if (gdata->vmDead) { if (gdata->vmDead) {
outStream_setError(out, JDWP_ERROR(VM_DEAD)); outStream_setError(out, JDWP_ERROR(VM_DEAD));
return JNI_TRUE; return JNI_TRUE;