[pypy-svn] r24980 - in pypy/branch/explicit-exceptions/translator/c: . src

cfbolz at codespeak.net cfbolz at codespeak.net
Fri Mar 24 23:08:28 CET 2006


Author: cfbolz
Date: Fri Mar 24 23:08:22 2006
New Revision: 24980

Modified:
   pypy/branch/explicit-exceptions/translator/c/funcgen.py
   pypy/branch/explicit-exceptions/translator/c/gc.py
   pypy/branch/explicit-exceptions/translator/c/src/address.h
   pypy/branch/explicit-exceptions/translator/c/src/char.h
   pypy/branch/explicit-exceptions/translator/c/src/float.h
   pypy/branch/explicit-exceptions/translator/c/src/int.h
   pypy/branch/explicit-exceptions/translator/c/src/ll_stackless.h
   pypy/branch/explicit-exceptions/translator/c/src/mem.h
   pypy/branch/explicit-exceptions/translator/c/src/pyobj.h
   pypy/branch/explicit-exceptions/translator/c/src/support.h
   pypy/branch/explicit-exceptions/translator/c/src/trace.h
   pypy/branch/explicit-exceptions/translator/c/src/unichar.h
   pypy/branch/explicit-exceptions/translator/c/stackless.py
Log:
remove the error label from all C code, especially the macros -- to raise an
exception use RPyRaiseException and make sure that no code is executed
afterwards (if it is a macro, otherwise you can return of course).


Modified: pypy/branch/explicit-exceptions/translator/c/funcgen.py
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/funcgen.py	(original)
+++ pypy/branch/explicit-exceptions/translator/c/funcgen.py	Fri Mar 24 23:08:22 2006
@@ -148,7 +148,7 @@
             vanishing_exc_value = self.expr(v)
             yield 'RPyConvertExceptionToCPython(%s);' % vanishing_exc_value
             for cleanupop in exc_cleanup_ops:
-                for line in self.gen_op(cleanupop, 'should_never_be_jumped_to'):
+                for line in self.gen_op(cleanupop):
                     yield line
         yield 'return %s; ' % self.error_return_value()
 
@@ -184,7 +184,7 @@
             yield ''
             yield 'block%d:' % myblocknum
             for i, op in enumerate(block.operations):
-                for line in self.gen_op(op, "should_never_be_reached"):
+                for line in self.gen_op(op):
                     yield line
             if len(block.exits) == 0:
                 assert len(block.inputargs) == 1
@@ -278,20 +278,19 @@
             yield line
         yield 'goto block%d;' % self.blocknum[link.target]
 
-    def gen_op(self, op, err):
+    def gen_op(self, op):
         macro = 'OP_%s' % op.opname.upper()
         if op.opname.startswith('gc_'):
             meth = getattr(self.gcpolicy, macro, None)
             if meth:
-                line = meth(self, op, err)
+                line = meth(self, op)
         else:
             meth = getattr(self, macro, None)
             if meth:
-                line = meth(op, err)
+                line = meth(op)
         if meth is None:
             lst = [self.expr(v) for v in op.args]
             lst.append(self.expr(op.result))
-            lst.append(err)
             line = '%s(%s);' % (macro, ', '.join(lst))
         if "\n" not in line:
             yield line
@@ -304,43 +303,43 @@
     # the C preprocessor cannot handle operations taking a variable number
     # of arguments, so here are Python methods that do it
     
-    def OP_NEWLIST(self, op, err):
+    def OP_NEWLIST(self, op):
         args = [self.expr(v) for v in op.args]
         r = self.expr(op.result)
         if len(args) == 0:
-            return 'OP_NEWLIST0(%s, %s);' % (r, err)
+            return 'OP_NEWLIST0(%s);' % (r, )
         else:
             args.insert(0, '%d' % len(args))
-            return 'OP_NEWLIST((%s), %s, %s);' % (', '.join(args), r, err)
+            return 'OP_NEWLIST((%s), %s);' % (', '.join(args), r)
 
-    def OP_NEWDICT(self, op, err):
+    def OP_NEWDICT(self, op):
         args = [self.expr(v) for v in op.args]
         r = self.expr(op.result)
         if len(args) == 0:
-            return 'OP_NEWDICT0(%s, %s);' % (r, err)
+            return 'OP_NEWDICT0(%s);' % (r, )
         else:
             assert len(args) % 2 == 0
             args.insert(0, '%d' % (len(args)//2))
-            return 'OP_NEWDICT((%s), %s, %s);' % (', '.join(args), r, err)
+            return 'OP_NEWDICT((%s), %s);' % (', '.join(args), r)
 
-    def OP_NEWTUPLE(self, op, err):
+    def OP_NEWTUPLE(self, op):
         args = [self.expr(v) for v in op.args]
         r = self.expr(op.result)
         args.insert(0, '%d' % len(args))
-        return 'OP_NEWTUPLE((%s), %s, %s);' % (', '.join(args), r, err)
+        return 'OP_NEWTUPLE((%s), %s);' % (', '.join(args), r)
 
-    def OP_SIMPLE_CALL(self, op, err):
+    def OP_SIMPLE_CALL(self, op):
         args = [self.expr(v) for v in op.args]
         r = self.expr(op.result)
         args.append('NULL')
-        return 'OP_SIMPLE_CALL((%s), %s, %s);' % (', '.join(args), r, err)
+        return 'OP_SIMPLE_CALL((%s), %s);' % (', '.join(args), r)
 
-    def OP_CALL_ARGS(self, op, err):
+    def OP_CALL_ARGS(self, op):
         args = [self.expr(v) for v in op.args]
         r = self.expr(op.result)
-        return 'OP_CALL_ARGS((%s), %s, %s);' % (', '.join(args), r, err)
+        return 'OP_CALL_ARGS((%s), %s);' % (', '.join(args), r)
 
-    def OP_DIRECT_CALL(self, op, err):
+    def OP_DIRECT_CALL(self, op):
         # skip 'void' arguments
         args = [self.expr(v) for v in op.args if self.lltypemap(v) is not Void]
         line = '%s(%s);' % (args[0], ', '.join(args[1:]))
@@ -348,7 +347,7 @@
             # skip assignment of 'void' return value
             r = self.expr(op.result)
             line = '%s = %s' % (r, line)
-        check = self.check_directcall_result(op, err)
+        check = self.check_directcall_result(op)
         if check:
             return line + '\n' + check
         return line
@@ -357,7 +356,7 @@
     # is of type Void, which is removed by OP_DIRECT_CALL
     OP_INDIRECT_CALL = OP_DIRECT_CALL
 
-    def check_directcall_result(self, op, err):
+    def check_directcall_result(self, op):
         return None
 
     # low-level operations
@@ -382,7 +381,7 @@
             result = '/* %s */' % result
         return result
 
-    def OP_GETFIELD(self, op, err, ampersand=''):
+    def OP_GETFIELD(self, op, ampersand=''):
         assert isinstance(op.args[1], Constant)
         STRUCT = self.lltypemap(op.args[0]).TO
         structdef = self.db.gettypedefnode(STRUCT)
@@ -391,7 +390,7 @@
                                                   self.expr(op.args[0]),
                                                   fieldname))
 
-    def OP_SETFIELD(self, op, err):
+    def OP_SETFIELD(self, op):
         assert isinstance(op.args[1], Constant)
         STRUCT = self.lltypemap(op.args[0]).TO
         structdef = self.db.gettypedefnode(STRUCT)
@@ -399,52 +398,52 @@
         return self.generic_set(op, '%s->%s' % (self.expr(op.args[0]),
                                                 fieldname))
 
-    def OP_GETSUBSTRUCT(self, op, err):
-        return self.OP_GETFIELD(op, err, ampersand='&')
+    def OP_GETSUBSTRUCT(self, op):
+        return self.OP_GETFIELD(op, ampersand='&')
 
-    def OP_GETARRAYSIZE(self, op, err):
+    def OP_GETARRAYSIZE(self, op):
         return '%s = %s->length;' % (self.expr(op.result),
                                      self.expr(op.args[0]))
 
-    def OP_GETARRAYITEM(self, op, err):
+    def OP_GETARRAYITEM(self, op):
         return self.generic_get(op, '%s->items[%s]' % (self.expr(op.args[0]),
                                                        self.expr(op.args[1])))
 
-    def OP_SETARRAYITEM(self, op, err):
+    def OP_SETARRAYITEM(self, op):
         return self.generic_set(op, '%s->items[%s]' % (self.expr(op.args[0]),
                                                        self.expr(op.args[1])))
 
-    def OP_GETARRAYSUBSTRUCT(self, op, err):
+    def OP_GETARRAYSUBSTRUCT(self, op):
         return '%s = %s->items + %s;' % (self.expr(op.result),
                                          self.expr(op.args[0]),
                                          self.expr(op.args[1]))
 
-    def OP_PTR_NONZERO(self, op, err):
+    def OP_PTR_NONZERO(self, op):
         return '%s = (%s != NULL);' % (self.expr(op.result),
                                        self.expr(op.args[0]))
-    def OP_PTR_ISZERO(self, op, err):
+    def OP_PTR_ISZERO(self, op):
         return '%s = (%s == NULL);' % (self.expr(op.result),
                                        self.expr(op.args[0]))
     
-    def OP_PTR_EQ(self, op, err):
+    def OP_PTR_EQ(self, op):
         return '%s = (%s == %s);' % (self.expr(op.result),
                                      self.expr(op.args[0]),
                                      self.expr(op.args[1]))
 
-    def OP_PTR_NE(self, op, err):
+    def OP_PTR_NE(self, op):
         return '%s = (%s != %s);' % (self.expr(op.result),
                                      self.expr(op.args[0]),
                                      self.expr(op.args[1]))
 
-    def OP_MALLOC(self, op, err):
+    def OP_MALLOC(self, op):
         TYPE = self.lltypemap(op.result).TO
         typename = self.db.gettype(TYPE)
         eresult = self.expr(op.result)
         esize = 'sizeof(%s)' % cdecl(typename, '')
 
