fix struct-array of struct class; inline memory>struct so the compiler can optimize a little better
parent
48c47740c6
commit
8dbd25b6cd
|
@ -36,7 +36,7 @@ M: struct equal?
|
||||||
|
|
||||||
: memory>struct ( ptr class -- struct )
|
: memory>struct ( ptr class -- struct )
|
||||||
over c-ptr? [ swap \ c-ptr bad-slot-value ] unless
|
over c-ptr? [ swap \ c-ptr bad-slot-value ] unless
|
||||||
tuple-layout <tuple> [ 2 set-slot ] keep ;
|
tuple-layout <tuple> [ 2 set-slot ] keep ; inline
|
||||||
|
|
||||||
: malloc-struct ( class -- struct )
|
: malloc-struct ( class -- struct )
|
||||||
[ heap-size malloc ] keep memory>struct ; inline
|
[ heap-size malloc ] keep memory>struct ; inline
|
||||||
|
|
|
@ -20,7 +20,7 @@ M: struct-array byte-length [ length>> ] [ element-size>> ] bi * ;
|
||||||
[ element-size>> * ] [ underlying>> ] bi <displaced-alien> ; inline
|
[ element-size>> * ] [ underlying>> ] bi <displaced-alien> ; inline
|
||||||
|
|
||||||
M: struct-array nth-unsafe
|
M: struct-array nth-unsafe
|
||||||
[ (nth-ptr) ] [ class>> struct-class? ] bi [ memory>struct ] when* ; inline
|
[ (nth-ptr) ] [ class>> dup struct-class? ] bi [ memory>struct ] [ drop ] if ; inline
|
||||||
|
|
||||||
M: struct-array set-nth-unsafe
|
M: struct-array set-nth-unsafe
|
||||||
[ (nth-ptr) swap ] [ element-size>> ] bi memcpy ;
|
[ (nth-ptr) swap ] [ element-size>> ] bi memcpy ;
|
||||||
|
|
Loading…
Reference in New Issue