[pypy-svn] r71503 - pypy/branch/fix-blackhole-virt/pypy/jit/metainterp

arigo at codespeak.net arigo at codespeak.net
Thu Feb 25 18:47:38 CET 2010

Author: arigo
Date: Thu Feb 25 18:47:37 2010
New Revision: 71503

Write a comment about the risks of putting stuff on
MetaInterpGlobalData.  Too bad that it's not well-tested :-(

Modified: pypy/branch/fix-blackhole-virt/pypy/jit/metainterp/pyjitpl.py
--- pypy/branch/fix-blackhole-virt/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/fix-blackhole-virt/pypy/jit/metainterp/pyjitpl.py	Thu Feb 25 18:47:37 2010
@@ -1243,6 +1243,18 @@
 # ____________________________________________________________
 class MetaInterpGlobalData(object):
+    """This object contains the JIT's global, mutable data.
+    Warning: for any data that you put here, think that there might be
+    multiple MetaInterps accessing it at the same time.  As usual we are
+    safe from corruption thanks to the GIL, but keep in mind that any
+    MetaInterp might modify any of these fields while another MetaInterp
+    is, say, currently in a residual call to a function.  Multiple
+    MetaInterps occur either with threads or, in single-threaded cases,
+    with recursion.  This is a case that is not well-tested, so please
+    be careful :-(  But thankfully this is one of the very few places
+    where multiple concurrent MetaInterps may interact with each other.
+    """
     def __init__(self, staticdata):
         self.initialized = False
         self.indirectcall_dict = None

More information about the Pypy-commit mailing list