compiler.cfg: ##unbox-long-long can have multiple outputs now, clean up long long parameter passing code using this

db4
Slava Pestov 2010-07-15 19:49:29 -04:00
parent 48e96ef032
commit 0fd636b4b9
6 changed files with 21 additions and 25 deletions

View File

@ -57,8 +57,7 @@ M: c-type unbox
[ drop f 2array 1array ] 2bi ;
M: long-long-type unbox
[ 8 cell f ^^local-allot ] dip '[ _ unboxer>> ##unbox-long-long ] keep
0 cell [ int-rep f ^^load-memory-imm ] bi-curry@ bi 2array
[ next-vreg next-vreg 2dup ] 2dip unboxer>> ##unbox-long-long 2array
int-rep long-long-on-stack? 2array dup 2array ;
M: struct-c-type unbox ( src c-type -- vregs reps )

View File

@ -645,7 +645,8 @@ use: src/tagged-rep
literal: unboxer rep ;
FOLDABLE-INSN: ##unbox-long-long
use: src/tagged-rep out/int-rep
def: dst1/int-rep dst2/int-rep
use: src/tagged-rep
literal: unboxer ;
FLUSHABLE-INSN: ##local-allot
@ -875,7 +876,8 @@ UNION: hairy-clobber-insn
##call-gc
alien-call-insn
##callback-inputs
##callback-outputs ;
##callback-outputs
##unbox-long-long ;
! Instructions that clobber registers but are allowed to produce
! outputs in registers. Inputs are in spill slots, except for
@ -886,7 +888,6 @@ hairy-clobber-insn
##unary-float-function
##binary-float-function
##unbox
##unbox-long-long
##box
##box-long-long
##allot-byte-array ;

View File

@ -585,7 +585,7 @@ HOOK: struct-return-on-stack? cpu ( -- ? )
! can be passed to a C function, or returned from a callback
HOOK: %unbox cpu ( dst src func rep -- )
HOOK: %unbox-long-long cpu ( src out func -- )
HOOK: %unbox-long-long cpu ( dst1 dst2 src func -- )
HOOK: %local-allot cpu ( dst size align offset -- )

View File

@ -158,27 +158,23 @@ M:: x86.32 %unbox ( dst src func rep -- )
src func call-unbox-func
dst rep %load-return ;
M:: x86.32 %unbox-long-long ( src out func -- )
EAX src int-rep %copy
0 stack@ EAX MOV
EAX out int-rep %copy
4 stack@ EAX MOV
8 save-vm-ptr
func f f %c-invoke ;
M:: x86.32 %unbox-long-long ( dst1 dst2 src func -- )
src int-rep 0 %store-stack-param
4 save-vm-ptr
func f f %c-invoke
dst1 EAX int-rep %copy
dst2 EDX int-rep %copy ;
M:: x86.32 %box ( dst src func rep gc-map -- )
src rep 0 %store-stack-param
rep rep-size save-vm-ptr
src rep %store-return
0 stack@ rep %load-return
func f gc-map %c-invoke
dst EAX tagged-rep %copy ;
M:: x86.32 %box-long-long ( dst src1 src2 func gc-map -- )
src1 int-rep 0 %store-stack-param
src2 int-rep 4 %store-stack-param
8 save-vm-ptr
EAX src1 int-rep %copy
0 stack@ EAX int-rep %copy
EAX src2 int-rep %copy
4 stack@ EAX int-rep %copy
func f gc-map %c-invoke
dst EAX tagged-rep %copy ;

View File

@ -491,9 +491,9 @@ s64 factor_vm::to_signed_8(cell obj)
}
}
VM_C_API void to_signed_8(cell obj, s64 *out, factor_vm *parent)
VM_C_API s64 to_signed_8(cell obj, factor_vm *parent)
{
*out = parent->to_signed_8(obj);
return parent->to_signed_8(obj);
}
cell factor_vm::from_unsigned_8(u64 n)
@ -524,9 +524,9 @@ u64 factor_vm::to_unsigned_8(cell obj)
}
}
VM_C_API void to_unsigned_8(cell obj, u64 *out, factor_vm *parent)
VM_C_API u64 to_unsigned_8(cell obj, factor_vm *parent)
{
*out = parent->to_unsigned_8(obj);
return parent->to_unsigned_8(obj);
}
VM_C_API cell from_float(float flo, factor_vm *parent)

View File

@ -90,8 +90,8 @@ VM_C_API cell from_unsigned_cell(cell integer, factor_vm *vm);
VM_C_API cell from_signed_8(s64 n, factor_vm *vm);
VM_C_API cell from_unsigned_8(u64 n, factor_vm *vm);
VM_C_API void to_signed_8(cell obj, s64 *out, factor_vm *parent);
VM_C_API void to_unsigned_8(cell obj, u64 *out, factor_vm *parent);
VM_C_API s64 to_signed_8(cell obj, factor_vm *parent);
VM_C_API u64 to_unsigned_8(cell obj, factor_vm *parent);
VM_C_API fixnum to_fixnum(cell tagged, factor_vm *vm);
VM_C_API cell to_cell(cell tagged, factor_vm *vm);