Remove unsafe string allocation, since its of dubious value
parent
eb79c6ab71
commit
d9231f3bc5
|
@ -152,10 +152,6 @@ SYMBOL: +stopped+
|
|||
>n ndrop >c c>
|
||||
continue continue-with
|
||||
stop suspend (spawn)
|
||||
! Don't step into some sequence words since output of
|
||||
! (string) and new-sequence-unsafe may not print due to
|
||||
! memory safety issues
|
||||
<sbuf> prepare-subseq subseq new-sequence-unsafe
|
||||
} [
|
||||
dup [ execute break ] curry
|
||||
"step-into" set-word-prop
|
||||
|
|
|
@ -520,7 +520,6 @@ tuple
|
|||
{ "<wrapper>" "kernel" }
|
||||
{ "(clone)" "kernel" }
|
||||
{ "<string>" "strings" }
|
||||
{ "(string)" "strings.private" }
|
||||
{ "array>quotation" "quotations.private" }
|
||||
{ "quotation-xt" "quotations" }
|
||||
{ "<tuple>" "classes.tuple.private" }
|
||||
|
|
|
@ -8,7 +8,7 @@ TUPLE: sbuf
|
|||
{ underlying string }
|
||||
{ length array-capacity } ;
|
||||
|
||||
: <sbuf> ( n -- sbuf ) (string) 0 sbuf boa ; inline
|
||||
: <sbuf> ( n -- sbuf ) 0 <string> 0 sbuf boa ; inline
|
||||
|
||||
M: sbuf set-nth-unsafe
|
||||
[ >fixnum ] [ >fixnum ] [ underlying>> ] tri* set-string-nth ;
|
||||
|
|
|
@ -81,7 +81,6 @@ GENERIC: resize ( n seq -- newseq ) flushable
|
|||
! Unsafe sequence protocol for inner loops
|
||||
GENERIC: nth-unsafe ( n seq -- elt ) flushable
|
||||
GENERIC: set-nth-unsafe ( elt n seq -- )
|
||||
GENERIC: new-sequence-unsafe ( len seq -- newseq ) flushable
|
||||
|
||||
M: sequence nth bounds-check nth-unsafe ;
|
||||
M: sequence set-nth bounds-check set-nth-unsafe ;
|
||||
|
@ -89,8 +88,6 @@ M: sequence set-nth bounds-check set-nth-unsafe ;
|
|||
M: sequence nth-unsafe nth ;
|
||||
M: sequence set-nth-unsafe set-nth ;
|
||||
|
||||
M: sequence new-sequence-unsafe new-sequence ;
|
||||
|
||||
! The f object supports the sequence protocol trivially
|
||||
M: f length drop 0 ;
|
||||
M: f nth-unsafe nip ;
|
||||
|
@ -259,7 +256,7 @@ INSTANCE: repetition immutable-sequence
|
|||
|
||||
: prepare-subseq ( from to seq -- dst i src j n )
|
||||
#! The check-length call forces partial dispatch
|
||||
[ [ swap - ] dip new-sequence-unsafe dup 0 ] 3keep
|
||||
[ [ swap - ] dip new-sequence dup 0 ] 3keep
|
||||
-rot drop roll length check-length ; inline
|
||||
|
||||
: check-copy ( src n dst -- )
|
||||
|
|
|
@ -56,6 +56,4 @@ M: string resize resize-string ;
|
|||
|
||||
M: string new-sequence drop 0 <string> ;
|
||||
|
||||
M: string new-sequence-unsafe drop (string) ;
|
||||
|
||||
INSTANCE: string sequence
|
||||
|
|
Loading…
Reference in New Issue