aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/hipe/hipe_amd64_bifs.m4
diff options
context:
space:
mode:
authorZandra Hird <[email protected]>2015-03-16 13:18:37 +0100
committerZandra Hird <[email protected]>2015-03-16 13:18:59 +0100
commitda0cfbabbae668bcacbf3e5fff1ebdc173e6f1e1 (patch)
treed970a02c19f9e5c31d600ea5b26ece53142f20e1 /erts/emulator/hipe/hipe_amd64_bifs.m4
parent3e2070b328b7c2c5f641f3b73a52d6cb7e3b5a44 (diff)
parent0e464f7be1ae9b54d0fba748ab2dc7bd435ac118 (diff)
downloadotp-da0cfbabbae668bcacbf3e5fff1ebdc173e6f1e1.tar.gz
otp-da0cfbabbae668bcacbf3e5fff1ebdc173e6f1e1.tar.bz2
otp-da0cfbabbae668bcacbf3e5fff1ebdc173e6f1e1.zip
Merge branch 'nox/ets-update_counter-4'
* nox/ets-update_counter-4: Create new BIF ets:update_counter/4 Allow 4-ary BIFs OTP-12563
Diffstat (limited to 'erts/emulator/hipe/hipe_amd64_bifs.m4')
-rw-r--r--erts/emulator/hipe/hipe_amd64_bifs.m440
1 files changed, 39 insertions, 1 deletions
diff --git a/erts/emulator/hipe/hipe_amd64_bifs.m4 b/erts/emulator/hipe/hipe_amd64_bifs.m4
index 7a4bb30447..7d94aa05b3 100644
--- a/erts/emulator/hipe/hipe_amd64_bifs.m4
+++ b/erts/emulator/hipe/hipe_amd64_bifs.m4
@@ -51,9 +51,10 @@ define(HANDLE_GOT_MBUF,`
* standard_bif_interface_1(nbif_name, cbif_name)
* standard_bif_interface_2(nbif_name, cbif_name)
* standard_bif_interface_3(nbif_name, cbif_name)
+ * standard_bif_interface_4(nbif_name, cbif_name)
* standard_bif_interface_0(nbif_name, cbif_name)
*
- * Generate native interface for a BIF with 0-3 parameters and
+ * Generate native interface for a BIF with 0-4 parameters and
* standard failure mode.
*/
define(standard_bif_interface_1,
@@ -154,6 +155,43 @@ ASYM($1):
TYPE_FUNCTION(ASYM($1))
#endif')
+define(standard_bif_interface_4,
+`
+#ifndef HAVE_$1
+#`define' HAVE_$1
+ TEXT
+ .align 4
+ GLOBAL(ASYM($1))
+ASYM($1):
+ /* set up the parameters */
+ movq P, %rdi
+ NBIF_ARG(%rsi,4,0)
+ NBIF_ARG(%rdx,4,1)
+ NBIF_ARG(%rcx,4,2)
+ NBIF_ARG(%r8,4,3)
+
+ /* make the call on the C stack */
+ SWITCH_ERLANG_TO_C
+ pushq %r8
+ pushq %rcx
+ pushq %rdx
+ pushq %rsi
+ movq %rsp, %rsi /* Eterm* BIF__ARGS */
+ sub $(8), %rsp /* stack frame 16-byte alignment */
+ CALL_BIF($2)
+ add $(4*8 + 8), %rsp
+ TEST_GOT_MBUF
+ SWITCH_C_TO_ERLANG
+
+ /* throw exception if failure, otherwise return */
+ TEST_GOT_EXN
+ jz nbif_4_simple_exception
+ NBIF_RET(4)
+ HANDLE_GOT_MBUF(4)
+ SET_SIZE(ASYM($1))
+ TYPE_FUNCTION(ASYM($1))
+#endif')
+
define(standard_bif_interface_0,
`
#ifndef HAVE_$1