[pypy-svn] pypy jitypes2: Probably implement support for the GIL. It's just a few lines of code,
arigo
commits-noreply at bitbucket.org
Mon Mar 28 16:26:36 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: jitypes2
Changeset: r42998:96d5bdab2f44
Date: 2011-03-28 16:26 +0200
http://bitbucket.org/pypy/pypy/changeset/96d5bdab2f44/
Log: Probably implement support for the GIL. It's just a few lines of
code, but it would take serious efforts to write a test for it :-(
Instead I suppose we can just give up and write a test for the whole
pypy-c.
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
@@ -286,13 +286,28 @@
new.prev = asmgcroot.gcrootanchor
asmgcroot.gcrootanchor.next = new
next.prev = new
- # XXX and now release the GIL
+ # and now release the GIL
+ before = rffi.aroundstate.before
+ # Store a flag (by abuse in new+2*WORD) that tells if we must
+ # call the "after" function or not. The issue is that the
+ # before/after fields can be set at a random point during the
+ # execution, and we should not call the "after" function if we
+ # did not call the "before" function. It works by assuming that
+ # before/after start out being None/None, and are later set (once
+ # only) to some pair of functions.
+ css[2] = int(bool(before))
+ if before:
+ before()
@staticmethod
def _reopen_stack(css):
+ # first reacquire the GIL
+ if css[2]:
+ after = rffi.aroundstate.after
+ assert after
+ after()
# similar to trackgcroot.py:pypy_asm_stackwalk, second part
from pypy.rpython.memory.gctransform import asmgcroot
- # XXX first reacquire the GIL
old = rffi.cast(asmgcroot.ASM_FRAMEDATA_HEAD_PTR, css)
prev = old.prev
next = old.next
More information about the Pypy-commit
mailing list