From: <cg...@us...> - 2008-10-26 06:23:25
|
Revision: 5509 http://jython.svn.sourceforge.net/jython/?rev=5509&view=rev Author: cgroves Date: 2008-10-26 06:23:15 +0000 (Sun, 26 Oct 2008) Log Message: ----------- Stuff commented out "for now" 10 years ago referring to code that no longer exists is probably with us for good. Modified Paths: -------------- trunk/jython/src/org/python/core/ThreadState.java Modified: trunk/jython/src/org/python/core/ThreadState.java =================================================================== --- trunk/jython/src/org/python/core/ThreadState.java 2008-10-25 23:03:38 UTC (rev 5508) +++ trunk/jython/src/org/python/core/ThreadState.java 2008-10-26 06:23:15 UTC (rev 5509) @@ -1,70 +1,58 @@ // Copyright (c) Corporation for National Research Initiatives package org.python.core; -import java.util.Stack; +import java.util.LinkedList; public class ThreadState { - // public InterpreterState interp; + public PySystemState systemState; public PyFrame frame; - // public PyObject curexc_type, curexc_value, curexc_traceback; - // public PyObject exc_type, exc_value, exc_traceback; public PyException exception; public Thread thread; public boolean tracing; - public PyList reprStack = null; + public PyList reprStack; - // public PyInstance initializingProxy = null; - private Stack initializingProxies = null; + public int compareStateNesting; - public int compareStateNesting = 0; + public int recursion_depth; - private PyDictionary compareStateDict; - - public int recursion_depth = 0; - public TraceFunction tracefunc; + public TraceFunction profilefunc; - + + private LinkedList<PyInstance> initializingProxies; + + private PyDictionary compareStateDict; + public PyInstance getInitializingProxy() { - if (this.initializingProxies == null - || this.initializingProxies.empty()) { + if (initializingProxies == null) { return null; } - return (PyInstance) this.initializingProxies.peek(); + return initializingProxies.peek(); } public void pushInitializingProxy(PyInstance proxy) { - if (this.initializingProxies == null) { - this.initializingProxies = new Stack(); + if (initializingProxies == null) { + initializingProxies = new LinkedList<PyInstance>(); } - this.initializingProxies.push(proxy); + initializingProxies.push(proxy); } public void popInitializingProxy() { - if (this.initializingProxies == null - || this.initializingProxies.empty()) { + if (initializingProxies == null || initializingProxies.isEmpty()) { throw Py.RuntimeError("invalid initializing proxies state"); } - this.initializingProxies.pop(); + initializingProxies.pop(); } public ThreadState(Thread t, PySystemState systemState) { - this.thread = t; - // Fake multiple interpreter states for now - /* - * if (Py.interp == null) { Py.interp = - * InterpreterState.getInterpreterState(); } - */ this.systemState = systemState; - // interp = Py.interp; - this.tracing = false; - // System.out.println("new thread state"); + thread = t; } public boolean enterRepr(PyObject obj) { @@ -85,7 +73,6 @@ if (reprStack == null) { return; } - for (int i = reprStack.size() - 1; i >= 0; i--) { if (reprStack.pyget(i) == obj) { reprStack.delRange(i, reprStack.size(), 1); @@ -94,9 +81,9 @@ } public PyDictionary getCompareStateDict() { - if (this.compareStateDict == null) { - this.compareStateDict = new PyDictionary(); + if (compareStateDict == null) { + compareStateDict = new PyDictionary(); } - return this.compareStateDict; + return compareStateDict; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2008-10-26 14:05:42
|
Revision: 5510 http://jython.svn.sourceforge.net/jython/?rev=5510&view=rev Author: fwierzbicki Date: 2008-10-26 14:05:35 +0000 (Sun, 26 Oct 2008) Log Message: ----------- Although not as nice, replace jdk6 LinkedList methods names with jdk5 names. Modified Paths: -------------- trunk/jython/src/org/python/core/ThreadState.java Modified: trunk/jython/src/org/python/core/ThreadState.java =================================================================== --- trunk/jython/src/org/python/core/ThreadState.java 2008-10-26 06:23:15 UTC (rev 5509) +++ trunk/jython/src/org/python/core/ThreadState.java 2008-10-26 14:05:35 UTC (rev 5510) @@ -40,14 +40,14 @@ if (initializingProxies == null) { initializingProxies = new LinkedList<PyInstance>(); } - initializingProxies.push(proxy); + initializingProxies.addFirst(proxy); } public void popInitializingProxy() { if (initializingProxies == null || initializingProxies.isEmpty()) { throw Py.RuntimeError("invalid initializing proxies state"); } - initializingProxies.pop(); + initializingProxies.removeFirst(); } public ThreadState(Thread t, PySystemState systemState) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2011-03-18 01:27:02
|
Revision: 7244 http://jython.svn.sourceforge.net/jython/?rev=7244&view=rev Author: pjenvey Date: 2011-03-18 01:26:55 +0000 (Fri, 18 Mar 2011) Log Message: ----------- add ThreadState.enter/leaveRecursiveCall Modified Paths: -------------- trunk/jython/src/org/python/core/ThreadState.java Modified: trunk/jython/src/org/python/core/ThreadState.java =================================================================== --- trunk/jython/src/org/python/core/ThreadState.java 2011-03-17 23:02:35 UTC (rev 7243) +++ trunk/jython/src/org/python/core/ThreadState.java 2011-03-18 01:26:55 UTC (rev 7244) @@ -86,4 +86,14 @@ } return compareStateDict; } + + public void enterRecursiveCall(String where) { + if (recursion_depth++ > systemState.getrecursionlimit()) { + throw Py.RuntimeError("maximum recursion depth exceeded" + where); + } + } + + public void leaveRecursiveCall() { + --recursion_depth; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |