: define-c-type ( quot name -- )
>r <c-type> [ swap bind ] keep r> c-types get set-hash ;
+ inline
: <c-object> ( size -- c-ptr ) cell / ceiling <byte-array> ;
: word-error ( word msg -- )
[ % dup word-vocabulary % " " % word-name % ] "" make
- throw ;
+ throw ; inline
: transfer-word ( word -- word )
#! This is a hack. See doc/bootstrap.txt.
! See http://factor.sf.net/license.txt for BSD license.
IN: compiler-backend
USING: assembler compiler errors inference kernel lists math
-namespaces sequences strings vectors words ;
+memory namespaces sequences strings vectors words ;
! Compile a VOP.
GENERIC: generate-node ( vop -- )
GENERIC: v>operand
+M: integer v>operand tag-bits shift ;
+
+M: f v>operand address ;
+
: dest/src ( vop -- dest src )
dup vop-out-1 v>operand swap vop-in-1 v>operand ;
: compile-c-call ( symbol dll -- )
2dup dlsym 19 LOAD32 0 1 rel-dlsym 19 MTLR BLRL ;
-M: integer v>operand tag-bits shift ;
M: vreg v>operand vreg-n 17 + ;
M: %prologue generate-node ( vop -- )
USING: alien assembler compiler inference kernel
kernel-internals lists math memory namespaces sequences words ;
-M: integer v>operand tag-bits shift ;
M: vreg v>operand vreg-n { EAX ECX EDX } nth ;
! Not used on x86
[ t ] [ 1 20 shift neg 1 20 shift neg [ fixnum* ] compile-1 1 40 shift = ] unit-test
[ 268435456 ] [ -268435456 >fixnum -1 [ fixnum/i ] compile-1 ] unit-test
+
+[ t ] [ f [ f eq? ] compile-1 ] unit-test
: defer-error ( port -- ? )
#! Return t if it is an unrecoverable error.
err_no dup EAGAIN = over EINTR = or
- [ 2drop f ] [ strerror swap report-error ] ifte ;
+ [ 2drop f ] [ strerror swap report-error t ] ifte ;
! Associates a port with a list of continuations waiting on the
! port to finish I/O