[pypy-svn] r52788 - pypy/branch/jit-hotpath/pypy/jit/timeshifter

arigo at codespeak.net arigo at codespeak.net
Thu Mar 20 19:34:28 CET 2008


Author: arigo
Date: Thu Mar 20 19:34:27 2008
New Revision: 52788

Modified:
   pypy/branch/jit-hotpath/pypy/jit/timeshifter/rcontainer.py
Log:
(cfbolz, arigo) Translation fix: can't define functions
with a malloc() if the allocated type is not 'gc'.


Modified: pypy/branch/jit-hotpath/pypy/jit/timeshifter/rcontainer.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/timeshifter/rcontainer.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/timeshifter/rcontainer.py	Thu Mar 20 19:34:27 2008
@@ -101,12 +101,12 @@
 
         self._compute_fielddescs(RGenOp)
 
-        if self.immutable and self.noidentity:
-            self._define_materialize()
-
-        if fixsize:
-            self._define_devirtualize()
-        self._define_allocate(fixsize)
+        if TYPE._gckind == 'gc':    # no 'allocate' for inlined substructs
+            if self.immutable and self.noidentity:
+                self._define_materialize()
+            if fixsize:
+                self._define_devirtualize()
+            self._define_allocate(fixsize)
 
         
     def _compute_fielddescs(self, RGenOp):
@@ -701,6 +701,11 @@
             array[index] = newvalue
         self.perform_setarrayitem = perform_setarrayitem
 
+        if TYPE._gckind == 'gc':    # no allocate for inlined arrays
+            self._define_allocate()
+
+    def _define_allocate(self):
+        TYPE = self.TYPE
         def allocate(rgenop, size):
             a = lltype.malloc(TYPE, size)
             return rgenop.genconst(a)



More information about the Pypy-commit mailing list