Open Bug 555761 Opened 14 years ago Updated 2 years ago

Inspect and test libffi native type support for closures

Categories

(Core :: js-ctypes, defect, P5)

defect

Tracking

()

People

(Reporter: dwitte, Unassigned)

References

(Blocks 1 open bug)

Details

From code inspection a while back, I remember thinking that libffi's support for various parameter and/or return value types (for closures) was spotty.

I think this was on x86/linux; the code I wrote for x86/win32 is correct, I think. No idea about OSX. Relevant asm code is in js/ctypes/libffi/src/{x86,arm}. (ppc too, I suppose.)

We also need exhaustive tests for this, just like we have for JS->C function calls.

If stuff is missing, we'll need to write asm and upstream it, which is easy -- the maintainer is quite receptive. Fun little project. :)

P1, need to at least examine this before 1.9.3.
One issue that's critical is return values from closures: I *think* the 'rval' pointer is treated as a promoted type for integrals. (That is, for int8_t return types, f.e., 'rval' would point to a 32-bit/64-bit word, and that whole word must be written into.) This follows standard C convention.

I don't think libffi does this for you.
The rval problem (comment 1) has been fixed, so that at least is good.

Only thing left to do here is fill out the closure tests to match the thoroughness of the call tests.
Priority: P1 → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.