factor/library/compiler/amd64/alien.factor

32 lines
938 B
Factor
Raw Normal View History

2005-12-10 01:02:13 -05:00
! Copyright (C) 2005 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license.
IN: compiler-backend
2006-01-20 21:37:38 -05:00
USING: alien assembler kernel math sequences ;
2006-01-21 03:23:14 -05:00
! GENERIC: store-insn ( offset reg-class -- )
!
! GENERIC: load-insn ( elt parameter reg-class -- )
!
! M: int-regs store-insn drop >r 3 1 r> stack@ STW ;
!
! M: int-regs load-insn drop 3 + 1 rot stack@ LWZ ;
!
! M: %unbox generate-node ( vop -- )
! drop
! ! Call the unboxer
! 1 input f compile-c-call
! ! Store the return value on the C stack
! 0 input 2 input store-insn ;
!
! 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 ;
!
! M: %box generate-node ( vop -- )
! drop
! ! Move return value of C function into input register
! param-regs first RAX MOV
! 0 input f compile-c-call ;
!
! M: %cleanup generate-node ( vop -- ) drop ;