From da3073e8d3d26ec6c63979a22c913d7758eeed71 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Mon, 13 Oct 2014 20:09:19 +0200 Subject: erts: Extend usage of ASM macro to avoid including asm macros in C code and reduce the probability of macro name collisions Catalyst: ppc macro "r0" conflicting with local variable in external.c --- erts/emulator/hipe/hipe_x86_bifs.m4 | 1 + 1 file changed, 1 insertion(+) (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 dd6980f555..a0f16efa33 100644 --- a/erts/emulator/hipe/hipe_x86_bifs.m4 +++ b/erts/emulator/hipe/hipe_x86_bifs.m4 @@ -19,6 +19,7 @@ changecom(`/*', `*/')dnl */ +#`define ASM' include(`hipe/hipe_x86_asm.m4') #`include' "config.h" #`include' "hipe_literals.h" -- cgit v1.2.3 From 0ec91ff571518e199aac7a4da961a80c153483b9 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Fri, 9 May 2014 16:00:54 +0200 Subject: Allow 4-ary BIFs --- erts/emulator/hipe/hipe_x86_bifs.m4 | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (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 a0f16efa33..b0064ee628 100644 --- a/erts/emulator/hipe/hipe_x86_bifs.m4 +++ b/erts/emulator/hipe/hipe_x86_bifs.m4 @@ -48,6 +48,7 @@ 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 @@ -158,6 +159,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): + /* copy native stack pointer */ + NBIF_COPY_NSP(4) + + /* switch to C stack */ + SWITCH_ERLANG_TO_C + + /* make the call on the C stack */ + NBIF_ARG_REG(0,P) + NBIF_ARG(2,4,0) + NBIF_ARG(3,4,1) + NBIF_ARG(4,4,2) + NBIF_ARG(5,4,3) + lea 8(%esp), %eax + NBIF_ARG_REG(1,%eax) /* BIF__ARGS */ + CALL_BIF($2) + TEST_GOT_MBUF + + /* switch to native stack */ + 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 -- cgit v1.2.3 From 086af2a9f8fffefd8fb8330cc45bdf1e698809df Mon Sep 17 00:00:00 2001 From: Mikael Pettersson Date: Fri, 27 Mar 2015 13:13:00 +0100 Subject: erts/hipe: unbreak arity 4 BIFs This fixes arity 4 BIF support in HiPE, following its introduction on master (OTP 18) via the nox/ets-update_counter-4 merge. - define standard_bif_interface_4, nbif_4_gc_after_bif, and nbif_4_simple_exception on ARM: unbreaks the build on ARM - remove bogus stack re-alignment from standard_bif_interface_4 on AMD64: for 4-arg BIFs the stack is already aligned, and the code would misalign the C stack which violates the ABI and may cause alignment faults in vectorized code - the nbif_4_simple_exception OPD name on PPC64 was incorrectly using the nbif_3_simple_exception OPD name: this would have caused a multiple definition error in the assembler or linker In addition there are a few cleanups: - fix standard_bif_interface_N comment on x86 - fix standard_bif_interface_4 comment on SPARC - separate nbif_N_simple_exception blocks by empty lines on PPC, like on ARM, to clearly show which things belong together - fix standard_bif_interface_N comment on ARM - fix standard_bif_interface_4 on AMD64 to match the indentation and spacing conventions of the rest of that file --- erts/emulator/hipe/hipe_x86_bifs.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 b0064ee628..bf549c90e4 100644 --- a/erts/emulator/hipe/hipe_x86_bifs.m4 +++ b/erts/emulator/hipe/hipe_x86_bifs.m4 @@ -51,7 +51,7 @@ define(HANDLE_GOT_MBUF,` * 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, -- cgit v1.2.3 From 738c34d4bb8f1a3811acd00af8c6c12107f8315b Mon Sep 17 00:00:00 2001 From: Bruce Yinhe Date: Thu, 18 Jun 2015 11:31:02 +0200 Subject: Change license text to APLv2 --- erts/emulator/hipe/hipe_x86_bifs.m4 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 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 bf549c90e4..0c0a8da6eb 100644 --- a/erts/emulator/hipe/hipe_x86_bifs.m4 +++ b/erts/emulator/hipe/hipe_x86_bifs.m4 @@ -4,16 +4,17 @@ changecom(`/*', `*/')dnl * * Copyright Ericsson AB 2001-2012. All Rights Reserved. * - * The contents of this file are subject to the Erlang Public License, - * Version 1.1, (the "License"); you may not use this file except in - * compliance with the License. You should have received a copy of the - * Erlang Public License along with this software. If not, it can be - * retrieved online at http://www.erlang.org/. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and limitations - * under the License. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * * %CopyrightEnd% */ -- cgit v1.2.3