[pypy-svn] pypy out-of-line-guards: Replace hacks with calls to ropauqe

fijal commits-noreply at bitbucket.org
Sun Jan 2 10:40:52 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: out-of-line-guards
Changeset: r40315:8fe345edd255
Date: 2011-01-02 11:30 +0200
http://bitbucket.org/pypy/pypy/changeset/8fe345edd255/

Log:	Replace hacks with calls to ropauqe

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
@@ -16,7 +16,7 @@
 from pypy.jit.backend.llgraph import llimpl, symbolic
 from pypy.jit.metainterp.typesystem import llhelper, oohelper
 from pypy.jit.codewriter import heaptracker
-from pypy.rlib import rgc
+from pypy.rlib import rgc, ropaque
 
 class MiniStats:
     pass
@@ -493,9 +493,9 @@
             next = getattr(arg, fieldname)
             while next:
                 prev = next
-                x = llmemory.weakref_deref(history.LoopToken._TYPE,
-                                           prev.address)
-                if x:
+                llx =  llmemory.weakref_deref(ropaque.ROPAQUE, prev.address)
+                if llx:
+                    x = ropaque.cast_ropaque_to_obj(history.LoopToken, llx)
                     x.invalidated = True
                     compiled = x.compiled_loop_token.compiled_version
                     llimpl.mark_as_invalid(compiled)

diff --git a/pypy/jit/metainterp/history.py b/pypy/jit/metainterp/history.py
--- a/pypy/jit/metainterp/history.py
+++ b/pypy/jit/metainterp/history.py
@@ -726,20 +726,6 @@
     was compiled; but the LoopDescr remains alive and points to the
     generated assembler.
     """
-    # <hack> to make tests think we're dealing with an actual lltype
-    _TYPE = lltype.Ptr(lltype.GcStruct('dummy struct for tests'))
-
-    def _normalizedcontainer(self):
-        return self
-
-    def _getobj(self, check=True):
-        return self
-    _as_ptr = _getobj
-    _obj0 = None
-    _obj = property(_getobj)
-    def _was_freed(self):
-        return False
-    # </hack>
     
     terminating = False # see TerminatingLoopToken in compile.py
     outermost_jitdriver_sd = None

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
@@ -5,7 +5,7 @@
 from pypy.rlib.unroll import unrolling_iterable
 from pypy.rlib.debug import debug_start, debug_stop, debug_print
 from pypy.rlib.debug import make_sure_not_resized
-from pypy.rlib import nonconst
+from pypy.rlib import nonconst, ropaque
 
 from pypy.jit.metainterp import history, compile, resume
 from pypy.jit.metainterp.history import Const, ConstInt, ConstPtr, ConstFloat
@@ -2238,11 +2238,8 @@
         self.history.operations.append(op)
 
     def remember_jit_invariants(self, loop):
-        if we_are_translated():
-            looptoken = cast_instance_to_base_ptr(loop.token)
-        else:
-            looptoken = loop.token
-        lltoken_weakref = llmemory.weakref_create(looptoken)
+        lllooptoken = ropaque.cast_obj_to_ropaque(loop.token)
+        lltoken_weakref = llmemory.weakref_create(lllooptoken)
         seen = {}
         for b_struct, c_appender in self.invariant_structs:
             if (b_struct, c_appender) not in seen:


More information about the Pypy-commit mailing list