hotspot/src/share/vm/prims/jvmti.xml
changeset 42307 cefc81dc1d52
parent 41287 203e59c224b0
child 42628 011eb980d4b7
child 42647 d01f2abf2c65
--- a/hotspot/src/share/vm/prims/jvmti.xml	Wed Nov 23 16:16:34 2016 +0000
+++ b/hotspot/src/share/vm/prims/jvmti.xml	Thu Dec 01 08:56:41 2016 +0000
@@ -863,14 +863,12 @@
   </intro>
 
 <intro id="bcimodules" label="Bytecode Instrumentation of code in modules">
-  Agents that instrument code in named modules may need to arrange for those
-  modules to read other modules. If code is instrumented to invoke a method
-  in a support class in another module, then the module of the instrumented
-  code should read the module of the supporting class. Furthermore, the
-  supporting class will only be accessible to the instrumented code if
-  it is <code>public</code> and in a package that is exported by its module.
-  Agents can use the JNI functions <code>CanReadModule</code> and
-  <code>AddModuleReads</code> to test and update a module to read another.
+  Agents can use the functions <functionlink id="AddModuleReads"/>,
+  <functionlink id="AddModuleExports"/>, <functionlink id="AddModuleOpens"/>,
+  <functionlink id="AddModuleUses"/> and <functionlink id="AddModuleProvides"/>
+  to update a module to expand the set of modules that it reads, the set of
+  packages that it exports or opens to other modules, or the services that it
+  uses and provides.
   <p/>
   As an aid to agents that deploy supporting classes on the search path of
   the bootstrap class loader, or the search path of the class loader that
@@ -6561,6 +6559,227 @@
         </error>
       </errors>
     </function>
