[pypy-svn] pypy out-of-line-guards: Fix all tests. Part of logic can (and should) be moved from warmstate to

fijal commits-noreply at bitbucket.org
Thu Feb 17 16:07:32 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: out-of-line-guards
Changeset: r42113:a22af9a1af46
Date: 2011-02-17 08:07 -0700
http://bitbucket.org/pypy/pypy/changeset/a22af9a1af46/

Log:	Fix all tests. Part of logic can (and should) be moved from
	warmstate to the ResumeDescrNotInvalidated. There are also missing
	tests about call_assembler being correctly redirected

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
@@ -375,6 +375,7 @@
         # to the corresponding guard_op and compile from there
         assert metainterp.resumekey_original_loop_token is not None
         new_loop.token = metainterp.resumekey_original_loop_token
+        new_loop.token.invalidated_array = metainterp.invalidated_array
         inputargs = metainterp.history.inputargs
         if not we_are_translated():
             self._debug_suboperations = new_loop.operations
@@ -569,6 +570,7 @@
         # to every guard in the loop.
         new_loop_token = make_loop_token(len(redargs), jitdriver_sd)
         new_loop.token = new_loop_token
+        new_loop_token.invalidated_array = metainterp.invalidated_array
         send_loop_to_backend(metainterp_sd, new_loop, "entry bridge")
         # send the new_loop to warmspot.py, to be called directly the next time
         jitdriver_sd.warmstate.attach_unoptimized_bridge_from_interp(
@@ -659,6 +661,7 @@
     # 'redboxes' is only used to know the types of red arguments.
     inputargs = [box.clonebox() for box in redboxes]
     loop_token = make_loop_token(len(inputargs), jitdriver_sd)
+    loop_token.invalidated_array = cpu.create_invalidate_array()
     # 'nb_red_args' might be smaller than len(redboxes),
     # because it doesn't include the virtualizable boxes.
     nb_red_args = jitdriver_sd.num_red_args

diff --git a/pypy/jit/metainterp/warmstate.py b/pypy/jit/metainterp/warmstate.py
--- a/pypy/jit/metainterp/warmstate.py
+++ b/pypy/jit/metainterp/warmstate.py
@@ -158,7 +158,7 @@
         if self.compiled_merge_points_wref is not None:
             for wref in self.compiled_merge_points_wref:
                 looptoken = wref()
-                if looptoken is not None and not looptoken.invalidated:
+                if looptoken is not None and not looptoken.invalidated_array[0]:
                     result.append(looptoken)
         return result
 
@@ -169,7 +169,7 @@
     def get_entry_loop_token(self):
         if self.wref_entry_loop_token is not None:
             looptoken = self.wref_entry_loop_token()
-            if looptoken is not None and looptoken.invalidated:
+            if looptoken is not None and looptoken.invalidated_array[0]:
                 self.wref_entry_loop_token = None
             else:
                 return looptoken
@@ -336,7 +336,7 @@
                 if not confirm_enter_jit(*args):
                     return
                 loop_token = cell.get_entry_loop_token()
-                if loop_token is None or loop_token.invalidated:
+                if loop_token is None or loop_token.invalidated_array[0]:
                     # it was a weakref that has been freed or invalidated
                     cell.counter = 0
                     return

diff --git a/pypy/jit/metainterp/test/test_outofline.py b/pypy/jit/metainterp/test/test_outofline.py
--- a/pypy/jit/metainterp/test/test_outofline.py
+++ b/pypy/jit/metainterp/test/test_outofline.py
@@ -79,7 +79,7 @@
             return total
 
         assert self.meta_interp(f, []) == f()
-        self.check_loop_count(3)
+        self.check_loop_count(4)
         self.check_history(getfield_gc=0, getfield_gc_pure=0)        
 
     def test_jit_invariant_entry_bridge(self):
@@ -111,7 +111,7 @@
             return total
 
         assert self.meta_interp(main, []) == main()
-        self.check_loop_count(4)
+        self.check_loop_count(2)
         self.check_history(getfield_gc=0, getfield_gc_pure=0)
 
     def test_jit_invariant_invalidate_bridge(self):

diff --git a/pypy/jit/metainterp/memmgr.py b/pypy/jit/metainterp/memmgr.py
--- a/pypy/jit/metainterp/memmgr.py
+++ b/pypy/jit/metainterp/memmgr.py
@@ -68,7 +68,7 @@
         debug_print("Loop tokens before:", oldtotal)
         max_generation = self.current_generation - (self.max_age-1)
         for looptoken in self.alive_loops.keys():
-            if (looptoken.invalidated or
+            if (looptoken.invalidated_array[0] or
                 0 <= looptoken.generation < max_generation):
                 # XXX free looptoken invalidated ptr
                 del self.alive_loops[looptoken]


More information about the Pypy-commit mailing list