From a651cc87b1ccfc0bec6f947043e2e56457a23e10 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 14 Nov 2005 03:04:14 +0000 Subject: [PATCH] various fixes to inference, experimenting with %char-slot vops and interruption checks --- TODO.FACTOR.txt | 10 +++--- library/cli.factor | 4 +++ library/collections/arrays.factor | 4 +-- library/compiler/intrinsics.factor | 17 +++++++++- library/compiler/ppc/fixnum.factor | 8 ++--- library/compiler/ppc/generator.factor | 2 ++ library/compiler/ppc/slots.factor | 33 ++++++++++++++----- library/compiler/vops.factor | 25 ++++++++++++-- library/inference/branches.factor | 3 +- library/inference/known-words.factor | 6 ++-- library/inference/words.factor | 43 +++++++++++++------------ library/syntax/parse-stream.factor | 4 --- library/test/compiler/intrinsics.factor | 10 +++++- library/test/inference.factor | 23 +++++++++++++ native/factor.c | 2 +- 15 files changed, 139 insertions(+), 55 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index a868d4417c..0296b147c7 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,12 +1,12 @@ - make-pane: if no input, just return pane-output -- intrinsic char-slot set-char-slot +- intrinsic char-slot set-char-slot for x86 +- closing ui does not stop timers +- adding/removing timers automatically for animated gadgets +- saving image with UI open - default library names are not useful - fix remaining GL issues - fix up the min thumb size hack -- closing ui does not stop timers -- adding/removing timers automatically for animated gadgets -- saving image with UI open - bug: left click to bring up context menu, click splitter bar and pane grows to 100% - bug: click tutorial, full screen, the right-most arrow icon @@ -16,8 +16,6 @@ - FIELD: char key_vector[32]; - FIELD: union { char b[20]; short s[10]; long l[5]; } data; - MEMBER: long pad[24]; -- inference: try changing nth and set-nth array methods to call -unsafe, - unbalanced branches error - floating point intrinsics - new basic block optimizer - declare slot types for built-ins diff --git a/library/cli.factor b/library/cli.factor index b98dad98a5..d79155fb9a 100644 --- a/library/cli.factor +++ b/library/cli.factor @@ -4,6 +4,10 @@ IN: kernel USING: errors hashtables io kernel-internals lists namespaces parser sequences strings ; +: try-run-file ( file -- ) + #! Run a file and trap errors, printing them to stdio. + [ [ run-file ] keep ] try drop ; + : run-user-init ( -- ) #! Run user init file if it exists "user-init" get [ diff --git a/library/collections/arrays.factor b/library/collections/arrays.factor index ce931b7775..14524f3b1c 100644 --- a/library/collections/arrays.factor +++ b/library/collections/arrays.factor @@ -18,8 +18,8 @@ IN: arrays M: array clone (clone) ; M: array length array-capacity ; -M: array nth bounds-check >r >fixnum r> array-nth ; -M: array set-nth bounds-check >r >fixnum r> set-array-nth ; +M: array nth bounds-check nth-unsafe ; +M: array set-nth bounds-check set-nth-unsafe ; M: array nth-unsafe >r >fixnum r> array-nth ; M: array set-nth-unsafe >r >fixnum r> set-array-nth ; M: array resize resize-array ; diff --git a/library/compiler/intrinsics.factor b/library/compiler/intrinsics.factor index 72c889b27c..6844c6505b 100644 --- a/library/compiler/intrinsics.factor +++ b/library/compiler/intrinsics.factor @@ -22,7 +22,7 @@ namespaces sequences words ; : slot@ ( node -- n/f ) #! Compute slot offset. - dup node-in-d reverse dup first dup literal? [ + dup node-in-d reverse-slice dup first dup literal? [ literal-value cell * swap second rot value-tag dup [ - ] [ 2drop f ] if ] [ @@ -59,6 +59,21 @@ namespaces sequences words ; 1 %write-barrier , ] "intrinsic" set-word-prop +! \ char-slot [ +! drop +! in-2 +! -1 %inc-d , +! 0 1 %char-slot , +! 1 0 %replace-d , +! ] "intrinsic" set-word-prop +! +! \ set-char-slot [ +! drop +! in-3 +! -3 %inc-d , +! 0 2 1 %set-char-slot , +! ] "intrinsic" set-word-prop + \ type [ drop in-1 diff --git a/library/compiler/ppc/fixnum.factor b/library/compiler/ppc/fixnum.factor index 67f8565f8d..e7df0c9bf2 100644 --- a/library/compiler/ppc/fixnum.factor +++ b/library/compiler/ppc/fixnum.factor @@ -18,8 +18,8 @@ namespaces words ; "end" get BNO dup >3-vop< 3dup r> execute 2dup - dup tag-bits SRAWI - dup tag-bits SRAWI + dup untag-fixnum + dup untag-fixnum 3 -rot r> execute drop "s48_long_to_bignum" f compile-c-call @@ -39,7 +39,7 @@ M: %fixnum- generate-node ( vop -- ) M: %fixnum* generate-node ( vop -- ) #! Note that this assumes the output will be in r3. - >3-vop< dup dup tag-bits SRAWI + >3-vop< dup dup untag-fixnum 0 MTXER [ >r >r drop 6 r> r> MULLWO. 3 ] 2keep