compiler.cfg: remove ##set-string-nth-fast instruction since it can be expressed just as efficiently using other instructions
parent
c81063614b
commit
279eb461b1
|
@ -93,10 +93,6 @@ def: dst/int-rep
|
|||
use: obj/tagged-rep index/int-rep
|
||||
temp: temp/int-rep ;
|
||||
|
||||
INSN: ##set-string-nth-fast
|
||||
use: src/int-rep obj/tagged-rep index/int-rep
|
||||
temp: temp/int-rep ;
|
||||
|
||||
! Register transfers
|
||||
PURE-INSN: ##copy
|
||||
def: dst
|
||||
|
|
|
@ -9,6 +9,7 @@ compiler.cfg.intrinsics.allot
|
|||
compiler.cfg.intrinsics.fixnum
|
||||
compiler.cfg.intrinsics.float
|
||||
compiler.cfg.intrinsics.slots
|
||||
compiler.cfg.intrinsics.strings
|
||||
compiler.cfg.intrinsics.misc
|
||||
compiler.cfg.comparisons ;
|
||||
QUALIFIED: alien
|
||||
|
|
|
@ -74,9 +74,3 @@ IN: compiler.cfg.intrinsics.slots
|
|||
dup third immediate-slot-offset?
|
||||
[ (emit-set-slot-imm) ] [ (emit-set-slot) ] if
|
||||
] [ drop emit-primitive ] if ;
|
||||
|
||||
: emit-string-nth ( -- )
|
||||
2inputs swap ^^string-nth ds-push ;
|
||||
|
||||
: emit-set-string-nth-fast ( -- )
|
||||
3inputs swap next-vreg ##set-string-nth-fast ;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Slava Pestov
|
|
@ -0,0 +1,13 @@
|
|||
! Copyright (C) 2010 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel compiler.constants compiler.cfg.hats
|
||||
compiler.cfg.instructions compiler.cfg.registers
|
||||
compiler.cfg.stacks ;
|
||||
IN: compiler.cfg.intrinsics.strings
|
||||
|
||||
: emit-string-nth ( -- )
|
||||
2inputs swap ^^string-nth ds-push ;
|
||||
|
||||
: emit-set-string-nth-fast ( -- )
|
||||
3inputs ^^tagged>integer ^^add swap [ string-offset ] dip
|
||||
##set-alien-integer-1 ;
|
|
@ -94,7 +94,6 @@ CODEGEN: ##slot-imm %slot-imm
|
|||
CODEGEN: ##set-slot %set-slot
|
||||
CODEGEN: ##set-slot-imm %set-slot-imm
|
||||
CODEGEN: ##string-nth %string-nth
|
||||
CODEGEN: ##set-string-nth-fast %set-string-nth-fast
|
||||
CODEGEN: ##add %add
|
||||
CODEGEN: ##add-imm %add-imm
|
||||
CODEGEN: ##sub %sub
|
||||
|
|
|
@ -226,7 +226,6 @@ HOOK: %set-slot cpu ( src obj slot -- )
|
|||
HOOK: %set-slot-imm cpu ( src obj slot tag -- )
|
||||
|
||||
HOOK: %string-nth cpu ( dst obj index temp -- )
|
||||
HOOK: %set-string-nth-fast cpu ( ch obj index temp -- )
|
||||
|
||||
HOOK: %add cpu ( dst src1 src2 -- )
|
||||
HOOK: %add-imm cpu ( dst src1 src2 -- )
|
||||
|
|
|
@ -160,10 +160,6 @@ M:: ppc %string-nth ( dst src index temp -- )
|
|||
"end" resolve-label
|
||||
] with-scope ;
|
||||
|
||||
M:: ppc %set-string-nth-fast ( ch obj index temp -- )
|
||||
temp obj index ADD
|
||||
ch temp string-offset STB ;
|
||||
|
||||
M: ppc %add ADD ;
|
||||
M: ppc %add-imm ADDI ;
|
||||
M: ppc %sub swap SUBF ;
|
||||
|
|
|
@ -354,13 +354,6 @@ M:: x86 %string-nth ( dst src index temp -- )
|
|||
dst new-dst int-rep %copy
|
||||
] with-small-register ;
|
||||
|
||||
M:: x86 %set-string-nth-fast ( ch str index temp -- )
|
||||
ch { index str temp } 8 [| new-ch |
|
||||
new-ch ch int-rep %copy
|
||||
temp str index [+] LEA
|
||||
temp string-offset [+] new-ch 8-bit-version-of MOV
|
||||
] with-small-register ;
|
||||
|
||||
:: %alien-integer-getter ( dst src offset size quot -- )
|
||||
dst { src } size [| new-dst |
|
||||
new-dst dup size n-bit-version-of dup src offset [+] MOV
|
||||
|
|
Loading…
Reference in New Issue