Author: Armin Rigo <ar...@tunes.org> Branch: mmap-for-arenas Changeset: r93481:685824de07b4 Date: 2017-12-18 21:52 +0100 http://bitbucket.org/pypy/pypy/changeset/685824de07b4/
Log: Translation fix diff --git a/rpython/rlib/rmmap.py b/rpython/rlib/rmmap.py --- a/rpython/rlib/rmmap.py +++ b/rpython/rlib/rmmap.py @@ -808,6 +808,9 @@ def arena_mmap(nbytes): flags = MAP_PRIVATE | MAP_ANONYMOUS prot = PROT_READ | PROT_WRITE + if we_are_translated(): + flags = NonConstant(flags) + prot = NonConstant(prot) p = c_mmap_safe(lltype.nullptr(PTR.TO), nbytes, prot, flags, -1, 0) if p == rffi.cast(PTR, -1): p = rffi.cast(PTR, 0) @@ -955,8 +958,12 @@ case of a sandboxed process """ null = lltype.nullptr(rffi.VOIDP.TO) - res = VirtualAlloc_safe(null, map_size, MEM_COMMIT | MEM_RESERVE, - PAGE_EXECUTE_READWRITE) + alloctype = MEM_COMMIT | MEM_RESERVE + protect = PAGE_EXECUTE_READWRITE + if we_are_translated(): + alloctype = NonConstant(alloctype) + protect = NonConstant(protect) + res = VirtualAlloc_safe(null, map_size, alloctype, protect) if not res: raise MemoryError arg = lltype.malloc(LPDWORD.TO, 1, zero=True, flavor='raw') @@ -980,8 +987,12 @@ def arena_mmap(nbytes): null = lltype.nullptr(rffi.VOIDP.TO) - res = VirtualAlloc_safe(null, nbytes, MEM_COMMIT | MEM_RESERVE, - PAGE_READWRITE) + alloctype = MEM_COMMIT | MEM_RESERVE + protect = PAGE_READWRITE + if we_are_translated(): + alloctype = NonConstant(alloctype) + protect = NonConstant(protect) + res = VirtualAlloc_safe(null, nbytes, alloctype, protect) return rffi.cast(PTR, res) def arena_munmap(arena_ptr, nbytes): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit