[svn:parrot] r41250 - in trunk/src: . jit/i386
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Sun Sep 13 11:25:14 UTC 2009
Author: NotFound
Date: Sun Sep 13 11:25:08 2009
New Revision: 41250
URL: https://trac.parrot.org/parrot/changeset/41250
Log:
[core] die cleanly when failing to allocate executable memory
Modified:
trunk/src/jit.c
trunk/src/jit/i386/jit_defs.c
Modified: trunk/src/jit.c
==============================================================================
--- trunk/src/jit.c Sun Sep 13 08:58:22 2009 (r41249)
+++ trunk/src/jit.c Sun Sep 13 11:25:08 2009 (r41250)
@@ -1456,6 +1456,9 @@
jit_info->arena.size = jit_info->arena.map_size * 20;
jit_info->native_ptr = jit_info->arena.start =
(char *)mem_alloc_executable((size_t)jit_info->arena.size);
+ if (! jit_info->native_ptr)
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR,
+ "Cannot allocate executable memory");
# if EXEC_CAPABLE
if (obj)
@@ -1831,6 +1834,9 @@
struct jit_buffer_private_data *jit = (struct jit_buffer_private_data*)priv;
void *ptr = PARROT_MANAGEDSTRUCT(pmc)->ptr;
void *newptr = mem_alloc_executable(jit->size);
+ if (!newptr)
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR,
+ "Cannot allocate executable memory");
memcpy(newptr, ptr, jit->size);
PARROT_MANAGEDSTRUCT(rv)->ptr = newptr;
}
Modified: trunk/src/jit/i386/jit_defs.c
==============================================================================
--- trunk/src/jit/i386/jit_defs.c Sun Sep 13 08:58:22 2009 (r41249)
+++ trunk/src/jit/i386/jit_defs.c Sun Sep 13 11:25:08 2009 (r41250)
@@ -2110,6 +2110,9 @@
* should free the function pointer returned here
*/
pc = jit_info.native_ptr = jit_info.arena.start = (char *)mem_alloc_executable(JIT_ALLOC_SIZE);
+ if (! pc)
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR,
+ "Cannot allocate executable memory");
/* this generated jit function will be called as (INTERP (EBP 8), func_ptr
More information about the parrot-commits
mailing list