More Mac Intel ABI fixes -- and fuck Apple for screwing up the Objective C ABI even further
parent
68bf49fca0
commit
c9590d2560
|
@ -50,6 +50,7 @@ parser sequences sequences-internals words ;
|
||||||
"native-io" get [ init-io ] when
|
"native-io" get [ init-io ] when
|
||||||
|
|
||||||
"cocoa" get [
|
"cocoa" get [
|
||||||
|
"/library/compiler/alien/objc/load.factor" run-resource
|
||||||
"/library/ui/cocoa/load.factor" run-resource
|
"/library/ui/cocoa/load.factor" run-resource
|
||||||
] when
|
] when
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
USING: kernel parser sequences ;
|
||||||
|
|
||||||
|
{
|
||||||
|
{ [ cpu "x86" = ] [ "/library/compiler/x86/objc.factor" ] }
|
||||||
|
{ [ cpu "ppc" = ] [ "/library/compiler/ppc/objc.factor" ] }
|
||||||
|
} cond run-resource
|
||||||
|
|
||||||
|
{
|
||||||
|
"/library/compiler/alien/objc/runtime.factor"
|
||||||
|
"/library/compiler/alien/objc/utilities.factor"
|
||||||
|
"/library/compiler/alien/objc/subclassing.factor"
|
||||||
|
} [
|
||||||
|
run-resource
|
||||||
|
] each
|
|
@ -66,7 +66,7 @@ libc math namespaces sequences strings words ;
|
||||||
|
|
||||||
: struct-return ( ret types quot -- ret types quot )
|
: struct-return ( ret types quot -- ret types quot )
|
||||||
pick c-struct? [
|
pick c-struct? [
|
||||||
pick c-size [ memcpy ] curry append
|
pick c-size [ memcpy (pre-stret) ] curry append
|
||||||
>r { "void*" } swap append >r drop "void" r> r>
|
>r { "void*" } swap append >r drop "void" r> r>
|
||||||
] when ;
|
] when ;
|
||||||
|
|
|
@ -14,7 +14,7 @@ kernel libc math namespaces parser sequences strings words ;
|
||||||
[ "void" f ] %
|
[ "void" f ] %
|
||||||
"_stret" append ,
|
"_stret" append ,
|
||||||
{ "void*" } swap second append ,
|
{ "void*" } swap second append ,
|
||||||
] make-alien-invoke ;
|
] make-alien-invoke \ (post-stret) add ;
|
||||||
|
|
||||||
: use-stret? ( type -- ? )
|
: use-stret? ( type -- ? )
|
||||||
#! We use the objc_msgSend_stret form in either of the
|
#! We use the objc_msgSend_stret form in either of the
|
|
@ -0,0 +1,7 @@
|
||||||
|
! Copyright (C) 2006 Slava Pestov.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
IN: objc
|
||||||
|
|
||||||
|
: (post-stret) ; inline
|
||||||
|
|
||||||
|
: (pre-stret) ; inline
|
|
@ -0,0 +1,20 @@
|
||||||
|
! Copyright (C) 2006 Slava Pestov.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
IN: objc
|
||||||
|
|
||||||
|
! In their infinite wisdom, Apple's struct-returning Objective C
|
||||||
|
! messages do not use their own documented ABI; instead they
|
||||||
|
! pop one of the input parameters off the stack. We compensate
|
||||||
|
! for that here.
|
||||||
|
|
||||||
|
! when calling an stret via objc_msgSend_stret, it pops the
|
||||||
|
! struct off the stack for us!
|
||||||
|
: (post-stret) ;
|
||||||
|
|
||||||
|
\ (post-stret) [ EAX PUSH ] H{ } define-intrinsic
|
||||||
|
|
||||||
|
! when an _stret is being called, we must pop the struct off
|
||||||
|
! the stack before returning
|
||||||
|
: (pre-stret) ;
|
||||||
|
|
||||||
|
\ (pre-stret) [ EAX POP ECX POP EAX PUSH ] H{ } define-intrinsic
|
|
@ -1,9 +1,6 @@
|
||||||
USING: compiler io parser sequences words ;
|
USING: compiler io parser sequences words ;
|
||||||
|
|
||||||
{
|
{
|
||||||
"/library/ui/cocoa/runtime.factor"
|
|
||||||
"/library/ui/cocoa/utilities.factor"
|
|
||||||
"/library/ui/cocoa/subclassing.factor"
|
|
||||||
"/library/ui/cocoa/core-foundation.factor"
|
"/library/ui/cocoa/core-foundation.factor"
|
||||||
"/library/ui/cocoa/types.factor"
|
"/library/ui/cocoa/types.factor"
|
||||||
"/library/ui/cocoa/init-cocoa.factor"
|
"/library/ui/cocoa/init-cocoa.factor"
|
||||||
|
|
Loading…
Reference in New Issue