From 9dbccbfa2759e2232cba8b3ffb7c5c44d564ec69 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 12 Oct 2011 16:12:53 +0200 Subject: erts-hipe: Remove obscuring macros in generated assembler code No semantic change. Just easier to debug when jumps are spelled out and not obscured by yet another layer of macros. --- erts/emulator/hipe/hipe_x86_bifs.m4 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'erts/emulator/hipe/hipe_x86_bifs.m4') diff --git a/erts/emulator/hipe/hipe_x86_bifs.m4 b/erts/emulator/hipe/hipe_x86_bifs.m4 index 1bb6488b00..649c556fae 100644 --- a/erts/emulator/hipe/hipe_x86_bifs.m4 +++ b/erts/emulator/hipe/hipe_x86_bifs.m4 @@ -28,9 +28,13 @@ include(`hipe/hipe_x86_asm.m4') #define TEST_GOT_EXN cmpl $THE_NON_VALUE,%eax #endif' -`#define TEST_GOT_MBUF movl P_MBUF(P), %edx; testl %edx, %edx; jnz 3f; 2: -#define JOIN3(A,B,C) A##B##C -#define HANDLE_GOT_MBUF(ARITY) 3: call JOIN3(nbif_,ARITY,_gc_after_bif); jmp 2b' +define(TEST_GOT_MBUF,`movl P_MBUF(P), %edx # `TEST_GOT_MBUF' + testl %edx, %edx + jnz 3f +2:') +define(HANDLE_GOT_MBUF,` +3: call nbif_$1_gc_after_bif # `HANDLE_GOT_MBUF' + jmp 2b') /* * standard_bif_interface_1(nbif_name, cbif_name) -- cgit v1.2.3 From 36573dcb143db17d9e40b0bd270f2001a9872b63 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 25 Oct 2011 10:57:12 +0200 Subject: erts-hipe: Adapt generated BIF wrappers for new calling convention x86 and amd64: Push BIF__ARGS array on C-stack. ppc, sparc and arm: Write BIF__ARGS array to P->def_arg_reg[] Just the simplest solution with limited assembler knowledge, probably room for improvements. --- erts/emulator/hipe/hipe_x86_bifs.m4 | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'erts/emulator/hipe/hipe_x86_bifs.m4') 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 -- cgit v1.2.3 From 7085a1a3240e80b9558d722e2979c9122e0b29d2 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 19 Oct 2011 17:02:50 +0200 Subject: erts-hipe: Rename fail_bif_interface_0 to standard_bif_interface_0 --- erts/emulator/hipe/hipe_x86_bifs.m4 | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'erts/emulator/hipe/hipe_x86_bifs.m4') diff --git a/erts/emulator/hipe/hipe_x86_bifs.m4 b/erts/emulator/hipe/hipe_x86_bifs.m4 index 12f22fbc10..dca5721c29 100644 --- a/erts/emulator/hipe/hipe_x86_bifs.m4 +++ b/erts/emulator/hipe/hipe_x86_bifs.m4 @@ -40,8 +40,9 @@ 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_0(nbif_name, cbif_name) * - * Generate native interface for a BIF with 1-3 parameters and + * Generate native interface for a BIF with 0-3 parameters and * standard failure mode. */ define(standard_bif_interface_1, @@ -149,13 +150,7 @@ ASYM($1): TYPE_FUNCTION(ASYM($1)) #endif') -/* - * fail_bif_interface_0(nbif_name, cbif_name) - * - * Generate native interface for a BIF with 0 parameters and - * standard failure mode. - */ -define(fail_bif_interface_0, +define(standard_bif_interface_0, ` #ifndef HAVE_$1 #`define' HAVE_$1 -- cgit v1.2.3 From 01c734e6a60bb9579c00079f7d81d197b684c9e3 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Fri, 18 Mar 2011 18:19:45 +0100 Subject: 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. --- erts/emulator/hipe/hipe_x86_bifs.m4 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'erts/emulator/hipe/hipe_x86_bifs.m4') diff --git a/erts/emulator/hipe/hipe_x86_bifs.m4 b/erts/emulator/hipe/hipe_x86_bifs.m4 index dca5721c29..2ea69bde3c 100644 --- a/erts/emulator/hipe/hipe_x86_bifs.m4 +++ b/erts/emulator/hipe/hipe_x86_bifs.m4 @@ -20,6 +20,7 @@ changecom(`/*', `*/')dnl include(`hipe/hipe_x86_asm.m4') +#`include' "config.h" #`include' "hipe_literals.h" `#if THE_NON_VALUE == 0 @@ -28,6 +29,12 @@ include(`hipe/hipe_x86_asm.m4') #define TEST_GOT_EXN cmpl $THE_NON_VALUE,%eax #endif' +`#if defined(ERTS_ENABLE_LOCK_CHECK) && defined(ERTS_SMP) +# define CALL_BIF(F) movl $CSYM(F), P_BIF_CALLEE(P); call CSYM(hipe_debug_bif_wrapper) +#else +# define CALL_BIF(F) call CSYM(F) +#endif' + define(TEST_GOT_MBUF,`movl P_MBUF(P), %edx # `TEST_GOT_MBUF' testl %edx, %edx jnz 3f @@ -64,7 +71,7 @@ ASYM($1): NBIF_ARG(2,1,0) lea 8(%esp), %eax NBIF_ARG_REG(1,%eax) # BIF__ARGS - call CSYM($2) + CALL_BIF($2) TEST_GOT_MBUF /* switch to native stack */ @@ -99,7 +106,7 @@ ASYM($1): NBIF_ARG(3,2,1) lea 8(%esp), %eax NBIF_ARG_REG(1,%eax) # BIF__ARGS - call CSYM($2) + CALL_BIF($2) TEST_GOT_MBUF /* switch to native stack */ @@ -135,7 +142,7 @@ ASYM($1): NBIF_ARG(4,3,2) lea 8(%esp), %eax NBIF_ARG_REG(1,%eax) # BIF__ARGS - call CSYM($2) + CALL_BIF($2) TEST_GOT_MBUF /* switch to native stack */ @@ -164,7 +171,7 @@ ASYM($1): /* make the call on the C stack */ NBIF_ARG_REG(0,P) /* skip BIF__ARGS */ - call CSYM($2) + CALL_BIF($2) TEST_GOT_MBUF /* switch to native stack */ -- cgit v1.2.3