From: <zy...@us...> - 2010-04-27 06:07:14
|
Revision: 7051 http://jython.svn.sourceforge.net/jython/?rev=7051&view=rev Author: zyasoft Date: 2010-04-27 06:07:08 +0000 (Tue, 27 Apr 2010) Log Message: ----------- Now nulls the ref to the args array for #1586 instead of clearing the array, so callee code has no copy responsibility (Phil Jenvey's suggestion). Backed out change to thread.PyLocal accordingly in r7047. Bumped bytecode magic. Modified Paths: -------------- trunk/jython/src/org/python/compiler/CodeCompiler.java trunk/jython/src/org/python/core/imp.java trunk/jython/src/org/python/modules/thread/PyLocal.java Modified: trunk/jython/src/org/python/compiler/CodeCompiler.java =================================================================== --- trunk/jython/src/org/python/compiler/CodeCompiler.java 2010-04-26 18:39:57 UTC (rev 7050) +++ trunk/jython/src/org/python/compiler/CodeCompiler.java 2010-04-27 06:07:08 UTC (rev 7051) @@ -413,6 +413,12 @@ code.freeLocal(array); } + public void freeArrayRef(int array) { + code.aconst_null(); + code.astore(array); + code.freeLocal(array); + } + public Str getDocStr(java.util.List<stmt> suite) { if (suite.size() > 0) { stmt stmt = suite.get(0); @@ -1811,7 +1817,7 @@ stackConsume(3); // target + starargs + kwargs code.invokevirtual(p(PyObject.class), "_callextra", sig(PyObject.class, PyObject[].class, String[].class, PyObject.class, PyObject.class)); - freeArray(argArray); + freeArrayRef(argArray); } else if (keys.size() > 0) { loadThreadState(); stackProduce(p(ThreadState.class)); @@ -1823,7 +1829,7 @@ stackConsume(2); // target + ts code.invokevirtual(p(PyObject.class), "__call__", sig(PyObject.class, ThreadState.class, PyObject[].class, String[].class)); - freeArray(argArray); + freeArrayRef(argArray); } else { loadThreadState(); stackProduce(p(ThreadState.class)); Modified: trunk/jython/src/org/python/core/imp.java =================================================================== --- trunk/jython/src/org/python/core/imp.java 2010-04-26 18:39:57 UTC (rev 7050) +++ trunk/jython/src/org/python/core/imp.java 2010-04-27 06:07:08 UTC (rev 7051) @@ -21,7 +21,7 @@ private static final String UNKNOWN_SOURCEFILE = "<unknown>"; - private static final int APIVersion = 29; + private static final int APIVersion = 30; public static final int NO_MTIME = -1; Modified: trunk/jython/src/org/python/modules/thread/PyLocal.java =================================================================== --- trunk/jython/src/org/python/modules/thread/PyLocal.java 2010-04-26 18:39:57 UTC (rev 7050) +++ trunk/jython/src/org/python/modules/thread/PyLocal.java 2010-04-27 06:07:08 UTC (rev 7051) @@ -59,9 +59,7 @@ if (where[0] == TYPE && args.length > 0) { throw Py.TypeError("Initialization arguments are not supported"); } - // caller zeros out `args` - this.args = new PyObject[args.length]; - System.arraycopy(args, 0, this.args, 0, args.length); + this.args = args; this.keywords = keywords; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |