From abe72ae7ae3bde79e380ea544ddc1e6957d564d0 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 5 Dec 2009 18:20:57 -0500 Subject: [PATCH 1/4] math.vectors.simd: ensure that set-alien-vector is open-coded in the actual set-nth-unsafe method on SIMD specialized arrays, not just inlined instances --- basis/math/vectors/simd/simd.factor | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/basis/math/vectors/simd/simd.factor b/basis/math/vectors/simd/simd.factor index b7b244de12..84468407bd 100644 --- a/basis/math/vectors/simd/simd.factor +++ b/basis/math/vectors/simd/simd.factor @@ -9,6 +9,8 @@ IN: math.vectors.simd ERROR: bad-simd-length got expected ; +ERROR: bad-simd-vector obj ; + << byte-array >>class A >>boxed-class { A-rep alien-vector A boa } >quotation >>getter - { [ underlying>> ] 2dip A-rep set-alien-vector } >quotation >>setter + { + [ dup simd-128? [ bad-simd-vector ] unless underlying>> ] 2dip + A-rep set-alien-vector + } >quotation >>setter 16 >>size 16 >>align A-rep >>rep From 0a5826c123d6dafc68ff9f07f8d3d7e415da4e94 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 5 Dec 2009 18:21:32 -0500 Subject: [PATCH 2/4] math.combinatorics: remove 'mirrors' from using list since its not needed --- basis/math/combinatorics/combinatorics.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/math/combinatorics/combinatorics.factor b/basis/math/combinatorics/combinatorics.factor index 5c03e41870..6971d88792 100644 --- a/basis/math/combinatorics/combinatorics.factor +++ b/basis/math/combinatorics/combinatorics.factor @@ -1,7 +1,7 @@ ! Copyright (c) 2007-2009 Slava Pestov, Doug Coleman, Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. USING: accessors assocs binary-search fry kernel locals math math.order - math.ranges mirrors namespaces sequences sorting ; + math.ranges namespaces sequences sorting ; IN: math.combinatorics Date: Sat, 5 Dec 2009 18:21:46 -0500 Subject: [PATCH 3/4] tools.deploy.shaker: "specializations" word-prop no longer used --- basis/tools/deploy/shaker/shaker.factor | 1 - 1 file changed, 1 deletion(-) diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor index 4e117e11b5..ea02aa03c9 100644 --- a/basis/tools/deploy/shaker/shaker.factor +++ b/basis/tools/deploy/shaker/shaker.factor @@ -180,7 +180,6 @@ IN: tools.deploy.shaker "slots" "special" "specializer" - "specializations" "struct-slots" ! UI needs this ! "superclass" From 344c357ef1818f41a0842bd3d47d55a7a7de9338 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 5 Dec 2009 19:03:53 -0500 Subject: [PATCH 4/4] vm: grow the heap if a full collection doesn't reclaim enough space --- vm/data_heap.cpp | 7 ++++++- vm/data_heap.hpp | 1 + vm/full_collector.cpp | 8 ++++++++ vm/gc.cpp | 4 ++-- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/vm/data_heap.cpp b/vm/data_heap.cpp index 7234ffb775..aa7e3eb51a 100755 --- a/vm/data_heap.cpp +++ b/vm/data_heap.cpp @@ -98,11 +98,16 @@ void data_heap::reset_generation(tenured_space *gen) clear_decks(gen); } -bool data_heap::low_memory_p() +bool data_heap::high_fragmentation_p() { return (tenured->largest_free_block() <= nursery->size + aging->size); } +bool data_heap::low_memory_p() +{ + return (tenured->free_space() <= nursery->size + aging->size); +} + void data_heap::mark_all_cards() { memset(cards,-1,cards_end - cards); diff --git a/vm/data_heap.hpp b/vm/data_heap.hpp index ce156696b8..cef43ef5fe 100755 --- a/vm/data_heap.hpp +++ b/vm/data_heap.hpp @@ -29,6 +29,7 @@ struct data_heap { void reset_generation(nursery_space *gen); void reset_generation(aging_space *gen); void reset_generation(tenured_space *gen); + bool high_fragmentation_p(); bool low_memory_p(); void mark_all_cards(); }; diff --git a/vm/full_collector.cpp b/vm/full_collector.cpp index 14c7f09332..da7da4a951 100644 --- a/vm/full_collector.cpp +++ b/vm/full_collector.cpp @@ -143,12 +143,20 @@ void factor_vm::collect_full(bool trace_contexts_p) { collect_mark_impl(trace_contexts_p); collect_sweep_impl(); + if(data->low_memory_p()) + { + current_gc->op = collect_growing_heap_op; + current_gc->event->op = collect_growing_heap_op; + collect_growing_heap(0,trace_contexts_p); + } + else if(data->high_fragmentation_p()) { current_gc->op = collect_compact_op; current_gc->event->op = collect_compact_op; collect_compact_impl(trace_contexts_p); } + code->flush_icache(); } diff --git a/vm/gc.cpp b/vm/gc.cpp index f90ad58f23..f8a9fd45b8 100755 --- a/vm/gc.cpp +++ b/vm/gc.cpp @@ -152,7 +152,7 @@ void factor_vm::gc(gc_op op, cell requested_bytes, bool trace_contexts_p) break; case collect_aging_op: collect_aging(); - if(data->low_memory_p()) + if(data->high_fragmentation_p()) { current_gc->op = collect_full_op; current_gc->event->op = collect_full_op; @@ -161,7 +161,7 @@ void factor_vm::gc(gc_op op, cell requested_bytes, bool trace_contexts_p) break; case collect_to_tenured_op: collect_to_tenured(); - if(data->low_memory_p()) + if(data->high_fragmentation_p()) { current_gc->op = collect_full_op; current_gc->event->op = collect_full_op;