-        return self.gcpolicy.zero_malloc(TYPE, esize, eresult, err)
+        return self.gcpolicy.zero_malloc(TYPE, esize, eresult)
 
-    def OP_MALLOC_VARSIZE(self, op, err):
+    def OP_MALLOC_VARSIZE(self, op):
         TYPE = self.lltypemap(op.result).TO
         typename = self.db.gettype(TYPE)
         lenfld = 'length'
@@ -464,45 +463,43 @@
             result = ''
         else:
             itemtype = cdecl(itemtypename, '')
-            result = 'OP_MAX_VARSIZE(%s, %s, %s);\n' % (
+            result = 'OP_MAX_VARSIZE(%s, %s);\n' % (
                 elength,
-                itemtype,
-                err)
+                itemtype)
             esize = 'sizeof(%s)-sizeof(%s)+%s*sizeof(%s)' % (
                 cdecl(typename, ''),
                 itemtype,
                 elength,
                 itemtype)
-        result += self.gcpolicy.zero_malloc(TYPE, esize, eresult, err)
+        result += self.gcpolicy.zero_malloc(TYPE, esize, eresult)
 
         # ctypes Arrays have no length field
         if not VARPART._hints.get('nolength', False):
             result += '\n%s->%s = %s;' % (eresult, lenfld, elength)
         return result
 
-    def OP_FLAVORED_MALLOC(self, op, err):
+    def OP_FLAVORED_MALLOC(self, op):
         TYPE = self.lltypemap(op.result).TO
         typename = self.db.gettype(TYPE)
         eresult = self.expr(op.result)
         esize = 'sizeof(%s)' % cdecl(typename, '')
         flavor = op.args[0].value
         if flavor == "raw": 
-            return "OP_RAW_MALLOC(%s, %s, %s);" % (esize, eresult, err) 
+            return "OP_RAW_MALLOC(%s, %s);" % (esize, eresult) 
         elif flavor == "stack": 
-            return "OP_STACK_MALLOC(%s, %s, %s);" % (esize, eresult, err) 
+            return "OP_STACK_MALLOC(%s, %s);" % (esize, eresult) 
         else:
             raise NotImplementedError
 
-    def OP_FLAVORED_FREE(self, op, err):
+    def OP_FLAVORED_FREE(self, op):
         flavor = op.args[0].value
         if flavor == "raw":
-            return "OP_RAW_FREE(%s, %s, %s)" % (self.expr(op.args[1]),
-                                                self.expr(op.result),
-                                                err)
+            return "OP_RAW_FREE(%s, %s)" % (self.expr(op.args[1]),
+                                            self.expr(op.result))
         else:
             raise NotImplementedError
 
-    def OP_CAST_POINTER(self, op, err):
+    def OP_CAST_POINTER(self, op):
         TYPE = self.lltypemap(op.result)
         typename = self.db.gettype(TYPE)
         result = []
@@ -517,13 +514,13 @@
     OP_CAST_PTR_TO_ADR = OP_CAST_POINTER
     OP_CAST_ADR_TO_PTR = OP_CAST_POINTER
 
-    def OP_CAST_INT_TO_PTR(self, op, err):
+    def OP_CAST_INT_TO_PTR(self, op):
         TYPE = self.lltypemap(op.result)
         typename = self.db.gettype(TYPE)
         return "%s = (%s)%s;" % (self.expr(op.result), cdecl(typename, ""), 
                                  self.expr(op.args[0]))
 
-    def OP_SAME_AS(self, op, err):
+    def OP_SAME_AS(self, op):
         result = []
         TYPE = self.lltypemap(op.result)
         assert self.lltypemap(op.args[0]) == TYPE
@@ -534,15 +531,15 @@
                 result.append('Py_XINCREF(%s);'%(LOCAL_VAR % op.result.name))
         return '\t'.join(result)
 
-    def OP_HINT(self, op, err):
+    def OP_HINT(self, op):
         hints = op.args[1].value
-        return '%s\t/* hint: %r */' % (self.OP_SAME_AS(op, err), hints)
+        return '%s\t/* hint: %r */' % (self.OP_SAME_AS(op), hints)
 
-    def OP_KEEPALIVE(self, op, err): # xxx what should be the sematics consequences of this
+    def OP_KEEPALIVE(self, op): # xxx what should be the sematics consequences of this
         return "/* kept alive: %s */ ;" % self.expr(op.args[0], special_case_void=False)
 
     #address operations
-    def OP_RAW_STORE(self, op, err):
+    def OP_RAW_STORE(self, op):
        addr = self.expr(op.args[0])
        TYPE = op.args[1].value
        offset = self.expr(op.args[2])
@@ -550,7 +547,7 @@
        typename = self.db.gettype(TYPE).replace("@", "*") #XXX help! is this the way to do it?
        return "*(((%(typename)s) %(addr)s ) + %(offset)s) = %(value)s;" % locals()
 
-    def OP_RAW_LOAD(self, op, err):
+    def OP_RAW_LOAD(self, op):
         addr = self.expr(op.args[0])
         TYPE = op.args[1].value
         offset = self.expr(op.args[2])

Modified: pypy/branch/explicit-exceptions/translator/c/gc.py
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/gc.py	(original)
+++ pypy/branch/explicit-exceptions/translator/c/gc.py	Fri Mar 24 23:08:22 2006
@@ -45,13 +45,13 @@
     def gc_startup_code(self):
         return []
 
-    def OP_GC_PUSH_ALIVE_PYOBJ(self, funcgen, op, err):
+    def OP_GC_PUSH_ALIVE_PYOBJ(self, funcgen, op):
         expr = funcgen.expr(op.args[0])
         if expr == 'NULL':
             return ''
         return 'Py_XINCREF(%s);' % expr
 
-    def OP_GC_POP_ALIVE_PYOBJ(self, funcgen, op, err):
+    def OP_GC_POP_ALIVE_PYOBJ(self, funcgen, op):
         expr = funcgen.expr(op.args[0])
         return 'Py_XDECREF(%s);' % expr
 
@@ -101,31 +101,30 @@
 
     # zero malloc impl
 
-    def zero_malloc(self, TYPE, esize, eresult, err):
+    def zero_malloc(self, TYPE, esize, eresult):
         assert TYPE._gcstatus()   # we don't really support this
-        return 'OP_ZERO_MALLOC(%s, %s, %s);' % (esize,
-                                                eresult,
-                                                err)
+        return 'OP_ZERO_MALLOC(%s, %s);' % (esize,
+                                            eresult)
 
-    def OP_GC_CALL_RTTI_DESTRUCTOR(self, funcgen, op, err):
+    def OP_GC_CALL_RTTI_DESTRUCTOR(self, funcgen, op):
         args = [funcgen.expr(v) for v in op.args]
         line = '%s(%s);' % (args[0], ', '.join(args[1:]))
         return line	
     
-    def OP_GC_FREE(self, funcgen, op, err):
+    def OP_GC_FREE(self, funcgen, op):
         args = [funcgen.expr(v) for v in op.args]
         return 'OP_FREE(%s);' % (args[0], )    
 
-    def OP_GC_FETCH_EXCEPTION(self, funcgen, op, err):
+    def OP_GC_FETCH_EXCEPTION(self, funcgen, op):
         result = funcgen.expr(op.result)
         return ('%s = RPyFetchExceptionValue();\n'
                 'RPyClearException();') % (result, )
 
-    def OP_GC_RESTORE_EXCEPTION(self, funcgen, op, err):
+    def OP_GC_RESTORE_EXCEPTION(self, funcgen, op):
         argh = funcgen.expr(op.args[0])
         return 'if (%s != NULL) RPyRaiseException(RPYTHON_TYPE_OF_EXC_INST(%s), %s);' % (argh, argh, argh)
 
-    def OP_GC__COLLECT(self, funcgen, op, err):
+    def OP_GC__COLLECT(self, funcgen, op):
         return ''
 
 
@@ -179,16 +178,15 @@
     def rtti_node_factory(self):
         return BoehmGcRuntimeTypeInfo_OpaqueNode
 
-    def zero_malloc(self, TYPE, esize, eresult, err):
+    def zero_malloc(self, TYPE, esize, eresult):
         gcinfo = self.db.gettypedefnode(TYPE).gcinfo
         assert TYPE._gcstatus()   # _is_atomic() depends on this!
         is_atomic = TYPE._is_atomic()
         is_varsize = TYPE._is_varsize()
-        result = 'OP_BOEHM_ZERO_MALLOC(%s, %s, %d, %d, %s);' % (esize,
-                                                                eresult,
-                                                                is_atomic,
-                                                                is_varsize,
-                                                                err)
+        result = 'OP_BOEHM_ZERO_MALLOC(%s, %s, %d, %d);' % (esize,
+                                                            eresult,
+                                                            is_atomic,
+                                                            is_varsize)
         if gcinfo and gcinfo.finalizer:
             result += ('\nGC_REGISTER_FINALIZER(%s, (GC_finalization_proc)%s, NULL, NULL, NULL);'
                        % (eresult, gcinfo.finalizer))
@@ -218,16 +216,16 @@
         yield 'GC_init();'
 
 
-    def OP_GC_FETCH_EXCEPTION(self, funcgen, op, err):
+    def OP_GC_FETCH_EXCEPTION(self, funcgen, op):
         result = funcgen.expr(op.result)
         return ('%s = RPyFetchExceptionValue();\n'
                 'RPyClearException();') % (result, )
 
-    def OP_GC_RESTORE_EXCEPTION(self, funcgen, op, err):
+    def OP_GC_RESTORE_EXCEPTION(self, funcgen, op):
         argh = funcgen.expr(op.args[0])
         return 'if (%s != NULL) RPyRaiseException(RPYTHON_TYPE_OF_EXC_INST(%s), %s);' % (argh, argh, argh)
 
-    def OP_GC__COLLECT(self, funcgen, op, err):
+    def OP_GC__COLLECT(self, funcgen, op):
         return 'GC_gcollect(); GC_invoke_finalizers();'
 
 
