[pypy-svn] pypy out-of-line-guards: rpythonize

fijal commits-noreply at bitbucket.org
Sun Jan 2 11:43:21 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: out-of-line-guards
Changeset: r40318:c71e2f44da39
Date: 2011-01-02 12:42 +0200
http://bitbucket.org/pypy/pypy/changeset/c71e2f44da39/

Log:	rpythonize

diff --git a/pypy/jit/metainterp/compile.py b/pypy/jit/metainterp/compile.py
--- a/pypy/jit/metainterp/compile.py
+++ b/pypy/jit/metainterp/compile.py
@@ -101,7 +101,8 @@
     if old_loop_token is not None:
         metainterp.staticdata.log("reusing old loop")
         return old_loop_token
-    if hasattr(metainterp, 'remember_jit_invariants'): # for tests
+    if we_are_translated() or hasattr(metainterp, 'remember_jit_invariants'):
+        # for tests
         metainterp.remember_jit_invariants(loop)
     send_loop_to_backend(metainterp_sd, loop, "loop")
     insert_loop_token(old_loop_tokens, loop_token)
@@ -565,7 +566,8 @@
         # know exactly what we must do (ResumeGuardDescr/ResumeFromInterpDescr)
         prepare_last_operation(new_loop, target_loop_token)
         resumekey.compile_and_attach(metainterp, new_loop)
-        if hasattr(metainterp, 'remember_jit_invariants'): # for tests
+        if we_are_translated() or hasattr(metainterp, 'remember_jit_invariants'):
+            # for tests
             metainterp.remember_jit_invariants(new_loop)
         record_loop_or_bridge(new_loop)
     return target_loop_token

diff --git a/pypy/jit/backend/llgraph/runner.py b/pypy/jit/backend/llgraph/runner.py
--- a/pypy/jit/backend/llgraph/runner.py
+++ b/pypy/jit/backend/llgraph/runner.py
@@ -489,7 +489,7 @@
         return self.get_fail_descr_from_number(fail_index)
 
     def get_invalidate_asm(self, TP, fieldname):
-        def invalidate_asm(arg, fieldname):
+        def invalidate_asm(arg):
             next = getattr(arg, fieldname)
             while next:
                 prev = next

diff --git a/pypy/rpython/lltypesystem/rclass.py b/pypy/rpython/lltypesystem/rclass.py
--- a/pypy/rpython/lltypesystem/rclass.py
+++ b/pypy/rpython/lltypesystem/rclass.py
@@ -90,6 +90,10 @@
 ASMCODE.become(GcStruct('asmcode', ('address', llmemory.WeakRefPtr),
                         ('next', lltype.Ptr(ASMCODE))))
 
+ASMCODE_APPENDER = lltype.FuncType([llmemory.GCREF, llmemory.WeakRefPtr],
+                                   lltype.Void)
+ASMCODE_APPENDER_PTR = lltype.Ptr(ASMCODE_APPENDER)
+
 def cast_vtable_to_typeptr(vtable):
     while typeOf(vtable).TO != OBJECT_VTABLE:
         vtable = vtable.super

diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py
--- a/pypy/jit/metainterp/pyjitpl.py
+++ b/pypy/jit/metainterp/pyjitpl.py
@@ -2243,8 +2243,10 @@
         seen = {}
         for b_struct, c_appender in self.invariant_structs:
             if (b_struct, c_appender) not in seen:
-                heaptracker.int2adr(c_appender.value).ptr(b_struct.value,
-                                                          lltoken_weakref)
+                adr = heaptracker.int2adr(c_appender.getint())
+                ptr = llmemory.cast_adr_to_ptr(adr,
+                                               rclass.ASMCODE_APPENDER_PTR)
+                ptr(b_struct.getref_base(), lltoken_weakref)
                 seen[(b_struct, c_appender)] = None
 
 # ____________________________________________________________

diff --git a/pypy/jit/metainterp/warmspot.py b/pypy/jit/metainterp/warmspot.py
--- a/pypy/jit/metainterp/warmspot.py
+++ b/pypy/jit/metainterp/warmspot.py
@@ -823,11 +823,11 @@
     def replace_jit_invariant_with_direct_call(self, op):
         op.opname = 'direct_call'
         ARG = op.args[0].concretetype
-        FUNC = lltype.Ptr(lltype.FuncType([ARG, lltype.Void], lltype.Void))
+        FUNC = lltype.Ptr(lltype.FuncType([ARG], lltype.Void))
         llptr = self.helper_func(FUNC, self.cpu.get_invalidate_asm(FUNC,
                                                              op.args[1].value))
         cptr = Constant(llptr, lltype.Void)
-        op.args = [cptr, op.args[0], op.args[1]]
+        op.args = [cptr, op.args[0]]
 
     def rewrite_jit_invariant_setfield(self):
         graphs = self.translator.graphs


More information about the Pypy-commit mailing list