7143353: -Xrunhprof fails in Java 7 due to bad switch
authornloodin
Thu, 24 May 2012 09:32:25 +0200
changeset 12846 7b6641ab1122
parent 12843 f785258dea60
child 12847 c3999bec8b2c
7143353: -Xrunhprof fails in Java 7 due to bad switch Reviewed-by: jrose, sspitsyn
jdk/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c
jdk/src/share/javavm/export/classfile_constants.h
--- a/jdk/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c	Wed May 23 10:41:45 2012 -0700
+++ b/jdk/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c	Thu May 24 09:32:25 2012 +0200
@@ -89,6 +89,12 @@
                          (ci)->input_position <= (ci)->input_len && \
                          (ci)->output_position <= (ci)->output_len) )
 
+#define BUFSIZE 256
+
+#ifdef _WIN32
+#define snprintf(buffer, count, format, ...) _snprintf_s(buffer, count, _TRUNCATE, format, ##__VA_ARGS__)
+#endif
+
 /* Typedefs for various integral numbers, just for code clarity */
 
 typedef unsigned       ClassOpcode;             /* One opcode */
@@ -651,6 +657,7 @@
         unsigned int    index2;
         unsigned        len;
         char *          utf8;
+        char message[BUFSIZE];
 
         ipos    = i;
         index1  = 0;
@@ -689,8 +696,20 @@
                 utf8[len] = 0;
                 write_bytes(ci, (void*)utf8, len);
                 break;
+            case JVM_CONSTANT_MethodType:
+                index1 = copyU2(ci);
+                break;
+            case JVM_CONSTANT_MethodHandle:
+                index1 = copyU1(ci);
+                index2 = copyU2(ci);
+                break;
+            case JVM_CONSTANT_InvokeDynamic:
+                index1 = copyU2(ci);
+                index2 = copyU2(ci);
+                break;
             default:
-                CRW_FATAL(ci, "Unknown constant");
+                snprintf(message, BUFSIZE, "Unknown tag: %d, at ipos %hu", tag, ipos);
+                CRW_FATAL(ci, message);
                 break;
         }
         fillin_cpool_entry(ci, ipos, tag, index1, index2, (const char *)utf8, len);
--- a/jdk/src/share/javavm/export/classfile_constants.h	Wed May 23 10:41:45 2012 -0700
+++ b/jdk/src/share/javavm/export/classfile_constants.h	Thu May 24 09:32:25 2012 +0200
@@ -86,7 +86,8 @@
     JVM_CONSTANT_InterfaceMethodref     = 11,
     JVM_CONSTANT_NameAndType            = 12,
     JVM_CONSTANT_MethodHandle           = 15,  // JSR 292
-    JVM_CONSTANT_MethodType             = 16   // JSR 292
+    JVM_CONSTANT_MethodType             = 16,   // JSR 292
+    JVM_CONSTANT_InvokeDynamic          = 18
 };
 
 /* JVM_CONSTANT_MethodHandle subtypes */