@@ -277,7 +275,7 @@
     def pre_gc_code(self):
         return []
 
-    def OP_GC_RELOAD_POSSIBLY_MOVED(self, funcgen, op, err):
+    def OP_GC_RELOAD_POSSIBLY_MOVED(self, funcgen, op):
         args = [funcgen.expr(v) for v in op.args]
         return '%s = %s; /* for moving GCs */' % (args[1], args[0])
 

Modified: pypy/branch/explicit-exceptions/translator/c/src/address.h
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/src/address.h	(original)
+++ pypy/branch/explicit-exceptions/translator/c/src/address.h	Fri Mar 24 23:08:22 2006
@@ -5,29 +5,29 @@
 
 /***  binary operations ***/
 
-#define OP_ADR_DELTA(x,y,r,err) r = ((char *)(x) - (char *)(y))
-#define OP_ADR_SUB(x,y,r,err)   r = ((char *)(x) - (y))
-#define OP_ADR_ADD(x,y,r,err)   r = ((char *)(x) + (y))
-
-#define OP_ADR_EQ(x,y,r,err)	  r = ((x) == (y))
-#define OP_ADR_NE(x,y,r,err)	  r = ((x) != (y))
-#define OP_ADR_LE(x,y,r,err)	  r = ((x) <= (y))
-#define OP_ADR_GT(x,y,r,err)	  r = ((x) >  (y))
-#define OP_ADR_LT(x,y,r,err)	  r = ((x) <  (y))
-#define OP_ADR_GE(x,y,r,err)	  r = ((x) >= (y))
-
-#define OP_RAW_MALLOC(size,r,err)                                           \
-    r = (void*) calloc(1, size);                                            \
-    if (r == NULL) FAIL_EXCEPTION(err, PyExc_MemoryError, "out of memory");\
+#define OP_ADR_DELTA(x,y,r) r = ((char *)(x) - (char *)(y))
+#define OP_ADR_SUB(x,y,r)   r = ((char *)(x) - (y))
+#define OP_ADR_ADD(x,y,r)   r = ((char *)(x) + (y))
+
+#define OP_ADR_EQ(x,y,r)	  r = ((x) == (y))
+#define OP_ADR_NE(x,y,r)	  r = ((x) != (y))
+#define OP_ADR_LE(x,y,r)	  r = ((x) <= (y))
+#define OP_ADR_GT(x,y,r)	  r = ((x) >  (y))
+#define OP_ADR_LT(x,y,r)	  r = ((x) <  (y))
+#define OP_ADR_GE(x,y,r)	  r = ((x) >= (y))
+
+#define OP_RAW_MALLOC(size,r)                                          \
+    r = (void*) calloc(1, size);                                       \
+    if (r == NULL) FAIL_EXCEPTION( PyExc_MemoryError, "out of memory");\
 
 #ifdef MS_WINDOWS
 #define alloca  _alloca
 #endif
 
-#define OP_STACK_MALLOC(size,r,err)                                           \
+#define OP_STACK_MALLOC(size,r)                                            \
     r = (void*) alloca(size);                                              \
-    if (r == NULL) FAIL_EXCEPTION(err, PyExc_MemoryError, "out of memory");\
+    if (r == NULL) FAIL_EXCEPTION(PyExc_MemoryError, "out of memory");\
  
-#define OP_RAW_FREE(x,r,err)        free(x);
-#define OP_RAW_MEMCOPY(x,y,size,r,err) memcpy(y,x,size);
+#define OP_RAW_FREE(x,r)        free(x);
+#define OP_RAW_MEMCOPY(x,y,size,r) memcpy(y,x,size);
 

Modified: pypy/branch/explicit-exceptions/translator/c/src/char.h
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/src/char.h	(original)
+++ pypy/branch/explicit-exceptions/translator/c/src/char.h	Fri Mar 24 23:08:22 2006
@@ -6,10 +6,10 @@
 /***  binary operations ***/
 
 
-#define OP_CHAR_EQ(x,y,r,err)	 r = ((x) == (y))
-#define OP_CHAR_NE(x,y,r,err)	 r = ((x) != (y))
-#define OP_CHAR_LE(x,y,r,err)	 r = ((unsigned char)(x) <= (unsigned char)(y))
-#define OP_CHAR_GT(x,y,r,err)	 r = ((unsigned char)(x) >  (unsigned char)(y))
-#define OP_CHAR_LT(x,y,r,err)	 r = ((unsigned char)(x) <  (unsigned char)(y))
-#define OP_CHAR_GE(x,y,r,err)	 r = ((unsigned char)(x) >= (unsigned char)(y))
+#define OP_CHAR_EQ(x,y,r)	 r = ((x) == (y))
+#define OP_CHAR_NE(x,y,r)	 r = ((x) != (y))
+#define OP_CHAR_LE(x,y,r)	 r = ((unsigned char)(x) <= (unsigned char)(y))
+#define OP_CHAR_GT(x,y,r)	 r = ((unsigned char)(x) >  (unsigned char)(y))
+#define OP_CHAR_LT(x,y,r)	 r = ((unsigned char)(x) <  (unsigned char)(y))
+#define OP_CHAR_GE(x,y,r)	 r = ((unsigned char)(x) >= (unsigned char)(y))
 

Modified: pypy/branch/explicit-exceptions/translator/c/src/float.h
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/src/float.h	(original)
+++ pypy/branch/explicit-exceptions/translator/c/src/float.h	Fri Mar 24 23:08:22 2006
@@ -5,35 +5,35 @@
 
 /*** unary operations ***/
 
-#define OP_FLOAT_IS_TRUE(x,r,err)   OP_FLOAT_NE(x,0.0,r,err)
-#define OP_FLOAT_NEG(x,r,err)       r = -x
-#define OP_FLOAT_ABS(x,r,err)       r = fabs(x)
+#define OP_FLOAT_IS_TRUE(x,r)   OP_FLOAT_NE(x,0.0,r)
+#define OP_FLOAT_NEG(x,r)       r = -x
+#define OP_FLOAT_ABS(x,r)       r = fabs(x)
 
 /***  binary operations ***/
 
-#define OP_FLOAT_EQ(x,y,r,err)	  r = (x == y)
-#define OP_FLOAT_NE(x,y,r,err)	  r = (x != y)
-#define OP_FLOAT_LE(x,y,r,err)	  r = (x <= y)
-#define OP_FLOAT_GT(x,y,r,err)	  r = (x >  y)
-#define OP_FLOAT_LT(x,y,r,err)	  r = (x <  y)
-#define OP_FLOAT_GE(x,y,r,err)	  r = (x >= y)
+#define OP_FLOAT_EQ(x,y,r)	  r = (x == y)
+#define OP_FLOAT_NE(x,y,r)	  r = (x != y)
+#define OP_FLOAT_LE(x,y,r)	  r = (x <= y)
+#define OP_FLOAT_GT(x,y,r)	  r = (x >  y)
+#define OP_FLOAT_LT(x,y,r)	  r = (x <  y)
+#define OP_FLOAT_GE(x,y,r)	  r = (x >= y)
 
-#define OP_FLOAT_CMP(x,y,r,err) \
+#define OP_FLOAT_CMP(x,y,r) \
 	r = ((x > y) - (x < y))
 
 /* addition, subtraction */
 
-#define OP_FLOAT_ADD(x,y,r,err)     r = x + y
-#define OP_FLOAT_SUB(x,y,r,err)     r = x - y
-#define OP_FLOAT_MUL(x,y,r,err)     r = x * y
-#define OP_FLOAT_DIV(x,y,r,err)     r = x / y
-#define OP_FLOAT_TRUEDIV(x,y,r,err) OP_FLOAT_DIV(x,y,r,err)
-#define OP_FLOAT_POW(x,y,r,err)     r = pow(x, y) 
+#define OP_FLOAT_ADD(x,y,r)     r = x + y
+#define OP_FLOAT_SUB(x,y,r)     r = x - y
+#define OP_FLOAT_MUL(x,y,r)     r = x * y
+#define OP_FLOAT_DIV(x,y,r)     r = x / y
+#define OP_FLOAT_TRUEDIV(x,y,r) OP_FLOAT_DIV(x,y,r)
+#define OP_FLOAT_POW(x,y,r)     r = pow(x, y) 
 
 /*** conversions ***/
 
-#define OP_CAST_FLOAT_TO_INT(x,r,err)    r = (long)(x)
-#define OP_CAST_FLOAT_TO_UINT(x,r,err)   r = (unsigned long)(x)
-#define OP_CAST_INT_TO_FLOAT(x,r,err)    r = (double)(x)
-#define OP_CAST_UINT_TO_FLOAT(x,r,err)   r = (double)(x)
-#define OP_CAST_BOOL_TO_FLOAT(x,r,err)   r = (double)(x)
+#define OP_CAST_FLOAT_TO_INT(x,r)    r = (long)(x)
+#define OP_CAST_FLOAT_TO_UINT(x,r)   r = (unsigned long)(x)
+#define OP_CAST_INT_TO_FLOAT(x,r)    r = (double)(x)
+#define OP_CAST_UINT_TO_FLOAT(x,r)   r = (double)(x)
+#define OP_CAST_BOOL_TO_FLOAT(x,r)   r = (double)(x)

Modified: pypy/branch/explicit-exceptions/translator/c/src/int.h
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/src/int.h	(original)
+++ pypy/branch/explicit-exceptions/translator/c/src/int.h	Fri Mar 24 23:08:22 2006
@@ -4,71 +4,71 @@
 
 /*** unary operations ***/
 
-#define OP_INT_IS_TRUE(x,r,err)   OP_INT_NE(x,0,r,err)
+#define OP_INT_IS_TRUE(x,r)   OP_INT_NE(x,0,r)
 
-#define OP_INT_INVERT(x,r,err)    r = ~((x))
+#define OP_INT_INVERT(x,r)    r = ~((x))
 
-#define OP_INT_POS(x,r,err)    r = x
+#define OP_INT_POS(x,r)    r = x
 
