]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix for native I/O backends that create callbacks in deployed apps; this affected...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sat, 13 Dec 2008 01:48:17 +0000 (19:48 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sat, 13 Dec 2008 01:48:17 +0000 (19:48 -0600)
basis/stack-checker/alien/alien.factor
core/alien/alien.factor
core/io/backend/backend.factor

index a38e9ea784201229e8a1dab3e1a1427c482b9a13..f52632040d23725697604b0d8186b764fcb0bde0 100644 (file)
@@ -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 -- )
index 6a5dfe30dff2db2aa510a2cc260a8f08845fe930..c97e36e889cc323ed885ea2126a7e60518f23d5e 100644 (file)
@@ -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
index 5456f2251ca61cfe782f10393dd2236fe9cb2fa5..e2c6c3d4647709e3a96eb791ae2f304c214af8e4 100644 (file)
@@ -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