+
+    <function id="AddModuleReads" num="94" since="9">
+      <synopsis>Add Module Reads</synopsis>
+      <description>
+         Update a module to read another module. This function is a no-op
+         when <paramlink id="module"></paramlink> is an unnamed module.
+         This function facilitates the instrumentation of code
+         in named modules where that instrumentation requires
+         expanding the set of modules that a module reads.
+      </description>
+      <origin>new</origin>
+      <capabilities>
+      </capabilities>
+      <parameters>
+        <param id="module">
+          <ptrtype><jobject/></ptrtype>
+          <description>
+            The module to update.
+          </description>
+        </param>
+        <param id="to_module">
+          <ptrtype><jobject/></ptrtype>
+          <description>
+            The additional module to read.
+          </description>
+        </param>
+      </parameters>
+      <errors>
+        <error id="JVMTI_ERROR_INVALID_MODULE">
+          If <paramlink id="module"></paramlink> is not a module object.
+        </error>
+        <error id="JVMTI_ERROR_INVALID_MODULE">
+          If <paramlink id="to_module"></paramlink> is not a module object.
+        </error>
+      </errors>
+    </function>
+
+    <function id="AddModuleExports" num="95" since="9">
+      <synopsis>Add Module Exports</synopsis>
+      <description>
+         Update a module to export a package to another module.
+         This function is a no-op when <paramlink id="module"></paramlink>
+         is an unnamed module or an open module.
+         This function facilitates the instrumentation of code
+         in named modules where that instrumentation requires
+         expanding the set of packages that a module exports.
+      </description>
+      <origin>new</origin>
+      <capabilities>
+      </capabilities>
+      <parameters>
+        <param id="module">
+          <ptrtype><jobject/></ptrtype>
+          <description>
+            The module to update.
+          </description>
+        </param>
+        <param id="pkg_name">
+          <inbuf><char/></inbuf>
+          <description>
+            The exported package name.
+          </description>
+        </param>
+        <param id="to_module">
+          <ptrtype><jobject/></ptrtype>
+          <description>
+            The module the package is exported to.
+            If the <code>to_module</code> is not a subclass of
+            <code>java.lang.reflect.Module</code> this function returns
+            <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
+          </description>
+        </param>
+      </parameters>
+      <errors>
+        <error id="JVMTI_ERROR_INVALID_MODULE">
+          If <paramlink id="module"></paramlink> is not a module object.
+        </error>
+        <error id="JVMTI_ERROR_INVALID_MODULE">
+          If <paramlink id="to_modules"></paramlink> is not a module object.
+        </error>
+        <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
+          If the package <paramlink id="pkg_name"></paramlink>
+          does not belong to the module.
+        </error>
+      </errors>
+    </function>
+
+    <function id="AddModuleOpens" num="96" since="9">
+      <synopsis>Add Module Opens</synopsis>
+      <description>
+         Update a module to open a package to another module.
+         This function is a no-op when <paramlink id="module"></paramlink>
+         is an unnamed module or an open module.
+         This function facilitates the instrumentation of code
+         in modules where that instrumentation requires
+         expanding the set of packages that a module opens to
+         other modules.
+      </description>
+      <origin>new</origin>
+      <capabilities>
+      </capabilities>
+      <parameters>
+        <param id="module">
+          <ptrtype><jobject/></ptrtype>
+          <description>
+            The module to update.
+          </description>
+        </param>
+        <param id="pkg_name">
+          <inbuf><char/></inbuf>
+          <description>
+            The package name of the package to open.
+          </description>
+        </param>
+        <param id="to_module">
+          <ptrtype><jobject/></ptrtype>
+          <description>
+            The module with the package to open.
+            If the <code>to_module</code> is not a subclass of
+            <code>java.lang.reflect.Module</code> this function returns
+            <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
+          </description>
+        </param>
+      </parameters>
+      <errors>
+        <error id="JVMTI_ERROR_INVALID_MODULE">
+          If <paramlink id="module"></paramlink> is not a module object.
+        </error>
+        <error id="JVMTI_ERROR_INVALID_MODULE">
+          If <paramlink id="to_modules"></paramlink> is not a module object.
+        </error>
+        <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
+          If the package <paramlink id="pkg_name"></paramlink>
+          does not belong to the module.
+        </error>
+      </errors>
+    </function>
+
+    <function id="AddModuleUses" num="97" since="9">
+      <synopsis>Add Module Uses</synopsis>
+      <description>
+         Updates a module to add a service to the set of services that
+         a module uses. This function is a no-op when the module
+         is an unnamed module.
+         This function facilitates the instrumentation of code
+         in named modules where that instrumentation requires
+         expanding the set of services that a module is using.
+      </description>
+      <origin>new</origin>
+      <capabilities>
+      </capabilities>
+      <parameters>
+        <param id="module">
+          <ptrtype><jobject/></ptrtype>
+          <description>
+            The module to update.
+          </description>
+        </param>
+        <param id="service">
+          <ptrtype><jclass/></ptrtype>
+          <description>
+            The service to use.
+          </description>
+        </param>
+      </parameters>
+      <errors>
+        <error id="JVMTI_ERROR_INVALID_MODULE">
+          If <paramlink id="module"></paramlink> is not a module object.
+        </error>
+        <error id="JVMTI_ERROR_INVALID_CLASS">
+          If <paramlink id="service"></paramlink> is not a class object.
+        </error>
+      </errors>
+    </function>
+
+    <function id="AddModuleProvides" num="98" since="9">
+      <synopsis>Add Module Provides</synopsis>
+      <description>
+         Updates a module to add a service to the set of services that
+         a module provides. This function is a no-op when the module
+         is an unnamed module.
+         This function facilitates the instrumentation of code
+         in named modules where that instrumentation requires
+         changes to the services that are provided.
+      </description>
+      <origin>new</origin>
+      <capabilities>
+      </capabilities>
+      <parameters>
+        <param id="module">
+          <ptrtype><jobject/></ptrtype>
+          <description>
+            The module to update.
+          </description>
+        </param>
+        <param id="service">
+          <ptrtype><jclass/></ptrtype>
+          <description>
+            The service to provide.
+          </description>
+        </param>
+        <param id="impl_class">
+          <ptrtype><jclass/></ptrtype>
+          <description>
+            The implementation class for the provided service.
+          </description>
+        </param>
+      </parameters>
+      <errors>
+        <error id="JVMTI_ERROR_INVALID_MODULE">
+          If <paramlink id="module"></paramlink> is not a module object.
+        </error>
+        <error id="JVMTI_ERROR_INVALID_CLASS">
+          If <paramlink id="service"></paramlink> is not a class object.
+        </error>
+        <error id="JVMTI_ERROR_INVALID_CLASS">
+          If <paramlink id="impl_class"></paramlink> is not a class object.
+        </error>
+      </errors>
+    </function>
+
   </category>
 
   <category id="class" label="Class">
@@ -11371,6 +11590,9 @@
     <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25">
       Invalid field.
     </errorid>
+    <errorid id="JVMTI_ERROR_INVALID_MODULE" num="26">
+      Invalid module.
+    </errorid>
     <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23">
       Invalid method.
     </errorid>
@@ -14492,17 +14714,17 @@
   <change date="19 June 2013" version="1.2.3">
       Added support for statically linked agents.
   </change>
-  <change date="5 July 2016" version="9.0.0">
+  <change date="13 October 2016" version="9.0.0">
       Support for modules:
        - The majorversion is 9 now
        - The ClassFileLoadHook events are not sent during the primordial phase anymore.
-       - Add new function GetAllModules
-       - Add new capability can_generate_early_vmstart
        - Allow CompiledMethodLoad events at start phase
-       - Add new capability can_generate_early_class_hook_events
-       - Add new function GetNamedModule
-  </change>
-  <change date="16 August 2016" version="9.0.0">
+       - Add new capabilities:
+          - can_generate_early_vmstart
+          - can_generate_early_class_hook_events
+       - Add new functions:
+          - GetAllModules
+          - AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides
       Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to
       disallow some implementation defined classes.
   </change>