-#define OP_INT_NEG(x,r,err)    r = -(x)
+#define OP_INT_NEG(x,r)    r = -(x)
 
-#define OP_INT_NEG_OVF(x,r,err) \
-	OP_INT_NEG(x,r,err); \
+#define OP_INT_NEG_OVF(x,r) \
+	OP_INT_NEG(x,r); \
 	if ((x) >= 0 || (x) != -(x)); \
-	else FAIL_OVF(err, "integer negate")
+	else FAIL_OVF("integer negate")
 
-#define OP_INT_ABS(x,r,err)    r = (x) >= 0 ? x : -(x)
-#define OP_UINT_ABS(x,r,err)   r = (x)
+#define OP_INT_ABS(x,r)    r = (x) >= 0 ? x : -(x)
+#define OP_UINT_ABS(x,r)   r = (x)
 
-#define OP_INT_ABS_OVF(x,r,err) \
-	OP_INT_ABS(x,r,err); \
+#define OP_INT_ABS_OVF(x,r) \
+	OP_INT_ABS(x,r); \
 	if ((x) >= 0 || (x) != -(x)); \
-	else FAIL_OVF(err, "integer absolute")
+	else FAIL_OVF("integer absolute")
 
 /***  binary operations ***/
 
-#define OP_INT_EQ(x,y,r,err)	  r = ((x) == (y))
-#define OP_INT_NE(x,y,r,err)	  r = ((x) != (y))
-#define OP_INT_LE(x,y,r,err)	  r = ((x) <= (y))
-#define OP_INT_GT(x,y,r,err)	  r = ((x) >  (y))
-#define OP_INT_LT(x,y,r,err)	  r = ((x) <  (y))
-#define OP_INT_GE(x,y,r,err)	  r = ((x) >= (y))
+#define OP_INT_EQ(x,y,r)	  r = ((x) == (y))
+#define OP_INT_NE(x,y,r)	  r = ((x) != (y))
+#define OP_INT_LE(x,y,r)	  r = ((x) <= (y))
+#define OP_INT_GT(x,y,r)	  r = ((x) >  (y))
+#define OP_INT_LT(x,y,r)	  r = ((x) <  (y))
+#define OP_INT_GE(x,y,r)	  r = ((x) >= (y))
 
-#define OP_INT_CMP(x,y,r,err) \
+#define OP_INT_CMP(x,y,r) \
 	r = (((x) > (y)) - ((x) < (y)))
 
 /* addition, subtraction */
 
-#define OP_INT_ADD(x,y,r,err)     r = (x) + (y)
+#define OP_INT_ADD(x,y,r)     r = (x) + (y)
 
-#define OP_INT_ADD_OVF(x,y,r,err) \
-	OP_INT_ADD(x,y,r,err); \
+#define OP_INT_ADD_OVF(x,y,r) \
+	OP_INT_ADD(x,y,r); \
 	if ((r^(x)) >= 0 || (r^(y)) >= 0); \
-	else FAIL_OVF(err, "integer addition")
+	else FAIL_OVF("integer addition")
 
-#define OP_INT_SUB(x,y,r,err)     r = (x) - (y)
+#define OP_INT_SUB(x,y,r)     r = (x) - (y)
 
-#define OP_INT_SUB_OVF(x,y,r,err) \
-	OP_INT_SUB(x,y,r,err); \
+#define OP_INT_SUB_OVF(x,y,r) \
+	OP_INT_SUB(x,y,r); \
 	if ((r^(x)) >= 0 || (r^~(y)) >= 0); \
-	else FAIL_OVF(err, "integer subtraction")
+	else FAIL_OVF("integer subtraction")
 
-#define OP_INT_MUL(x,y,r,err)     r = (x) * (y)
+#define OP_INT_MUL(x,y,r)     r = (x) * (y)
 
 #ifndef HAVE_LONG_LONG
 
-#define OP_INT_MUL_OVF(x,y,r,err) \
+#define OP_INT_MUL_OVF(x,y,r) \
 	if (op_int_mul_ovf(x,y,&r)); \
-	else FAIL_OVF(err, "integer multiplication")
+	else FAIL_OVF("integer multiplication")
 
 #else
 
-#define OP_INT_MUL_OVF(x,y,r,err) \
+#define OP_INT_MUL_OVF(x,y,r) \
 	{ \
 		PY_LONG_LONG lr = (PY_LONG_LONG)(x) * (PY_LONG_LONG)(y); \
 		r = (long)lr; \
 		if ((PY_LONG_LONG)r == lr); \
-		else FAIL_OVF(err, "integer multiplication"); \
+		else FAIL_OVF("integer multiplication"); \
 	}
 #endif
 
@@ -76,99 +76,99 @@
 
 /* NB. shifting has same limitations as C: the shift count must be
        >= 0 and < LONG_BITS. */
-#define OP_INT_RSHIFT(x,y,r,err)    r = Py_ARITHMETIC_RIGHT_SHIFT(long, x, y)
-#define OP_UINT_RSHIFT(x,y,r,err)   r = (x) >> (y)
+#define OP_INT_RSHIFT(x,y,r)    r = Py_ARITHMETIC_RIGHT_SHIFT(long, x, y)
+#define OP_UINT_RSHIFT(x,y,r)   r = (x) >> (y)
 
-#define OP_INT_LSHIFT(x,y,r,err)    r = (x) << (y)
-#define OP_UINT_LSHIFT(x,y,r,err)   r = (x) << (y)
+#define OP_INT_LSHIFT(x,y,r)    r = (x) << (y)
+#define OP_UINT_LSHIFT(x,y,r)   r = (x) << (y)
 
-#define OP_INT_LSHIFT_OVF(x,y,r,err) \
-	OP_INT_LSHIFT(x,y,r,err); \
+#define OP_INT_LSHIFT_OVF(x,y,r) \
+	OP_INT_LSHIFT(x,y,r); \
 	if ((x) != Py_ARITHMETIC_RIGHT_SHIFT(long, r, (y))) \
-		FAIL_OVF(err, "x<<y loosing bits or changing sign")
+		FAIL_OVF("x<<y loosing bits or changing sign")
 
 /* the safe value-checking version of the above macros */
 
-#define OP_INT_RSHIFT_VAL(x,y,r,err) \
-	if ((y) >= 0) { OP_INT_RSHIFT(x,y,r,err); } \
-	else FAIL_VAL(err, "negative shift count")
-
-#define OP_INT_LSHIFT_VAL(x,y,r,err) \
-	if ((y) >= 0) { OP_INT_LSHIFT(x,y,r,err); } \
-	else FAIL_VAL(err, "negative shift count")
-
-#define OP_INT_LSHIFT_OVF_VAL(x,y,r,err) \
-	if ((y) >= 0) { OP_INT_LSHIFT_OVF(x,y,r,err); } \
-	else FAIL_VAL(err, "negative shift count")
+#define OP_INT_RSHIFT_VAL(x,y,r) \
+	if ((y) >= 0) { OP_INT_RSHIFT(x,y,r); } \
+	else FAIL_VAL("negative shift count")
+
+#define OP_INT_LSHIFT_VAL(x,y,r) \
+	if ((y) >= 0) { OP_INT_LSHIFT(x,y,r); } \
+	else FAIL_VAL("negative shift count")
+
+#define OP_INT_LSHIFT_OVF_VAL(x,y,r) \
+	if ((y) >= 0) { OP_INT_LSHIFT_OVF(x,y,r); } \
+	else FAIL_VAL("negative shift count")
 
 
 /* floor division */
 
-#define OP_INT_FLOORDIV(x,y,r,err)    r = op_divmod_adj(x, y, NULL)
-#define OP_UINT_FLOORDIV(x,y,r,err)   r = (x) / (y)
+#define OP_INT_FLOORDIV(x,y,r)    r = op_divmod_adj(x, y, NULL)
+#define OP_UINT_FLOORDIV(x,y,r)   r = (x) / (y)
 
-#define OP_INT_FLOORDIV_OVF(x,y,r,err) \
+#define OP_INT_FLOORDIV_OVF(x,y,r) \
 	if ((y) == -1 && (x) < 0 && ((unsigned long)(x) << 1) == 0) \
-		FAIL_OVF(err, "integer division"); \
-	OP_INT_FLOORDIV(x,y,r,err)
+            { FAIL_OVF("integer division"); } \
+        else OP_INT_FLOORDIV(x,y,r)
 
-#define OP_INT_FLOORDIV_ZER(x,y,r,err) \
-	if ((y)) { OP_INT_FLOORDIV(x,y,r,err); } \
-	else FAIL_ZER(err, "integer division")
-#define OP_UINT_FLOORDIV_ZER(x,y,r,err) \
-	if ((y)) { OP_UINT_FLOORDIV(x,y,r,err); } \
-	else FAIL_ZER(err, "unsigned integer division")
-
-#define OP_INT_FLOORDIV_OVF_ZER(x,y,r,err) \
-	if ((y)) { OP_INT_FLOORDIV_OVF(x,y,r,err); } \
-	else FAIL_ZER(err, "integer division")
+#define OP_INT_FLOORDIV_ZER(x,y,r) \
+	if ((y)) { OP_INT_FLOORDIV(x,y,r); } \
+	else FAIL_ZER("integer division")
+#define OP_UINT_FLOORDIV_ZER(x,y,r) \
+	if ((y)) { OP_UINT_FLOORDIV(x,y,r); } \
+	else FAIL_ZER("unsigned integer division")
+
+#define OP_INT_FLOORDIV_OVF_ZER(x,y,r) \
+	if ((y)) { OP_INT_FLOORDIV_OVF(x,y,r); } \
+	else FAIL_ZER("integer division")
 
 /* modulus */
 
-#define OP_INT_MOD(x,y,r,err)     op_divmod_adj(x, y, &r)
-#define OP_UINT_MOD(x,y,r,err)    r = (x) % (y)
+#define OP_INT_MOD(x,y,r)     op_divmod_adj(x, y, &r)
+#define OP_UINT_MOD(x,y,r)    r = (x) % (y)
 
