Opened 4 years ago

#1310 new enhancement

Add arrays displaced to foreign memory

Reported by: sionescu Owned by:
Priority: normal Milestone:
Component: Runtime (threads, GC) Version: trunk
Keywords: Cc:

Description

I sometimes need to turn a piece of foreign memory into a Lisp array: e.g. I’d like to use a POSIX shared memory segment as an (UNSIGNED-BYTE 8) or (UNSIGNED-BYTE 64) simple-array, same with page-aligned blocks as returned by posix_memalign(3) for DMA operations.

For that purpose, I’d like to be able to create a simple-array displaced to a foreign memory pointer. Such a constructor would receive the memory pointer, element-type and array length, then allocate the array header in the Lisp heap. I’m mostly interested in element-type being UNSIGNED-BYTE of sizes 8/32/64, but it might be useful for other people to have the full set of element types that the compiler allows for regular simple arrays.

The Lisp GC would only dispose of the array header and the foreign memory would need to be deallocated manually, although the constructor could take another argument specifying that free(3) must be used to deallocate the foreign memory, as a common case.

Change History (0)

Note: See TracTickets for help on using tickets.