Mercurial > pub > dyncall > dyncall
changeset 661:93ce63d72d59
- dyncallback code cleanup: removed unneeded headers
author | Tassilo Philipp |
---|---|
date | Thu, 14 Mar 2024 10:11:28 +0100 |
parents | 17dff20b9c10 |
children | 2012dee097d3 |
files | dyncallback/dyncall_args_arm32.c dyncallback/dyncall_args_arm32.h dyncallback/dyncall_args_arm64.c dyncallback/dyncall_args_ppc64.c dyncallback/dyncall_args_ppc64.h dyncallback/dyncall_args_sparc32.c dyncallback/dyncall_args_sparc32.h dyncallback/dyncall_args_sparc64.c dyncallback/dyncall_args_sparc64.h dyncallback/dyncall_args_x64.c dyncallback/dyncall_args_x64.h |
diffstat | 11 files changed, 67 insertions(+), 229 deletions(-) [+] |
line wrap: on
line diff
--- a/dyncallback/dyncall_args_arm32.c Tue Mar 12 23:32:12 2024 +0100 +++ b/dyncallback/dyncall_args_arm32.c Thu Mar 14 10:11:28 2024 +0100 @@ -6,7 +6,7 @@ Description: Callback's Arguments VM - Implementation for ARM32 (ARM and THUMB mode) License: - Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>, + Copyright (c) 2007-2024 Daniel Adler <dadler@uni-goettingen.de>, Tassilo Philipp <tphilipp@potion-studios.com> Permission to use, copy, modify, and distribute this software for any @@ -25,7 +25,20 @@ -#include "dyncall_args_arm32.h" +#include "dyncall_args.h" + +struct DCArgs +{ + /* Don't change order! */ + long reg_data[4]; + int reg_count; + long* stack_ptr; +#if defined(DC__ABI_ARM_HF) + DCfloat f[16]; + int freg_count; + int dreg_count; +#endif +}; static void arm_align_64(DCArgs* args)
--- a/dyncallback/dyncall_args_arm32.h Tue Mar 12 23:32:12 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* - - Package: dyncall - Library: dyncallback - File: dyncallback/dyncall_args_arm32.h - Description: Callback's Arguments VM - Header for ARM32 (ARM and THUMB mode) - License: - - Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>, - Tassilo Philipp <tphilipp@potion-studios.com> - - Permission to use, copy, modify, and distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -*/ - - -#ifndef DYNCALLBACK_ARGS_ARM32_H -#define DYNCALLBACK_ARGS_ARM32_H - -#include "dyncall_args.h" - -struct DCArgs -{ - /* Don't change order! */ - long reg_data[4]; - int reg_count; - long* stack_ptr; -#if defined(DC__ABI_ARM_HF) - DCfloat f[16]; - int freg_count; - int dreg_count; -#endif -}; - -#endif /* DYNCALLBACK_ARGS_ARM32_H */ -
--- a/dyncallback/dyncall_args_arm64.c Tue Mar 12 23:32:12 2024 +0100 +++ b/dyncallback/dyncall_args_arm64.c Thu Mar 14 10:11:28 2024 +0100 @@ -22,6 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + #include "dyncall_args.h" #include <stdint.h>
--- a/dyncallback/dyncall_args_ppc64.c Tue Mar 12 23:32:12 2024 +0100 +++ b/dyncallback/dyncall_args_ppc64.c Thu Mar 14 10:11:28 2024 +0100 @@ -7,7 +7,7 @@ License: Copyright (c) 2014-2015 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com>, - 2022 Tassilo Philipp <tphilipp@potion-studios.com> + 2022-2024 Tassilo Philipp <tphilipp@potion-studios.com> Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -23,7 +23,16 @@ */ -#include "dyncall_args_ppc64.h" +#include "dyncall_args.h" + +struct DCArgs +{ + long long ireg_data[8]; + double freg_data[13]; + unsigned char* stackptr; + int ireg_count; + int freg_count; +}; DCint dcbArgInt (DCArgs* p) { return (DCint) dcbArgLongLong(p); } DCuint dcbArgUInt (DCArgs* p) { return (DCuint) dcbArgLongLong(p); }
--- a/dyncallback/dyncall_args_ppc64.h Tue Mar 12 23:32:12 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* - - Package: dyncall - Library: dyncallback - File: dyncallback/dyncall_args_ppc64.h - Description: Callback's Arguments VM - Header for ppc64 - License: - - Copyright (c) 2014-2015 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com> - - Permission to use, copy, modify, and distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -*/ - -#ifndef DYNCALLBACK_ARGS_PPC64_H -#define DYNCALLBACK_ARGS_PPC64_H - -#include "dyncall_args.h" - -struct DCArgs -{ - long long ireg_data[8]; - double freg_data[13]; - unsigned char* stackptr; - int ireg_count; - int freg_count; -}; - -#endif /* DYNCALLBACK_ARGS_PPC64_H */ -
--- a/dyncallback/dyncall_args_sparc32.c Tue Mar 12 23:32:12 2024 +0100 +++ b/dyncallback/dyncall_args_sparc32.c Thu Mar 14 10:11:28 2024 +0100 @@ -6,7 +6,7 @@ Description: Callback's Arguments VM - Implementation for sparc32 - not yet License: - Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>, + Copyright (c) 2007-2024 Daniel Adler <dadler@uni-goettingen.de>, Tassilo Philipp <tphilipp@potion-studios.com> Permission to use, copy, modify, and distribute this software for any @@ -24,7 +24,12 @@ */ -#include "dyncall_args_sparc32.h" +#include "dyncall_args.h" + +struct DCArgs +{ + int *arg_ptr; +}; /* Compiler aligns this to 8-byte boundaries, b/c of dword members, a fact needed below */ typedef union {
--- a/dyncallback/dyncall_args_sparc32.h Tue Mar 12 23:32:12 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - - Package: dyncall - Library: dyncallback - File: dyncallback/dyncall_args_sparc32.h - Description: Callback's Arguments VM - Header for sparc32 - License: - - Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>, - Tassilo Philipp <tphilipp@potion-studios.com> - - Permission to use, copy, modify, and distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -*/ - - -#ifndef DYNCALLBACK_ARGS_SPARC32_H -#define DYNCALLBACK_ARGS_SPARC32_H - -#include "dyncall_args.h" - -struct DCArgs -{ - int *arg_ptr; -}; - -#endif /* DYNCALLBACK_ARGS_SPARC32_H */ -
--- a/dyncallback/dyncall_args_sparc64.c Tue Mar 12 23:32:12 2024 +0100 +++ b/dyncallback/dyncall_args_sparc64.c Thu Mar 14 10:11:28 2024 +0100 @@ -6,7 +6,7 @@ Description: Callback's Arguments VM - Implementation for sparc64 - not yet License: - Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>, + Copyright (c) 2007-2024 Daniel Adler <dadler@uni-goettingen.de>, Tassilo Philipp <tphilipp@potion-studios.com> Permission to use, copy, modify, and distribute this software for any @@ -24,7 +24,17 @@ */ -#include "dyncall_args_sparc64.h" +#include "dyncall_args.h" + +#define DCARGS_SPARC64_NUM_DOUBLE_REGS 16 +struct DCArgs +{ + /* Don't change order or types, laid out for asm code to fill in! */ + DClonglong *arg_ptr; + DCdouble dreg_data[DCARGS_SPARC64_NUM_DOUBLE_REGS]; + DClonglong i; /* args fetched */ +}; + DCulonglong dcbArgULongLong(DCArgs* p) { return p->arg_ptr[p->i++]; } DClonglong dcbArgLongLong (DCArgs* p) { return (DClonglong)dcbArgULongLong(p); }
--- a/dyncallback/dyncall_args_sparc64.h Tue Mar 12 23:32:12 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - - Package: dyncall - Library: dyncallback - File: dyncallback/dyncall_args_sparc64.h - Description: Callback's Arguments VM - Header for sparc64 - not yet - License: - - Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>, - Tassilo Philipp <tphilipp@potion-studios.com> - - Permission to use, copy, modify, and distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -*/ - - -#ifndef DYNCALLBACK_ARGS_SPARC64_H -#define DYNCALLBACK_ARGS_SPARC64_H - -#include "dyncall_args.h" - -#define DCARGS_SPARC64_NUM_DOUBLE_REGS 16 -struct DCArgs -{ - /* Don't change order or types, laid out for asm code to fill in! */ - DClonglong *arg_ptr; - DCdouble dreg_data[DCARGS_SPARC64_NUM_DOUBLE_REGS]; - DClonglong i; /* args fetched */ -}; - -#endif /* DYNCALLBACK_ARGS_SPARC64_H */ -
--- a/dyncallback/dyncall_args_x64.c Tue Mar 12 23:32:12 2024 +0100 +++ b/dyncallback/dyncall_args_x64.c Thu Mar 14 10:11:28 2024 +0100 @@ -6,7 +6,7 @@ Description: Callback's Arguments VM - Implementation for x64 License: - Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>, + Copyright (c) 2007-2024 Daniel Adler <dadler@uni-goettingen.de>, Tassilo Philipp <tphilipp@potion-studios.com> Permission to use, copy, modify, and distribute this software for any @@ -25,12 +25,31 @@ -#include "dyncall_args_x64.h" +#include "dyncall_args.h" +#include "dyncall_callvm_x64.h" /* reuse DCRegCount_x64 and DCRegData_x64_s */ +#include "dyncall_aggregate.h" #include <assert.h> #include <string.h> +struct DCArgs +{ + /* state */ + int64* stack_ptr; /* offset 0 */ + DCRegCount_x64 reg_count; /* offset 8, size:win 4, size:*nix 8 */ +#if defined(DC_WINDOWS) + int pad_w; /* alignment helper for win/x64 */ +#endif + int aggr_return_register; /* offset 16 */ + int pad; /* offset 20 */ + DCaggr** aggrs; /* offset 24 */ + + /* reg data */ + DCRegData_x64_s reg_data; /* offset 32 */ +}; + + static int64* arg_i64(DCArgs* args) { args->reg_count.i += (args->reg_count.i == args->aggr_return_register);
--- a/dyncallback/dyncall_args_x64.h Tue Mar 12 23:32:12 2024 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - - Package: dyncall - Library: dyncallback - File: dyncallback/dyncall_args_x64.h - Description: Callback's Arguments VM - Header for x64 - License: - - Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>, - Tassilo Philipp <tphilipp@potion-studios.com> - - Permission to use, copy, modify, and distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -*/ - - -#ifndef DYNCALLBACK_ARGS_X64_H -#define DYNCALLBACK_ARGS_X64_H - -#include "dyncall_args.h" -#include "dyncall_callvm_x64.h" /* reuse DCRegCount_x64 and DCRegData_x64_s */ -#include "dyncall_aggregate.h" - - - -struct DCArgs -{ - /* state */ - int64* stack_ptr; /* offset 0 */ - DCRegCount_x64 reg_count; /* offset 8, size:win 4, size:*nix 8 */ -#if defined(DC_WINDOWS) - int pad_w; /* alignment helper for win/x64 */ -#endif - int aggr_return_register; /* offset 16 */ - int pad; /* offset 20 */ - DCaggr** aggrs; /* offset 24 */ - - /* reg data */ - DCRegData_x64_s reg_data; /* offset 32 */ -}; - -#endif /* DYNCALLBACK_ARGS_X64_H */ -