-#define OP_INT_MOD_OVF(x,y,r,err) \
+#define OP_INT_MOD_OVF(x,y,r) \
 	if ((y) == -1 && (x) < 0 && ((unsigned long)(x) << 1) == 0) \
-		FAIL_OVF(err, "integer modulo"); \
-	OP_INT_MOD(x,y,r,err)
+            { FAIL_OVF("integer modulo"); }\
+        else OP_INT_MOD(x,y,r)
 
-#define OP_INT_MOD_ZER(x,y,r,err) \
-	if ((y)) { OP_INT_MOD(x,y,r,err); } \
-	else FAIL_ZER(err, "integer modulo")
-#define OP_UINT_MOD_ZER(x,y,r,err) \
-	if ((y)) { OP_UINT_MOD(x,y,r,err); } \
-	else FAIL_ZER(err, "unsigned integer modulo")
-
-#define OP_INT_MOD_OVF_ZER(x,y,r,err) \
-	if ((y)) { OP_INT_MOD_OVF(x,y,r,err); } \
-	else FAIL_ZER(err, "integer modulo")
+#define OP_INT_MOD_ZER(x,y,r) \
+	if ((y)) { OP_INT_MOD(x,y,r); } \
+	else FAIL_ZER("integer modulo")
+#define OP_UINT_MOD_ZER(x,y,r) \
+	if ((y)) { OP_UINT_MOD(x,y,r); } \
+	else FAIL_ZER("unsigned integer modulo")
+
+#define OP_INT_MOD_OVF_ZER(x,y,r) \
+	if ((y)) { OP_INT_MOD_OVF(x,y,r); } \
+	else FAIL_ZER("integer modulo")
 
 /* bit operations */
 
-#define OP_INT_AND(x,y,r,err)     r = (x) & (y)
-#define OP_INT_OR( x,y,r,err)     r = (x) | (y)
-#define OP_INT_XOR(x,y,r,err)     r = (x) ^ (y)
+#define OP_INT_AND(x,y,r)     r = (x) & (y)
+#define OP_INT_OR( x,y,r)     r = (x) | (y)
+#define OP_INT_XOR(x,y,r)     r = (x) ^ (y)
 
 /*** conversions ***/
 
-#define OP_CAST_BOOL_TO_INT(x,r,err)    r = (long)(x)
-#define OP_CAST_BOOL_TO_UINT(x,r,err)   r = (unsigned long)(x)
-#define OP_CAST_UINT_TO_INT(x,r,err)    r = (long)(x)
-#define OP_CAST_INT_TO_UINT(x,r,err)    r = (unsigned long)(x)
-#define OP_CAST_INT_TO_LONGLONG(x,r,err) r = (long long)(x)
-#define OP_CAST_CHAR_TO_INT(x,r,err)    r = (long)((unsigned char)(x))
-#define OP_CAST_INT_TO_CHAR(x,r,err)    r = (char)(x)
-#define OP_CAST_PTR_TO_INT(x,r,err)     r = (long)(x)    /* XXX */
+#define OP_CAST_BOOL_TO_INT(x,r)    r = (long)(x)
+#define OP_CAST_BOOL_TO_UINT(x,r)   r = (unsigned long)(x)
+#define OP_CAST_UINT_TO_INT(x,r)    r = (long)(x)
+#define OP_CAST_INT_TO_UINT(x,r)    r = (unsigned long)(x)
+#define OP_CAST_INT_TO_LONGLONG(x,r) r = (long long)(x)
+#define OP_CAST_CHAR_TO_INT(x,r)    r = (long)((unsigned char)(x))
+#define OP_CAST_INT_TO_CHAR(x,r)    r = (char)(x)
+#define OP_CAST_PTR_TO_INT(x,r)     r = (long)(x)    /* XXX */
 
-#define OP_TRUNCATE_LONGLONG_TO_INT(x,r,err) r = (long)(x)
+#define OP_TRUNCATE_LONGLONG_TO_INT(x,r) r = (long)(x)
 
-#define OP_CAST_UNICHAR_TO_INT(x,r,err)    r = (long)((unsigned long)(x)) /*?*/
-#define OP_CAST_INT_TO_UNICHAR(x,r,err)    r = (unsigned int)(x)
+#define OP_CAST_UNICHAR_TO_INT(x,r)    r = (long)((unsigned long)(x)) /*?*/
+#define OP_CAST_INT_TO_UNICHAR(x,r)    r = (unsigned int)(x)
 
 /* bool operations */
 
-#define OP_BOOL_NOT(x, r, err) r = !(x)
+#define OP_BOOL_NOT(x, r) r = !(x)
 
 /* _________________ certain implementations __________________ */
 

Modified: pypy/branch/explicit-exceptions/translator/c/src/ll_stackless.h
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/src/ll_stackless.h	(original)
+++ pypy/branch/explicit-exceptions/translator/c/src/ll_stackless.h	Fri Mar 24 23:08:22 2006
@@ -39,12 +39,11 @@
                     FAIL(exception_label);  \
             }
 #else
-#define StacklessUnwindAndRPyExceptionHandling(unwind_label, resume_label, exception_label) \
+#define StacklessUnwindAndRPyExceptionHandling(unwind_label, resume_label) \
             resume_label:                   \
             if (RPyExceptionOccurred()) {   \
                 if (slp_frame_stack_bottom) \
                     goto unwind_label;      \
-                FAIL(exception_label);      \
             }
 #endif
 
@@ -54,12 +53,10 @@
 
 #define RPyExceptionClear()
 
-#define StacklessUnwindAndRPyExceptionHandling(unwind_label, resume_label, exception_label) do { \
+#define StacklessUnwindAndRPyExceptionHandling(unwind_label, resume_label) do { \
             if (slp_frame_stack_bottom)     \
                 goto unwind_label;          \
             resume_label:                   \
-            if (RPyExceptionOccurred())     \
-                FAIL(exception_label);      \
             } while (0)
 #endif
 

Modified: pypy/branch/explicit-exceptions/translator/c/src/mem.h
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/src/mem.h	(original)
+++ pypy/branch/explicit-exceptions/translator/c/src/mem.h	Fri Mar 24 23:08:22 2006
@@ -8,10 +8,10 @@
    to compute the largest allowed number of items in the array. */
 #define MAXIMUM_MALLOCABLE_SIZE   (LONG_MAX-4096)
 
-#define OP_MAX_VARSIZE(numitems, itemtype, err)  {			\
+#define OP_MAX_VARSIZE(numitems, itemtype)  {			\
     if (((unsigned long)(numitems)) >					\
 		(MAXIMUM_MALLOCABLE_SIZE / sizeof(itemtype)))		\
-        FAIL_EXCEPTION(err, PyExc_MemoryError, "addr space overflow");	\
+        FAIL_EXCEPTION(PyExc_MemoryError, "addr space overflow");	\
   } 
 
 
@@ -20,11 +20,13 @@
    other globals, plus one.  This upper bound "approximation" will do... */
 #define REFCOUNT_IMMORTAL  (INT_MAX/2)
 
-#define OP_ZERO_MALLOC(size, r, err)  {                                 \
+#define OP_ZERO_MALLOC(size, r)  {                                      \
     r = (void*) PyObject_Malloc(size);                                  \
-    if (r == NULL) FAIL_EXCEPTION(err, PyExc_MemoryError, "out of memory");\
-    memset((void*) r, 0, size);                                         \
-    COUNT_MALLOC;                                                       \
+    if (r == NULL) {FAIL_EXCEPTION(PyExc_MemoryError, "out of memory"); } \
+    else {                                                              \
+        memset((void*) r, 0, size);                                     \
+        COUNT_MALLOC;                                                   \
+    }                                                                   \
   }
 
 #define OP_FREE(p)	{ PyObject_Free(p); COUNT_FREE; }
@@ -65,11 +67,13 @@
 /* #define BOEHM_MALLOC_0_1   GC_MALLOC_IGNORE_OFF_PAGE */
 /* #define BOEHM_MALLOC_1_1   GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE */
 
-#define OP_BOEHM_ZERO_MALLOC(size, r, is_atomic, is_varsize, err)   {        \
+#define OP_BOEHM_ZERO_MALLOC(size, r, is_atomic, is_varsize)   {             \
 	r = (void*) BOEHM_MALLOC_ ## is_atomic ## _ ## is_varsize (size);    \
-	if (r == NULL) FAIL_EXCEPTION(err, PyExc_MemoryError, "out of memory");	\
-	if (is_atomic)  /* the non-atomic versions return cleared memory */  \
-		memset((void*) r, 0, size);                                  \
+	if (r == NULL) FAIL_EXCEPTION(PyExc_MemoryError, "out of memoy");    \
+        else {                                                               \
+            if (is_atomic)  /* the non-atomic versions return cleared memory */  \
+                memset((void*) r, 0, size);                                   \
+        }                                                                     \
   }
 
 /* as we said in rbuiltin.py: 
@@ -77,7 +81,7 @@
 # some kind of proper GC integration
 if GC integration has happened and this junk is still here, please delete it :)
 */
-#define OP_CALL_BOEHM_GC_ALLOC(size, r, err) OP_BOEHM_ZERO_MALLOC(size, r, 0, 0, err)
+#define OP_CALL_BOEHM_GC_ALLOC(size, r) OP_BOEHM_ZERO_MALLOC(size, r, 0, 0)
 
 #endif /* USING_BOEHM_GC */
 
@@ -86,11 +90,13 @@
 
 #undef OP_ZERO_MALLOC
 
-#define OP_ZERO_MALLOC(size, r, err)  {                                 \
+#define OP_ZERO_MALLOC(size, r)  {                                 \
     r = (void*) malloc(size);                                  \
-    if (r == NULL) FAIL_EXCEPTION(err, PyExc_MemoryError, "out of memory");\
-    memset((void*) r, 0, size);                                         \
-    COUNT_MALLOC;                                                       \
+    if (r == NULL) FAIL_EXCEPTION(PyExc_MemoryError, "out of memory");\
+    else {                                                                  \
+        memset((void*) r, 0, size);                                         \
+        COUNT_MALLOC;                                                       \
+    }                                                                       \
   }
 
 #undef PUSH_ALIVE

