cpu.x86: combine 32-bit and 64-bit %dispatch template

db4
Slava Pestov 2010-06-11 21:52:38 -04:00
parent e4d6611070
commit 8ed4760b51
3 changed files with 14 additions and 29 deletions

View File

@ -56,20 +56,6 @@ M: x86.32 %mark-deck
rc-absolute-cell rel-decks-offset
building get push ;
M:: x86.32 %dispatch ( src temp -- )
! Load jump table base.
temp src HEX: ffffffff [+] LEA
building get length :> start
0 rc-absolute-cell rel-here
! Go
temp HEX: 7f [+] JMP
building get length :> end
! Fix up the displacement above
cell alignment
[ end start - + building get dup pop* push ]
[ (align-code) ]
bi ;
M: x86.32 pic-tail-reg EDX ;
M: x86.32 reserved-stack-space 0 ;

View File

@ -81,21 +81,6 @@ M: x86.64 %mark-deck
dup load-decks-offset
[+] card-mark <byte> MOV ;
M:: x86.64 %dispatch ( src temp -- )
! Load jump table base.
temp HEX: ffffffff MOV
building get length :> start
0 rc-absolute-cell rel-here
! Add jump table base
temp src ADD
temp HEX: 7f [+] JMP
building get length :> end
! Fix up the displacement above
cell alignment
[ end start - + building get dup pop* push ]
[ (align-code) ]
bi ;
M:: x86.64 %load-reg-param ( dst reg rep -- )
dst reg rep %copy ;

View File

@ -570,6 +570,20 @@ M:: x86 %compare-imm-branch ( label src1 src2 cc -- )
src1 src2 (%compare-imm)
label cc %branch ;
M:: x86 %dispatch ( src temp -- )
! Load jump table base.
temp HEX: ffffffff MOV
building get length :> start
0 rc-absolute-cell rel-here
! Add jump table base
temp src HEX: 7f [++] JMP
building get length :> end
! Fix up the displacement above
cell alignment
[ end start - + building get dup pop* push ]
[ (align-code) ]
bi ;
M:: x86 %spill ( src rep dst -- )
dst src rep %copy ;