/[pcre]/code/trunk/sljit/sljitExecAllocator.c
ViewVC logotype

Diff of /code/trunk/sljit/sljitExecAllocator.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1181 by ph10, Wed Dec 28 17:16:11 2011 UTC revision 1182 by zherczeg, Sun Oct 28 05:22:32 2012 UTC
# Line 52  Line 52 
52     The unused blocks are stored in a chain list pointed by free_blocks. This     The unused blocks are stored in a chain list pointed by free_blocks. This
53     list is useful if we need to find a suitable memory area when the allocator     list is useful if we need to find a suitable memory area when the allocator
54     is called.     is called.
55    
56     When a block is freed, the new free block is connected to its adjacent free     When a block is freed, the new free block is connected to its adjacent free
57     blocks if possible.     blocks if possible.
58    
# Line 83  Line 83 
83    
84  static SLJIT_INLINE void* alloc_chunk(sljit_uw size)  static SLJIT_INLINE void* alloc_chunk(sljit_uw size)
85  {  {
86          return VirtualAlloc(0, size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);          return VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
87  }  }
88    
89  static SLJIT_INLINE void free_chunk(void* chunk, sljit_uw size)  static SLJIT_INLINE void free_chunk(void* chunk, sljit_uw size)
# Line 94  static SLJIT_INLINE void free_chunk(void Line 94  static SLJIT_INLINE void free_chunk(void
94    
95  #else  #else
96    
 #include <sys/mman.h>  
   
97  static SLJIT_INLINE void* alloc_chunk(sljit_uw size)  static SLJIT_INLINE void* alloc_chunk(sljit_uw size)
98  {  {
99          void* retval = mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0);          void* retval;
100    
101    #ifdef MAP_ANON
102            retval = mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0);
103    #else
104            if (dev_zero < 0) {
105                    if (open_dev_zero())
106                            return NULL;
107            }
108            retval = mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, dev_zero, 0);
109    #endif
110    
111          return (retval != MAP_FAILED) ? retval : NULL;          return (retval != MAP_FAILED) ? retval : NULL;
112  }  }
113    

Legend:
Removed from v.1181  
changed lines
  Added in v.1182

  ViewVC Help
Powered by ViewVC 1.1.5