diff --git a/basis/io/unix/multiplexers/run-loop/run-loop.factor b/basis/io/unix/multiplexers/run-loop/run-loop.factor index 593fe93ac4..7b80e461dc 100644 --- a/basis/io/unix/multiplexers/run-loop/run-loop.factor +++ b/basis/io/unix/multiplexers/run-loop/run-loop.factor @@ -40,8 +40,8 @@ SYMBOL: kqueue-run-loop-source M: run-loop-mx dispose [ { - [ fd>> &dispose drop ] - [ source>> &dispose drop ] + [ fd>> &CFRelease drop ] + [ source>> &CFRelease drop ] [ remove-kqueue-from-run-loop ] [ kqueue-mx>> &dispose drop ] } cleave diff --git a/basis/stack-checker/alien/alien.factor b/basis/stack-checker/alien/alien.factor index a38e9ea784..f52632040d 100644 --- a/basis/stack-checker/alien/alien.factor +++ b/basis/stack-checker/alien/alien.factor @@ -61,12 +61,6 @@ TUPLE: alien-callback-params < alien-node-params quot xt ; ! Quotation which coerces return value to required type return-prep-quot infer-quot-here ; -! Callbacks are registered in a global hashtable. If you clear -! this hashtable, they will all be blown away by code GC, beware -SYMBOL: callbacks - -[ H{ } clone callbacks set-global ] "alien.compiler" add-init-hook - : register-callback ( word -- ) callbacks get conjoin ; : callback-bottom ( params -- ) diff --git a/basis/tools/deploy/deploy-tests.factor b/basis/tools/deploy/deploy-tests.factor index 71dc746fb5..a390ce56c4 100644 --- a/basis/tools/deploy/deploy-tests.factor +++ b/basis/tools/deploy/deploy-tests.factor @@ -107,3 +107,8 @@ M: quit-responder call-responder* "tools.deploy.test.8" shake-and-bake run-temp-image ] unit-test + +[ ] [ + "tools.deploy.test.9" shake-and-bake + run-temp-image +] unit-test diff --git a/basis/tools/deploy/test/3/deploy.factor b/basis/tools/deploy/test/3/deploy.factor index b38c5da676..f3131237bf 100644 --- a/basis/tools/deploy/test/3/deploy.factor +++ b/basis/tools/deploy/test/3/deploy.factor @@ -1,14 +1,15 @@ USING: tools.deploy.config ; H{ - { deploy-threads? t } - { deploy-c-types? f } - { deploy-ui? f } - { deploy-word-props? f } - { deploy-word-defs? f } - { deploy-math? t } - { deploy-io 3 } + { deploy-unicode? f } { deploy-name "tools.deploy.test.3" } - { deploy-compiler? t } - { deploy-reflection 1 } + { deploy-ui? f } { "stop-after-last-window?" t } + { deploy-word-defs? f } + { deploy-reflection 1 } + { deploy-compiler? t } + { deploy-threads? t } + { deploy-io 3 } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } } diff --git a/basis/tools/deploy/test/9/9.factor b/basis/tools/deploy/test/9/9.factor new file mode 100644 index 0000000000..a1cbd5bc66 --- /dev/null +++ b/basis/tools/deploy/test/9/9.factor @@ -0,0 +1,10 @@ +USING: alien kernel math ; +IN: tools.deploy.test.9 + +: callback-test ( -- callback ) + "int" { "int" } "cdecl" [ 1 + ] alien-callback ; + +: indirect-test ( -- ) + 10 callback-test "int" { "int" } "cdecl" alien-indirect 11 assert= ; + +MAIN: indirect-test diff --git a/basis/tools/deploy/test/9/deploy.factor b/basis/tools/deploy/test/9/deploy.factor new file mode 100644 index 0000000000..91b1da5697 --- /dev/null +++ b/basis/tools/deploy/test/9/deploy.factor @@ -0,0 +1,15 @@ +USING: tools.deploy.config ; +H{ + { deploy-unicode? f } + { deploy-name "tools.deploy.test.9" } + { deploy-ui? f } + { "stop-after-last-window?" t } + { deploy-word-defs? f } + { deploy-reflection 1 } + { deploy-compiler? t } + { deploy-threads? f } + { deploy-io 1 } + { deploy-math? t } + { deploy-word-props? f } + { deploy-c-types? f } +} diff --git a/core/alien/alien.factor b/core/alien/alien.factor index 6a5dfe30df..c97e36e889 100644 --- a/core/alien/alien.factor +++ b/core/alien/alien.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2004, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors assocs kernel math namespaces sequences system -kernel.private byte-arrays arrays ; +kernel.private byte-arrays arrays init ; IN: alien ! Some predicate classes used by the compiler for optimization @@ -72,3 +72,9 @@ ERROR: alien-invoke-error library symbol ; : alien-invoke ( ... return library function parameters -- ... ) 2over alien-invoke-error ; + +! Callbacks are registered in a global hashtable. If you clear +! this hashtable, they will all be blown away by code GC, beware. +SYMBOL: callbacks + +[ H{ } clone callbacks set-global ] "alien" add-init-hook diff --git a/core/io/backend/backend.factor b/core/io/backend/backend.factor index 5456f2251c..e2c6c3d464 100644 --- a/core/io/backend/backend.factor +++ b/core/io/backend/backend.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: init kernel system namespaces io io.encodings -io.encodings.utf8 init assocs splitting ; +io.encodings.utf8 init assocs splitting alien ; IN: io.backend SYMBOL: io-backend @@ -32,5 +32,7 @@ M: object normalize-directory normalize-path ; io-backend set-global init-io init-stdio "io.files" init-hooks get at call ; +! Note that we have 'alien' in our using list so that the alien +! init hook runs before this one. [ init-io embedded? [ init-stdio ] unless ] "io.backend" add-init-hook