From 3c1ddde1f903f9feab002865bd6817677dbc9d23 Mon Sep 17 00:00:00 2001 From: sheeple Date: Thu, 12 Feb 2009 08:10:21 -0600 Subject: [PATCH] Fix complex float support on NetBSD --- basis/alien/complex/complex.factor | 11 +++++++++-- basis/alien/structs/structs.factor | 4 +++- basis/cpu/x86/32/32.factor | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/basis/alien/complex/complex.factor b/basis/alien/complex/complex.factor index 60a84b9394..079ad57aa5 100644 --- a/basis/alien/complex/complex.factor +++ b/basis/alien/complex/complex.factor @@ -1,6 +1,13 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.complex.functor sequences kernel ; +USING: alien.c-types alien.complex.functor accessors +sequences kernel ; IN: alien.complex -<< { "float" "double" } [ dup "complex-" prepend define-complex-type ] each >> \ No newline at end of file +<< +{ "float" "double" } [ dup "complex-" prepend define-complex-type ] each + +! This overrides the fact that small structures are never returned +! in registers on NetBSD, Linux and Solaris running on 32-bit x86. +"complex-float" c-type t >>return-in-registers? drop + >> diff --git a/basis/alien/structs/structs.factor b/basis/alien/structs/structs.factor index 9c28b71cc6..3e26e4fb39 100755 --- a/basis/alien/structs/structs.factor +++ b/basis/alien/structs/structs.factor @@ -14,7 +14,9 @@ fields { unboxer-quot callable } { getter callable } { setter callable } -return-in-registers ; +return-in-registers? ; + +M: struct-type c-type ; M: struct-type heap-size size>> ; diff --git a/basis/cpu/x86/32/32.factor b/basis/cpu/x86/32/32.factor index c409cfb164..f881792ac6 100755 --- a/basis/cpu/x86/32/32.factor +++ b/basis/cpu/x86/32/32.factor @@ -53,7 +53,7 @@ M: x86.32 return-struct-in-registers? ( c-type -- ? ) [ return-in-registers?>> ] [ heap-size { 1 2 4 8 } member? ] bi os { linux netbsd solaris } member? not - and and ; + and or ; : struct-return@ ( n -- operand ) [ next-stack@ ] [ stack-frame get params>> stack@ ] if* ;