Skip to content

Commit

Permalink
Sync ffi.h
Browse files Browse the repository at this point in the history
  • Loading branch information
lygstate committed May 5, 2021
1 parent 3ce18ac commit 074780d
Show file tree
Hide file tree
Showing 15 changed files with 417 additions and 218 deletions.
41 changes: 27 additions & 14 deletions deps/libffi/config/freebsd/ia32/ffi.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* -----------------------------------------------------------------*-C-*-
libffi 3.3 - Copyright (c) 2011, 2014, 2019 Anthony Green
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
libffi @VERSION@
- Copyright (c) 2011, 2014, 2019, 2021 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 @@ -217,7 +218,8 @@ FFI_EXTERN ffi_type ffi_type_complex_longdouble;
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 @@ -269,7 +271,7 @@ typedef ffi_raw ffi_java_raw;
#endif


FFI_API
FFI_API
void ffi_raw_call (ffi_cif *cif,
void (*fn)(void),
void *rvalue,
Expand Down Expand Up @@ -310,7 +312,10 @@ typedef struct {
void *trampoline_table;
void *trampoline_table_entry;
#else
char tramp[FFI_TRAMPOLINE_SIZE];
union {
char tramp[FFI_TRAMPOLINE_SIZE];
void *ftramp;
};
#endif
ffi_cif *cif;
void (*fun)(ffi_cif*,void*,void**,void*);
Expand All @@ -330,6 +335,14 @@ typedef struct {
FFI_API void *ffi_closure_alloc (size_t size, void **code);
FFI_API void ffi_closure_free (void *);

#if defined(PA_LINUX) || defined(PA_HPUX)
#define FFI_CLOSURE_PTR(X) ((void *)((unsigned int)(X) | 2))
#define FFI_RESTORE_PTR(X) ((void *)((unsigned int)(X) & ~3))
#else
#define FFI_CLOSURE_PTR(X) (X)
#define FFI_RESTORE_PTR(X) (X)
#endif

FFI_API ffi_status
ffi_prep_closure (ffi_closure*,
ffi_cif *,
Expand Down Expand Up @@ -363,8 +376,8 @@ typedef struct {

#if !FFI_NATIVE_RAW_API

/* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate
/* 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*. */

void (*translate_args)(ffi_cif*,void*,void**,void*);
Expand All @@ -389,8 +402,8 @@ typedef struct {

#if !FFI_NATIVE_RAW_API

/* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate
/* 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 translation, void** -> ffi_raw*. */

void (*translate_args)(ffi_cif*,void*,void**,void*);
Expand Down Expand Up @@ -451,7 +464,7 @@ FFI_API void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,

/* ---- Public interface definition -------------------------------------- */

FFI_API
FFI_API
ffi_status ffi_prep_cif(ffi_cif *cif,
ffi_abi abi,
unsigned int nargs,
Expand Down Expand Up @@ -484,18 +497,18 @@ ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
#endif

/* If these change, update src/mips/ffitarget.h. */
#define FFI_TYPE_VOID 0
#define FFI_TYPE_VOID 0
#define FFI_TYPE_INT 1
#define FFI_TYPE_FLOAT 2
#define FFI_TYPE_FLOAT 2
#define FFI_TYPE_DOUBLE 3
#if 1
#define FFI_TYPE_LONGDOUBLE 4
#else
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
#endif
#define FFI_TYPE_UINT8 5
#define FFI_TYPE_UINT8 5
#define FFI_TYPE_SINT8 6
#define FFI_TYPE_UINT16 7
#define FFI_TYPE_UINT16 7
#define FFI_TYPE_SINT16 8
#define FFI_TYPE_UINT32 9
#define FFI_TYPE_SINT32 10
Expand Down
41 changes: 27 additions & 14 deletions deps/libffi/config/freebsd/x64/ffi.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* -----------------------------------------------------------------*-C-*-
libffi 3.3 - Copyright (c) 2011, 2014, 2019 Anthony Green
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
libffi @VERSION@
- Copyright (c) 2011, 2014, 2019, 2021 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 @@ -217,7 +218,8 @@ FFI_EXTERN ffi_type ffi_type_complex_longdouble;
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 @@ -269,7 +271,7 @@ typedef ffi_raw ffi_java_raw;
#endif


FFI_API
FFI_API
void ffi_raw_call (ffi_cif *cif,
void (*fn)(void),
void *rvalue,
Expand Down Expand Up @@ -310,7 +312,10 @@ typedef struct {
void *trampoline_table;
void *trampoline_table_entry;
#else
char tramp[FFI_TRAMPOLINE_SIZE];
union {
char tramp[FFI_TRAMPOLINE_SIZE];
void *ftramp;
};
#endif
ffi_cif *cif;
void (*fun)(ffi_cif*,void*,void**,void*);
Expand All @@ -330,6 +335,14 @@ typedef struct {
FFI_API void *ffi_closure_alloc (size_t size, void **code);
FFI_API void ffi_closure_free (void *);

#if defined(PA_LINUX) || defined(PA_HPUX)
#define FFI_CLOSURE_PTR(X) ((void *)((unsigned int)(X) | 2))
#define FFI_RESTORE_PTR(X) ((void *)((unsigned int)(X) & ~3))
#else
#define FFI_CLOSURE_PTR(X) (X)
#define FFI_RESTORE_PTR(X) (X)
#endif

FFI_API ffi_status
ffi_prep_closure (ffi_closure*,
ffi_cif *,
Expand Down Expand Up @@ -363,8 +376,8 @@ typedef struct {

#if !FFI_NATIVE_RAW_API

/* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate
/* 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*. */

void (*translate_args)(ffi_cif*,void*,void**,void*);
Expand All @@ -389,8 +402,8 @@ typedef struct {

#if !FFI_NATIVE_RAW_API

/* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate
/* 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 translation, void** -> ffi_raw*. */

void (*translate_args)(ffi_cif*,void*,void**,void*);
Expand Down Expand Up @@ -451,7 +464,7 @@ FFI_API void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,

/* ---- Public interface definition -------------------------------------- */

FFI_API
FFI_API
ffi_status ffi_prep_cif(ffi_cif *cif,
ffi_abi abi,
unsigned int nargs,
Expand Down Expand Up @@ -484,18 +497,18 @@ ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
#endif

/* If these change, update src/mips/ffitarget.h. */
#define FFI_TYPE_VOID 0
#define FFI_TYPE_VOID 0
#define FFI_TYPE_INT 1
#define FFI_TYPE_FLOAT 2
#define FFI_TYPE_FLOAT 2
#define FFI_TYPE_DOUBLE 3
#if 1
#define FFI_TYPE_LONGDOUBLE 4
#else
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
#endif
#define FFI_TYPE_UINT8 5
#define FFI_TYPE_UINT8 5
#define FFI_TYPE_SINT8 6
#define FFI_TYPE_UINT16 7
#define FFI_TYPE_UINT16 7
#define FFI_TYPE_SINT16 8
#define FFI_TYPE_UINT32 9
#define FFI_TYPE_SINT32 10
Expand Down
41 changes: 27 additions & 14 deletions deps/libffi/config/linux/arm/ffi.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* -----------------------------------------------------------------*-C-*-
libffi 3.3 - Copyright (c) 2011, 2014, 2019 Anthony Green
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
libffi @VERSION@
- Copyright (c) 2011, 2014, 2019, 2021 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 @@ -217,7 +218,8 @@ FFI_EXTERN ffi_type ffi_type_complex_longdouble;
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 @@ -269,7 +271,7 @@ typedef ffi_raw ffi_java_raw;
#endif


FFI_API
FFI_API
void ffi_raw_call (ffi_cif *cif,
void (*fn)(void),
void *rvalue,
Expand Down Expand Up @@ -310,7 +312,10 @@ typedef struct {
void *trampoline_table;
void *trampoline_table_entry;
#else
char tramp[FFI_TRAMPOLINE_SIZE];
union {
char tramp[FFI_TRAMPOLINE_SIZE];
void *ftramp;
};
#endif
ffi_cif *cif;
void (*fun)(ffi_cif*,void*,void**,void*);
Expand All @@ -330,6 +335,14 @@ typedef struct {
FFI_API void *ffi_closure_alloc (size_t size, void **code);
FFI_API void ffi_closure_free (void *);

#if defined(PA_LINUX) || defined(PA_HPUX)
#define FFI_CLOSURE_PTR(X) ((void *)((unsigned int)(X) | 2))
#define FFI_RESTORE_PTR(X) ((void *)((unsigned int)(X) & ~3))
#else
#define FFI_CLOSURE_PTR(X) (X)
#define FFI_RESTORE_PTR(X) (X)
#endif

FFI_API ffi_status
ffi_prep_closure (ffi_closure*,
ffi_cif *,
Expand Down Expand Up @@ -363,8 +376,8 @@ typedef struct {

#if !FFI_NATIVE_RAW_API

/* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate
/* 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*. */

void (*translate_args)(ffi_cif*,void*,void**,void*);
Expand All @@ -389,8 +402,8 @@ typedef struct {

#if !FFI_NATIVE_RAW_API

/* If this is enabled, then a raw closure has the same layout
as a regular closure. We use this to install an intermediate
/* 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 translation, void** -> ffi_raw*. */

void (*translate_args)(ffi_cif*,void*,void**,void*);
Expand Down Expand Up @@ -451,7 +464,7 @@ FFI_API void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,

/* ---- Public interface definition -------------------------------------- */

FFI_API
FFI_API
ffi_status ffi_prep_cif(ffi_cif *cif,
ffi_abi abi,
unsigned int nargs,
Expand Down Expand Up @@ -484,18 +497,18 @@ ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
#endif

/* If these change, update src/mips/ffitarget.h. */
#define FFI_TYPE_VOID 0
#define FFI_TYPE_VOID 0
#define FFI_TYPE_INT 1
#define FFI_TYPE_FLOAT 2
#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_UINT8 5
#define FFI_TYPE_SINT8 6
#define FFI_TYPE_UINT16 7
#define FFI_TYPE_UINT16 7
#define FFI_TYPE_SINT16 8
#define FFI_TYPE_UINT32 9
#define FFI_TYPE_SINT32 10
Expand Down

0 comments on commit 074780d

Please sign in to comment.