*** pypy/pypy/rlib/rmmap.py
Wed May 30 08:11:31 2012
--- pypy/pypy/rlib/rmmap.py Sat Jun 9 16:23:45 2012
***************
*** 14,19 ****
--- 14,20 ----
_MS_WINDOWS = os.name == "nt"
_LINUX = "linux" in sys.platform
_64BIT = "64bit" in platform.architecture()[0]
+ _CYGWIN = "cygwin" == sys.platform
class RValueError(Exception):
def __init__(self,
message):
***************
*** 692,698 ****
so the memory has the executable bit set and gets allocated
internally in case of a sandboxed process.
"""
! flags = MAP_PRIVATE | MAP_ANONYMOUS
prot = PROT_EXEC | PROT_READ | PROT_WRITE
hintp = rffi.cast(PTR, hint.pos)
res = c_mmap_safe(hintp,
map_size, prot, flags, -1, 0)
--- 693,703 ----
so the memory has the executable bit set and gets allocated
internally in case of a sandboxed process.
"""
! if _CYGWIN:
! # XXX Hack: JIT memory should be private but Cygwin's fork() fails
! flags = MAP_SHARED | MAP_ANONYMOUS
! else:
! flags = MAP_PRIVATE | MAP_ANONYMOUS
prot = PROT_EXEC | PROT_READ | PROT_WRITE
hintp = rffi.cast(PTR, hint.pos)
res = c_mmap_safe(hintp, map_size, prot, flags, -1, 0)
PS Here's a little test program.
import sys, os
from test import pystone
# run some code that uses the
JIT
print "top-level process:", pystone.main()
print "top-level process:", pystone.main()
pid = os.fork()
if pid == 0:
print "I'm the child, my PID is", os.getpid()
print "child process:", pystone.main()
print "child process:", pystone.main()
sys.exit()
else:
print "I'm the parent, my PID is", os.getpid(), " the child PID is",
pid
print "parent process:", pystone.main()
print "parent process:", pystone.main()
sys.exit()