[pypy-svn] r65248 - in pypy/branch/pyjitpl5/pypy: jit/backend/x86 rpython/lltypesystem rpython/memory/gctransform

arigo at codespeak.net arigo at codespeak.net
Mon May 11 23:19:41 CEST 2009


Author: arigo
Date: Mon May 11 23:19:41 2009
New Revision: 65248

Modified:
   pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py
   pypy/branch/pyjitpl5/pypy/jit/backend/x86/gc.py
   pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/lloperation.py
   pypy/branch/pyjitpl5/pypy/rpython/memory/gctransform/framework.py
Log:
Transation fixes: add an operation 'do_malloc_fixedsize_clear'
that is replaced later by the GC transform with a direct_call to
the GC method of the same name.

Fix a bug in the order of arguments in assembler.py.


Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/assembler.py	Mon May 11 23:19:41 2009
@@ -399,7 +399,7 @@
             
 
     def call(self, addr, args, res):
-        for i in range(len(args)):
+        for i in range(len(args)-1, -1, -1):
             arg = args[i]
             assert not isinstance(arg, MODRM)
             self.mc.PUSH(arg)

Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/gc.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/gc.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/gc.py	Mon May 11 23:19:41 2009
@@ -1,6 +1,6 @@
 from pypy.rpython.lltypesystem import lltype, llmemory, rffi, rclass
 from pypy.rpython.lltypesystem.lloperation import llop
-from pypy.rpython.annlowlevel import cast_base_ptr_to_instance
+from pypy.rpython.annlowlevel import llhelper
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.jit.backend.x86 import symbolic
 from pypy.jit.backend.x86.runner import ConstDescr3
@@ -64,14 +64,12 @@
         # where it can be fished and reused by the FrameworkGCTransformer
         self.layoutbuilder = framework.TransformerLayoutBuilder()
         self.translator._transformerlayoutbuilder_from_jit = self.layoutbuilder
-        GCClass, _ = choose_gc_from_config(gcdescr.config)
+        #GCClass, _ = choose_gc_from_config(gcdescr.config)
 
         # make a malloc function, with three arguments
-        def getgc():
-            ptr = llop.get_gc_pointer(rclass.OBJECTPTR)
-            return cast_base_ptr_to_instance(GCClass, ptr)
         def malloc_basic(size, type_id, has_finalizer):
-            return getgc().malloc_fixedsize_clear(type_id, size, True,
+            return llop.do_malloc_fixedsize_clear(llmemory.GCREF,
+                                                  type_id, size, True,
                                                   has_finalizer, False)
         self.malloc_basic = malloc_basic
         self.GC_MALLOC_BASIC = lltype.Ptr(lltype.FuncType(

Modified: pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/lloperation.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/lloperation.py	(original)
+++ pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/lloperation.py	Mon May 11 23:19:41 2009
@@ -387,7 +387,7 @@
     'promote_virtualizable':LLOp(canrun=True),
     'get_exception_addr':   LLOp(),
     'get_exc_value_addr':   LLOp(),
-    'get_gc_pointer':       LLOp(),
+    'do_malloc_fixedsize_clear': LLOp(),
 
     # __________ GC operations __________
 

Modified: pypy/branch/pyjitpl5/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/rpython/memory/gctransform/framework.py	(original)
+++ pypy/branch/pyjitpl5/pypy/rpython/memory/gctransform/framework.py	Mon May 11 23:19:41 2009
@@ -596,6 +596,17 @@
                   [c_result],
                   resultvar=op.result)
 
+    def gct_do_malloc_fixedsize_clear(self, hop):
+        # used by the JIT (see the x86 backend)
+        op = hop.spaceop
+        [v_typeid, v_size, v_can_collect,
+         v_has_finalizer, v_contains_weakptr] = op.args
+        hop.genop("direct_call",
+                  [self.malloc_fixedsize_clear_ptr, self.c_const_gc,
+                   v_typeid, v_size, v_can_collect,
+                   v_has_finalizer, v_contains_weakptr],
+                  resultvar=op.result)
+
     def gct_zero_gc_pointers_inside(self, hop):
         if not self.malloc_zero_filled:
             v_ob = hop.spaceop.args[0]



More information about the Pypy-commit mailing list