Modified: pypy/branch/explicit-exceptions/translator/c/src/pyobj.h
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/src/pyobj.h	(original)
+++ pypy/branch/explicit-exceptions/translator/c/src/pyobj.h	Fri Mar 24 23:08:22 2006
@@ -4,187 +4,198 @@
   /***  as OP_XXX() macros calling the CPython API          ***/
 
 
-#define op_bool(r,err,what) { \
+#define op_bool(r,what) { \
 		int _retval = what; \
-		if (_retval < 0) CFAIL(err); \
-		r = PyBool_FromLong(_retval); \
+		if (_retval < 0) {CFAIL(); } \
+                else                         \
+                    r = PyBool_FromLong(_retval); \
 	}
 
-#define op_richcmp(x,y,r,err,dir) \
-					if (!(r=PyObject_RichCompare(x,y,dir))) CFAIL(err)
-#define OP_LT(x,y,r,err)  op_richcmp(x,y,r,err, Py_LT)
-#define OP_LE(x,y,r,err)  op_richcmp(x,y,r,err, Py_LE)
-#define OP_EQ(x,y,r,err)  op_richcmp(x,y,r,err, Py_EQ)
-#define OP_NE(x,y,r,err)  op_richcmp(x,y,r,err, Py_NE)
-#define OP_GT(x,y,r,err)  op_richcmp(x,y,r,err, Py_GT)
-#define OP_GE(x,y,r,err)  op_richcmp(x,y,r,err, Py_GE)
-
-#define OP_IS_(x,y,r,err) op_bool(r,err,(x == y))
-
-#define OP_IS_TRUE(x,r,err) op_bool(r,err,PyObject_IsTrue(x))
-#define OP_NONZERO(x,r,err) op_bool(r,err,PyObject_IsTrue(x))
-
-#define OP_LEN(x,r,err) { \
-		int _retval = PyObject_Size(x); \
-		if (_retval < 0) CFAIL(err); \
-		r = PyInt_FromLong(_retval); \
+#define op_richcmp(x,y,r,dir) \
+					if (!(r=PyObject_RichCompare(x,y,dir))) CFAIL()
+#define OP_LT(x,y,r)  op_richcmp(x,y,r, Py_LT)
+#define OP_LE(x,y,r)  op_richcmp(x,y,r, Py_LE)
+#define OP_EQ(x,y,r)  op_richcmp(x,y,r, Py_EQ)
+#define OP_NE(x,y,r)  op_richcmp(x,y,r, Py_NE)
+#define OP_GT(x,y,r)  op_richcmp(x,y,r, Py_GT)
+#define OP_GE(x,y,r)  op_richcmp(x,y,r, Py_GE)
+
+#define OP_IS_(x,y,r) op_bool(r,(x == y))
+
+#define OP_IS_TRUE(x,r) op_bool(r,PyObject_IsTrue(x))
+#define OP_NONZERO(x,r) op_bool(r,PyObject_IsTrue(x))
+
+#define OP_LEN(x,r) { \
+		int _retval = PyObject_Size(x);  \
+		if (_retval < 0) { CFAIL() };    \
+                else                             \
+                    r = PyInt_FromLong(_retval); \
 	}
-#define OP_NEG(x,r,err)           if (!(r=PyNumber_Negative(x)))     CFAIL(err)
-#define OP_POS(x,r,err)           if (!(r=PyNumber_Positive(x)))     CFAIL(err)
-#define OP_INVERT(x,r,err)        if (!(r=PyNumber_Invert(x)))       CFAIL(err)
-#define OP_ABS(x,r,err)           if (!(r=PyNumber_Absolute(x)))     CFAIL(err)
-
-#define OP_ADD(x,y,r,err)         if (!(r=PyNumber_Add(x,y)))        CFAIL(err)
-#define OP_SUB(x,y,r,err)         if (!(r=PyNumber_Subtract(x,y)))   CFAIL(err)
-#define OP_MUL(x,y,r,err)         if (!(r=PyNumber_Multiply(x,y)))   CFAIL(err)
-#define OP_TRUEDIV(x,y,r,err)     if (!(r=PyNumber_TrueDivide(x,y))) CFAIL(err)
-#define OP_FLOORDIV(x,y,r,err)    if (!(r=PyNumber_FloorDivide(x,y)))CFAIL(err)
-#define OP_DIV(x,y,r,err)         if (!(r=PyNumber_Divide(x,y)))     CFAIL(err)
-#define OP_MOD(x,y,r,err)         if (!(r=PyNumber_Remainder(x,y)))  CFAIL(err)
-#define OP_DIVMOD(x,y,r,err)      if (!(r=PyNumber_Divmod(x,y)))     CFAIL(err)
-#define OP_POW(x,y,z,r,err)       if (!(r=PyNumber_Power(x,y,z)))    CFAIL(err)
-#define OP_LSHIFT(x,y,r,err)      if (!(r=PyNumber_Lshift(x,y)))     CFAIL(err)
-#define OP_RSHIFT(x,y,r,err)      if (!(r=PyNumber_Rshift(x,y)))     CFAIL(err)
-#define OP_AND_(x,y,r,err)        if (!(r=PyNumber_And(x,y)))        CFAIL(err)
-#define OP_OR_(x,y,r,err)         if (!(r=PyNumber_Or(x,y)))         CFAIL(err)
-#define OP_XOR(x,y,r,err)         if (!(r=PyNumber_Xor(x,y)))        CFAIL(err)
-
-#define OP_INPLACE_ADD(x,y,r,err) if (!(r=PyNumber_InPlaceAdd(x,y)))           \
-								     CFAIL(err)
-#define OP_INPLACE_SUB(x,y,r,err) if (!(r=PyNumber_InPlaceSubtract(x,y)))      \
-								     CFAIL(err)
-#define OP_INPLACE_MUL(x,y,r,err) if (!(r=PyNumber_InPlaceMultiply(x,y)))      \
-								     CFAIL(err)
-#define OP_INPLACE_TRUEDIV(x,y,r,err) if (!(r=PyNumber_InPlaceTrueDivide(x,y)))\
-								     CFAIL(err)
-#define OP_INPLACE_FLOORDIV(x,y,r,err)if(!(r=PyNumber_InPlaceFloorDivide(x,y)))\
-								     CFAIL(err)
-#define OP_INPLACE_DIV(x,y,r,err) if (!(r=PyNumber_InPlaceDivide(x,y)))        \
-								     CFAIL(err)
-#define OP_INPLACE_MOD(x,y,r,err) if (!(r=PyNumber_InPlaceRemainder(x,y)))     \
-								     CFAIL(err)
-#define OP_INPLACE_POW(x,y,r,err) if (!(r=PyNumber_InPlacePower(x,y,Py_None))) \
-								     CFAIL(err)
-#define OP_INPLACE_LSHIFT(x,y,r,err) if (!(r=PyNumber_InPlaceLshift(x,y)))     \
-								     CFAIL(err)
-#define OP_INPLACE_RSHIFT(x,y,r,err) if (!(r=PyNumber_InPlaceRshift(x,y)))     \
-								     CFAIL(err)
-#define OP_INPLACE_AND(x,y,r,err)    if (!(r=PyNumber_InPlaceAnd(x,y)))        \
-								     CFAIL(err)
-#define OP_INPLACE_OR(x,y,r,err)     if (!(r=PyNumber_InPlaceOr(x,y)))         \
-								     CFAIL(err)
-#define OP_INPLACE_XOR(x,y,r,err)    if (!(r=PyNumber_InPlaceXor(x,y)))        \
-								     CFAIL(err)
-
-#define OP_GETITEM(x,y,r,err)    if (!(r=PyObject_GetItem1(x,y)))   CFAIL(err)
-#define OP_SETITEM(x,y,z,r,err)  if ((PyObject_SetItem1(x,y,z))<0)  CFAIL(err);\
+#define OP_NEG(x,r)           if (!(r=PyNumber_Negative(x)))     CFAIL()
+#define OP_POS(x,r)           if (!(r=PyNumber_Positive(x)))     CFAIL()
+#define OP_INVERT(x,r)        if (!(r=PyNumber_Invert(x)))       CFAIL()
+#define OP_ABS(x,r)           if (!(r=PyNumber_Absolute(x)))     CFAIL()
+
+#define OP_ADD(x,y,r)         if (!(r=PyNumber_Add(x,y)))        CFAIL()
+#define OP_SUB(x,y,r)         if (!(r=PyNumber_Subtract(x,y)))   CFAIL()
+#define OP_MUL(x,y,r)         if (!(r=PyNumber_Multiply(x,y)))   CFAIL()
+#define OP_TRUEDIV(x,y,r)     if (!(r=PyNumber_TrueDivide(x,y))) CFAIL()
+#define OP_FLOORDIV(x,y,r)    if (!(r=PyNumber_FloorDivide(x,y)))CFAIL()
+#define OP_DIV(x,y,r)         if (!(r=PyNumber_Divide(x,y)))     CFAIL()
+#define OP_MOD(x,y,r)         if (!(r=PyNumber_Remainder(x,y)))  CFAIL()
+#define OP_DIVMOD(x,y,r)      if (!(r=PyNumber_Divmod(x,y)))     CFAIL()
+#define OP_POW(x,y,z,r)       if (!(r=PyNumber_Power(x,y,z)))    CFAIL()
+#define OP_LSHIFT(x,y,r)      if (!(r=PyNumber_Lshift(x,y)))     CFAIL()
+#define OP_RSHIFT(x,y,r)      if (!(r=PyNumber_Rshift(x,y)))     CFAIL()
+#define OP_AND_(x,y,r)        if (!(r=PyNumber_And(x,y)))        CFAIL()
+#define OP_OR_(x,y,r)         if (!(r=PyNumber_Or(x,y)))         CFAIL()
+#define OP_XOR(x,y,r)         if (!(r=PyNumber_Xor(x,y)))        CFAIL()
+
+#define OP_INPLACE_ADD(x,y,r) if (!(r=PyNumber_InPlaceAdd(x,y)))        \
+								     CFAIL()
+#define OP_INPLACE_SUB(x,y,r) if (!(r=PyNumber_InPlaceSubtract(x,y)))   \
+								     CFAIL()
+#define OP_INPLACE_MUL(x,y,r) if (!(r=PyNumber_InPlaceMultiply(x,y)))   \
+								     CFAIL()
+#define OP_INPLACE_TRUEDIV(x,y,r) if (!(r=PyNumber_InPlaceTrueDivide(x,y)))\
+								     CFAIL()
+#define OP_INPLACE_FLOORDIV(x,y,r)if(!(r=PyNumber_InPlaceFloorDivide(x,y)))\
+								     CFAIL()
+#define OP_INPLACE_DIV(x,y,r) if (!(r=PyNumber_InPlaceDivide(x,y)))        \
+								     CFAIL()
+#define OP_INPLACE_MOD(x,y,r) if (!(r=PyNumber_InPlaceRemainder(x,y)))     \
+								     CFAIL()
+#define OP_INPLACE_POW(x,y,r) if (!(r=PyNumber_InPlacePower(x,y,Py_None))) \
+								     CFAIL()
+#define OP_INPLACE_LSHIFT(x,y,r) if (!(r=PyNumber_InPlaceLshift(x,y)))     \
+								     CFAIL()
+#define OP_INPLACE_RSHIFT(x,y,r) if (!(r=PyNumber_InPlaceRshift(x,y)))     \
+								     CFAIL()
+#define OP_INPLACE_AND(x,y,r)    if (!(r=PyNumber_InPlaceAnd(x,y)))        \
+								     CFAIL()
+#define OP_INPLACE_OR(x,y,r)     if (!(r=PyNumber_InPlaceOr(x,y)))         \
+								     CFAIL()
+#define OP_INPLACE_XOR(x,y,r)    if (!(r=PyNumber_InPlaceXor(x,y)))        \
+								     CFAIL()
+
+#define OP_GETITEM(x,y,r)    if (!(r=PyObject_GetItem1(x,y)))   CFAIL()
+#define OP_SETITEM(x,y,z,r)  if ((PyObject_SetItem1(x,y,z))<0)  {CFAIL(); }\
+                             else                                       \
 				  r=Py_None; Py_INCREF(r)
