indy: more demos work
authorjrose
Mon Apr 06 03:29:37 2009 -0700 (7 months ago)
changeset 208b5cc1a371e9
parent 19f1e1022079f2
child 21daca8baee5f4
indy: more demos work
indy.patch
indy.verify.patch
series
--- a/indy.patch Fri Apr 03 03:01:14 2009 -0700
+++ b/indy.patch Mon Apr 06 03:29:37 2009 -0700
@@ -1,3 +1,37 @@ diff --git a/src/share/classes/impl/java
+diff --git a/make/Makefile b/make/Makefile
+--- a/make/Makefile
++++ b/make/Makefile
+@@ -1,5 +1,5 @@
+ #
+-# Copyright 1995-2009 Sun Microsystems, Inc. All Rights Reserved.
++# Copyright 1995-2007 Sun Microsystems, Inc. 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
+@@ -239,7 +239,7 @@
+
+ all build:: sanity-all post-sanity-all
+
+-SUBDIRS = tools java javax org impl sun sunw com jpda mkdemo mksample launchers
++SUBDIRS = tools java javax org sun sunw com jpda mkdemo mksample launchers
+ all build::
+ $(SUBDIRS-loop)
+
+diff --git a/src/share/classes/impl/java/dyn/AdapterMethodHandle.java b/src/share/classes/impl/java/dyn/AdapterMethodHandle.java
+--- a/src/share/classes/impl/java/dyn/AdapterMethodHandle.java
++++ b/src/share/classes/impl/java/dyn/AdapterMethodHandle.java
+@@ -341,10 +341,7 @@
+
+ @Override
+ public String toString() {
+- MethodType adaptedType = ((MethodHandle)this).type();
+- Object namh = nonAdapter((MethodHandle)vmtarget);
+- if (namh == null) namh = "unknown";
+- return "Adapted[" + adaptedType + "," + namh + "]";
++ return addTypeString("Adapted[" + basicToString(nonAdapter((MethodHandle)vmtarget)) + "]");
+ }
+
+ private static MethodHandle nonAdapter(MethodHandle mh) {
diff --git a/src/share/classes/impl/java/dyn/CallSiteImpl.java b/src/share/classes/impl/java/dyn/CallSiteImpl.java
new file mode 100644
--- /dev/null
@@ -68,6 +102,36 @@ new file mode 100644
+ return site;
+ }
+}
+diff --git a/src/share/classes/impl/java/dyn/MethodHandleImpl.java b/src/share/classes/impl/java/dyn/MethodHandleImpl.java
+--- a/src/share/classes/impl/java/dyn/MethodHandleImpl.java
++++ b/src/share/classes/impl/java/dyn/MethodHandleImpl.java
+@@ -252,18 +252,23 @@
+ }
+
+ protected static String basicToString(MethodHandle target) {
+- MemberName name = MethodHandleNatives.getMethodName(target);
++ MemberName name = null;
++ if (target != null)
++ name = MethodHandleNatives.getMethodName(target);
+ if (name == null)
+- name = new MemberName(null, "<unknown>", target.type());
++ return "<unknown>";
+ return name.toString();
+ }
+
++ protected String addTypeString(String name) {
++ return name+((MethodHandle)this).type();
++ }
+ static RuntimeException newIllegalArgumentException(String string) {
+ return new IllegalArgumentException(string);
+ }
+
+ @Override
+ public String toString() {
+- return basicToString((MethodHandle)this);
++ return addTypeString(basicToString((MethodHandle)this));
+ }
+ }
diff --git a/src/share/classes/impl/java/dyn/util/BytecodeName.java b/src/share/classes/impl/java/dyn/util/BytecodeName.java
new file mode 100644
--- /dev/null
--- a/series Fri Apr 03 03:01:14 2009 -0700
+++ b/series Mon Apr 06 03:29:37 2009 -0700
@@ -1,6 +1,8 @@
# base = 940223097cb1 in http://hg.openjdk.java.net/bsd-port/bsd-port/jdk
-anonk.patch #-/anonk #+940223097cb1
-meth.patch #-/meth #+940223097cb1
-indy.patch #-/indy #+940223097cb1
+anonk.patch #-/anonk #+940223097cb1
+meth.patch #-/meth #+940223097cb1
+indy.patch #-/indy #+940223097cb1
+indy.verify.patch #-/indy #+940223097cb1
+
#inti.patch #-/inti #+jdk7-b34 #-buildable
callcc.patch #-/callcc #+jdk7-b30 #-testable
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/indy.verify.patch Mon Apr 06 03:29:37 2009 -0700
@@ -0,0 +1,161 @@
+diff --git a/src/share/javavm/export/classfile_constants.h b/src/share/javavm/export/classfile_constants.h
+--- a/src/share/javavm/export/classfile_constants.h
++++ b/src/share/javavm/export/classfile_constants.h
+@@ -306,7 +306,7 @@
+ JVM_OPC_invokespecial = 183,
+ JVM_OPC_invokestatic = 184,
+ JVM_OPC_invokeinterface = 185,
+- JVM_OPC_xxxunusedxxx = 186,
++ JVM_OPC_invokedynamic = 186,
+ JVM_OPC_new = 187,
+ JVM_OPC_newarray = 188,
+ JVM_OPC_anewarray = 189,
+@@ -515,7 +515,7 @@
+ 3, /* invokespecial */ \
+ 3, /* invokestatic */ \
+ 5, /* invokeinterface */ \
+- 0, /* xxxunusedxxx */ \
++ 5, /* invokedynamic */ \
+ 3, /* new */ \
+ 2, /* newarray */ \
+ 3, /* anewarray */ \
+diff --git a/src/share/native/common/check_code.c b/src/share/native/common/check_code.c
+--- a/src/share/native/common/check_code.c
++++ b/src/share/native/common/check_code.c
+@@ -243,6 +243,7 @@
+ fullinfo_type throwable_info; /* fullinfo for java/lang/Throwable */
+ fullinfo_type cloneable_info; /* fullinfo for java/lang/Cloneable */
+ fullinfo_type serializable_info; /* fullinfo for java/io/Serializable */
++ fullinfo_type dynamic_info; /* fullinfo for java/dyn/Dynamic */
+
+ fullinfo_type currentclass_info; /* fullinfo for context->class */
+ fullinfo_type superclass_info; /* fullinfo for superclass */
+@@ -767,6 +768,8 @@
+ make_class_info_from_name(context, "java/lang/Cloneable");
+ context->serializable_info =
+ make_class_info_from_name(context, "java/io/Serializable");
++ context->dynamic_info =
++ make_class_info_from_name(context, "java/dyn/Dynamic");
+
+ context->currentclass_info = make_loadable_class_info(context, cb);
+
+@@ -1223,16 +1226,20 @@
+ case JVM_OPC_invokevirtual:
+ case JVM_OPC_invokespecial:
+ case JVM_OPC_invokestatic:
++ case JVM_OPC_invokedynamic:
+ case JVM_OPC_invokeinterface: {
+ /* Make sure the constant pool item is the right type. */
+ int key = (code[offset + 1] << 8) + code[offset + 2];
+ const char *methodname;
+ jclass cb = context->class;
+ fullinfo_type clazz_info;
+- int is_constructor, is_internal;
++ int is_constructor, is_internal, is_invokedynamic;
+ int kind = (opcode == JVM_OPC_invokeinterface
+ ? 1 << JVM_CONSTANT_InterfaceMethodref
++ : opcode == JVM_OPC_invokedynamic
++ ? 1 << JVM_CONSTANT_NameAndType
+ : 1 << JVM_CONSTANT_Methodref);
++ is_invokedynamic = opcode == JVM_OPC_invokedynamic;
+ /* Make sure the constant pool item is the right type. */
+ verify_constant_pool_type(context, key, kind);
+ methodname = JVM_GetCPMethodNameUTF(env, cb, key);
+@@ -1241,8 +1248,11 @@
+ is_internal = methodname[0] == '<';
+ pop_and_free(context);
+
+- clazz_info = cp_index_to_class_fullinfo(context, key,
+- JVM_CONSTANT_Methodref);
++ if (is_invokedynamic)
++ clazz_info = context->object_info; // anything will do
++ else
++ clazz_info = cp_index_to_class_fullinfo(context, key,
++ JVM_CONSTANT_Methodref);
+ this_idata->operand.i = key;
+ this_idata->operand2.fi = clazz_info;
+ if (is_constructor) {
+@@ -1304,6 +1314,11 @@
+ "Fourth operand byte of invokeinterface must be zero");
+ }
+ pop_and_free(context);
++ } else if (opcode == JVM_OPC_invokedynamic) {
++ if (code[offset + 3] != 0 || code[offset + 4] != 0) {
++ CCerror(context,
++ "Third and fourth operand bytes of invokedynamic must be zero");
++ }
+ } else if (opcode == JVM_OPC_invokevirtual
+ || opcode == JVM_OPC_invokespecial)
+ set_protected(context, inumber, key, opcode);
+@@ -1990,6 +2005,7 @@
+
+ case JVM_OPC_invokevirtual: case JVM_OPC_invokespecial:
+ case JVM_OPC_invokeinit: /* invokespecial call to <init> */
++ case JVM_OPC_invokedynamic:
+ case JVM_OPC_invokestatic: case JVM_OPC_invokeinterface: {
+ /* The top stuff on the stack depends on the method signature */
+ int operand = this_idata->operand.i;
+@@ -2005,7 +2021,8 @@
+ print_formatted_methodname(context, operand);
+ }
+ #endif
+- if (opcode != JVM_OPC_invokestatic)
++ if (opcode != JVM_OPC_invokestatic &&
++ opcode != JVM_OPC_invokedynamic)
+ /* First, push the object */
+ *ip++ = (opcode == JVM_OPC_invokeinit ? '@' : 'A');
+ for (p = signature + 1; *p != JVM_SIGNATURE_ENDFUNC; ) {
+@@ -2290,6 +2307,7 @@
+
+ case JVM_OPC_invokevirtual: case JVM_OPC_invokespecial:
+ case JVM_OPC_invokeinit:
++ case JVM_OPC_invokedynamic:
+ case JVM_OPC_invokeinterface: case JVM_OPC_invokestatic: {
+ int operand = this_idata->operand.i;
+ const char *signature =
+@@ -2299,7 +2317,8 @@
+ int item;
+ const char *p;
+ check_and_push(context, signature, VM_STRING_UTF);
+- if (opcode == JVM_OPC_invokestatic) {
++ if (opcode == JVM_OPC_invokestatic ||
++ opcode == JVM_OPC_invokedynamic) {
+ item = 0;
+ } else if (opcode == JVM_OPC_invokeinit) {
+ fullinfo_type init_type = this_idata->operand2.fi;
+@@ -2680,6 +2699,7 @@
+
+ case JVM_OPC_invokevirtual: case JVM_OPC_invokespecial:
+ case JVM_OPC_invokeinit:
++ case JVM_OPC_invokedynamic:
+ case JVM_OPC_invokestatic: case JVM_OPC_invokeinterface: {
+ /* Look to signature to determine correct result. */
+ int operand = this_idata->operand.i;
+@@ -3782,6 +3802,15 @@
+ return target;
+ }
+ return value;
++ } else if (for_assignment && target == context->dynamic_info) {
++ /* Special case: Any reference type converts to interface Dynamic.
++ * The new verifier does not need this special case, because it
++ * treats all interface types this way.
++ * N.B. Make sure Dynamic actually resolves to an interface.
++ */
++ jclass cb = object_fullinfo_to_classclass(context, target);
++ if (cb && JVM_IsInterface(env, cb))
++ return target;
+ }
+ if (GET_INDIRECTION(value) > 0 || GET_INDIRECTION(target) > 0) {
+ /* At least one is an array. Neither is java/lang/Object or NULL.
+diff --git a/src/share/native/common/opcodes.in_out b/src/share/native/common/opcodes.in_out
+--- a/src/share/native/common/opcodes.in_out
++++ b/src/share/native/common/opcodes.in_out
+@@ -210,7 +210,7 @@
+ {"?", "?"}, /* invokespecial */
+ {"?", "?"}, /* invokestatic */
+ {"?", "?"}, /* invokeinterface */
+- {"?", "?"}, /* xxxunusedxxx */
++ {"?", "?"}, /* invokedynamic */
+ {"", "A"}, /* new */
+ {"I", "A"}, /* newarray */
+ {"I", "A"}, /* anewarray */