Fix x86
parent
c6bc074472
commit
b88d219ff6
|
@ -85,7 +85,7 @@ M: x86-backend %jump-label ( label -- ) JMP ;
|
||||||
M: x86-backend %jump-t ( label -- )
|
M: x86-backend %jump-t ( label -- )
|
||||||
"flag" operand f v>operand CMP JNE ;
|
"flag" operand f v>operand CMP JNE ;
|
||||||
|
|
||||||
: (%dispatch) ( -- operand )
|
: (%dispatch) ( n -- operand )
|
||||||
! Load jump table base. We use a temporary register
|
! Load jump table base. We use a temporary register
|
||||||
! since on AMD64 we have to load a 64-bit immediate. On
|
! since on AMD64 we have to load a 64-bit immediate. On
|
||||||
! x86, this is redundant.
|
! x86, this is redundant.
|
||||||
|
@ -94,16 +94,16 @@ M: x86-backend %jump-t ( label -- )
|
||||||
! Add jump table base
|
! Add jump table base
|
||||||
"offset" operand HEX: ffffffff MOV rc-absolute-cell rel-here
|
"offset" operand HEX: ffffffff MOV rc-absolute-cell rel-here
|
||||||
"n" operand "offset" operand ADD
|
"n" operand "offset" operand ADD
|
||||||
"n" operand bootstrap-cell 8 = 14 9 ? [+] ;
|
"n" operand swap bootstrap-cell 8 = 14 9 ? + [+] ;
|
||||||
|
|
||||||
M: x86-backend %call-dispatch ( word-table# -- )
|
M: x86-backend %call-dispatch ( word-table# -- )
|
||||||
[ (%dispatch) CALL <label> dup JMP ] H{
|
[ 5 (%dispatch) CALL <label> dup JMP ] H{
|
||||||
{ +input+ { { f "n" } } }
|
{ +input+ { { f "n" } } }
|
||||||
{ +scratch+ { { f "offset" } } }
|
{ +scratch+ { { f "offset" } } }
|
||||||
} with-template ;
|
} with-template ;
|
||||||
|
|
||||||
M: x86-backend %jump-dispatch ( -- )
|
M: x86-backend %jump-dispatch ( -- )
|
||||||
[ %epilogue-later (%dispatch) JMP ] H{
|
[ %epilogue-later 0 (%dispatch) JMP ] H{
|
||||||
{ +input+ { { f "n" } } }
|
{ +input+ { { f "n" } } }
|
||||||
{ +scratch+ { { f "offset" } } }
|
{ +scratch+ { { f "offset" } } }
|
||||||
} with-template ;
|
} with-template ;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: arrays byte-arrays kernel kernel.private math memory
|
USING: arrays byte-arrays kernel kernel.private math memory
|
||||||
namespaces sequences tools.test math.private quotations
|
namespaces sequences tools.test math.private quotations
|
||||||
continuations prettyprint io.streams.string debugger ;
|
continuations prettyprint io.streams.string debugger assocs ;
|
||||||
IN: temporary
|
IN: temporary
|
||||||
|
|
||||||
[ 0 ] [ f size ] unit-test
|
[ 0 ] [ f size ] unit-test
|
||||||
|
|
Loading…
Reference in New Issue