[CakeML-dev] memcpy in wordLang?
magnus.myreen at gmail.com
Fri Mar 17 05:48:15 UTC 2017
I'm on holiday at the moment, but want to write a short reply.
I will be implementing a mem copy stub in data-to-word early next week for
Scott's ConsExtend. That mem copy will copy word for word.
Mem copy should not be primitive in wordlang. Having it as a primitive
doesn't buy you anything. This also applies to byte by byte mem copy.
For efficiency, you want to implement these copy routines as stubs in
wordlang as opposed to stubs in higher levels like BVL, BVI or DataLang.
On Fri, 17 Mar 2017 at 06:07, Ramana Kumar <Ramana.Kumar at cl.cam.ac.uk>
> 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.)
> Developers mailing list
> Developers at cakeml.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Developers