From d54fc8172d7a7a60d7d497cb7a6131306fbf0552 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 12 Jan 2008 22:24:27 -0500 Subject: [PATCH] Assorted fixes --- core/bootstrap/compiler/compiler.factor | 2 +- core/compiler/test/intrinsics.factor | 8 ++++++++ core/cpu/ppc/intrinsics/intrinsics.factor | 4 +++- core/math/integers/integers-docs.factor | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/bootstrap/compiler/compiler.factor b/core/bootstrap/compiler/compiler.factor index 9da231ac96..ff9d5c5e1e 100755 --- a/core/bootstrap/compiler/compiler.factor +++ b/core/bootstrap/compiler/compiler.factor @@ -17,7 +17,7 @@ IN: bootstrap.compiler "cpu." cpu append require nl -"Compiling some words to speed up bootstrap..." write +"Compiling some words to speed up bootstrap..." write flush ! Compile a set of words ahead of the full compile. ! This set of words was determined semi-empirically diff --git a/core/compiler/test/intrinsics.factor b/core/compiler/test/intrinsics.factor index 759258d684..954e45cb66 100755 --- a/core/compiler/test/intrinsics.factor +++ b/core/compiler/test/intrinsics.factor @@ -450,6 +450,14 @@ cell 8 = [ 16 -3 [ fixnum-shift-fast ] compile-call ] unit-test +[ 2 ] [ + 16 [ -3 fixnum-shift-fast ] compile-call +] unit-test + [ 8 ] [ 1 3 [ fixnum-shift-fast ] compile-call ] unit-test + +[ 8 ] [ + 1 [ 3 fixnum-shift-fast ] compile-call +] unit-test diff --git a/core/cpu/ppc/intrinsics/intrinsics.factor b/core/cpu/ppc/intrinsics/intrinsics.factor index d158e8a319..6a49e34d58 100755 --- a/core/cpu/ppc/intrinsics/intrinsics.factor +++ b/core/cpu/ppc/intrinsics/intrinsics.factor @@ -172,7 +172,8 @@ IN: cpu.ppc.intrinsics \ fixnum-shift-fast { { [ - "out" operand "x" operand "y" get neg SRAWI + "out" operand "x" operand "y" get + dup 0 < [ neg SRAWI ] [ swapd SLWI ] if ! Mask off low bits "out" operand dup %untag ] H{ @@ -199,6 +200,7 @@ IN: cpu.ppc.intrinsics { +input+ { { f "x" } { f "y" } } } { +scratch+ { { f "out" } } } { +output+ { "out" } } + { +clobber+ { "x" "y" } } } } } define-intrinsics diff --git a/core/math/integers/integers-docs.factor b/core/math/integers/integers-docs.factor index 27bab404cd..aa716c3197 100755 --- a/core/math/integers/integers-docs.factor +++ b/core/math/integers/integers-docs.factor @@ -120,7 +120,7 @@ HELP: fixnum-shift ( x y -- z ) { $description "Primitive version of " { $link shift } ". The result may overflow to a bignum." } { $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link shift } " instead." } ; -HELP: fixnum-shift-shift ( x y -- z ) +HELP: fixnum-shift-fast ( x y -- z ) { $values { "x" fixnum } { "y" fixnum } { "z" fixnum } } { $description "Primitive version of " { $link shift } ". Unlike " { $link fixnum-shift } ", does not perform an overflow check, so the result may be incorrect." } { $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link shift } " instead." } ;