8219023: Investigate syncing JVMTI spec version with JDK version
authorsspitsyn
Tue, 14 May 2019 02:07:13 -0700
changeset 54836 e2ed0691ae79
parent 54835 43764a3a986d
child 54837 6b06de11e78e
8219023: Investigate syncing JVMTI spec version with JDK version Summary: Auto sync versions with the jdk versions Reviewed-by: dholmes, jcbeyler, cjplummer
make/hotspot/gensrc/GensrcJvmti.gmk
src/hotspot/share/prims/jvmti.xml
src/hotspot/share/prims/jvmti.xsl
src/hotspot/share/prims/jvmtiExport.cpp
src/hotspot/share/prims/jvmtiH.xsl
src/hotspot/share/prims/jvmtiLib.xsl
src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java
src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c
--- a/make/hotspot/gensrc/GensrcJvmti.gmk	Tue May 14 09:25:58 2019 +0100
+++ b/make/hotspot/gensrc/GensrcJvmti.gmk	Tue May 14 02:07:13 2019 -0700
@@ -100,12 +100,17 @@
 endef
 
 $(eval $(call SetupJvmtiGeneration, jvmtiEnter.cpp, jvmtiEnter.xsl, \
+    -PARAM majorversion $(VERSION_FEATURE) \
     -PARAM interface jvmti))
 $(eval $(call SetupJvmtiGeneration, jvmtiEnterTrace.cpp, jvmtiEnter.xsl, \
+    -PARAM majorversion $(VERSION_FEATURE) \
     -PARAM interface jvmti -PARAM trace Trace))
-$(eval $(call SetupJvmtiGeneration, jvmtiEnv.hpp, jvmtiHpp.xsl))
-$(eval $(call SetupJvmtiGeneration, jvmti.h, jvmtiH.xsl))
-$(eval $(call SetupJvmtiGeneration, jvmti.html, jvmti.xsl))
+$(eval $(call SetupJvmtiGeneration, jvmtiEnv.hpp, jvmtiHpp.xsl, \
+    -PARAM majorversion $(VERSION_FEATURE)))
+$(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
 
--- a/src/hotspot/share/prims/jvmti.xml	Tue May 14 09:25:58 2019 +0100
+++ b/src/hotspot/share/prims/jvmti.xml	Tue May 14 02:07:13 2019 -0700
@@ -26,10 +26,7 @@
 <!DOCTYPE specification [
    <!ELEMENT specification (title, intro*, functionsection, errorsection,
                             eventsection, datasection, issuessection, changehistory)>
-   <!ATTLIST specification label CDATA #REQUIRED
-                           majorversion CDATA #REQUIRED
-                           minorversion CDATA #REQUIRED
-                           microversion CDATA #REQUIRED>
+   <!ATTLIST specification label CDATA #REQUIRED>
 
    <!ELEMENT title (#PCDATA|jvmti|tm)*>
    <!ATTLIST title subtitle CDATA #REQUIRED>
@@ -357,10 +354,7 @@
    <!ELEMENT li  ANY>
  ]>
 
-<specification label="JVM(TM) Tool Interface"
-        majorversion="11"
-        minorversion="0"
-        microversion="0">
+<specification label="JVM(TM) Tool Interface">
   <title subtitle="Version">
     <tm>JVM</tm> Tool Interface
   </title>
--- a/src/hotspot/share/prims/jvmti.xsl	Tue May 14 09:25:58 2019 +0100
+++ b/src/hotspot/share/prims/jvmti.xsl	Tue May 14 02:07:13 2019 -0700
@@ -1899,12 +1899,20 @@
   </dd>
 </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">
     <div class="sep"/>
     <hr class="thick"/>
     <h2>Change History</h2>
     Last update: <xsl:value-of select="@update"/><br/>
-    Version: <xsl:call-template name="showversion"/>
+    Version: <xsl:call-template name="lastchangeversion"/>
     <div class="sep"/>
     <xsl:apply-templates select="intro"/>
     <div class="sep"/>
--- a/src/hotspot/share/prims/jvmtiExport.cpp	Tue May 14 09:25:58 2019 +0100
+++ b/src/hotspot/share/prims/jvmtiExport.cpp	Tue May 14 02:07:13 2019 -0700
@@ -383,7 +383,10 @@
       }
       break;
     default:
-      return JNI_EVERSION;  // unsupported major version number
+      // 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
+      }
   }
 
   if (JvmtiEnv::get_phase() == JVMTI_PHASE_LIVE) {
--- a/src/hotspot/share/prims/jvmtiH.xsl	Tue May 14 09:25:58 2019 +0100
+++ b/src/hotspot/share/prims/jvmtiH.xsl	Tue May 14 02:07:13 2019 -0700
@@ -1,6 +1,6 @@
 <?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.
 
  This code is free software; you can redistribute it and/or modify it
@@ -117,10 +117,10 @@
     JVMTI_VERSION_11  = 0x300B0000,
 
     JVMTI_VERSION = 0x30000000 + (</xsl:text>
-  <xsl:value-of select="//specification/@majorversion"/>
+  <xsl:value-of select="$majorversion"/>
   <xsl:text> * 0x10000) + (</xsl:text>
-  <xsl:value-of select="//specification/@minorversion"/>
-  <xsl:text> * 0x100)</xsl:text>
+  <!-- Now minorversion is always 0 -->
+  <xsl:text> 0 * 0x100)</xsl:text>
   <xsl:variable name="micro">
     <xsl:call-template name="microversion"/>
   </xsl:variable>
--- a/src/hotspot/share/prims/jvmtiLib.xsl	Tue May 14 09:25:58 2019 +0100
+++ b/src/hotspot/share/prims/jvmtiLib.xsl	Tue May 14 02:07:13 2019 -0700
@@ -1,7 +1,7 @@
 <?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.
 
  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"
                 version="1.0">
 
+  <xsl:param name="majorversion"></xsl:param>
+
   <xsl:template name="microversion">
-    <xsl:value-of select="//specification/@microversion"/>
+    <!-- Now microversion is always 0 -->
+    <xsl:text>0</xsl:text>
   </xsl:template>
 
   <xsl:template name="showbasicversion">
-    <xsl:value-of select="//specification/@majorversion"/>
-    <xsl:text>.</xsl:text>
-    <xsl:value-of select="//specification/@minorversion"/>
+    <xsl:value-of select="$majorversion"/>
+    <!-- Now minorversion is always 0 -->
+    <xsl:text>.0</xsl:text>
   </xsl:template>
 
   <xsl:template name="showversion">
--- a/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java	Tue May 14 09:25:58 2019 +0100
+++ b/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java	Tue May 14 02:07:13 2019 -0700
@@ -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.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@
     private final ThreadGroup mainGroupForJDI;
     private ResourceBundle messages = null;
     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 Object lock = new Object();
--- a/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c	Tue May 14 09:25:58 2019 +0100
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c	Tue May 14 02:07:13 2019 -0700
@@ -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.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,8 +35,6 @@
 #include "FrameID.h"
 
 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
 version(PacketInputStream *in, PacketOutputStream *out)
@@ -46,6 +44,10 @@
     char *vmVersion;
     char *vmInfo;
 
+    /* Now the JDWP versions are the same as JVMTI versions */
+    int majorVersion = jvmtiMajorVersion();
+    int minorVersion = 0;
+
     if (gdata->vmDead) {
         outStream_setError(out, JDWP_ERROR(VM_DEAD));
         return JNI_TRUE;