Created
January 25, 2020 16:29
-
-
Save dcoutts/095d84fc00dfc8983d64fdb43ae35376 to your computer and use it in GitHub Desktop.
placeByteArray# CMM primop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Cmm.h" | |
/* Place a ByteArray# object header so that its payload is at the given address. | |
The payload pointer we're given points to the first byte of the payload, | |
so we have to place the object header immediately before it. The caller | |
must ensure that the space before the payload is appropriately allocated | |
so that we can use it. | |
*/ | |
stg_placeByteArrayzh ( W_ payload, W_ n ) | |
{ | |
gcptr p; | |
p = payload - SIZEOF_StgArrBytes; | |
SET_HDR(p, stg_ARR_WORDS_info, CCCS); | |
StgArrBytes_bytes(p) = n; | |
return (p); | |
} |
Apparently P_
is the right type.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not sure if
W_ payload
is the right CMM type forAddr#
: