[pypy-svn] r30412 - in pypy/dist/pypy/translator/cli: . test

antocuni at codespeak.net antocuni at codespeak.net
Sun Jul 23 21:53:23 CEST 2006


Author: antocuni
Date: Sun Jul 23 21:53:18 2006
New Revision: 30412

Modified:
   pypy/dist/pypy/translator/cli/opcodes.py
   pypy/dist/pypy/translator/cli/test/test_op.py
Log:
Really ignore resume_point, instead of pushing the args and leaving
them on the stack.



Modified: pypy/dist/pypy/translator/cli/opcodes.py
==============================================================================
--- pypy/dist/pypy/translator/cli/opcodes.py	(original)
+++ pypy/dist/pypy/translator/cli/opcodes.py	Sun Jul 23 21:53:18 2006
@@ -7,6 +7,7 @@
 # some useful instruction patterns
 Not = ['ldc.i4.0', 'ceq']
 DoNothing = [PushAllArgs]
+Ignore = []
 
 def _not(op):
     return [PushAllArgs, op]+Not
@@ -50,7 +51,7 @@
     'cast_ptr_to_weakadr':      [PushAllArgs, 'newobj instance void class [mscorlib]System.WeakReference::.ctor(object)'],
     'cast_weakadr_to_ptr':      [CastWeakAdrToPtr],
     'gc__collect':              'call void class [mscorlib]System.GC::Collect()',
-    'resume_point':             DoNothing,
+    'resume_point':             Ignore,
 
     # __________ numeric operations __________
 
@@ -223,7 +224,7 @@
     if type(value) is str:
         value = InstructionList([PushAllArgs, value, StoreResult])
     elif value is not None:
-        if StoreResult not in value and not isinstance(value[0], MapException):
+        if value is not Ignore and StoreResult not in value and not isinstance(value[0], MapException):
             value.append(StoreResult)
         value = InstructionList(value)
 

Modified: pypy/dist/pypy/translator/cli/test/test_op.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/test_op.py	(original)
+++ pypy/dist/pypy/translator/cli/test/test_op.py	Sun Jul 23 21:53:18 2006
@@ -1,6 +1,7 @@
 from pypy.translator.cli.test.runtest import CliTest
 from pypy.translator.cli.test.runtest import check
 from pypy.rpython.rarithmetic import r_uint, r_ulonglong, r_longlong, ovfcheck
+from pypy.rpython import rstack
 from pypy.annotation import model as annmodel
 import sys
 
@@ -45,6 +46,12 @@
             return res
         assert self.interpret(fn, [sys.maxint, 2]) == 1
 
+    def test_ignore_resume_point(self):
+        def fn(x):
+            rstack.resume_point('hello world', x)
+            return x
+        assert self.interpret(fn, [42]) == 42
+
 def test_op():
     yield check, op_any_ge, [int, int], (42, 42)
     yield check, op_any_ge, [int, int], (13, 42)



More information about the Pypy-commit mailing list