-#define OP_DELITEM(x,y,r,err)    if ((PyObject_DelItem(x,y))<0)     CFAIL(err);\
+#define OP_DELITEM(x,y,r)    if ((PyObject_DelItem(x,y))<0)     CFAIL();\
 				  r=Py_None; Py_INCREF(r)
-#define OP_CONTAINS(x,y,r,err)    op_bool(r,err,(PySequence_Contains(x,y)))
+#define OP_CONTAINS(x,y,r)    op_bool(r,(PySequence_Contains(x,y)))
 
-#define OP_GETATTR(x,y,r,err)    if (!(r=PyObject_GetAttr(x,y)))    CFAIL(err)
-#define OP_SETATTR(x,y,z,r,err)  if ((PyObject_SetAttr(x,y,z))<0)   CFAIL(err);\
+#define OP_GETATTR(x,y,r)    if (!(r=PyObject_GetAttr(x,y)))    CFAIL()
+#define OP_SETATTR(x,y,z,r)  if ((PyObject_SetAttr(x,y,z))<0)   {CFAIL();}\
+                             else                                       \
 				  r=Py_None; Py_INCREF(r)
-#define OP_DELATTR(x,y,r,err)    if ((PyObject_SetAttr(x,y,NULL))<0)CFAIL(err);\
+#define OP_DELATTR(x,y,r)    if ((PyObject_SetAttr(x,y,NULL))<0) {CFAIL();}\
+                             else                                       \
 				  r=Py_None; Py_INCREF(r)
 
-#define OP_NEWSLICE(x,y,z,r,err) if (!(r=PySlice_New(x,y,z)))       CFAIL(err)
+#define OP_NEWSLICE(x,y,z,r) if (!(r=PySlice_New(x,y,z)))       CFAIL()
 
-#define OP_GETSLICE(x,y,z,r,err)  {					\
+#define OP_GETSLICE(x,y,z,r)  {		         			\
 		PyObject *__yo = y, *__zo = z;				\
 		int __y = 0, __z = INT_MAX;				\
 		if (__yo == Py_None) __yo = NULL;			\
 		if (__zo == Py_None) __zo = NULL;			\
 		if (!_PyEval_SliceIndex(__yo, &__y) ||			\
 		    !_PyEval_SliceIndex(__zo, &__z) ||			\
-		    !(r=PySequence_GetSlice(x, __y, __z))) CFAIL(err);	\
+		    !(r=PySequence_GetSlice(x, __y, __z))) CFAIL();	\
 	}
 
-#define OP_ALLOC_AND_SET(x,y,r,err) { \
+#define OP_ALLOC_AND_SET(x,y,r) { \
 		/* XXX check for long/int overflow */ \
 		int __i, __x = PyInt_AsLong(x); \
-		if (PyErr_Occurred()) CFAIL(err); \
-		if (!(r = PyList_New(__x))) CFAIL(err); \
-		for (__i=0; __i<__x; __i++) { \
-			Py_INCREF(y); \
-			PyList_SET_ITEM(r, __i, y); \
-		} \
+		if (PyErr_Occurred()) CFAIL(); \
+                else {                         \
+                    if (!(r = PyList_New(__x))) CFAIL(); \
+                    else {   \
+                        for (__i=0; __i<__x; __i++) { \
+                                Py_INCREF(y); \
+                                PyList_SET_ITEM(r, __i, y); \
+                        } \
+                    } \
+                } \
 	}
 
-#define OP_ITER(x,r,err)          if (!(r=PyObject_GetIter(x)))      CFAIL(err)
-#define OP_NEXT(x,r,err)          if (!(r=PyIter_Next(x))) {                   \
+#define OP_ITER(x,r)          if (!(r=PyObject_GetIter(x)))      CFAIL()
+#define OP_NEXT(x,r)          if (!(r=PyIter_Next(x))) {                   \
 		if (!PyErr_Occurred()) PyErr_SetNone(PyExc_StopIteration);     \
-		CFAIL(err);                                                    \
+		CFAIL();                                                    \
 	}
 
-#define OP_STR(x,r,err)           if (!(r=PyObject_Str(x)))          CFAIL(err)
-#define OP_REPR(x,r,err)          if (!(r=PyObject_Repr(x)))         CFAIL(err)
-#define OP_ORD(s,r,err) { \
+#define OP_STR(x,r)           if (!(r=PyObject_Str(x)))          CFAIL()
+#define OP_REPR(x,r)          if (!(r=PyObject_Repr(x)))         CFAIL()
+#define OP_ORD(s,r) { \
 	char *__c = PyString_AsString(s); \
 	int __len; \
-	if ( !__c) CFAIL(err); \
-	if ((__len = PyString_GET_SIZE(s)) != 1) { \
-	    PyErr_Format(PyExc_TypeError, \
-		  "ord() expected a character, but string of length %d found", \
-		  __len); \
-	    CFAIL(err); \
-	} \
-	if (!(r = PyInt_FromLong((unsigned char)(__c[0])))) \
-	    CFAIL(err); \
+	if ( !__c) CFAIL(); \
+        else { \
+            if ((__len = PyString_GET_SIZE(s)) != 1) { \
+                PyErr_Format(PyExc_TypeError, \
+                      "ord() expected a character, but string of length %d found", \
+                      __len); \
+                CFAIL(); \
+            } \
+            else if (!(r = PyInt_FromLong((unsigned char)(__c[0])))) \
+                { CFAIL(); }\
+        } \
     }
-#define OP_ID(x,r,err)    if (!(r=PyLong_FromVoidPtr(x))) CFAIL(err)
-#define OP_HASH(x,r,err)  { \
+#define OP_ID(x,r)    if (!(r=PyLong_FromVoidPtr(x))) CFAIL()
+#define OP_HASH(x,r)  { \
 	long __hash = PyObject_Hash(x); \
-	if (__hash == -1 && PyErr_Occurred()) CFAIL(err); \
-	if (!(r = PyInt_FromLong(__hash))) CFAIL(err); \
+	if (__hash == -1 && PyErr_Occurred()) CFAIL(); \
+        else if (!(r = PyInt_FromLong(__hash))) { CFAIL(); } \
     }
 
-#define OP_HEX(x,r,err)   { \
+#define OP_HEX(x,r)   { \
 	PyNumberMethods *__nb; \
 	if ((__nb = x->ob_type->tp_as_number) == NULL || \
 	    __nb->nb_hex == NULL) { \
 		PyErr_SetString(PyExc_TypeError, \
 			   "hex() argument can't be converted to hex"); \
-		CFAIL(err); \
+		CFAIL(); \
 	} \
-	if (!(r = (*__nb->nb_hex)(x))) CFAIL(err); \
+        else if (!(r = (*__nb->nb_hex)(x))) { CFAIL(); } \
     }
-#define OP_OCT(x,r,err)   { \
+#define OP_OCT(x,r)   { \
 	PyNumberMethods *__nb; \
 	if ((__nb = x->ob_type->tp_as_number) == NULL || \
 	    __nb->nb_oct == NULL) { \
 		PyErr_SetString(PyExc_TypeError, \
 			   "oct() argument can't be converted to oct"); \
-		CFAIL(err); \
+		CFAIL(); \
 	} \
-	if (!(r = (*__nb->nb_oct)(x))) CFAIL(err); \
+        else if (!(r = (*__nb->nb_oct)(x))) { CFAIL(); } \
     }
 
-#define OP_INT(x,r,err)   { \
+#define OP_INT(x,r)   { \
 	long __val = PyInt_AsLong(x); \
-	if (__val == -1 && PyErr_Occurred()) CFAIL(err); \
-	if (!(r = PyInt_FromLong(__val))) CFAIL (err); \
+	if (__val == -1 && PyErr_Occurred()) CFAIL(); \
+        else if (!(r = PyInt_FromLong(__val))) { CFAIL (); } \
     }
