aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/hipe/hipe_bif0.c
diff options
context:
space:
mode:
authorMikael Pettersson <[email protected]>2015-01-11 16:48:20 +0100
committerMarcus Arendt <[email protected]>2015-01-26 15:57:04 +0100
commit3d41006a0e17d57fef4324c2a49c778f7a4a3390 (patch)
tree3bef60849913ccfabfc605a78d542cb955f70154 /erts/emulator/hipe/hipe_bif0.c
parent14d585fdcafad61a377feeba1035d6ddcfaf0248 (diff)
downloadotp-3d41006a0e17d57fef4324c2a49c778f7a4a3390.tar.gz
otp-3d41006a0e17d57fef4324c2a49c778f7a4a3390.tar.bz2
otp-3d41006a0e17d57fef4324c2a49c778f7a4a3390.zip
hipe: improve error handling at code allocation failure
Diffstat (limited to 'erts/emulator/hipe/hipe_bif0.c')
-rw-r--r--erts/emulator/hipe/hipe_bif0.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/erts/emulator/hipe/hipe_bif0.c b/erts/emulator/hipe/hipe_bif0.c
index dc45e60411..9e5830f345 100644
--- a/erts/emulator/hipe/hipe_bif0.c
+++ b/erts/emulator/hipe/hipe_bif0.c
@@ -398,8 +398,16 @@ BIF_RETTYPE hipe_bifs_enter_code_2(BIF_ALIST_2)
ASSERT(bitsize == 0);
trampolines = NIL;
address = hipe_alloc_code(nrbytes, BIF_ARG_2, &trampolines, BIF_P);
- if (!address)
- BIF_ERROR(BIF_P, BADARG);
+ if (!address) {
+ Uint nrcallees;
+
+ if (is_tuple(BIF_ARG_2))
+ nrcallees = arityval(tuple_val(BIF_ARG_2)[0]);
+ else
+ nrcallees = 0;
+ erl_exit(1, "%s: failed to allocate %lu bytes and %lu trampolines\r\n",
+ __func__, (unsigned long)nrbytes, (unsigned long)nrcallees);
+ }
memcpy(address, bytes, nrbytes);
hipe_flush_icache_range(address, nrbytes);
hp = HAlloc(BIF_P, 3);
@@ -1274,6 +1282,8 @@ static void *hipe_make_stub(Eterm m, Eterm f, unsigned int arity, int is_remote)
export_entry = erts_export_get_or_make_stub(m, f, arity);
StubAddress = hipe_make_native_stub(export_entry, arity);
+ if (!StubAddress)
+ erl_exit(1, "hipe_make_stub: code allocation failed\r\n");
return StubAddress;
}