--- /org/python/compiler/Module.java Tue Dec 5 23:58:46 2006 +++ Module.java Fri Jan 12 16:48:37 2007 @@ -252,7 +252,7 @@ CodeCompiler.makeStrings(c, null, 0); } - c.ldc(((PyStringConstant)module.filename).value); + c.aload(1); c.ldc(co_name); c.iconst(co_firstlineno); @@ -538,12 +538,12 @@ //This block of code writes out the various standard methods public void addInit() throws IOException { - Code c = classfile.addMethod("", "()V", ClassFile.PUBLIC); + Code c = classfile.addMethod("", "(Ljava/lang/String;)V", ClassFile.PUBLIC); c.aload(0); c.invokespecial(c.pool.Methodref("org/python/core/PyFunctionTable", "", "()V")); - c.return_(); + addConstants(c); } public void addRunnable() throws IOException { @@ -571,14 +571,10 @@ c.return_(); } - public void addConstants() throws IOException { - Code c = classfile.addMethod("", "()V", ClassFile.STATIC); - + public void addConstants(Code c) throws IOException { classfile.addField("self", "L"+classfile.name+";", ClassFile.STATIC|ClassFile.FINAL); - c.new_(c.pool.Class(classfile.name)); - c.dup(); - c.invokespecial(c.pool.Methodref(classfile.name, "", "()V")); + c.aload(0); c.putstatic(c.pool.Fieldref(classfile.name, "self", "L"+classfile.name+";")); @@ -637,7 +633,6 @@ addRunnable(); //addMain(); - addConstants(); addFunctions(); classfile.addInterface("org/python/core/PyRunnable");