[pypy-svn] pypy out-of-line-guards: Start of x86 support

fijal commits-noreply at bitbucket.org
Sun Jan 2 15:08:14 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: out-of-line-guards
Changeset: r40323:3ed1dc119524
Date: 2011-01-02 14:35 +0200
http://bitbucket.org/pypy/pypy/changeset/3ed1dc119524/

Log:	Start of x86 support

diff --git a/pypy/jit/backend/x86/assembler.py b/pypy/jit/backend/x86/assembler.py
--- a/pypy/jit/backend/x86/assembler.py
+++ b/pypy/jit/backend/x86/assembler.py
@@ -203,6 +203,7 @@
                _x86_param_depth
                _x86_arglocs
                _x86_debug_checksum
+               _x86_asm_invalidated
         '''
         # XXX this function is too longish and contains some code
         # duplication with assemble_bridge().  Also, we should think
@@ -253,6 +254,10 @@
         looptoken._x86_bootstrap_code = rawstart + bootstrappos
         looptoken._x86_loop_code = rawstart + self.looppos
         looptoken._x86_direct_bootstrap_code = rawstart + directbootstrappos
+        looptoken._x86_asm_invalidated = lltype.malloc(rffi.CArray(
+            lltype.Signed), 1, flavor='raw', track_allocation=False)
+        # XXX wrong, free it one day
+        looptoken._x86_asm_invalidated[0] = 0
         self.teardown()
         # oprofile support
         if self.cpu.profile_agent is not None:

diff --git a/pypy/jit/backend/x86/runner.py b/pypy/jit/backend/x86/runner.py
--- a/pypy/jit/backend/x86/runner.py
+++ b/pypy/jit/backend/x86/runner.py
@@ -140,6 +140,23 @@
         assert fail_index == fail_index_2
         return faildescr
 
+    def get_invalidate_asm(self, TP, fieldname):
+        def invalidate_asm(arg):
+            next = getattr(arg, fieldname)
+            while next:
+                prev = next
+                llx =  llmemory.weakref_deref(ropaque.ROPAQUE, prev.address)
+                if llx:
+                    x = ropaque.cast_ropaque_to_obj(history.LoopToken, llx)
+                    x.invalidated = True
+                    x._x86_asm_invalidated[0] = 1
+                    for elem in x._back_looptokens:
+                        token = elem()
+                        if token:
+                            self.redirect_call_assembler(token, x._tmp_token)
+                next = next.next
+        return invalidate_asm
+
     def redirect_call_assembler(self, oldlooptoken, newlooptoken):
         self.assembler.redirect_call_assembler(oldlooptoken, newlooptoken)
 


More information about the Pypy-commit mailing list