Open Bug 552070 Opened 15 years ago Updated 2 years ago

Make ctypes.ArrayType(t, n) not allocate O(n) bytes

Categories

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

defect

Tracking

()

People

(Reporter: dwitte, Unassigned)

References

(Blocks 1 open bug)

Details

Currently, in building the ffi_type for an array, we must abuse FFI_TYPE_STRUCT. This means adding 'n' elements to the ffi_type, each of type 't', simply to declare the type. (Which takes up n * sizeof(void*) bytes.)

We need proper array support in libffi to fix this. It's a pretty simple job -- just add another case everywhere it uses FFI_TYPE_STRUCT, that calculates size and such based on a multiplier 'n' rather than by adding up discrete elements. (I'm assuming the ABI for arrays is the same as that for structs on all platforms, which I certainly hope is true.)
P3, nice to have. (Nontrivial to fix since it requires changes to a bunch of libffi arches.)
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.