compiler.cfg: ##unbox-long-long can have multiple outputs now, clean up long long parameter passing code using this
							parent
							
								
									48e96ef032
								
							
						
					
					
						commit
						0fd636b4b9
					
				| 
						 | 
					@ -57,8 +57,7 @@ M: c-type unbox
 | 
				
			||||||
    [ drop f 2array 1array ] 2bi ;
 | 
					    [ drop f 2array 1array ] 2bi ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
M: long-long-type unbox
 | 
					M: long-long-type unbox
 | 
				
			||||||
    [ 8 cell f ^^local-allot ] dip '[ _ unboxer>> ##unbox-long-long ] keep
 | 
					    [ next-vreg next-vreg 2dup ] 2dip unboxer>> ##unbox-long-long 2array
 | 
				
			||||||
    0 cell [ int-rep f ^^load-memory-imm ] bi-curry@ bi 2array
 | 
					 | 
				
			||||||
    int-rep long-long-on-stack? 2array dup 2array ;
 | 
					    int-rep long-long-on-stack? 2array dup 2array ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
M: struct-c-type unbox ( src c-type -- vregs reps )
 | 
					M: struct-c-type unbox ( src c-type -- vregs reps )
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -645,7 +645,8 @@ use: src/tagged-rep
 | 
				
			||||||
literal: unboxer rep ;
 | 
					literal: unboxer rep ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FOLDABLE-INSN: ##unbox-long-long
 | 
					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 ;
 | 
					literal: unboxer ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FLUSHABLE-INSN: ##local-allot
 | 
					FLUSHABLE-INSN: ##local-allot
 | 
				
			||||||
| 
						 | 
					@ -875,7 +876,8 @@ UNION: hairy-clobber-insn
 | 
				
			||||||
##call-gc
 | 
					##call-gc
 | 
				
			||||||
alien-call-insn
 | 
					alien-call-insn
 | 
				
			||||||
##callback-inputs
 | 
					##callback-inputs
 | 
				
			||||||
##callback-outputs ;
 | 
					##callback-outputs
 | 
				
			||||||
 | 
					##unbox-long-long ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
! Instructions that clobber registers but are allowed to produce
 | 
					! Instructions that clobber registers but are allowed to produce
 | 
				
			||||||
! outputs in registers. Inputs are in spill slots, except for
 | 
					! outputs in registers. Inputs are in spill slots, except for
 | 
				
			||||||
| 
						 | 
					@ -886,7 +888,6 @@ hairy-clobber-insn
 | 
				
			||||||
##unary-float-function
 | 
					##unary-float-function
 | 
				
			||||||
##binary-float-function
 | 
					##binary-float-function
 | 
				
			||||||
##unbox
 | 
					##unbox
 | 
				
			||||||
##unbox-long-long
 | 
					 | 
				
			||||||
##box
 | 
					##box
 | 
				
			||||||
##box-long-long
 | 
					##box-long-long
 | 
				
			||||||
##allot-byte-array ;
 | 
					##allot-byte-array ;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -585,7 +585,7 @@ HOOK: struct-return-on-stack? cpu ( -- ? )
 | 
				
			||||||
! can be passed to a C function, or returned from a callback
 | 
					! can be passed to a C function, or returned from a callback
 | 
				
			||||||
HOOK: %unbox cpu ( dst src func rep -- )
 | 
					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 -- )
 | 
					HOOK: %local-allot cpu ( dst size align offset -- )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,27 +158,23 @@ M:: x86.32 %unbox ( dst src func rep -- )
 | 
				
			||||||
    src func call-unbox-func
 | 
					    src func call-unbox-func
 | 
				
			||||||
    dst rep %load-return ;
 | 
					    dst rep %load-return ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
M:: x86.32 %unbox-long-long ( src out func -- )
 | 
					M:: x86.32 %unbox-long-long ( dst1 dst2 src func -- )
 | 
				
			||||||
    EAX src int-rep %copy
 | 
					    src int-rep 0 %store-stack-param
 | 
				
			||||||
    0 stack@ EAX MOV
 | 
					    4 save-vm-ptr
 | 
				
			||||||
    EAX out int-rep %copy
 | 
					    func f f %c-invoke
 | 
				
			||||||
    4 stack@ EAX MOV
 | 
					    dst1 EAX int-rep %copy
 | 
				
			||||||
    8 save-vm-ptr
 | 
					    dst2 EDX int-rep %copy ;
 | 
				
			||||||
    func f f %c-invoke ;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
M:: x86.32 %box ( dst src func rep gc-map -- )
 | 
					M:: x86.32 %box ( dst src func rep gc-map -- )
 | 
				
			||||||
 | 
					    src rep 0 %store-stack-param
 | 
				
			||||||
    rep rep-size save-vm-ptr
 | 
					    rep rep-size save-vm-ptr
 | 
				
			||||||
    src rep %store-return
 | 
					 | 
				
			||||||
    0 stack@ rep %load-return
 | 
					 | 
				
			||||||
    func f gc-map %c-invoke
 | 
					    func f gc-map %c-invoke
 | 
				
			||||||
    dst EAX tagged-rep %copy ;
 | 
					    dst EAX tagged-rep %copy ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
M:: x86.32 %box-long-long ( dst src1 src2 func gc-map -- )
 | 
					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
 | 
					    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
 | 
					    func f gc-map %c-invoke
 | 
				
			||||||
    dst EAX tagged-rep %copy ;
 | 
					    dst EAX tagged-rep %copy ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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)
 | 
					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)
 | 
					VM_C_API cell from_float(float flo, factor_vm *parent)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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_signed_8(s64 n, factor_vm *vm);
 | 
				
			||||||
VM_C_API cell from_unsigned_8(u64 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 s64 to_signed_8(cell obj, factor_vm *parent);
 | 
				
			||||||
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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VM_C_API fixnum to_fixnum(cell tagged, factor_vm *vm);
 | 
					VM_C_API fixnum to_fixnum(cell tagged, factor_vm *vm);
 | 
				
			||||||
VM_C_API cell to_cell(cell tagged, factor_vm *vm);
 | 
					VM_C_API cell to_cell(cell tagged, factor_vm *vm);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue