[pypy-svn] r27229 - in pypy/dist/pypy/translator/stackless: . test
mwh at codespeak.net
mwh at codespeak.net
Mon May 15 13:08:00 CEST 2006
Author: mwh
Date: Mon May 15 13:07:58 2006
New Revision: 27229
Modified:
pypy/dist/pypy/translator/stackless/test/test_transform.py
pypy/dist/pypy/translator/stackless/transform.py
Log:
convert a few stackless tests to say "rstack.stack_unwind" instead of "raise
code.UnwindException" which lets me simplify the detection of a function that
might unwind the stack.
Modified: pypy/dist/pypy/translator/stackless/test/test_transform.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/test/test_transform.py (original)
+++ pypy/dist/pypy/translator/stackless/test/test_transform.py Mon May 15 13:07:58 2006
@@ -5,7 +5,7 @@
from pypy.translator.c import gc
from pypy.rpython.memory.gctransform import varoftype
from pypy.rpython.lltypesystem import lltype, llmemory
-from pypy.rpython import llinterp
+from pypy.rpython import llinterp, rstack
from pypy.translator.translator import TranslationContext, graphof
from pypy.objspace.flow.model import checkgraph
from pypy.annotation import model as annmodel
@@ -34,8 +34,6 @@
assert s2_1 is s2_2
-from pypy.translator.stackless import code
-
def factorial(n):
if n > 1:
return factorial(n-1) * n
@@ -55,8 +53,7 @@
def test_simple_transform_llinterp():
def check(x):
if x:
- raise code.UnwindException
- check.stackless_explicit = True
+ rstack.stack_unwind()
def g(x):
check(x)
return x + 1
@@ -68,7 +65,7 @@
def test_simple_transform_llinterp_float():
def check(x):
if x:
- raise code.UnwindException
+ rstack.stack_unwind()
def g(x):
check(x)
return x + 0.125
@@ -80,7 +77,7 @@
def test_simple_transform_compiled():
def check(x):
if x:
- raise code.UnwindException # XXX or so
+ rstack.stack_unwind()
def g(x):
check(x)
return x + 1
@@ -92,7 +89,7 @@
def test_protected_call():
def check(x):
if x:
- raise code.UnwindException
+ rstack.stack_unwind()
def g(x):
check(x)
return x + 1
@@ -110,7 +107,7 @@
def test_resume_with_exception():
def check(x):
if x:
- raise code.UnwindException
+ rstack.stack_unwind()
def g(x):
check(x)
if x:
@@ -130,7 +127,7 @@
def test_resume_with_exception_handling():
def check(x):
if x:
- raise code.UnwindException
+ rstack.stack_unwind()
def g(x):
check(x)
if x:
@@ -151,7 +148,7 @@
def test_resume_with_exception_handling_with_vals():
def check(x):
if x:
- raise code.UnwindException
+ rstack.stack_unwind()
def g(x):
check(x)
if x:
@@ -173,8 +170,7 @@
def test_listcomp():
def check(x):
if x:
- raise code.UnwindException
- check.stackless_explicit = True
+ rstack.stack_unwind()
def f():
l = one()
check(l)
@@ -208,8 +204,7 @@
def test_dont_transform_too_much():
def check(x):
if x:
- raise code.UnwindException
- check.stackless_explicit = True
+ rstack.stack_unwind()
def f(x):
return x + 2
def g(x):
Modified: pypy/dist/pypy/translator/stackless/transform.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/transform.py (original)
+++ pypy/dist/pypy/translator/stackless/transform.py Mon May 15 13:07:58 2006
@@ -101,15 +101,6 @@
self.stackless_gc and (op.opname.startswith('malloc')
or op.opname == 'gc__collect'))
- def analyze_link(self, graph, link):
- if link.target is graph.exceptblock:
- # XXX is this the right way to do this?
- op = link.prevblock.operations[-1]
- if op.opname == 'cast_pointer':
- ct = op.args[0].concretetype
- return ct is self.unwindtype
- return False
-
def analyze_external_call(self, op):
callable = op.args[0].value._obj._callable
#assert getattr(callable, 'suggested_primitive', False)
More information about the Pypy-commit
mailing list