[pypy-svn] r31889 - pypy/dist/pypy/jit/codegen/i386

benyoung at codespeak.net benyoung at codespeak.net
Thu Aug 31 17:13:25 CEST 2006


Author: benyoung
Date: Thu Aug 31 17:13:16 2006
New Revision: 31889

Modified:
   pypy/dist/pypy/jit/codegen/i386/codebuf_nt.py
Log:
Fix the JIT allocation code for Windows (to a certain extent)

Modified: pypy/dist/pypy/jit/codegen/i386/codebuf_nt.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/i386/codebuf_nt.py	(original)
+++ pypy/dist/pypy/jit/codegen/i386/codebuf_nt.py	Thu Aug 31 17:13:16 2006
@@ -5,11 +5,11 @@
 
 
 class CConfig:
-    _includes_ = ('Windows.h',)
+    _header_ = '#include <Windows.h>'
 
-    SIZE_T                 = SimpleType('SIZE_T', c_long)
-    DWORD                  = SimpleType('DWORD', c_long)
-    BOOL                   = SimpleType('BOOL', c_int)
+    SIZE_T                 = SimpleType('SIZE_T', ctypes.c_long)
+    DWORD                  = SimpleType('DWORD', ctypes.c_long)
+    BOOL                   = SimpleType('BOOL', ctypes.c_int)
     MEM_COMMIT             = ConstantInteger('MEM_COMMIT')
     MEM_RESERVE            = ConstantInteger('MEM_RESERVE')
     MEM_RELEASE            = ConstantInteger('MEM_RELEASE')
@@ -35,12 +35,12 @@
 # ____________________________________________________________
 
 def alloc(map_size):
-    res = VirtualAlloc(ctypes.c_void_p(), map_size, MEM_COMMIT|MEM_RESERVE,
+    res = VirtualAlloc(LPVOID(), map_size, MEM_COMMIT|MEM_RESERVE,
                        PAGE_EXECUTE_READWRITE)
     if not res:
         raise MemoryError
     old = DWORD()
-    VirtualProtect(res, map_size, PAGE_EXECUTE_READWRITE, byref(old))
+    VirtualProtect(res, map_size, PAGE_EXECUTE_READWRITE, ctypes.byref(old))
     # ignore errors, just try
     return res
 



More information about the Pypy-commit mailing list