aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/hipe/hipe_amd64_bifs.m414
-rw-r--r--erts/emulator/hipe/hipe_arm_bifs.m410
-rw-r--r--erts/emulator/hipe/hipe_ppc_bifs.m416
-rw-r--r--erts/emulator/hipe/hipe_sparc_bifs.m416
-rw-r--r--erts/emulator/hipe/hipe_x86_bifs.m419
5 files changed, 69 insertions, 6 deletions
diff --git a/erts/emulator/hipe/hipe_amd64_bifs.m4 b/erts/emulator/hipe/hipe_amd64_bifs.m4
index 4d53947998..8b326968c9 100644
--- a/erts/emulator/hipe/hipe_amd64_bifs.m4
+++ b/erts/emulator/hipe/hipe_amd64_bifs.m4
@@ -58,7 +58,11 @@ ASYM($1):
/* make the call on the C stack */
SWITCH_ERLANG_TO_C
+ pushq %rsi
+ movq %rsp, %rsi /* Eterm* BIF__ARGS */
+ sub $(8), %rsp /* stack frame 16-byte alignment */
call CSYM($2)
+ add $(1*8 + 8), %rsp
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
@@ -86,7 +90,11 @@ ASYM($1):
/* make the call on the C stack */
SWITCH_ERLANG_TO_C
+ pushq %rdx
+ pushq %rsi
+ movq %rsp, %rsi /* Eterm* BIF__ARGS */
call CSYM($2)
+ add $(2*8), %rsp
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
@@ -115,7 +123,13 @@ ASYM($1):
/* make the call on the C stack */
SWITCH_ERLANG_TO_C
+ pushq %rcx
+ pushq %rdx
+ pushq %rsi
+ movq %rsp, %rsi /* Eterm* BIF__ARGS */
+ sub $(8), %rsp /* stack frame 16-byte alignment */
call CSYM($2)
+ add $(3*8 + 8), %rsp
TEST_GOT_MBUF
SWITCH_C_TO_ERLANG
diff --git a/erts/emulator/hipe/hipe_arm_bifs.m4 b/erts/emulator/hipe/hipe_arm_bifs.m4
index f20739ec52..560e6f46d0 100644
--- a/erts/emulator/hipe/hipe_arm_bifs.m4
+++ b/erts/emulator/hipe/hipe_arm_bifs.m4
@@ -49,6 +49,8 @@ $1:
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_BIF
+ str r1, [r0, #P_ARG0] /* Store BIF__ARGS in def_arg_reg[] */
+ add r1, r0, #P_ARG0
bl $2
TEST_GOT_MBUF(1)
@@ -74,6 +76,9 @@ $1:
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_BIF
+ str r1, [r0, #P_ARG0] /* Store BIF__ARGS in def_arg_reg[] */
+ str r2, [r0, #P_ARG1]
+ add r1, r0, #P_ARG0
bl $2
TEST_GOT_MBUF(2)
@@ -100,6 +105,10 @@ $1:
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_BIF
+ str r1, [r0, #P_ARG0] /* Store BIF__ARGS in def_arg_reg[] */
+ str r2, [r0, #P_ARG1]
+ str r3, [r0, #P_ARG2]
+ add r1, r0, #P_ARG0
bl $2
TEST_GOT_MBUF(3)
@@ -129,6 +138,7 @@ $1:
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_BIF
+ /* ignore empty BIF__ARGS */
bl $2
TEST_GOT_MBUF(0)
diff --git a/erts/emulator/hipe/hipe_ppc_bifs.m4 b/erts/emulator/hipe/hipe_ppc_bifs.m4
index 458bd86949..32cd11f68b 100644
--- a/erts/emulator/hipe/hipe_ppc_bifs.m4
+++ b/erts/emulator/hipe/hipe_ppc_bifs.m4
@@ -54,6 +54,8 @@ ASYM($1):
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_BIF
+ STORE r4, P_ARG0(r3) # Store BIF__ARGS in def_arg_reg[]
+ addi r4, r3, P_ARG0
bl CSYM($2)
TEST_GOT_MBUF
@@ -82,6 +84,9 @@ ASYM($1):
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_BIF
+ STORE r4, P_ARG0(r3) # Store BIF__ARGS in def_arg_reg[]
+ STORE r5, P_ARG1(r3)
+ addi r4, r3, P_ARG0
bl CSYM($2)
TEST_GOT_MBUF
@@ -111,6 +116,10 @@ ASYM($1):
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_BIF
+ STORE r4, P_ARG0(r3) # Store BIF__ARGS in def_arg_reg[]
+ STORE r5, P_ARG1(r3)
+ STORE r6, P_ARG2(r3)
+ addi r4, r3, P_ARG0
bl CSYM($2)
TEST_GOT_MBUF
@@ -143,6 +152,7 @@ ASYM($1):
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_BIF
+ /* ignore empty BIF__ARGS */
bl CSYM($2)
TEST_GOT_MBUF
@@ -178,6 +188,7 @@ ASYM($1):
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_GC
+ /* ignore empty BIF__ARGS */
bl CSYM($2)
TEST_GOT_MBUF
@@ -201,6 +212,8 @@ ASYM($1):
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_GC
+ STORE r4, P_ARG0(r3) # Store BIF__ARGS in def_arg_reg[]
+ addi r4, r3, P_ARG0
bl CSYM($2)
TEST_GOT_MBUF
@@ -229,6 +242,9 @@ ASYM($1):
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_GC
+ STORE r4, P_ARG0(r3) # Store BIF__ARGS in def_arg_reg[]
+ STORE r5, P_ARG1(r3)
+ addi r4, r3, P_ARG0
bl CSYM($2)
TEST_GOT_MBUF
diff --git a/erts/emulator/hipe/hipe_sparc_bifs.m4 b/erts/emulator/hipe/hipe_sparc_bifs.m4
index 26337d038a..cf0ad2de30 100644
--- a/erts/emulator/hipe/hipe_sparc_bifs.m4
+++ b/erts/emulator/hipe/hipe_sparc_bifs.m4
@@ -62,6 +62,8 @@ $1:
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_BIF
+ st %o1, [%o0+P_ARG0] ! Store BIF__ARGS in def_arg_reg
+ add %o0, P_ARG0, %o1
call $2
nop
TEST_GOT_MBUF
@@ -88,6 +90,9 @@ $1:
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_BIF
+ st %o1, [%o0+P_ARG0] ! Store BIF__ARGS in def_arg_reg
+ st %o2, [%o0+P_ARG1]
+ add %o0, P_ARG0, %o1
call $2
nop
TEST_GOT_MBUF
@@ -115,6 +120,10 @@ $1:
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_BIF
+ st %o1, [%o0+P_ARG0] ! Store BIF__ARGS in def_arg_reg
+ st %o2, [%o0+P_ARG1]
+ st %o3, [%o0+P_ARG2]
+ add %o0, P_ARG0, %o1
call $2
nop
TEST_GOT_MBUF
@@ -145,6 +154,7 @@ $1:
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_BIF
+ /* ignore empty BIF__ARGS */
call $2
nop
TEST_GOT_MBUF
@@ -178,6 +188,7 @@ $1:
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_GC
+ /* ignore empty BIF__ARGS */
call $2
nop
TEST_GOT_MBUF
@@ -202,6 +213,8 @@ $1:
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_GC
+ st %o1, [%o0+P_ARG0] ! Store BIF__ARGS in def_arg_reg
+ add %o0, P_ARG0, %o1
call $2
nop
TEST_GOT_MBUF
@@ -228,6 +241,9 @@ $1:
/* Save caller-save registers and call the C function. */
SAVE_CONTEXT_GC
+ st %o1, [%o0+P_ARG0] ! Store BIF__ARGS in def_arg_reg
+ st %o2, [%o0+P_ARG1]
+ add %o0, P_ARG0, %o1
call $2
nop
TEST_GOT_MBUF
diff --git a/erts/emulator/hipe/hipe_x86_bifs.m4 b/erts/emulator/hipe/hipe_x86_bifs.m4
index 649c556fae..12f22fbc10 100644
--- a/erts/emulator/hipe/hipe_x86_bifs.m4
+++ b/erts/emulator/hipe/hipe_x86_bifs.m4
@@ -60,7 +60,9 @@ ASYM($1):
/* make the call on the C stack */
NBIF_ARG_REG(0,P)
- NBIF_ARG(1,1,0)
+ NBIF_ARG(2,1,0)
+ lea 8(%esp), %eax
+ NBIF_ARG_REG(1,%eax) # BIF__ARGS
call CSYM($2)
TEST_GOT_MBUF
@@ -92,8 +94,10 @@ ASYM($1):
/* make the call on the C stack */
NBIF_ARG_REG(0,P)
- NBIF_ARG(1,2,0)
- NBIF_ARG(2,2,1)
+ NBIF_ARG(2,2,0)
+ NBIF_ARG(3,2,1)
+ lea 8(%esp), %eax
+ NBIF_ARG_REG(1,%eax) # BIF__ARGS
call CSYM($2)
TEST_GOT_MBUF
@@ -125,9 +129,11 @@ ASYM($1):
/* make the call on the C stack */
NBIF_ARG_REG(0,P)
- NBIF_ARG(1,3,0)
- NBIF_ARG(2,3,1)
- NBIF_ARG(3,3,2)
+ NBIF_ARG(2,3,0)
+ NBIF_ARG(3,3,1)
+ NBIF_ARG(4,3,2)
+ lea 8(%esp), %eax
+ NBIF_ARG_REG(1,%eax) # BIF__ARGS
call CSYM($2)
TEST_GOT_MBUF
@@ -162,6 +168,7 @@ ASYM($1):
/* make the call on the C stack */
NBIF_ARG_REG(0,P)
+ /* skip BIF__ARGS */
call CSYM($2)
TEST_GOT_MBUF