[pypy-svn] r33180 - pypy/dist/pypy/translator/c

pedronis at codespeak.net pedronis at codespeak.net
Wed Oct 11 19:12:41 CEST 2006


Author: pedronis
Date: Wed Oct 11 19:12:40 2006
New Revision: 33180

Modified:
   pypy/dist/pypy/translator/c/funcgen.py
Log:
(arre, pedronis)

support op_debug_fatalerror



Modified: pypy/dist/pypy/translator/c/funcgen.py
==============================================================================
--- pypy/dist/pypy/translator/c/funcgen.py	(original)
+++ pypy/dist/pypy/translator/c/funcgen.py	Wed Oct 11 19:12:40 2006
@@ -724,4 +724,18 @@
     def OP_DEBUG_ASSERT(self, op):
         return '/* debug_assert removed */'
 
+    def OP_DEBUG_FATALERROR(self, op):
+        # XXX
+        from pypy.rpython.lltypesystem.rstr import STR
+        msg = op.args[0]
+        assert msg.concretetype == Ptr(STR)
+        argv = []
+        if isinstance(msg, Constant):
+            msg = c_string_constant(''.join(msg.value.chars))
+        else:
+            msg = 'RPyString_AsString(%s)' % self.expr(msg)
+
+        return 'fprintf(stderr, "%%s\\n", %s); abort();' % msg
+            
+
 assert not USESLOTS or '__dict__' not in dir(FunctionCodeGenerator)



More information about the Pypy-commit mailing list