aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/hipe/hipe_gc.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/hipe/hipe_gc.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/hipe/hipe_gc.c')
-rw-r--r--erts/emulator/hipe/hipe_gc.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/erts/emulator/hipe/hipe_gc.c b/erts/emulator/hipe/hipe_gc.c
index be665ccdb9..e6ce7ce628 100644
--- a/erts/emulator/hipe/hipe_gc.c
+++ b/erts/emulator/hipe/hipe_gc.c
@@ -356,3 +356,36 @@ nstack_any_heap_ref_ptrs(Process *rp, char* mod_start, Uint mod_size)
}
return 0;
}
+
+int
+nstack_any_cps_in_segment(Process *p, char* seg_start, Uint seg_size)
+{
+ Eterm *nsp;
+ Eterm *nsp_end;
+ const struct hipe_sdesc *sdesc;
+ /* arch-specific nstack walk state */
+ struct nstack_walk_state walk_state;
+
+ if (!p->hipe.nstack || !nstack_walk_init_check(p))
+ return 0;
+ ASSERT(p->hipe.nsp && p->hipe.nstend);
+ nsp = nstack_walk_nsp_begin(p);
+ nsp_end = nstack_walk_nsp_end(p);
+ sdesc = nstack_walk_init_sdesc_ignore_trap(p, &walk_state);
+
+ /* Check the topmost frame */
+ if (ErtsInArea(sdesc->bucket.hvalue, seg_start, seg_size))
+ return 1;
+
+ while (!nstack_walk_nsp_reached_end(nsp, nsp_end)) {
+ unsigned sdesc_size = nstack_walk_frame_size(sdesc);
+ unsigned long ra = nstack_walk_frame_ra(nsp, sdesc);
+ if (ra == (unsigned long)nbif_stack_trap_ra)
+ ra = (unsigned long)p->hipe.ngra;
+ if (ErtsInArea(ra, seg_start, seg_size))
+ return 1;
+ sdesc = hipe_find_sdesc(ra);
+ nsp = nstack_walk_next_frame(nsp, sdesc_size);
+ }
+ return 0;
+}