Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "libffi"]
path = libffi
url = https://github.com/NativeScript/libffi.git
branch = darind/v8-ios
branch = feat/vector-types
[submodule "TestRunner/app/shared"]
path = TestRunner/app/shared
url = https://github.com/NativeScript/common-runtime-tests-app.git
Expand Down
171 changes: 111 additions & 60 deletions NativeScript/include/libffi/arm64/ffi.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* -----------------------------------------------------------------*-C-*-
libffi 3.3-rc0 - Copyright (c) 2011, 2014 Anthony Green
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
libffi 3.7.1
- Copyright (c) 2011, 2014, 2019, 2021, 2022, 2024, 2025, 2026 Anthony Green
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -55,6 +56,34 @@ extern "C" {

/* ---- System configuration information --------------------------------- */

/* If these change, update src/mips/ffitarget.h. */
#define FFI_TYPE_VOID 0
#define FFI_TYPE_INT 1
#define FFI_TYPE_FLOAT 2
#define FFI_TYPE_DOUBLE 3
#if 0
#define FFI_TYPE_LONGDOUBLE 4
#else
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
#endif
#define FFI_TYPE_UINT8 5
#define FFI_TYPE_SINT8 6
#define FFI_TYPE_UINT16 7
#define FFI_TYPE_SINT16 8
#define FFI_TYPE_UINT32 9
#define FFI_TYPE_SINT32 10
#define FFI_TYPE_UINT64 11
#define FFI_TYPE_SINT64 12
#define FFI_TYPE_STRUCT 13
#define FFI_TYPE_POINTER 14
#define FFI_TYPE_COMPLEX 15
#define FFI_TYPE_UINT128 16
#define FFI_TYPE_SINT128 17
#define FFI_TYPE_VECTOR 18

/* This should always refer to the last type code (for sanity checks). */
#define FFI_TYPE_LAST FFI_TYPE_VECTOR

#include "ffitarget.h"

#ifndef LIBFFI_ASM
Expand Down Expand Up @@ -114,13 +143,11 @@ typedef struct _ffi_type
when using the static version of the library.
Besides, as a workaround, they can define FFI_BUILDING if they
*know* they are going to link with the static library. */
#if defined _MSC_VER
#if defined _MSC_VER && !defined(FFI_STATIC_BUILD)
# if defined FFI_BUILDING_DLL /* Building libffi.DLL with msvcc.sh */
# define FFI_API __declspec(dllexport)
# elif !defined FFI_BUILDING /* Importing libffi.DLL */
# else /* Importing libffi.DLL */
# define FFI_API __declspec(dllimport)
# else /* Building/linking static library */
# define FFI_API
# endif
#else
# define FFI_API
Expand Down Expand Up @@ -196,28 +223,25 @@ FFI_EXTERN ffi_type ffi_type_sint64;
FFI_EXTERN ffi_type ffi_type_float;
FFI_EXTERN ffi_type ffi_type_double;
FFI_EXTERN ffi_type ffi_type_pointer;

#if 0
FFI_EXTERN ffi_type ffi_type_longdouble;
#else
#define ffi_type_longdouble ffi_type_double
#endif

#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
FFI_EXTERN ffi_type ffi_type_complex_float;
FFI_EXTERN ffi_type ffi_type_complex_double;
#if 0
FFI_EXTERN ffi_type ffi_type_complex_longdouble;
#else
#define ffi_type_complex_longdouble ffi_type_complex_double
#endif

#ifdef FFI_TARGET_HAS_INT128
FFI_EXTERN ffi_type ffi_type_uint128;
FFI_EXTERN ffi_type ffi_type_sint128;
#endif
#endif /* LIBFFI_HIDE_BASIC_TYPES */

typedef enum {
FFI_OK = 0,
FFI_BAD_TYPEDEF,
FFI_BAD_ABI
FFI_BAD_ABI,
FFI_BAD_ARGTYPE
} ffi_status;

typedef struct {
Expand Down Expand Up @@ -288,15 +312,33 @@ FFI_API
void ffi_java_raw_call (ffi_cif *cif,
void (*fn)(void),
void *rvalue,
ffi_java_raw *avalue);
ffi_java_raw *avalue) __attribute__((deprecated));
#endif

FFI_API
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) __attribute__((deprecated));
FFI_API
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args) __attribute__((deprecated));
FFI_API
size_t ffi_java_raw_size (ffi_cif *cif);
size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));

