[pypy-commit] pypy win64-stage1: hacked a bit on ll2ctypes/do_allocation_in_far_regions

ctismer noreply at buildbot.pypy.org
Sat Nov 26 20:37:55 CET 2011


Author: Christian Tismer <tismer at stackless.com>
Branch: win64-stage1
Changeset: r49838:af23ec1f5f06
Date: 2011-11-26 20:36 +0100
http://bitbucket.org/pypy/pypy/changeset/af23ec1f5f06/

Log:	hacked a bit on ll2ctypes/do_allocation_in_far_regions stopped this,
	fijal claims it makes no longer sense

diff --git a/pypy/rlib/rmmap.py b/pypy/rlib/rmmap.py
--- a/pypy/rlib/rmmap.py
+++ b/pypy/rlib/rmmap.py
@@ -707,7 +707,7 @@
     
 elif _MS_WINDOWS:
     def mmap(fileno, length, flags=0, tagname="", access=_ACCESS_DEFAULT, offset=0):
-        # XXX flags is unused by now.
+        # XXX flags is or-ed into access by now.
         
         # check size boundaries
         _check_map_size(length)
@@ -790,6 +790,7 @@
             offset_hi = 0
             offset_lo = offset
 
+        flProtect |= flags
         m.map_handle = CreateFileMapping(m.file_handle, NULL, flProtect,
                                          size_hi, size_lo, m.tagname)
 
@@ -807,6 +808,11 @@
         m.map_handle = INVALID_HANDLE
         raise winerror
 
+    class Hint:
+        pos = -0x4fff0000   # for reproducible results
+    hint = Hint()
+    # XXX this has no effect on windows
+
     def alloc(map_size):
         """Allocate memory.  This is intended to be used by the JIT,
         so the memory has the executable bit set.  
diff --git a/pypy/rpython/lltypesystem/ll2ctypes.py b/pypy/rpython/lltypesystem/ll2ctypes.py
--- a/pypy/rpython/lltypesystem/ll2ctypes.py
+++ b/pypy/rpython/lltypesystem/ll2ctypes.py
@@ -87,7 +87,9 @@
         if _LINUX:
             flags = (rmmap.MAP_PRIVATE|rmmap.MAP_ANONYMOUS|rmmap.MAP_NORESERVE,
                      rmmap.PROT_READ|rmmap.PROT_WRITE)
-            
+        if _MS_WINDOWS:
+            flags = rmmap.MEM_RESERVE
+            # XXX seems not to work
         m = rmmap.mmap(-1, PIECES * PIECESIZE, flags)
         m.close = lambda : None    # leak instead of giving a spurious
                                    # error at CPython's shutdown


More information about the pypy-commit mailing list