Why do we have two sets of unaligned memory access functions?
One is EXTRACT_xxx() in port.h (available since antiquity) which uses raw access iff the arch is IA32. The other is get_unaligned_xxx() in pike_memory.h (available since 2014) which uses raw access iff the arch is EM64T.
Both have exactly the same implementation, except for the obvious descripancy in the list of arches getting special treatment. Shouldn't we consolidate this to just one copy of the implementation, and a consistent list of arches using raw access (preferrably using the define HANDLES_UNALIGNED_MEMORY_ACCESS which has also been available since antiquity...)?
Why do we have two sets of unaligned memory access functions?
Good question.
Both have exactly the same implementation, except for the obvious descripancy in the list of arches getting special treatment. Shouldn't we consolidate this to just one copy of the implementation, and a consistent list of arches using raw access (preferrably using the define HANDLES_UNALIGNED_MEMORY_ACCESS which has also been available since antiquity...)?
Sounds like a good idea.
Incidentally, HANDLES_UNALIGNED_MEMORY_ACCESS was originally set by a configure test, but this was removed for unknown reasons in 0919be6. We could put it back, although such a test only shows that raw access _works_, not that it is faster than the memcpy variant (it could be handled by a kernel trap).
pike-devel@lists.lysator.liu.se