[CakeML-dev] memcpy in wordLang?

Ramana Kumar Ramana.Kumar at cl.cam.ac.uk
Fri Mar 17 05:07:13 UTC 2017

Hi developers,

This question is especially for those familiar with wordLang.

Would it be reasonable to implement a memcpy primitive in wordLang? In
particular, I would want to add a primitive to BVL/BVI that given a
byte array, an offset, and another byte array, copies the contents of
the latter into the former starting at the offset.

The question is whether it is possible to do this efficiently in
wordLang even if the offset is not word aligned.

Obviously I can already write a byte-by-byte copying routine in BVL
(or even higher). I'm trying to figure out how to actually be more
efficient than that when implementing concatenation and
string/bytearray conversion primitives.

(Another annoying thing I noticed is that currently the only way to
create a byte array forces you to write some initial dummy replicated
value into it, even if you're going to overwrite them all right after.
But I don't know what a good primitive to use instead would look like
- some super create-and-copy-with-offsets primitive maybe, but that's
pretty complicated.)


More information about the Developers mailing list