diff --git a/core/cpu/x86/64/64.factor b/core/cpu/x86/64/64.factor index 956439262a..55513b0930 100644 --- a/core/cpu/x86/64/64.factor +++ b/core/cpu/x86/64/64.factor @@ -4,7 +4,7 @@ USING: alien.c-types arrays cpu.x86.assembler cpu.x86.architecture cpu.x86.intrinsics cpu.x86.sse2 cpu.x86.allot cpu.architecture kernel kernel.private math namespaces sequences generator.registers generator.fixup system -alien ; +alien alien.compiler alien.structs slots splitting math.functions ; IN: cpu.x86.64 PREDICATE: x86-backend amd64-backend @@ -178,10 +178,10 @@ T{ x86-backend f 8 } compiler-backend set-global ! The ABI for passing structs by value is pretty messed up "void*" c-type clone "__stack_value" define-primitive-type -T{ stack-regs } "__stack_value" c-type set-c-type-reg-class +T{ stack-params } "__stack_value" c-type set-c-type-reg-class -: struct-types&offset ( ctype -- pairs ) - c-type struct-type-fields [ +: struct-types&offset ( struct-type -- pairs ) + struct-type-fields [ dup slot-spec-type swap slot-spec-offset 2array ] map ; @@ -192,14 +192,15 @@ T{ stack-regs } "__stack_value" c-type set-c-type-reg-class : flatten-large-struct ( type -- ) heap-size cell align - cell /i "__stack_value" % ; + cell /i "__stack_value" c-type % ; M: struct-type flatten-value-type ( type -- seq ) - dup c-size 16 > [ + dup heap-size 16 > [ flatten-large-struct ] [ struct-types&offset split-struct [ [ c-type c-type-reg-class ] map - T{ int-regs } swap member? "void*" "double" ? , + T{ int-regs } swap member? + "void*" "double" ? c-type , ] each ] if ;