diff --git a/library/compiler/amd64/alien.factor b/library/compiler/amd64/alien.factor index b8c26688ae..ebee97ede1 100644 --- a/library/compiler/amd64/alien.factor +++ b/library/compiler/amd64/alien.factor @@ -8,7 +8,7 @@ GENERIC: store-insn ( offset reg-class -- ) GENERIC: load-insn ( elt parameter reg-class -- ) -: stack@ RCX RSP MOV RCX swap 2array ; +: stack@ R10 RSP MOV R10 swap 2array ; M: int-regs store-insn drop stack@ RAX MOV ; @@ -37,6 +37,12 @@ M: %parameter generate-node ( vop -- ) ! Move a value from the C stack into the fastcall register drop 0 input 1 input 2 input load-insn ; +: reset-sse RAX RAX XOR ; + +M: %alien-invoke generate-node + reset-sse + drop 0 input 1 input load-library compile-c-call ; + : load-return-value ( reg-class -- ) dup fastcall-regs first swap return-reg 2dup eq? [ 2drop ] [ MOV ] if ; diff --git a/library/compiler/amd64/architecture.factor b/library/compiler/amd64/architecture.factor index 7c712cdeab..d1a7f0ba25 100644 --- a/library/compiler/amd64/architecture.factor +++ b/library/compiler/amd64/architecture.factor @@ -23,12 +23,9 @@ M: int-regs return-reg drop RAX ; M: int-regs fastcall-regs drop { RDI RSI RDX RCX R8 R9 } ; -: reset-sse RAX RAX XOR ; - : compile-c-call ( symbol dll -- ) - reset-sse - 2dup dlsym 1 scratch swap MOV - rel-absolute-cell rel-dlsym 1 scratch CALL ; + 2dup dlsym R10 swap MOV + rel-absolute-cell rel-dlsym R10 CALL ; : compile-c-call* ( symbol dll args -- ) T{ int-regs } fastcall-regs