Remove useless optimization
parent
2a093912db
commit
423b0c4697
|
@ -51,14 +51,8 @@ HOOK: %save-dispatch-xt compiler-backend ( -- )
|
||||||
|
|
||||||
M: object %save-dispatch-xt %save-word-xt ;
|
M: object %save-dispatch-xt %save-word-xt ;
|
||||||
|
|
||||||
! Call C primitive
|
! Call another word
|
||||||
HOOK: %call-primitive compiler-backend ( label -- )
|
HOOK: %call compiler-backend ( word -- )
|
||||||
|
|
||||||
! Call another label
|
|
||||||
HOOK: %call-label compiler-backend ( label -- )
|
|
||||||
|
|
||||||
! Far jump to C primitive
|
|
||||||
HOOK: %jump-primitive compiler-backend ( label -- )
|
|
||||||
|
|
||||||
! Local jump for branches
|
! Local jump for branches
|
||||||
HOOK: %jump-label compiler-backend ( label -- )
|
HOOK: %jump-label compiler-backend ( label -- )
|
||||||
|
|
|
@ -97,26 +97,14 @@ M: ppc-backend %epilogue ( n -- )
|
||||||
1 1 rot ADDI
|
1 1 rot ADDI
|
||||||
0 MTLR ;
|
0 MTLR ;
|
||||||
|
|
||||||
: %prepare-primitive ( word -- )
|
|
||||||
#! Save stack pointer to stack_chain->callstack_top, load XT
|
|
||||||
4 1 MR
|
|
||||||
0 11 LOAD32
|
|
||||||
rc-absolute-ppc-2/2 rel-primitive ;
|
|
||||||
|
|
||||||
: (%call) 11 MTLR BLRL ;
|
: (%call) 11 MTLR BLRL ;
|
||||||
|
|
||||||
M: ppc-backend %call-primitive ( word -- )
|
|
||||||
%prepare-primitive (%call) ;
|
|
||||||
|
|
||||||
: (%jump) 11 MTCTR BCTR ;
|
: (%jump) 11 MTCTR BCTR ;
|
||||||
|
|
||||||
M: ppc-backend %jump-primitive ( word -- )
|
|
||||||
%prepare-primitive (%jump) ;
|
|
||||||
|
|
||||||
: %load-dlsym ( symbol dll register -- )
|
: %load-dlsym ( symbol dll register -- )
|
||||||
0 swap LOAD32 rc-absolute-ppc-2/2 rel-dlsym ;
|
0 swap LOAD32 rc-absolute-ppc-2/2 rel-dlsym ;
|
||||||
|
|
||||||
M: ppc-backend %call-label ( label -- ) BL ;
|
M: ppc-backend %call ( label -- ) BL ;
|
||||||
|
|
||||||
M: ppc-backend %jump-label ( label -- ) B ;
|
M: ppc-backend %jump-label ( label -- ) B ;
|
||||||
|
|
||||||
|
|
|
@ -70,15 +70,7 @@ M: x86-backend %prepare-alien-invoke
|
||||||
temp-reg v>operand 2 cells [+] ds-reg MOV
|
temp-reg v>operand 2 cells [+] ds-reg MOV
|
||||||
temp-reg v>operand 3 cells [+] rs-reg MOV ;
|
temp-reg v>operand 3 cells [+] rs-reg MOV ;
|
||||||
|
|
||||||
M: x86-backend %call-primitive ( word -- )
|
M: x86-backend %call ( label -- ) CALL ;
|
||||||
stack-save-reg stack-reg cell neg [+] LEA
|
|
||||||
address-operand CALL ;
|
|
||||||
|
|
||||||
M: x86-backend %jump-primitive ( word -- )
|
|
||||||
stack-save-reg stack-reg MOV
|
|
||||||
address-operand JMP ;
|
|
||||||
|
|
||||||
M: x86-backend %call-label ( label -- ) CALL ;
|
|
||||||
|
|
||||||
M: x86-backend %jump-label ( label -- ) JMP ;
|
M: x86-backend %jump-label ( label -- ) JMP ;
|
||||||
|
|
||||||
|
|
|
@ -100,21 +100,10 @@ UNION: #terminal
|
||||||
! node
|
! node
|
||||||
M: node generate-node drop iterate-next ;
|
M: node generate-node drop iterate-next ;
|
||||||
|
|
||||||
: %call ( word -- )
|
|
||||||
dup primitive? [ %call-primitive ] [ %call-label ] if ;
|
|
||||||
|
|
||||||
: %jump ( word -- )
|
: %jump ( word -- )
|
||||||
{
|
dup compiling-label get eq?
|
||||||
{ [ dup compiling-label get eq? ] [
|
[ drop current-label-start get ] [ %epilogue-later ] if
|
||||||
drop current-label-start get %jump-label
|
%jump-label ;
|
||||||
] }
|
|
||||||
{ [ dup primitive? ] [
|
|
||||||
%epilogue-later %jump-primitive
|
|
||||||
] }
|
|
||||||
{ [ t ] [
|
|
||||||
%epilogue-later %jump-label
|
|
||||||
] }
|
|
||||||
} cond ;
|
|
||||||
|
|
||||||
: generate-call ( label -- next )
|
: generate-call ( label -- next )
|
||||||
dup maybe-compile
|
dup maybe-compile
|
||||||
|
|
Loading…
Reference in New Issue