-#define OP_FLOAT(x,r,err)   { \
+#define OP_FLOAT(x,r)   { \
 	double __val = PyFloat_AsDouble(x); \
-	if (PyErr_Occurred()) CFAIL(err); \
-	if (!(r = PyFloat_FromDouble(__val))) CFAIL (err); \
+	if (PyErr_Occurred()) CFAIL(); \
+        else if (!(r = PyFloat_FromDouble(__val))) { CFAIL (); } \
     }
 
-#define OP_CMP(x,y,r,err)   { \
+#define OP_CMP(x,y,r)   { \
 	int __val = PyObject_Compare(x, y); \
-	if (PyErr_Occurred()) CFAIL(err); \
-	if (!(r = PyInt_FromLong(__val))) CFAIL (err); \
+	if (PyErr_Occurred()) CFAIL(); \
+        else if (!(r = PyInt_FromLong(__val))) { CFAIL (); }\
     }
 
 
-#define OP_SIMPLE_CALL(args,r,err) if (!(r=PyObject_CallFunctionObjArgs args)) \
-					CFAIL(err)
-#define OP_CALL_ARGS(args,r,err)   if (!(r=CallWithShape args))    CFAIL(err)
+#define OP_SIMPLE_CALL(args,r) if (!(r=PyObject_CallFunctionObjArgs args)) \
+					CFAIL()
+#define OP_CALL_ARGS(args,r)   if (!(r=CallWithShape args))    CFAIL()
 
 /* Needs to act like getattr(x, '__class__', type(x)) */
-#define OP_TYPE(x,r,err) { \
+#define OP_TYPE(x,r) { \
 		PyObject *o = x; \
 		if (PyInstance_Check(o)) { \
 			r = (PyObject*)(((PyInstanceObject*)o)->in_class); \
@@ -195,26 +206,26 @@
 	}
 
 /* Needs to act like instance(x,y) */
-#define OP_ISSUBTYPE(x,y,r,err)  \
-		op_bool(r,err,PyObject_IsSubclass(x, y))
+#define OP_ISSUBTYPE(x,y,r)  \
+		op_bool(r,PyObject_IsSubclass(x, y))
 
 
 /*** operations with a variable number of arguments ***/
 
-#define OP_NEWLIST0(r,err)         if (!(r=PyList_New(0))) CFAIL(err)
-#define OP_NEWLIST(args,r,err)     if (!(r=PyList_Pack args)) CFAIL(err)
-#define OP_NEWDICT0(r,err)         if (!(r=PyDict_New())) CFAIL(err)
-#define OP_NEWDICT(args,r,err)     if (!(r=PyDict_Pack args)) CFAIL(err)
-#define OP_NEWTUPLE(args,r,err)    if (!(r=PyTuple_Pack args)) CFAIL(err)
+#define OP_NEWLIST0(r)         if (!(r=PyList_New(0))) CFAIL()
+#define OP_NEWLIST(args,r)     if (!(r=PyList_Pack args)) CFAIL()
+#define OP_NEWDICT0(r)         if (!(r=PyDict_New())) CFAIL()
+#define OP_NEWDICT(args,r)     if (!(r=PyDict_Pack args)) CFAIL()
+#define OP_NEWTUPLE(args,r)    if (!(r=PyTuple_Pack args)) CFAIL()
 
 /*** argument parsing ***/
 
-#define OP_DECODE_ARG(fname, pos, name, vargs, vkwds, r, err)	\
-	if (!(r=decode_arg(fname, pos, name, vargs, vkwds, NULL))) CFAIL(err)
-#define OP_DECODE_ARG_DEF(fname, pos, name, vargs, vkwds, def, r, err)	\
-	if (!(r=decode_arg(fname, pos, name, vargs, vkwds, def))) CFAIL(err)
-#define OP_CHECK_NO_MORE_ARG(fname, n, vargs, r, err)	\
-	if (check_no_more_arg(fname, n, vargs) < 0) CFAIL(err)
+#define OP_DECODE_ARG(fname, pos, name, vargs, vkwds, r)	\
+	if (!(r=decode_arg(fname, pos, name, vargs, vkwds, NULL))) CFAIL()
+#define OP_DECODE_ARG_DEF(fname, pos, name, vargs, vkwds, def, r)	\
+	if (!(r=decode_arg(fname, pos, name, vargs, vkwds, def))) CFAIL()
+#define OP_CHECK_NO_MORE_ARG(fname, n, vargs, r)	\
+	if (check_no_more_arg(fname, n, vargs) < 0) CFAIL()
 
 unsigned long long RPyLong_AsUnsignedLongLong(PyObject *v);
 long long RPyLong_AsLongLong(PyObject *v);

Modified: pypy/branch/explicit-exceptions/translator/c/src/support.h
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/src/support.h	(original)
+++ pypy/branch/explicit-exceptions/translator/c/src/support.h	Fri Mar 24 23:08:22 2006
@@ -9,15 +9,14 @@
 #define MIN(a,b) (((a)<(b))?(a):(b))
 #endif /* MIN */
 
-#define FAIL_EXCEPTION(err, exc, msg) \
+#define FAIL_EXCEPTION(exc, msg) \
 	{ \
 		RPyRaiseSimpleException(exc, msg); \
-		FAIL(err); \
 	}
-#define FAIL_OVF(err, msg) FAIL_EXCEPTION(err, PyExc_OverflowError, msg)
-#define FAIL_VAL(err, msg) FAIL_EXCEPTION(err, PyExc_ValueError, msg)
-#define FAIL_ZER(err, msg) FAIL_EXCEPTION(err, PyExc_ZeroDivisionError, msg)
-#define CFAIL(err)         { RPyConvertExceptionFromCPython(); FAIL(err); }
+#define FAIL_OVF(msg) FAIL_EXCEPTION(PyExc_OverflowError, msg)
+#define FAIL_VAL(msg) FAIL_EXCEPTION(PyExc_ValueError, msg)
+#define FAIL_ZER(msg) FAIL_EXCEPTION(PyExc_ZeroDivisionError, msg)
+#define CFAIL()         { RPyConvertExceptionFromCPython(); }
 
 #define PyString_FromLLCharArrayAndSize(itemsarray, size) \
 		PyString_FromStringAndSize(itemsarray->items, size)

Modified: pypy/branch/explicit-exceptions/translator/c/src/trace.h
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/src/trace.h	(original)
+++ pypy/branch/explicit-exceptions/translator/c/src/trace.h	Fri Mar 24 23:08:22 2006
@@ -16,8 +16,6 @@
 #define TRACE_CALL       __f, __tstate
 #define TRACE_ARGS       PyFrameObject *__f, PyThreadState *__tstate
 
-#define FAIL(err) { __f->f_lineno = __f->f_code->co_firstlineno = __LINE__; goto err; }
-
 #define FUNCTION_HEAD(signature, self, args, names, file, line) \
 	PyThreadState *__tstate = PyThreadState_GET(); \
 	PyObject *__localnames = PyList_CrazyStringPack names; \
@@ -32,10 +30,6 @@
 
 #else /* !defined(USE_CALL_TRACE) */
 
-/* XXX we need to be more clever when exception handling actually checks for
- * specific error values */
-#define FAIL(err) /*goto err */ 
-
 #endif /* defined(USE_CALL_TRACE) */
 
 

Modified: pypy/branch/explicit-exceptions/translator/c/src/unichar.h
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/src/unichar.h	(original)
+++ pypy/branch/explicit-exceptions/translator/c/src/unichar.h	Fri Mar 24 23:08:22 2006
@@ -6,6 +6,6 @@
 /***  binary operations ***/
 
 /* typedef unsigned pypy_unichar; */
-#define OP_UNICHAR_EQ(x,y,r,err)	 r = ((x) == (y))
-#define OP_UNICHAR_NE(x,y,r,err)	 r = ((x) != (y))
+#define OP_UNICHAR_EQ(x,y,r)	 r = ((x) == (y))
+#define OP_UNICHAR_NE(x,y,r)	 r = ((x) != (y))
 

Modified: pypy/branch/explicit-exceptions/translator/c/stackless.py
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/stackless.py	(original)
+++ pypy/branch/explicit-exceptions/translator/c/stackless.py	Fri Mar 24 23:08:22 2006
@@ -257,7 +257,7 @@
         del self.savelines
         del self.resumeblocks
 
-    def check_directcall_result(self, op, err, specialreturnvalue=None):
+    def check_directcall_result(self, op, specialreturnvalue=None):
         slp = self.db.stacklessdata
         # don't generate code for calls that cannot unwind
         if not specialreturnvalue:
@@ -272,7 +272,7 @@
             if not need_stackless:
                 slp.count_calls[False] += 1
                 return (super(SlpFunctionCodeGenerator, self)
-                        .check_directcall_result(op, err))
+                        .check_directcall_result(op))
         slp.count_calls[True] += 1
         block = self.currentblock
         curpos = block.operations.index(op)
@@ -336,16 +336,16 @@
         # add the checks for the unwinding case just after the directcall
         # in the source
         return 'StacklessUnwindAndRPyExceptionHandling(%s,%s,%s);' % (
-            savelabel, resumelabel, err)
+            savelabel, resumelabel)
 
-    def OP_YIELD_CURRENT_FRAME_TO_CALLER(self, op, err):
+    def OP_YIELD_CURRENT_FRAME_TO_CALLER(self, op):
         # special handling of this operation: call stack_unwind() to force the
         # current frame to be saved into the heap, but don't propagate the
         # unwind -- instead, capture it and return it normally
         line = '/* yield_current_frame_to_caller */\n'
         line += '%s = NULL;\n' % self.expr(op.result)
         line += 'LL_stackless_stack_unwind();\n'
-        line += self.check_directcall_result(op, err,
+        line += self.check_directcall_result(op,
                     specialreturnvalue='slp_return_current_frame_to_caller()')
         return line
 



More information about the Pypy-commit mailing list