aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/hipe/hipe_bif2.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2011-03-18 18:19:45 +0100
committerSverker Eriksson <[email protected]>2011-10-26 18:22:42 +0200
commit01c734e6a60bb9579c00079f7d81d197b684c9e3 (patch)
treeafc4d3879b54dbedbe3e94453af9135cd399c3d2 /erts/emulator/hipe/hipe_bif2.c
parent7085a1a3240e80b9558d722e2979c9122e0b29d2 (diff)
downloadotp-01c734e6a60bb9579c00079f7d81d197b684c9e3.tar.gz
otp-01c734e6a60bb9579c00079f7d81d197b684c9e3.tar.bz2
otp-01c734e6a60bb9579c00079f7d81d197b684c9e3.zip
erts-hipe: Enable debug compiled hipe-VM with lock checker
Add hipe_debug_bif_wrapper() as a wrapper for every BIF called by native code.
Diffstat (limited to 'erts/emulator/hipe/hipe_bif2.c')
-rw-r--r--erts/emulator/hipe/hipe_bif2.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/erts/emulator/hipe/hipe_bif2.c b/erts/emulator/hipe/hipe_bif2.c
index 2660f74a82..ee97541e15 100644
--- a/erts/emulator/hipe/hipe_bif2.c
+++ b/erts/emulator/hipe/hipe_bif2.c
@@ -166,3 +166,26 @@ BIF_RETTYPE hipe_bifs_show_message_area_0(BIF_ALIST_0)
BIF_RET(am_false);
#endif
}
+
+#if defined(ERTS_ENABLE_LOCK_CHECK) && defined(ERTS_SMP)
+
+BIF_RETTYPE hipe_debug_bif_wrapper(BIF_ALIST_1);
+
+# define ERTS_SMP_REQ_PROC_MAIN_LOCK(P) \
+ if ((P)) erts_proc_lc_require_lock((P), ERTS_PROC_LOCK_MAIN)
+# define ERTS_SMP_UNREQ_PROC_MAIN_LOCK(P) \
+ if ((P)) erts_proc_lc_unrequire_lock((P), ERTS_PROC_LOCK_MAIN)
+
+BIF_RETTYPE hipe_debug_bif_wrapper(BIF_ALIST_1)
+{
+ typedef BIF_RETTYPE Bif(BIF_ALIST_1);
+ Bif* fp = (Bif*) (BIF_P->hipe.bif_callee);
+ BIF_RETTYPE res;
+ ERTS_SMP_UNREQ_PROC_MAIN_LOCK(BIF_P);
+ res = (*fp)(BIF_P, BIF__ARGS);
+ ERTS_SMP_REQ_PROC_MAIN_LOCK(BIF_P);
+ return res;
+}
+
+#endif /* ERTS_ENABLE_LOCK_CHECK && ERTS_SMP */
+