]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.cfg: ##unbox-long-long can have multiple outputs now, clean up long long...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 15 Jul 2010 23:49:29 +0000 (19:49 -0400)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 15 Jul 2010 23:49:29 +0000 (19:49 -0400)
basis/compiler/cfg/builder/alien/boxing/boxing.factor
basis/compiler/cfg/instructions/instructions.factor
basis/cpu/architecture/architecture.factor
basis/cpu/x86/32/32.factor
vm/math.cpp
vm/math.hpp

index 48652737be1c79cb917adace712d0cd3c8e85820..fb57700c80809c10b706841ea0e8049e2ac9726c 100644 (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 )
index 1b7aa94fae50ddba19d70a8d418b737e78ccf324..7efd1b3a5dc7926699bc3a99f761984e239fcea3 100644 (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 ;
index 277896130e11cba8e0380b0e7f25b9b1a2e35f7a..b4b5132ed55385e1c9a2363592076a45bd722896 100644 (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 -- )
 
index 12a067c684d713743712e4e78393f28a98f096db..ee6082425b61e5dc6435aec28ea48598898c0f74 100755 (executable)
@@ -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 ;
 
index 737b35ab85735d11f9f4f39d699bbcac295b2991..e64db2690ed43e58da2fca01da78a6606a316b2b 100755 (executable)
@@ -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)
index 13934048cdce68968b8666785147ac30dc597152..dc6d37bcfdfb645d1d39f90cb375e4c9cbf3c5b6 100644 (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);