Closed
Bug 583206
Opened 15 years ago
Closed 3 years ago
ffi returning struct doesn't work on SPARC
Categories
(Core :: js-ctypes, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: ginnchen+exoracle, Unassigned)
Details
Attachments
(1 file, 2 obsolete files)
2.21 KB,
patch
|
Details | Diff | Splinter Review |
This is a bug of libffi.
Just log some information here.
SPARC V8 Manual has:
"When a procedure expecting an aggregate return value from a called function is compiled, an UNIMP instruction is placed after the delay-slot instruction follow- ing the CALL to the function in question. The immediate field in this UNIMP instruction contains the low-order twelve bits of the size (in bytes) of the area allocated by the caller for the aggregate value expected to be returned."
But in v8.S, we just leave a "nop", so the returning struct is not copied.
If we use UNIMP instead of "nop", the size of return struct must be strictly matched, otherwise it will get SIGILL.
It seems if we want to support this, we need to write thousands of call.
For 1 byte return struct:
call %i5
mov %l0, %sp ! (delay) switch to frame
unimp $1 ! STRUCT returning functions skip 12 instead of 8 bytes
For 2 bytes return struct:
call %i5
mov %l0, %sp ! (delay) switch to frame
unimp $2 ! STRUCT returning functions skip 12 instead of 8 bytes
etc.
Sounds crazy.
Or maybe mmap some executable space?
Comment 1•15 years ago
|
||
What about V9? Do we care about supporting the V8 ABI?
If the answer is "yes", then I agree with your suggestion -- get some executable space and twiddle the instruction. You could use the closure code as a reference. There are two parts to this: first the instruction bits (see e.g. http://mxr.mozilla.org/mozilla-central/source/js/src/ctypes/libffi/src/x86/ffi.c#496); and the executable mapping bits (http://mxr.mozilla.org/mozilla-central/source/js/src/ctypes/libffi/src/closures.c). If the code segment is writable on SPARC, you could skip the executable region stuff, and just have the code write directly to itself...
(In reply to comment #1)
> What about V9? Do we care about supporting the V8 ABI?
V9 is doing this in a different way.
See: http://mxr.mozilla.org/mozilla-central/source/js/src/ctypes/libffi/src/sparc/v9.S#113
Yes, we do support V8.
V8 is 32bit, V9 is 64bit.
Currently we only ships Firefox in 32bit on Solaris and JIT is still not ported to SPARC V9.
Verified with gcc and Sun Studio with ffi test suite. (libffi is compiled with gcc.)
Assignee: nobody → ginn.chen
Status: NEW → ASSIGNED
Attachment #499799 -
Attachment is obsolete: true
add null check for ffi_closure_alloc
Attachment #499805 -
Attachment is obsolete: true
Comment 6•3 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months.
:sdetar, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee: ginnchen+exoracle → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(sdetar)
Comment 7•3 years ago
|
||
No activity for 11 years. Lets close. Please re-open if someone thinks this is still important.
Status: NEW → RESOLVED
Closed: 3 years ago
Flags: needinfo?(sdetar)
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•