|
222abd0c
|
2023-02-02T07:04:55
|
|
From Dave Anglin:
This patch is derived from the work done in implementing libffi for 64-bit hppa64-hpux target. Currently, the 32-bit hppa targets do a linear search for the return type of an ffi_call. This is slow and inefficient. A jump table can used to jump directly to the code used to process the return value. In most common cases, the return value can be processed in the jump table itself.
The patch also fixes return handling for FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16 and FFI_TYPE_SINT16.
|
|
e58e22b2
|
2023-02-02T07:02:53
|
|
From Dave Anglin:
A couple of years ago the 32-bit hppa targets were converted from using a trampoline executed on the stack to the function descriptor technique used by ia64. This is more efficient and avoids having to have an executable stack. However, function pointers on 32-bit need the PLABEL bit set in the pointer. It distinguishes between pointers that point directly to the executable code and pointer that point to a function descriptor. We need the later for libffi. But as a result, it is not possible to convert using casts data pointers to function pointers.
The solution at the time was to set the PLABEL bit in hppa closure pointers using FFI_CLOSURE_PTR. However, I realized recently that this was a bad choice. Packages like python-cffi allocate their own closure pointers, so this isn't going to work well there.
A better solution is to leave closure pointers unchanged and only set the PLABEL bit in pointers used to point to executable code.
The attached patch drops the FFI_CLOSURE_PTR and FFI_RESTORE_PTR defines. This allows some cleanup in the hppa closure routines. The FFI_FN define is now used to set the PLABEL bit on hppa. ffi_closure_alloc is modified to set the PLABEL bit in the value set in *code.
I also added a FFI_CL define to convert a function pointer to a closure pointer. It is only used in one test case.
|
|
c50c16d0
|
2022-11-20T12:20:40
|
|
Fix large struct passing on PA-RISC
|
|
8eb2d2b0
|
2020-02-24T10:29:20
|
|
Revamp PA_LINUX and PA_HPUX target closures to use function descriptors.
2020-02-23 John David Anglin <danglin@gcc.gnu.org>
* include/ffi.h.in (FFI_CLOSURE_PTR, FFI_RESTORE_PTR): Define.
* src/closures.c (ffi_closure_alloc): Convert closure pointer
return by malloc to function pointer.
(ffi_closure_free): Convert function pointer back to malloc pointer.
* src/pa/ffi.c (ffi_closure_inner_pa32): Use union to double word
align return address on stack. Adjust statements referencing return
address. Convert closure argument from function pointer to standard
closure pointer.
(ffi_prep_closure_loc): Likewise convert closure argument back to
closure pointer. Remove assembler trampolines. Setup simulated
function descriptor as on ia64.
src/pa/ffitarget.h (FFI_TRAMPOLINE_SIZE): Reduce to 12.
src/pa/hpux32.S (ffi_closure_pa32): Retrieve closure pointer and real
gp from fake gp value in register %r19.
src/pa/linux.S (ffi_closure_pa32): Likewise.
|
|
1fbf9dc4
|
2011-02-13T08:06:39
|
|
Fix bad_abi test. rc5.
|
|
115ab36f
|
2009-12-24T00:22:00
|
|
Update missing changes for 3.0.9r4.
|
|
c6dddbd0
|
2009-10-04T08:11:33
|
|
Initial commit
|