aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_bif_load.c
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-09-16 19:33:38 +0200
committerSverker Eriksson <[email protected]>2016-10-14 14:29:15 +0200
commit5e879fb1d4a9273f0a6183da7509dcdbc24f9653 (patch)
tree30726298d83c5a20625f13989f8be923cc4271d7 /erts/emulator/beam/beam_bif_load.c
parent39072836944d00c288beebfd98b14593f9609006 (diff)
downloadotp-5e879fb1d4a9273f0a6183da7509dcdbc24f9653.tar.gz
otp-5e879fb1d4a9273f0a6183da7509dcdbc24f9653.tar.bz2
otp-5e879fb1d4a9273f0a6183da7509dcdbc24f9653.zip
erts: Check hipe stack in check_process_code
This is part of commit 1bd508921dd93086b05e7d0038b816b36c421d86. I did not include the fun-checking as we have a new purge strategy for funs in OTP 20. That remains to be solved some other way for hipe.
Diffstat (limited to 'erts/emulator/beam/beam_bif_load.c')
-rw-r--r--erts/emulator/beam/beam_bif_load.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c
index 3302de0787..ec1db8d9c2 100644
--- a/erts/emulator/beam/beam_bif_load.c
+++ b/erts/emulator/beam/beam_bif_load.c
@@ -1069,6 +1069,8 @@ check_process_code(Process* rp, Module* modp, int *redsp, int fcalls)
BeamInstr* start;
char* mod_start;
Uint mod_size;
+ void *nat_start = NULL;
+ Uint nat_size = 0;
Eterm* sp;
*redsp += 1;
@@ -1099,6 +1101,20 @@ check_process_code(Process* rp, Module* modp, int *redsp, int fcalls)
}
}
+#ifdef HIPE
+ /*
+ * Check all continuation pointers stored on the native stack if the module
+ * has native code.
+ */
+ if (modp->old.hipe_code) {
+ nat_start = modp->old.hipe_code->text_segment;
+ nat_size = modp->old.hipe_code->text_segment_size;
+ if (nat_size && nstack_any_cps_in_segment(rp, nat_start, nat_size)) {
+ return am_true;
+ }
+ }
+#endif
+
/*
* Check all continuation pointers stored in stackdump
* and clear exception stackdump if there is a pointer
@@ -1115,8 +1131,16 @@ check_process_code(Process* rp, Module* modp, int *redsp, int fcalls)
rp->ftrace = NIL;
} else {
int i;
+ char *area_start = mod_start;
+ Uint area_size = mod_size;
+#ifdef HIPE
+ if (rp->freason & EXF_NATIVE) {
+ area_start = nat_start;
+ area_size = nat_size;
+ }
+#endif
for (i = 0; i < s->depth; i++) {
- if (ErtsInArea(s->trace[i], mod_start, mod_size)) {
+ if (ErtsInArea(s->trace[i], area_start, area_size)) {
rp->freason = EXC_NULL;
rp->fvalue = NIL;
rp->ftrace = NIL;