aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/hipe
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/hipe')
-rw-r--r--erts/emulator/hipe/hipe_amd64.c5
-rw-r--r--erts/emulator/hipe/hipe_arch.h4
-rw-r--r--erts/emulator/hipe/hipe_bif0.c11
-rw-r--r--erts/emulator/hipe/hipe_module.c6
4 files changed, 10 insertions, 16 deletions
diff --git a/erts/emulator/hipe/hipe_amd64.c b/erts/emulator/hipe/hipe_amd64.c
index df53f4db30..96b8c22265 100644
--- a/erts/emulator/hipe/hipe_amd64.c
+++ b/erts/emulator/hipe/hipe_amd64.c
@@ -130,10 +130,11 @@ void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *
return alloc_code(nrbytes);
}
-void hipe_free_code(void* code)
+void hipe_free_code(void* code, unsigned int bytes)
{
ALLOC_CODE_STATS(--nr_allocs);
- /*ALLOC_CODE_STATS(total_alloc += alloc_bytes);*/
+ ALLOC_CODE_STATS(total_alloc -= bytes);
+
erts_free(ERTS_ALC_T_HIPE_EXEC, code);
}
diff --git a/erts/emulator/hipe/hipe_arch.h b/erts/emulator/hipe/hipe_arch.h
index df38a80069..059b8e7f29 100644
--- a/erts/emulator/hipe/hipe_arch.h
+++ b/erts/emulator/hipe/hipe_arch.h
@@ -30,8 +30,8 @@ extern void hipe_patch_load_fe(Uint *address, Uint value);
extern int hipe_patch_insn(void *address, Uint value, Eterm type);
extern int hipe_patch_call(void *callAddress, void *destAddress, void *trampoline);
-extern void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, Process *p);
-extern void hipe_free_code(void*);
+extern void *hipe_alloc_code(Uint nrbytes, Eterm callees, Eterm *trampolines, struct process *p);
+extern void hipe_free_code(void*, unsigned int);
extern void *hipe_make_native_stub(void *exp, unsigned int beamArity);
extern void hipe_free_native_stub(void*);
diff --git a/erts/emulator/hipe/hipe_bif0.c b/erts/emulator/hipe/hipe_bif0.c
index daa198d695..46d4378f21 100644
--- a/erts/emulator/hipe/hipe_bif0.c
+++ b/erts/emulator/hipe/hipe_bif0.c
@@ -1743,14 +1743,9 @@ void hipe_purge_module(Module* modp)
prevp = &p->next_in_mod;
}
}
- if (modp->old.hipe_code && modp->old.hipe_code->text_segment) {
-#ifdef DEBUG
- sys_memset(modp->old.hipe_code->text_segment, 0xfe,
- modp->old.hipe_code->text_segment_size);
-#endif
- hipe_free_code(modp->old.hipe_code->text_segment);
- modp->old.hipe_code->text_segment = NULL;
- modp->old.hipe_code->text_segment_size = 0;
+ if (modp->old.hipe_code) {
+ hipe_free_module(modp->old.hipe_code);
+ modp->old.hipe_code = NULL;
}
}
diff --git a/erts/emulator/hipe/hipe_module.c b/erts/emulator/hipe/hipe_module.c
index 1553bf9087..469f077dd2 100644
--- a/erts/emulator/hipe/hipe_module.c
+++ b/erts/emulator/hipe/hipe_module.c
@@ -22,14 +22,12 @@
#include "config.h"
#endif
#include "sys.h"
+#include "hipe_arch.h"
#include "hipe_module.h"
void hipe_free_module(HipeModule *mod)
{
-#ifdef DEBUG
- sys_memzero(mod->text_segment, mod->text_segment_size);
-#endif
- /* XXX: erts_free(ERTS_ALC_T_HIPE, mod->text_segment); */
+ hipe_free_code(mod->text_segment, mod->text_segment_size);
if (mod->data_segment) /* Some modules lack data segments */
erts_free(ERTS_ALC_T_HIPE, mod->data_segment);