From: <fwi...@us...> - 2009-07-17 04:28:58
|
Revision: 6540 http://jython.svn.sourceforge.net/jython/?rev=6540&view=rev Author: fwierzbicki Date: 2009-07-17 04:28:55 +0000 (Fri, 17 Jul 2009) Log Message: ----------- Simplest possible test of InvokeDynamic embedded in Jython. Used R?\195?\169mi Forax's 292 backport, just because I got it working before I got an MLVM patched JDK 7 working. Modified Paths: -------------- branches/indy/build.xml Added Paths: ----------- branches/indy/extlibs/asm-all-3.2.jar branches/indy/extlibs/jsr292-backport.jar branches/indy/extlibs/jsr292-mock.jar branches/indy/src/org/python/compiler/IndyTest.java Modified: branches/indy/build.xml =================================================================== --- branches/indy/build.xml 2009-07-15 20:05:51 UTC (rev 6539) +++ branches/indy/build.xml 2009-07-17 04:28:55 UTC (rev 6540) @@ -115,12 +115,11 @@ <target name="init" depends="version-init"> <property name="build.compiler" value="modern" /> - <property name="jdk.target.version" value="1.5" /> - <property name="jdk.source.version" value="1.5" /> + <property name="jdk.target.version" value="1.7" /> + <property name="jdk.source.version" value="1.7" /> <property name="deprecation" value="true" /> <property name="debug" value="true" /> <property name="nowarn" value="false" /> - <property name="javac.Xlint" value="-Xlint -Xlint:-serial -Xlint:-unchecked -Xlint:-cast"/> <!-- properties work.dir and jython.base.dir are also defined in full-preinit --> <property name="work.dir" value="${basedir}" /> @@ -141,7 +140,11 @@ <property name="dist.dir" value="${work.dir}/dist" /> <property name="apidoc.dir" value="${dist.dir}/Doc/javadoc" /> <property name="junit.reports" value="${dist.dir}/testreports" /> + <property name="javac.Xlint" value="-Xlint -Xlint:-serial -Xlint:-unchecked -Xlint:-cast -Xbootclasspath/p:${extlibs.dir}/jsr292-mock.jar"/> + <!-- + <property name="javac.Xlint" value="-Xlint -Xlint:-serial -XDinvokedynamic -Xlint:-unchecked -Xlint:-cast"/> + --> <!-- classpaths --> <path id="main.classpath"> <pathelement path="${extlibs.dir}/libreadline-java-0.8.jar" /> @@ -155,10 +158,10 @@ <pathelement path="${extlibs.dir}/antlr-3.1.3.jar" /> <pathelement path="${extlibs.dir}/stringtemplate-3.2.jar" /> - <pathelement path="${extlibs.dir}/asm-3.1.jar" /> - <pathelement path="${extlibs.dir}/asm-commons-3.1.jar" /> + <pathelement path="${extlibs.dir}/asm-all-3.2.jar" /> <pathelement path="${extlibs.dir}/constantine-0.4.jar" /> <pathelement path="${extlibs.dir}/jna-posix.jar"/> + <pathelement path="${extlibs.dir}/jsr292-mock.jar"/> </path> <available property="informix.present" classname="com.informix.jdbc.IfxDriver" classpath="${informix.jar}" /> @@ -166,7 +169,7 @@ <path id="test.classpath"> <path refid="main.classpath"/> - <pathelement path="${extlibs.dir}/asm-commons-3.1.jar" /> + <pathelement path="${extlibs.dir}/asm-all-3.2.jar" /> <pathelement path="${extlibs.dir}/junit-3.8.2.jar" /> <pathelement path="${exposed.dir}" /> <pathelement path="${compile.dir}" /> @@ -548,9 +551,7 @@ <zipfileset src="${dist.dir}/${jython.dev.jar}"/> <zipfileset src="extlibs/antlr-runtime-3.1.3.jar"/> <rule pattern="org.antlr.runtime.**" result="org.python.antlr.runtime.@1"/> - <zipfileset src="extlibs/asm-3.1.jar"/> - <zipfileset src="extlibs/asm-commons-3.1.jar"/> - <zipfileset src="extlibs/asm-util-3.1.jar"/> + <zipfileset src="extlibs/asm-all-3.2.jar"/> <rule pattern="org.objectweb.asm.**" result="org.python.objectweb.asm.@1"/> <zipfileset src="extlibs/jna.jar"/> <zipfileset src="extlibs/jna-posix.jar"/> Added: branches/indy/extlibs/asm-all-3.2.jar =================================================================== (Binary files differ) Property changes on: branches/indy/extlibs/asm-all-3.2.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/indy/extlibs/jsr292-backport.jar =================================================================== (Binary files differ) Property changes on: branches/indy/extlibs/jsr292-backport.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/indy/extlibs/jsr292-mock.jar =================================================================== (Binary files differ) Property changes on: branches/indy/extlibs/jsr292-mock.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/indy/src/org/python/compiler/IndyTest.java =================================================================== --- branches/indy/src/org/python/compiler/IndyTest.java (rev 0) +++ branches/indy/src/org/python/compiler/IndyTest.java 2009-07-17 04:28:55 UTC (rev 6540) @@ -0,0 +1,27 @@ +package org.python.compiler; + +import java.dyn.CallSite; +import java.dyn.InvokeDynamic; +import java.dyn.Linkage; +import java.dyn.MethodType; +import java.dyn.MethodHandles; +import java.dyn.MethodType; + +import org.python.core.Py; +import org.python.core.PyString; + +public class IndyTest { + + public static void run() { + PyString result = InvokeDynamic.<PyString>sayHello("Hello Indy!"); + System.out.println(result); + } + + static { Linkage.registerBootstrapMethod("linkDynamic"); } + private static CallSite linkDynamic(Class<?> caller, String name, MethodType type) { + CallSite c = new CallSite(caller, name, type); + c.setTarget(MethodHandles.lookup().findStatic(Py.class, "newString", + MethodType.make(PyString.class, String.class))); + return c; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |