[pypy-svn] r18384 - in pypy/dist/pypy/translator/c: . src

arigo at codespeak.net arigo at codespeak.net
Tue Oct 11 12:57:05 CEST 2005


Author: arigo
Date: Tue Oct 11 12:57:01 2005
New Revision: 18384

Modified:
   pypy/dist/pypy/translator/c/genc.py
   pypy/dist/pypy/translator/c/src/ll_stackless.h
   pypy/dist/pypy/translator/c/stackless.py
Log:
(still same 6 people)

Progressing on Stackless GenC.  No more segfault, just garbage result instead.



Modified: pypy/dist/pypy/translator/c/genc.py
==============================================================================
--- pypy/dist/pypy/translator/c/genc.py	(original)
+++ pypy/dist/pypy/translator/c/genc.py	Tue Oct 11 12:57:01 2005
@@ -30,6 +30,10 @@
         pf = self.getentrypointptr()
         db = LowLevelDatabase(translator, standalone=self.standalone, gcpolicy=self.gcpolicy)
 
+        if self.stackless:
+            from pypy.translator.c.stackless import StacklessData
+            db.stacklessdata = StacklessData()
+
         # we need a concrete gcpolicy to do this        
         self.libraries += db.gcpolicy.gc_libraries()
 
@@ -50,8 +54,6 @@
                                       symboltable = self.symboltable)
         else:
             if self.stackless:
-                from pypy.translator.c.stackless import StacklessData
-                db.stacklessdata = StacklessData()
                 defines['USE_STACKLESS'] = '1'
             cfile, extra = gen_source_standalone(db, modulename, targetdir,
                                                  entrypointname = pfname,

Modified: pypy/dist/pypy/translator/c/src/ll_stackless.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_stackless.h	(original)
+++ pypy/dist/pypy/translator/c/src/ll_stackless.h	Tue Oct 11 12:57:01 2005
@@ -30,6 +30,7 @@
 slp_frame_t* slp_new_frame(int size, int state)
 {
   slp_frame_t* f = (slp_frame_t*) malloc(size);
+  assert(f != NULL);   /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
   f->f_back = NULL;
   f->state = state;
   return f;

Modified: pypy/dist/pypy/translator/c/stackless.py
==============================================================================
--- pypy/dist/pypy/translator/c/stackless.py	(original)
+++ pypy/dist/pypy/translator/c/stackless.py	Tue Oct 11 12:57:01 2005
@@ -228,16 +228,16 @@
         for v, fieldname in variables_to_restore:
             varname = self.expr(v)
             vartype = self.lltypename(v).replace('@', '')
-            lines.append('\t%s = (%s)(((struct %s*) f)->%s);' % (
+            lines.append('%s = (%s)(((struct %s*) f)->%s);' % (
                 varname, vartype, structname, fieldname))
             retvarname = self.expr(op.result)
             retvartype = self.lltypename(op.result).replace('@', '')
             retvarst = simplified_type(op.result.concretetype)
             if retvarst is not None:
                 globalretvalvarname = RETVALVARS[retvarst]
-                lines.append('\t%s = (%s) %s;' % (
+                lines.append('%s = (%s) %s;' % (
                     retvarname, retvartype, globalretvalvarname))
-            lines.append('\tgoto %s;' % (resumelabel,))
+        lines.append('goto %s;' % (resumelabel,))
         self.resumeblocks.append(lines)
 
         # add the checks for the unwinding case just after the directcall
@@ -245,9 +245,9 @@
         unwind_check = "if (slp_frame_stack_bottom) goto %s;" % (savelabel,)
         exception_check = (super(SlpFunctionCodeGenerator, self)
                            .check_directcall_result(op, err))
-        return '%s\n%s:\n%s' % (unwind_check,
-                                resumelabel,
-                                exception_check)
+        return '%s\n     %s:\n\t%s' % (unwind_check,
+                                       resumelabel,
+                                       exception_check)
 
 
 def erase_ptr_type(T):



More information about the Pypy-commit mailing list