From: <fwi...@us...> - 2009-09-25 03:13:19
|
Revision: 6811 http://jython.svn.sourceforge.net/jython/?rev=6811&view=rev Author: fwierzbicki Date: 2009-09-25 03:13:10 +0000 (Fri, 25 Sep 2009) Log Message: ----------- Remove leftover experimental code for now. Modified Paths: -------------- branches/indy/src/org/python/compiler/Module.java Modified: branches/indy/src/org/python/compiler/Module.java =================================================================== --- branches/indy/src/org/python/compiler/Module.java 2009-09-25 03:08:49 UTC (rev 6810) +++ branches/indy/src/org/python/compiler/Module.java 2009-09-25 03:13:10 UTC (rev 6811) @@ -16,7 +16,6 @@ import org.python.core.CodeFlag; import org.python.core.CodeLoader; import org.python.core.CompilerFlags; -import org.python.core.invokedynamic.InvokeDynamicSupport; import org.python.core.Py; import org.python.core.PyException; import org.python.core.PyRunnableBootstrap; @@ -541,10 +540,6 @@ Code c = classfile.addMethod("<init>", "(Ljava/lang/String;)V", ACC_PUBLIC); c.aload(0); c.invokespecial("org/python/core/IndyFunctionTable", "<init>", "()V"); - - //HERE - //c.invokestatic(p(InvokeDynamicSupport.class), "registerBootstrap", sig(void.class, Class.class)); - addConstants(c); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-10-23 21:55:36
|
Revision: 6891 http://jython.svn.sourceforge.net/jython/?rev=6891&view=rev Author: fwierzbicki Date: 2009-10-23 21:55:28 +0000 (Fri, 23 Oct 2009) Log Message: ----------- change a few calls to Codegen style, some cleanup. Modified Paths: -------------- branches/indy/src/org/python/compiler/Module.java Modified: branches/indy/src/org/python/compiler/Module.java =================================================================== --- branches/indy/src/org/python/compiler/Module.java 2009-10-23 19:10:19 UTC (rev 6890) +++ branches/indy/src/org/python/compiler/Module.java 2009-10-23 21:55:28 UTC (rev 6891) @@ -1,6 +1,7 @@ // Copyright (c) Corporation for National Research Initiatives package org.python.compiler; +import java.dyn.MethodHandle; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; @@ -414,8 +415,11 @@ c.iconst(moreflags); - c.invokestatic("org/python/core/Py", "newCode", "(I" + $strArr + $str + $str + "IZZ" + - $pyFuncTbl + "Ljava/dyn/MethodHandle;" + $strArr + $strArr + "II)" + $pyCode); + c.invokestatic(p(Py.class), "newCode", sig(PyCode.class, Integer.TYPE, + String[].class, String.class, String.class, Integer.TYPE, Boolean.TYPE, + Boolean.TYPE, IndyFunctionTable.class, MethodHandle.class, String[].class, + String[].class, Integer.TYPE, Integer.TYPE)); + c.putstatic(module.classfile.name, name, ci(PyCode.class)); } } @@ -633,24 +637,15 @@ public void addFunctions() throws IOException { Code code = classfile.addMethod( "call_function", - "(Ljava/dyn/MethodHandle;" + $pyFrame + $threadState + ")" + $pyObj, + sig(PyObject.class, MethodHandle.class, PyFrame.class, ThreadState.class), ACC_PUBLIC); code.aload(1); // handle code.aload(0); // this code.aload(2); // frame code.aload(3); // thread state - /* - Label def = new Label(); - Label[] labels = new Label[codes.size()]; - int i; - for (i = 0; i < labels.length; i++) { - labels[i] = new Label(); - } - - */ - code.invokevirtual("java/dyn/MethodHandle", "invoke", "(Ljava/lang/Object;" + $pyFrame + - $threadState + ")" + $pyObj); + code.invokevirtual(p(MethodHandle.class), "invoke", + sig(PyObject.class, Object.class, PyFrame.class, ThreadState.class)); code.areturn(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-10-24 03:17:49
|
Revision: 6895 http://jython.svn.sourceforge.net/jython/?rev=6895&view=rev Author: fwierzbicki Date: 2009-10-24 03:17:41 +0000 (Sat, 24 Oct 2009) Log Message: ----------- move MethodHandle bytecode production into its own method. Modified Paths: -------------- branches/indy/src/org/python/compiler/Module.java Modified: branches/indy/src/org/python/compiler/Module.java =================================================================== --- branches/indy/src/org/python/compiler/Module.java 2009-10-24 03:11:46 UTC (rev 6894) +++ branches/indy/src/org/python/compiler/Module.java 2009-10-24 03:17:41 UTC (rev 6895) @@ -357,6 +357,22 @@ c.getstatic(module.classfile.name, name, ci(PyCode.class)); } + private void makeMethodHandle(Code c) { + c.visitMethodInsn(INVOKESTATIC, "java/dyn/MethodHandles", "lookup", "()Ljava/dyn/MethodHandles$Lookup;"); + c.visitLdcInsn(Type.getType("L"+module.classfile.name+";")); + c.visitLdcInsn(fname); + c.visitLdcInsn(Type.getType("Lorg/python/core/PyObject;")); + c.visitLdcInsn(Type.getType("Lorg/python/core/PyFrame;")); + c.visitInsn(ICONST_1); + c.visitTypeInsn(ANEWARRAY, "java/lang/Class"); + c.visitInsn(DUP); + c.visitInsn(ICONST_0); + c.visitLdcInsn(Type.getType("Lorg/python/core/ThreadState;")); + c.visitInsn(AASTORE); + c.visitMethodInsn(INVOKESTATIC, "java/dyn/MethodType", "make", "(Ljava/lang/Class;Ljava/lang/Class;[Ljava/lang/Class;)Ljava/dyn/MethodType;"); + c.visitMethodInsn(INVOKEVIRTUAL, "java/dyn/MethodHandles$Lookup", "findVirtual", "(Ljava/lang/Class;Ljava/lang/String;Ljava/dyn/MethodType;)Ljava/dyn/MethodHandle;"); + } + void put(Code c) throws IOException { module.classfile.addField(name, ci(PyCode.class), access); c.iconst(argcount); @@ -379,23 +395,8 @@ c.getstatic(module.classfile.name, "self", "L" + module.classfile.name + ";"); - //REPLACING WITH METH HANDLE - //c.iconst(id); + makeMethodHandle(c); -c.visitMethodInsn(INVOKESTATIC, "java/dyn/MethodHandles", "lookup", "()Ljava/dyn/MethodHandles$Lookup;"); -c.visitLdcInsn(Type.getType("L"+module.classfile.name+";")); -c.visitLdcInsn(fname); -c.visitLdcInsn(Type.getType("Lorg/python/core/PyObject;")); -c.visitLdcInsn(Type.getType("Lorg/python/core/PyFrame;")); -c.visitInsn(ICONST_1); -c.visitTypeInsn(ANEWARRAY, "java/lang/Class"); -c.visitInsn(DUP); -c.visitInsn(ICONST_0); -c.visitLdcInsn(Type.getType("Lorg/python/core/ThreadState;")); -c.visitInsn(AASTORE); -c.visitMethodInsn(INVOKESTATIC, "java/dyn/MethodType", "make", "(Ljava/lang/Class;Ljava/lang/Class;[Ljava/lang/Class;)Ljava/dyn/MethodType;"); -c.visitMethodInsn(INVOKEVIRTUAL, "java/dyn/MethodHandles$Lookup", "findVirtual", "(Ljava/lang/Class;Ljava/lang/String;Ljava/dyn/MethodType;)Ljava/dyn/MethodHandle;"); - if (cellvars != null) { int strArray = CodeCompiler.makeStrings(c, cellvars); c.aload(strArray); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-10-25 02:34:12
|
Revision: 6900 http://jython.svn.sourceforge.net/jython/?rev=6900&view=rev Author: fwierzbicki Date: 2009-10-25 02:34:06 +0000 (Sun, 25 Oct 2009) Log Message: ----------- switch MethodHandle creation to Codegen style. Modified Paths: -------------- branches/indy/src/org/python/compiler/Module.java Modified: branches/indy/src/org/python/compiler/Module.java =================================================================== --- branches/indy/src/org/python/compiler/Module.java 2009-10-24 07:19:01 UTC (rev 6899) +++ branches/indy/src/org/python/compiler/Module.java 2009-10-25 02:34:06 UTC (rev 6900) @@ -2,6 +2,9 @@ package org.python.compiler; import java.dyn.MethodHandle; +import java.dyn.MethodHandles; +import java.dyn.MethodHandles.Lookup; +import java.dyn.MethodType; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; @@ -358,19 +361,21 @@ } private void makeMethodHandle(Code c) { - c.visitMethodInsn(INVOKESTATIC, "java/dyn/MethodHandles", "lookup", "()Ljava/dyn/MethodHandles$Lookup;"); - c.visitLdcInsn(Type.getType("L"+module.classfile.name+";")); - c.visitLdcInsn(fname); - c.visitLdcInsn(Type.getType("Lorg/python/core/PyObject;")); - c.visitLdcInsn(Type.getType("Lorg/python/core/PyFrame;")); - c.visitInsn(ICONST_1); - c.visitTypeInsn(ANEWARRAY, "java/lang/Class"); - c.visitInsn(DUP); - c.visitInsn(ICONST_0); - c.visitLdcInsn(Type.getType("Lorg/python/core/ThreadState;")); - c.visitInsn(AASTORE); - c.visitMethodInsn(INVOKESTATIC, "java/dyn/MethodType", "make", "(Ljava/lang/Class;Ljava/lang/Class;[Ljava/lang/Class;)Ljava/dyn/MethodType;"); - c.visitMethodInsn(INVOKEVIRTUAL, "java/dyn/MethodHandles$Lookup", "findVirtual", "(Ljava/lang/Class;Ljava/lang/String;Ljava/dyn/MethodType;)Ljava/dyn/MethodHandle;"); + c.invokestatic(p(MethodHandles.class), "lookup", sig(Lookup.class)); + c.ldc(Type.getType("L"+module.classfile.name+";")); + c.ldc(fname); + c.ldc(Type.getType(ci(PyObject.class))); + c.ldc(Type.getType(ci(PyFrame.class))); + c.iconst_1(); + c.anewarray(p(Class.class)); + c.dup(); + c.iconst_0(); + c.ldc(Type.getType(ci(ThreadState.class))); + c.aastore(); + c.invokestatic(p(MethodType.class), "make", + sig(MethodType.class, Class.class, Class.class, Class[].class)); + c.invokevirtual(p(Lookup.class), "findVirtual", + sig(MethodHandle.class, Class.class, String.class, MethodType.class)); } void put(Code c) throws IOException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |