From 63b89c65f94531e75be6667f5b0c89b33f76cb99 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Thu, 3 Dec 2009 12:46:56 -0800 Subject: [PATCH 1/2] don't use intrinsics for simd vector element operations when the component size doesn't fit in a fixnum --- .../compiler/cfg/intrinsics/simd/simd.factor | 19 +++++++++++++------ basis/cpu/x86/x86.factor | 7 ------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/basis/compiler/cfg/intrinsics/simd/simd.factor b/basis/compiler/cfg/intrinsics/simd/simd.factor index a64c657556..ab5e3e1d1d 100644 --- a/basis/compiler/cfg/intrinsics/simd/simd.factor +++ b/basis/compiler/cfg/intrinsics/simd/simd.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2009 Slava Pestov, Joe Groff. ! See http://factorcode.org/license.txt for BSD license. USING: accessors alien alien.c-types byte-arrays fry -classes.algebra cpu.architecture kernel math sequences +classes.algebra cpu.architecture kernel layouts math sequences math.vectors math.vectors.simd.intrinsics macros generalizations combinators combinators.short-circuit arrays locals compiler.tree.propagation.info @@ -152,6 +152,9 @@ IN: compiler.cfg.intrinsics.simd ] } } v-vector-op ; +PREDICATE: fixnum-vector-rep < int-vector-rep + rep-component-type heap-size cell < ; + : ^(sum-vector-2) ( src rep -- dst ) { [ dupd ^^horizontal-add-vector ] @@ -249,7 +252,7 @@ IN: compiler.cfg.intrinsics.simd : ^sum-vector ( src rep -- dst ) { { float-vector-rep [ ^(sum-vector) ] } - { int-vector-rep [| src rep | + { fixnum-vector-rep [| src rep | src rep ^unpack-vector-head :> head src rep ^unpack-vector-tail :> tail rep widen-vector-rep :> wide-rep @@ -526,22 +529,26 @@ IN: compiler.cfg.intrinsics.simd : emit-simd-with ( node -- ) { - [ ^with-vector ] + { fixnum-vector-rep [ ^with-vector ] } + { float-vector-rep [ ^with-vector ] } } emit-v-vector-op ; : emit-simd-gather-2 ( node -- ) { - [ ^^gather-vector-2 ] + { fixnum-vector-rep [ ^^gather-vector-2 ] } + { float-vector-rep [ ^^gather-vector-2 ] } } emit-vv-vector-op ; : emit-simd-gather-4 ( node -- ) { - [ ^^gather-vector-4 ] + { fixnum-vector-rep [ ^^gather-vector-4 ] } + { float-vector-rep [ ^^gather-vector-4 ] } } emit-vvvv-vector-op ; : emit-simd-select ( node -- ) { - [ ^select-vector ] + { fixnum-vector-rep [ ^select-vector ] } + { float-vector-rep [ ^select-vector ] } } [ integer? ] emit-vl-vector-op ; : emit-alien-vector ( node -- ) diff --git a/basis/cpu/x86/x86.factor b/basis/cpu/x86/x86.factor index 302b033a7f..1a5cc6b850 100644 --- a/basis/cpu/x86/x86.factor +++ b/basis/cpu/x86/x86.factor @@ -1323,15 +1323,8 @@ M: x86 %shr-vector-imm-reps %shr-vector-reps ; M: x86 %integer>scalar drop MOVD ; -! XXX the longlong versions won't work on x86.32 M:: x86 %scalar>integer ( dst src rep -- ) rep { - { longlong-scalar-rep [ - dst src MOVD - ] } - { ulonglong-scalar-rep [ - dst src MOVD - ] } { int-scalar-rep [ dst 32-bit-version-of src MOVD dst dst 32-bit-version-of From ead592697b049244252ef6450675c68d5ffd2fab Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 4 Dec 2009 03:41:19 -0500 Subject: [PATCH 2/2] vm: be more eager to do a full collection to avoid fragmentation leading to heap growth --- vm/data_heap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/data_heap.cpp b/vm/data_heap.cpp index 0b79b53238..7234ffb775 100755 --- a/vm/data_heap.cpp +++ b/vm/data_heap.cpp @@ -100,7 +100,7 @@ void data_heap::reset_generation(tenured_space *gen) bool data_heap::low_memory_p() { - return (tenured->free_space() <= nursery->size + aging->size); + return (tenured->largest_free_block() <= nursery->size + aging->size); } void data_heap::mark_all_cards()