compiler.cfg.intrinsics.allot: fix <byte-array> intrinsic for real. Don't ever check in code without testing it
parent
aaa706dd29
commit
07092df20b
|
@ -4,7 +4,8 @@ USING: kernel math math.order sequences accessors arrays
|
||||||
byte-arrays layouts classes.tuple.private fry locals
|
byte-arrays layouts classes.tuple.private fry locals
|
||||||
compiler.tree.propagation.info compiler.cfg.hats
|
compiler.tree.propagation.info compiler.cfg.hats
|
||||||
compiler.cfg.instructions compiler.cfg.stacks
|
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
|
IN: compiler.cfg.intrinsics.allot
|
||||||
|
|
||||||
: ##set-slots ( regs obj class -- )
|
: ##set-slots ( regs obj class -- )
|
||||||
|
@ -73,10 +74,16 @@ IN: compiler.cfg.intrinsics.allot
|
||||||
dup node-input-infos first literal>> dup expand-(byte-array)?
|
dup node-input-infos first literal>> dup expand-(byte-array)?
|
||||||
[ nip emit-allot-byte-array drop ] [ drop emit-primitive ] if ;
|
[ 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 -- )
|
:: emit-<byte-array> ( node -- )
|
||||||
node node-input-infos first literal>> dup expand-<byte-array>? [
|
node node-input-infos first literal>> dup expand-<byte-array>? [
|
||||||
:> len
|
:> len
|
||||||
0 ^^load-literal :> elt
|
|
||||||
len emit-allot-byte-array :> reg
|
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 ;
|
] [ drop node emit-primitive ] if ;
|
||||||
|
|
Loading…
Reference in New Issue