/* ---- Version API ------------------------------------------------------ */

#define FFI_VERSION_STRING "3.7.1"
#define FFI_VERSION_NUMBER 30701

#ifndef LIBFFI_ASM
/* Return a version string. */
FFI_API const char *ffi_get_version (void);

/* Return the version as an unsigned long value: (x * 10000 + y * 100 + z) */
FFI_API unsigned long ffi_get_version_number (void);
#endif

/* ---- Internals API ---------------------------------------------------- */

FFI_API unsigned int ffi_get_default_abi (void);
FFI_API size_t ffi_get_closure_size (void);

/* ---- Definitions for closures ----------------------------------------- */

Expand All @@ -310,11 +352,22 @@ typedef struct {
void *trampoline_table;
void *trampoline_table_entry;
#else
char tramp[FFI_TRAMPOLINE_SIZE];
/* Anonymous unions are C11 (a GNU extension in C99); __extension__ keeps
the field names without tripping -Wpedantic under -std=c99 (#795). */
#ifdef __GNUC__
__extension__
#endif
union {
char tramp[FFI_TRAMPOLINE_SIZE];
void *ftramp;
};
#endif
ffi_cif *cif;
void (*fun)(ffi_cif*,void*,void**,void*);
void *user_data;
#if defined(_MSC_VER) && defined(_M_IX86)
void *padding;
#endif
} ffi_closure
#ifdef __GNUC__
__attribute__((aligned (8)))
Expand Down Expand Up @@ -347,7 +400,7 @@ ffi_prep_closure_loc (ffi_closure*,
ffi_cif *,
void (*fun)(ffi_cif*,void*,void**,void*),
void *user_data,
void*codeloc);
void *codeloc);

#ifdef __sgi
# pragma pack 8
Expand All @@ -365,7 +418,7 @@ typedef struct {

/* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate
handler to do the transaltion, void** -> ffi_raw*. */
handler to do the translation, void** -> ffi_raw*. */

void (*translate_args)(ffi_cif*,void*,void**,void*);
void *this_closure;
Expand Down Expand Up @@ -421,19 +474,19 @@ FFI_API ffi_status
ffi_prep_java_raw_closure (ffi_java_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data);
void *user_data) __attribute__((deprecated));

FFI_API ffi_status
ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
ffi_cif *cif,
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data,
void *codeloc);
void *codeloc) __attribute__((deprecated));
#endif

#endif /* FFI_CLOSURES */

#if FFI_GO_CLOSURES
#ifdef FFI_GO_CLOSURES

typedef struct {
void *tramp;
Expand Down Expand Up @@ -472,49 +525,47 @@ void ffi_call(ffi_cif *cif,
void *rvalue,
void **avalue);

/* Reusable call plans.

A plan captures a signature's argument placement once so that repeated
calls skip the per-call work that ffi_call would otherwise redo. Build one
with ffi_call_plan_alloc, invoke it as many times as you like, and release
it with ffi_call_plan_free.

The plan is opaque and caller-owned. The cif must outlive the plan.
ffi_call_plan_alloc returns NULL only on allocation failure; a signature
with no fast path is still valid and ffi_call_plan_invoke falls back to
ffi_call for it. A plan is immutable once built, so it may be shared and
invoked concurrently from multiple threads. */
typedef struct ffi_call_plan ffi_call_plan;

FFI_API
ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
size_t *offsets);
ffi_call_plan *ffi_call_plan_alloc (ffi_cif *cif);

/* Useful for eliminating compiler warnings. */
#define FFI_FN(f) ((void (*)(void))f)
FFI_API
void ffi_call_plan_invoke (ffi_call_plan *plan,
void (*fn)(void),
void *rvalue,
void **avalue);

