? vtable.dump
? z
? z.memory.c
? z.pasm
Index: include/parrot/memory.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/memory.h,v
retrieving revision 1.14
diff -u -u -r1.14 memory.h
--- include/parrot/memory.h	21 Jul 2003 18:00:42 -0000	1.14
+++ include/parrot/memory.h	28 Dec 2003 09:44:02 -0000
@@ -17,6 +17,8 @@
 
 void *mem_sys_allocate_zeroed(size_t);
 
+void *mem_sys_allocate_executable(size_t);
+
 void *mem_sys_realloc(void *, size_t);
 
 void mem_sys_free(void *);
Index: src/jit.c
===================================================================
RCS file: /cvs/public/parrot/src/jit.c,v
retrieving revision 1.78
diff -u -u -r1.78 jit.c
--- src/jit.c	21 Dec 2003 10:15:19 -0000	1.78
+++ src/jit.c	28 Dec 2003 09:44:02 -0000
@@ -1023,7 +1023,7 @@
     if ((size_t)jit_info->arena.map_size * 10 > (size_t)jit_info->arena.size)
         jit_info->arena.size = jit_info->arena.map_size * 10;
     jit_info->native_ptr = jit_info->arena.start =
-        mem_sys_allocate_zeroed((size_t)jit_info->arena.size);
+        mem_sys_allocate_executable((size_t)jit_info->arena.size);
 #  if EXEC_CAPABLE
     if (obj)
         jit_info->objfile->text.code = jit_info->arena.start;
Index: src/memory.c
===================================================================
RCS file: /cvs/public/parrot/src/memory.c,v
retrieving revision 1.41
diff -u -u -r1.41 memory.c
--- src/memory.c	21 Dec 2003 10:15:19 -0000	1.41
+++ src/memory.c	28 Dec 2003 09:44:02 -0000
@@ -40,6 +40,33 @@
     return ptr;
 }
 
+/*=for api mem mem_sys_allocate_executable
+   allocate a block of memory which can be used for executable code
+*/
+void *
+mem_sys_allocate_executable(size_t size)
+{
+    void *ptr;
+#ifdef PARROT_HAS_HEADER_SYSMMAN
+    static int dev_zero = -1;
+    if (dev_zero == -1) {
+        dev_zero = open("/dev/zero", O_RDONLY);
+        if (dev_zero == -1)
+            PANIC("Error during open /dev/zero");
+    }
+    ptr = mmap(0, size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE,
+               dev_zero, 0);
+    if (ptr == MAP_FAILED)
+        PANIC("Error during mmap");
+    return ptr;
+#else
+    ptr = calloc(1, size);
+    if (!ptr)
+        PANIC("Out of mem");
+    return ptr;
+#endif
+}
+
 /*=for api mem mem_sys_realloc
    resize a chunk of system memory
 */
