[pypy-svn] r54260 - in pypy/branch/oo-jit/pypy/jit: codegen codegen/llgraph timeshifter

antocuni at codespeak.net antocuni at codespeak.net
Wed Apr 30 11:51:15 CEST 2008


Author: antocuni
Date: Wed Apr 30 11:51:14 2008
New Revision: 54260

Modified:
   pypy/branch/oo-jit/pypy/jit/codegen/llgraph/rgenop.py
   pypy/branch/oo-jit/pypy/jit/codegen/model.py
   pypy/branch/oo-jit/pypy/jit/timeshifter/vlist.py
Log:
fix force_runtime_container for ootype-fixedsize-list



Modified: pypy/branch/oo-jit/pypy/jit/codegen/llgraph/rgenop.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/llgraph/rgenop.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/llgraph/rgenop.py	Wed Apr 30 11:51:14 2008
@@ -273,6 +273,13 @@
         return LLVar(llimpl.genop(self.b, 'new', vars_gv,
                                   gv_OBJTYPE.v))
 
+    def genop_oonewarray(self, (gv_TYPE, gv_OBJTYPE), gv_length):
+        ll_assert(self.rgenop.currently_writing is self,
+                     "genop_oonewarray: bad currently_writing")
+        vars_gv = [gv_TYPE.v, gv_length.v]
+        return LLVar(llimpl.genop(self.b, 'oonewarray', vars_gv,
+                                  gv_OBJTYPE.v))
+
     def genop_same_as(self, gv_value):
         ll_assert(self.rgenop.currently_writing is self,
                      "genop_same_as: bad currently_writing")

Modified: pypy/branch/oo-jit/pypy/jit/codegen/model.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/model.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/model.py	Wed Apr 30 11:51:14 2008
@@ -88,11 +88,18 @@
 ##     def genop_malloc_fixedsize(self, alloctoken):
 ##     def genop_malloc_varsize(self, varsizealloctoken, gv_size):
 ##     def genop_call(self, sigtoken, gv_fnptr, args_gv):
-##     def genop_oosend(self, methtoken, gv_self, args_gv):
 ##     def genop_same_as(self, gv_x):
 ##     def genop_debug_pdb(self):    # may take an args_gv later
 ##     def genop_cast_int_to_ptr(self, kind, gv_int)
 
+##     # ootype-specific operations
+##     def genop_new(self, alloctoken):
+##     def genop_oonewarray(self, alloctoken, gv_length):
+##     def genop_oosend(self, methtoken, gv_self, args_gv): 
+##     def genop_oononnull(self, gv_obj):
+##     def genop_oogetfield(self, fieldtoken, gv_obj):
+##     def genop_oosetfield(self, fieldtoken, gv_obj, gv_value):
+
     # the other thing that happens for a given chunk is entering and
     # leaving basic blocks inside it.
 

Modified: pypy/branch/oo-jit/pypy/jit/timeshifter/vlist.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/timeshifter/vlist.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/timeshifter/vlist.py	Wed Apr 30 11:51:14 2008
@@ -1,4 +1,5 @@
 from pypy.rpython.lltypesystem import lltype, llmemory
+from pypy.rpython.ootypesystem import ootype
 from pypy.jit.timeshifter.rcontainer import VirtualContainer, FrozenContainer
 from pypy.jit.timeshifter.rcontainer import cachedtype
 from pypy.jit.timeshifter import rvalue, rvirtualizable, oop
@@ -135,11 +136,23 @@
     PtrRedBox = rvalue.InstanceRedBox
 
     def _setup(self, RGenOp, rtyper, LIST):
-        self.alloctoken = RGenOp.allocToken(LIST)
-        self.tok_ll_resize = self._tok(RGenOp, LIST, '_ll_resize')
         self.tok_ll_setitem_fast = self._tok(RGenOp, LIST,
                                              'll_setitem_fast')
 
+        alloctoken = RGenOp.allocToken(LIST)
+        tok_ll_resize = self._tok(RGenOp, LIST, '_ll_resize')
+        if isinstance(LIST, ootype.Array):
+            def gen_newlist_impl(builder, args_gv):
+                assert len(args_gv) == 1
+                gv_length = args_gv[0]
+                return builder.genop_oonewarray(alloctoken, gv_length)
+        else:
+            def gen_newlist_impl(builder, args_gv):
+                gv_lst = builder.genop_new(alloctoken)
+                builder.genop_oosend(tok_ll_resize, gv_lst, args_gv)
+                return gv_lst
+        self.gen_newlist_impl = gen_newlist_impl
+
     def _tok(self, RGenOp, LIST, name):
         _, meth = LIST._lookup(name)
         if meth is None:
@@ -151,9 +164,7 @@
         pass # XXX
 
     def gen_newlist(self, builder, args_gv):
-        gv_lst = builder.genop_new(self.alloctoken)
-        builder.genop_oosend(self.tok_ll_resize, gv_lst, args_gv)
-        return gv_lst
+        return self.gen_newlist_impl(builder, args_gv)
 
     def gen_setitem_fast(self, builder, args_gv):
         gv_lst = args_gv.pop(0)



More information about the Pypy-commit mailing list