summaryrefslogtreecommitdiff
path: root/erts/emulator/hipe/hipe_amd64_bifs.m4
diff options
context:
space:
mode:
authorSverker Eriksson <sverker@erlang.org>2011-03-18 18:19:45 +0100
committerSverker Eriksson <sverker@erlang.org>2011-10-26 18:22:42 +0200
commit01c734e6a60bb9579c00079f7d81d197b684c9e3 (patch)
treeafc4d3879b54dbedbe3e94453af9135cd399c3d2 /erts/emulator/hipe/hipe_amd64_bifs.m4
parent7085a1a3240e80b9558d722e2979c9122e0b29d2 (diff)
downloaderlang-01c734e6a60bb9579c00079f7d81d197b684c9e3.tar.gz
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_amd64_bifs.m4')
-rw-r--r--erts/emulator/hipe/hipe_amd64_bifs.m416
1 files changed, 12 insertions, 4 deletions
diff --git a/erts/emulator/hipe/hipe_amd64_bifs.m4 b/erts/emulator/hipe/hipe_amd64_bifs.m4
index 9385cbd22b..97a8267647 100644
--- a/erts/emulator/hipe/hipe_amd64_bifs.m4
+++ b/erts/emulator/hipe/hipe_amd64_bifs.m4
@@ -20,8 +20,10 @@ changecom(`/*', `*/')dnl
include(`hipe/hipe_amd64_asm.m4')
+#`include' "config.h"
#`include' "hipe_literals.h"
+
`#if THE_NON_VALUE == 0
#define TEST_GOT_EXN testq %rax, %rax
#else
@@ -36,6 +38,12 @@ define(HANDLE_GOT_MBUF,`
3: call nbif_$1_gc_after_bif # `HANDLE_GOT_MBUF'
jmp 2b')
+`#if defined(ERTS_ENABLE_LOCK_CHECK) && defined(ERTS_SMP)
+# define CALL_BIF(F) movq $CSYM(F), P_BIF_CALLEE(P); call CSYM(hipe_debug_bif_wrapper)
+#else
+# define CALL_BIF(F) call CSYM(F)
+#endif'
+
/*
* standard_bif_interface_1(nbif_name, cbif_name)
* standard_bif_interface_2(nbif_name, cbif_name)
@@ -62,7 +70,7 @@ ASYM($1):
pushq %rsi
movq %rsp, %rsi /* Eterm* BIF__ARGS */
sub $(8), %rsp /* stack frame 16-byte alignment */
- call CSYM($2)
+ CALL_BIF($2)
add $(1*8 + 8), %rsp
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
@@ -94,7 +102,7 @@ ASYM($1):
pushq %rdx
pushq %rsi
movq %rsp, %rsi /* Eterm* BIF__ARGS */
- call CSYM($2)
+ CALL_BIF($2)
add $(2*8), %rsp
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
@@ -129,7 +137,7 @@ ASYM($1):
pushq %rsi
movq %rsp, %rsi /* Eterm* BIF__ARGS */
sub $(8), %rsp /* stack frame 16-byte alignment */
- call CSYM($2)
+ CALL_BIF($2)
add $(3*8 + 8), %rsp
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
@@ -156,7 +164,7 @@ ASYM($1):
/* make the call on the C stack */
SWITCH_ERLANG_TO_C
- call CSYM($2)
+ CALL_BIF($2)
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG