[pypy-svn] r26954 - in pypy/dist/pypy: rpython/lltypesystem translator/stackless translator/stackless/test

arigo at codespeak.net arigo at codespeak.net
Sun May 7 21:39:35 CEST 2006


Author: arigo
Date: Sun May  7 21:39:33 2006
New Revision: 26954

Modified:
   pypy/dist/pypy/rpython/lltypesystem/lloperation.py
   pypy/dist/pypy/translator/stackless/code.py
   pypy/dist/pypy/translator/stackless/test/test_transform.py
   pypy/dist/pypy/translator/stackless/test/test_yield_current_frame_to_caller.py
Log:
(pedronis, arigo)
Compile yield_current_etc() and switch() with GenC.
Added a missing 'canraise' in lloperation for yield_current_etc(),
which actually raises UnwindException.


Modified: pypy/dist/pypy/rpython/lltypesystem/lloperation.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/lloperation.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/lloperation.py	Sun May  7 21:39:33 2006
@@ -67,6 +67,11 @@
         hop.exception_is_here()
         return hop.genop(op.opname, args_v, resulttype=hop.r_result.lowleveltype)
 
+
+class StackException(Exception):
+    """Base for internal exceptions possibly used by the stackless
+    implementation."""
+
 # ____________________________________________________________
 #
 # This list corresponds to the operations implemented by the LLInterpreter.
@@ -311,7 +316,7 @@
 
     # __________ stackless operation(s) __________
 
-    'yield_current_frame_to_caller': LLOp(),    
+    'yield_current_frame_to_caller': LLOp(canraise=(StackException,)),
 
     # __________ misc operations __________
 

Modified: pypy/dist/pypy/translator/stackless/code.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/code.py	(original)
+++ pypy/dist/pypy/translator/stackless/code.py	Sun May  7 21:39:33 2006
@@ -158,7 +158,7 @@
             llmemory.Address, fn)
 call_function.stackless_explicit = True
 
-class UnwindException(Exception):
+class UnwindException(lloperation.StackException):
     def __init__(self):
         # during unwind, global_state.top points to frame that first caught
         # the UnwindException, whilst frame_bottom points to the frame

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	Sun May  7 21:39:33 2006
@@ -190,7 +190,7 @@
 
     t.stacklesstransformer = StacklessTransformer(t)
 
-    cbuilder = CStandaloneBuilder(t, entry_point)
+    cbuilder = CStandaloneBuilder(t, entry_point, gcpolicy=gc.BoehmGcPolicy)
     cbuilder.generate_source()
     if conftest.option.view:
         t.view()

Modified: pypy/dist/pypy/translator/stackless/test/test_yield_current_frame_to_caller.py
==============================================================================
--- pypy/dist/pypy/translator/stackless/test/test_yield_current_frame_to_caller.py	(original)
+++ pypy/dist/pypy/translator/stackless/test/test_yield_current_frame_to_caller.py	Sun May  7 21:39:33 2006
@@ -24,6 +24,8 @@
         data = llinterp_stackless_function(f)
         assert data == 1
 
+        res = run_stackless_function(f)
+        assert res.strip() == "1"
 
     def test_switch(self):
         def f(ignored):
@@ -37,6 +39,8 @@
         data = llinterp_stackless_function(f)
         assert data == 1
 
+        res = run_stackless_function(f)
+        assert res.strip() == "1"
 
     def test_yield_frame(self):
 
@@ -65,6 +69,9 @@
         data = llinterp_stackless_function(f)
         assert data == 1234567
 
+        res = run_stackless_function(f)
+        assert res.strip() == "1234567"
+
 
 class TestFromRStack(TestFromCode):
     yield_current_frame_to_caller = staticmethod(



More information about the Pypy-commit mailing list