changeset 5031:61517f1fe79e

7143353: -Xrunhprof fails in Java 7 due to bad switch Reviewed-by: jrose, sspitsyn
author nloodin
date Thu, 24 May 2012 09:32:25 +0200
parents 7647f9201e31
children 39db51e1aa62
files src/share/demo/jvmti/java_crw_demo/java_crw_demo.c src/share/javavm/export/classfile_constants.h
diffstat 2 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c	Thu May 24 17:17:58 2012 +0400
+++ b/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/src/share/javavm/export/classfile_constants.h	Thu May 24 17:17:58 2012 +0400
+++ b/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 */