changeset 22414:c1c05278cdf8

renamed exceptionTable* methods in CompilerToVM to getExceptionTable* and added javadoc (JDK-8133194)
author Doug Simon <doug.simon@oracle.com>
date Mon, 10 Aug 2015 22:54:59 +0200
parents 454a38908a59
children c25188911c49
files jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVMImpl.java jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java src/share/vm/jvmci/jvmciCompilerToVM.cpp
diffstat 4 files changed, 34 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java	Mon Aug 10 14:59:44 2015 +0200
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVM.java	Mon Aug 10 22:54:59 2015 +0200
@@ -41,9 +41,33 @@
      */
     byte[] getBytecode(long metaspaceMethod);
 
-    int exceptionTableLength(long metaspaceMethod);
+    /**
+     * Gets the number of entries in the data structure describing the exception handlers for a
+     * given method.
+     *
+     * @param metaspaceMethod the metaspace Method object
+     * @return the number of entries in the exception handler table for {@code metaspaceMethod}
+     */
+    int getExceptionTableLength(long metaspaceMethod);
 
-    long exceptionTableStart(long metaspaceMethod);
+    /**
+     * Gets the address of the first entry in the exception handler table for a given method. Each
+     * entry is a {@code ExceptionTableElement} native object and is described by these fields:
+     *
+     * <ul>
+     * <li>{@link HotSpotVMConfig#exceptionTableElementSize}</li>
+     * <li>{@link HotSpotVMConfig#exceptionTableElementStartPcOffset}</li>
+     * <li>{@link HotSpotVMConfig#exceptionTableElementEndPcOffset}</li>
+     * <li>{@link HotSpotVMConfig#exceptionTableElementHandlerPcOffset}</li>
+     * <li>{@link HotSpotVMConfig#exceptionTableElementCatchTypeIndexOffset}
+     * </ul>
+     *
+     * The behavior of this method is undefined if {@link #getExceptionTableLength(long)} returns 0 for
+     * {@code metaspaceMethod}.
+     *
+     * @param metaspaceMethod the metaspace Method object
+     */
+    long getExceptionTableStart(long metaspaceMethod);
 
     /**
      * Determines if a given metaspace Method object has balanced monitors.
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVMImpl.java	Mon Aug 10 14:59:44 2015 +0200
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/CompilerToVMImpl.java	Mon Aug 10 22:54:59 2015 +0200
@@ -55,10 +55,10 @@
     public native byte[] getBytecode(long metaspaceMethod);
 
     @Override
-    public native int exceptionTableLength(long metaspaceMethod);
+    public native int getExceptionTableLength(long metaspaceMethod);
 
     @Override
-    public native long exceptionTableStart(long metaspaceMethod);
+    public native long getExceptionTableStart(long metaspaceMethod);
 
     @Override
     public native boolean hasBalancedMonitors(long metaspaceMethod);
--- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java	Mon Aug 10 14:59:44 2015 +0200
+++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java	Mon Aug 10 22:54:59 2015 +0200
@@ -215,9 +215,9 @@
         }
 
         HotSpotVMConfig config = runtime().getConfig();
-        final int exceptionTableLength = runtime().getCompilerToVM().exceptionTableLength(metaspaceMethod);
+        final int exceptionTableLength = runtime().getCompilerToVM().getExceptionTableLength(metaspaceMethod);
         ExceptionHandler[] handlers = new ExceptionHandler[exceptionTableLength];
-        long exceptionTableElement = runtime().getCompilerToVM().exceptionTableStart(metaspaceMethod);
+        long exceptionTableElement = runtime().getCompilerToVM().getExceptionTableStart(metaspaceMethod);
 
         for (int i = 0; i < exceptionTableLength; i++) {
             final int startPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementStartPcOffset);
--- a/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Mon Aug 10 14:59:44 2015 +0200
+++ b/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Mon Aug 10 22:54:59 2015 +0200
@@ -157,13 +157,13 @@
   return (jbyteArray) JNIHandles::make_local(THREAD, reconstituted_code);
 C2V_END
 
-C2V_VMENTRY(jint, exceptionTableLength, (JNIEnv *, jobject, jlong metaspace_method))
+C2V_VMENTRY(jint, getExceptionTableLength, (JNIEnv *, jobject, jlong metaspace_method))
   ResourceMark rm;
   methodHandle method = asMethod(metaspace_method);
   return method->exception_table_length();
 C2V_END
 
-C2V_VMENTRY(jlong, exceptionTableStart, (JNIEnv *, jobject, jlong metaspace_method))
+C2V_VMENTRY(jlong, getExceptionTableStart, (JNIEnv *, jobject, jlong metaspace_method))
   ResourceMark rm;
   methodHandle method = asMethod(metaspace_method);
   assert(method->exception_table_length() != 0, "should be handled in Java code");
@@ -1057,8 +1057,8 @@
 
 JNINativeMethod CompilerToVM_methods[] = {
   {CC"getBytecode",                                  CC"("METASPACE_METHOD")[B",                                               FN_PTR(getBytecode)},
-  {CC"exceptionTableStart",                          CC"("METASPACE_METHOD")J",                                                FN_PTR(exceptionTableStart)},
-  {CC"exceptionTableLength",                         CC"("METASPACE_METHOD")I",                                                FN_PTR(exceptionTableLength)},
+  {CC"getExceptionTableStart",                       CC"("METASPACE_METHOD")J",                                                FN_PTR(getExceptionTableStart)},
+  {CC"getExceptionTableLength",                      CC"("METASPACE_METHOD")I",                                                FN_PTR(getExceptionTableLength)},
   {CC"hasBalancedMonitors",                          CC"("METASPACE_METHOD")Z",                                                FN_PTR(hasBalancedMonitors)},
   {CC"findUniqueConcreteMethod",                     CC"("METASPACE_KLASS METASPACE_METHOD")"METASPACE_METHOD,                 FN_PTR(findUniqueConcreteMethod)},
   {CC"getKlassImplementor",                          CC"("METASPACE_KLASS")"METASPACE_KLASS,                                   FN_PTR(getKlassImplementor)},