[pypy-svn] pypy jit-shadowstack: Small fixes.

arigo commits-noreply at bitbucket.org
Thu Mar 31 15:01:36 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: jit-shadowstack
Changeset: r43052:5c9ce3fce574
Date: 2011-03-31 12:54 +0000
http://bitbucket.org/pypy/pypy/changeset/5c9ce3fce574/

Log:	Small fixes.

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
@@ -133,7 +133,7 @@
 
     def setup(self, looptoken):
         assert self.memcpy_addr != 0, "setup_once() not called?"
-        self.currently_compiling_loop = looptoken
+        self.current_clt = looptoken.compiled_loop_token
         self.pending_guard_tokens = []
         self.mc = codebuf.MachineCodeBlockWrapper()
         if self.datablockwrapper is None:
@@ -146,6 +146,7 @@
         self.mc = None
         self.looppos = -1
         self.currently_compiling_loop = None
+        self.current_clt = None
 
     def finish_once(self):
         if self._debug:
@@ -321,6 +322,7 @@
             assert len(set(inputargs)) == len(inputargs)
 
         self.setup(looptoken)
+        self.currently_compiling_loop = looptoken
         funcname = self._find_debug_merge_point(operations)
         if log:
             self._register_counter()
@@ -1046,7 +1048,7 @@
         # instruction that doesn't already have a force_index.
         gcrootmap = self.cpu.gc_ll_descr.gcrootmap
         if gcrootmap and gcrootmap.is_shadow_stack:
-            clt = self.currently_compiling_loop.compiled_loop_token
+            clt = self.current_clt
             force_index = clt.reserve_and_record_some_faildescr_index()
             self.mc.MOV_bi(FORCE_INDEX_OFS, force_index)
             return force_index

diff --git a/pypy/jit/backend/llsupport/gc.py b/pypy/jit/backend/llsupport/gc.py
--- a/pypy/jit/backend/llsupport/gc.py
+++ b/pypy/jit/backend/llsupport/gc.py
@@ -458,7 +458,8 @@
                 if offset == 0:
                     break
                 addr = llmemory.cast_int_to_adr(frame_addr + offset)
-                callback(gc, addr)
+                if gc.points_to_valid_gc_object(addr):
+                    callback(gc, addr)
                 n += 1
         #
         jit2gc.update({


More information about the Pypy-commit mailing list