[pypy-svn] r71376 - pypy/trunk/pypy/jit/metainterp

arigo at codespeak.net arigo at codespeak.net
Sun Feb 21 15:03:09 CET 2010


Author: arigo
Date: Sun Feb 21 15:03:08 2010
New Revision: 71376

Modified:
   pypy/trunk/pypy/jit/metainterp/optimizeopt.py
   pypy/trunk/pypy/jit/metainterp/virtualref.py
Log:
(merge of r71354)
Don't use 0 at all for TOKEN_*.  May help distinguishing
uninitialized from initialized-to-TOKEN_NONE cases.


Modified: pypy/trunk/pypy/jit/metainterp/optimizeopt.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/optimizeopt.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/optimizeopt.py	Sun Feb 21 15:03:08 2010
@@ -800,7 +800,7 @@
                           descr = vrefinfo.descr_forced)
         self.optimize_SETFIELD_GC(op1)
         # - set 'virtual_token' to TOKEN_NONE
-        args = [op.args[0], ConstInt(0)]
+        args = [op.args[0], ConstInt(vrefinfo.TOKEN_NONE)]
         op1 = ResOperation(rop.SETFIELD_GC, args, None,
                       descr = vrefinfo.descr_virtual_token)
         self.optimize_SETFIELD_GC(op1)

Modified: pypy/trunk/pypy/jit/metainterp/virtualref.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/virtualref.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/virtualref.py	Sun Feb 21 15:03:08 2010
@@ -59,11 +59,11 @@
 
     # The 'virtual_token' field has the same meaning as the 'vable_token' field
     # of a virtualizable.  It is equal to:
-    #  * 0 (TOKEN_NONE) when tracing, except as described below;
+    #  * -2 (TOKEN_NONE) when tracing, except as described below;
     #  * -1 (TOKEN_TRACING_RESCALL) during tracing when we do a residual call;
     #  * addr in the CPU stack (set by FORCE_TOKEN) when running the assembler;
-    #  * 0 (TOKEN_NONE) after the virtual is forced, if it is forced at all.
-    TOKEN_NONE            = 0
+    #  * -2 (TOKEN_NONE) after the virtual is forced, if it is forced at all.
+    TOKEN_NONE            = -2
     TOKEN_TRACING_RESCALL = -1
 
     def virtual_ref_during_tracing(self, real_object):
@@ -85,7 +85,7 @@
         if not self.is_virtual_ref(gcref):
             return
         vref = lltype.cast_opaque_ptr(lltype.Ptr(self.JIT_VIRTUAL_REF), gcref)
-        assert not vref.virtual_token
+        assert vref.virtual_token == self.TOKEN_NONE
         vref.virtual_token = self.TOKEN_TRACING_RESCALL
 
     def tracing_after_residual_call(self, gcref):
@@ -93,7 +93,7 @@
             return False
         vref = lltype.cast_opaque_ptr(lltype.Ptr(self.JIT_VIRTUAL_REF), gcref)
         assert vref.forced
-        if vref.virtual_token:
+        if vref.virtual_token != self.TOKEN_NONE:
             # not modified by the residual call; assert that it is still
             # set to TOKEN_TRACING_RESCALL and clear it.
             assert vref.virtual_token == self.TOKEN_TRACING_RESCALL



More information about the Pypy-commit mailing list