/* ---- Definitions shared with assembly code ---------------------------- */
FFI_API
void ffi_call_plan_free (ffi_call_plan *plan);

#endif
FFI_API
ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
size_t *offsets);

/* If these change, update src/mips/ffitarget.h. */
#define FFI_TYPE_VOID 0
#define FFI_TYPE_INT 1
#define FFI_TYPE_FLOAT 2
#define FFI_TYPE_DOUBLE 3
#if 0
#define FFI_TYPE_LONGDOUBLE 4
/* Convert between closure and function pointers. */
#if defined(PA_LINUX) || defined(PA_HPUX)
#define FFI_FN(f) ((void (*)(void))((unsigned int)(f) | 2))
#define FFI_CL(f) ((void *)((unsigned int)(f) & ~3))
#else
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
#endif
#define FFI_TYPE_UINT8 5
#define FFI_TYPE_SINT8 6
#define FFI_TYPE_UINT16 7
#define FFI_TYPE_SINT16 8
#define FFI_TYPE_UINT32 9
#define FFI_TYPE_SINT32 10
#define FFI_TYPE_UINT64 11
#define FFI_TYPE_SINT64 12
#define FFI_TYPE_STRUCT 13
#define FFI_TYPE_POINTER 14
#define FFI_TYPE_COMPLEX 15
#if 1
#define FFI_TYPE_EXT_VECTOR 16
#else
#define FFI_TYPE_EXT_VECTOR FFI_TYPE_STRUCT
#define FFI_FN(f) ((void (*)(void))f)
#define FFI_CL(f) ((void *)(f))
#endif

/* This should always refer to the last type code (for sanity checks). */
#if 1
#define FFI_TYPE_LAST FFI_TYPE_EXT_VECTOR
#else
#define FFI_TYPE_LAST FFI_TYPE_COMPLEX
/* ---- Definitions shared with assembly code ---------------------------- */

#endif

#ifdef __cplusplus
Expand Down
23 changes: 17 additions & 6 deletions NativeScript/include/libffi/arm64/ffitarget.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define FFI_SIZEOF_JAVA_RAW 4
typedef unsigned long long ffi_arg;
typedef signed long long ffi_sarg;
#elif defined(_M_ARM64)
#elif defined(_WIN32)
#define FFI_SIZEOF_ARG 8
typedef unsigned long long ffi_arg;
typedef signed long long ffi_sarg;
Expand All @@ -45,8 +45,13 @@ typedef enum ffi_abi
{
FFI_FIRST_ABI = 0,
FFI_SYSV,
FFI_WIN64,
FFI_LAST_ABI,
#if defined(_WIN32)
FFI_DEFAULT_ABI = FFI_WIN64
#else
FFI_DEFAULT_ABI = FFI_SYSV
#endif
} ffi_abi;
#endif

Expand All @@ -69,24 +74,30 @@ typedef enum ffi_abi
#define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
#endif

#ifdef _M_ARM64
#ifdef _WIN32
#define FFI_EXTRA_CIF_FIELDS unsigned is_variadic
#endif
#define FFI_TARGET_SPECIFIC_VARIADIC

/* ---- Internal ---- */

#if defined (__APPLE__)
#define FFI_TARGET_SPECIFIC_VARIADIC
#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs
#elif !defined(_M_ARM64)
/* iOS and Windows reserve x18 for the system. Disable Go closures until
#elif !defined(_WIN32) && !defined(__ANDROID__)
/* iOS, Windows and Android reserve x18 for the system. Disable Go closures until
a new static chain is chosen. */
#define FFI_GO_CLOSURES 1
#endif

#ifndef _M_ARM64
#ifndef _WIN32
/* No complex type on Windows */
#define FFI_TARGET_HAS_COMPLEX_TYPE
#endif

/* AAPCS64 passes 8- and 16-byte vectors in V/Q registers and homogeneous
vector aggregates in consecutive V/Q registers; see is_vfp_type. */
#define FFI_TARGET_HAS_VECTOR_TYPE

#define FFI_TARGET_HAS_INT128 1

#endif
Loading
Loading