byte-arrays layouts classes.tuple.private fry locals
compiler.tree.propagation.info compiler.cfg.hats
compiler.cfg.instructions compiler.cfg.stacks
-compiler.cfg.utilities compiler.cfg.builder.blocks ;
+compiler.cfg.utilities compiler.cfg.builder.blocks
+compiler.constants cpu.architecture alien.c-types ;
IN: compiler.cfg.intrinsics.allot
: ##set-slots ( regs obj class -- )
dup node-input-infos first literal>> dup expand-(byte-array)?
[ nip emit-allot-byte-array drop ] [ drop emit-primitive ] if ;
+:: zero-byte-array ( len reg -- )
+ 0 ^^load-literal :> elt
+ reg ^^tagged>integer :> reg
+ len 3 + 4 /i iota [
+ [ elt reg ] dip 4 * byte-array-offset + int-rep uint ##store-memory-imm
+ ] each ;
+
:: emit-<byte-array> ( node -- )
node node-input-infos first literal>> dup expand-<byte-array>? [
:> len
- 0 ^^load-literal :> elt
len emit-allot-byte-array :> reg
- len cell align cell /i reg elt byte-array store-initial-element
+ len reg zero-byte-array
] [ drop node emit-primitive ] if ;