[pypy-svn] r66002 - pypy/branch/pyjitpl5/pypy/jit/metainterp

arigo at codespeak.net arigo at codespeak.net
Fri Jun 26 21:04:44 CEST 2009


Author: arigo
Date: Fri Jun 26 21:04:42 2009
New Revision: 66002

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/virtualizable.py
Log:
Clarify the situation for when vable_rti should be NULL
and when it shouldn't.


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/pyjitpl.py	Fri Jun 26 21:04:42 2009
@@ -1485,10 +1485,12 @@
             self.initialize_virtualizable_enter()
 
     def initialize_virtualizable_enter(self):
+        # Switched from the interpreter (case 1 in the comment in
+        # virtualizable.py) to tracing mode (case 2): force vable_rti to NULL.
         vinfo = self.staticdata.virtualizable_info
         virtualizable_box = self.virtualizable_boxes[-1]
         virtualizable = vinfo.unwrap_virtualizable_box(virtualizable_box)
-        vinfo.tracing_enter(virtualizable)
+        vinfo.clear_vable_rti(virtualizable)
 
     def before_residual_call(self):
         vinfo = self.staticdata.virtualizable_info
@@ -1538,10 +1540,16 @@
                                     newboxes):
         if not we_are_translated():
             self._debug_history.append(['guard_failure', None, None])
-        if self.staticdata.virtualizable_info is not None:
+        vinfo = self.staticdata.virtualizable_info
+        if vinfo is not None:
             self.virtualizable_boxes = _consume_nums(vable_nums,
                                                      newboxes, consts)
-            self.initialize_virtualizable_enter()
+            # just jumped away from assembler (case 4 in the comment in
+            # virtualizable.py) into tracing (case 2); check that vable_rti
+            # is and stays NULL.
+            virtualizable_box = self.virtualizable_boxes[-1]
+            virtualizable = vinfo.unwrap_virtualizable_box(virtualizable_box)
+            assert not virtualizable.vable_rti
             self.synchronize_virtualizable()
             #
         self.framestack = []

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/virtualizable.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/virtualizable.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/virtualizable.py	Fri Jun 26 21:04:42 2009
@@ -203,7 +203,7 @@
             vable_rti._TYPE = self.VABLERTI   # hack for non-translated mode
             return vable_rti
 
-    def tracing_enter(self, virtualizable):
+    def clear_vable_rti(self, virtualizable):
         if virtualizable.vable_rti:
             self.force_now(virtualizable)
             assert not virtualizable.vable_rti
@@ -234,6 +234,20 @@
     force_now._dont_inline_ = True
 
 # ____________________________________________________________
+#
+# The 'vable_rti' field of a virtualizable is either NULL or points
+# to an instance of the following classes.  It is:
+#
+#   1. NULL if not in the JIT at all, except as described below.
+#
+#   2. always NULL when tracing is in progress.
+#
+#   3. 'tracing_vable_rti' during tracing when we do a residual call,
+#      calling random unknown other parts of the interpreter; it is
+#      reset to NULL as soon as something occurs to the virtualizable.
+#
+#   4. NULL for now when running the machine code with a virtualizable;
+#      later it will be a RunningVableRti().
 
 
 class AbstractVableRti(object):



More information about the Pypy-commit mailing list