eventFlags numEvents <direct-int-array>
eventIds numEvents <direct-longlong-array>
3array flip
- info event-stream-callbacks get at [ drop ] or call ;
+ info event-stream-callbacks get at [ drop ] or call( changes -- ) ;
: master-event-source-callback ( -- alien )
"void"
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors combinators combinators.private effects fry
-kernel kernel.private make sequences continuations
+kernel kernel.private make sequences continuations quotations
stack-checker stack-checker.transforms ;
IN: stack-checker.call-effect
: cache-hit? ( word/quot ic -- ? ) value>> eq? ; inline
-SYMBOL: +failed+
+SYMBOL: +unknown+
-: cached-effect ( quot -- effect )
+GENERIC: cached-effect ( quot -- effect )
+
+M: object cached-effect drop +unknown+ ;
+
+M: quotation cached-effect
dup cached-effect>>
[ ] [
- [ [ infer ] [ 2drop +failed+ ] recover dup ] keep
+ [ [ infer ] [ 2drop +unknown+ ] recover dup ] keep
(>>cached-effect)
] ?if ;
: call-effect-unsafe? ( quot effect -- ? )
[ cached-effect ] dip
- over +failed+ eq?
+ over +unknown+ eq?
[ 2drop f ] [ effect<= ] if ; inline
: (call-effect-slow>quot) ( in out effect -- quot )
"inline"
"inlined-block"
"input-classes"
+ "instances"
"interval"
"intrinsics"
"lambda"
] 2each ;
: compress-quotations ( -- )
- [ quotation? ] [ remain-compiled ] "quotations" compress ;
+ [ quotation? ] [ remain-compiled ] "quotations" compress
+ [ quotation? ] instances [ f >>cached-effect f >>cache-counter drop ] each ;
: compress-strings ( -- )
[ string? ] [ ] "strings" compress ;
IN: call
USE: call.private
+: call-effect ( word effect -- ) call-effect-unsafe ; inline
+
: execute-effect ( word effect -- ) execute-effect-unsafe ; inline
\ No newline at end of file
[ -3 ] [ 1 4 \ - compile-execute(-test-2 ] unit-test
[ 5 ] [ 1 4 \ + compile-execute(-test-2 ] unit-test
+: compile-call(-test-1 ( a b q -- c ) call( a b -- c ) ;
+
+[ t ] [ \ compile-call(-test-1 optimized>> ] unit-test
+[ 4 ] [ 1 3 [ + ] compile-call(-test-1 ] unit-test
+[ 7 ] [ 1 3 2 [ * + ] curry compile-call(-test-1 ] unit-test
+[ 7 ] [ 1 3 [ 2 * ] [ + ] compose compile-call(-test-1 ] unit-test
+[ 4 ] [ 1 3 [ { + } [ ] like call ] compile-call(-test-1 ] unit-test
+
! Compiled
: cond-test-1 ( obj -- str )
{