VM: each_object() can't iterate the nursery so instead we assume it's empty
parent
115511038d
commit
2a5e1e06f3
|
@ -13,6 +13,25 @@ IN: memory.tests
|
|||
! Tests for 'become'
|
||||
[ ] [ { } { } become ] unit-test
|
||||
|
||||
! Become something when it's on the data stack.
|
||||
{ "replacer" } [
|
||||
"original" dup 1array { "replacer" } become
|
||||
] unit-test
|
||||
|
||||
! Nested in aging
|
||||
{ "replacer" } [
|
||||
"original" [ 5 [ 1array ] times ] [ 1array ] bi
|
||||
minor-gc
|
||||
{ "replacer" } become 5 [ first ] times
|
||||
] unit-test
|
||||
|
||||
! Also when it is nested in nursery
|
||||
{ "replacer" } [
|
||||
minor-gc
|
||||
"original" [ 5 [ 1array ] times ] [ 1array ] bi { "replacer" } become
|
||||
5 [ first ] times
|
||||
] unit-test
|
||||
|
||||
! Bug found on Windows build box, having too many words in the
|
||||
! image breaks 'become'
|
||||
[ ] [ 100000 [ f <uninterned-word> ] replicate { } { } become drop ] unit-test
|
||||
|
@ -45,12 +64,12 @@ SYMBOL: foo
|
|||
gc
|
||||
|
||||
data-room tenured>> size>>
|
||||
|
||||
|
||||
10 [
|
||||
4 [ 120 1024 * f <array> ] replicate foo set-global
|
||||
100 [ 256 1024 * f <array> drop ] times
|
||||
] times
|
||||
|
||||
|
||||
data-room tenured>> size>>
|
||||
assert=
|
||||
] unit-test
|
||||
|
|
|
@ -149,6 +149,7 @@ struct object_accumulator {
|
|||
|
||||
/* Allocates memory */
|
||||
cell factor_vm::instances(cell type) {
|
||||
primitive_full_gc();
|
||||
object_accumulator accum(type);
|
||||
each_object(accum);
|
||||
return std_vector_to_array(accum.objects);
|
||||
|
@ -156,7 +157,6 @@ cell factor_vm::instances(cell type) {
|
|||
|
||||
/* Allocates memory */
|
||||
void factor_vm::primitive_all_instances() {
|
||||
primitive_full_gc();
|
||||
ctx->push(instances(TYPE_COUNT));
|
||||
}
|
||||
|
||||
|
|
|
@ -122,6 +122,7 @@ struct code_block_write_barrier_visitor {
|
|||
/* classes.tuple uses this to reshape tuples; tools.deploy.shaker uses this
|
||||
to coalesce equal but distinct quotations and wrappers. */
|
||||
void factor_vm::primitive_become() {
|
||||
primitive_minor_gc();
|
||||
array* new_objects = untag_check<array>(ctx->pop());
|
||||
array* old_objects = untag_check<array>(ctx->pop());
|
||||
|
||||
|
|
|
@ -327,12 +327,15 @@ struct factor_vm {
|
|||
}
|
||||
|
||||
template <typename Iterator> inline void each_object(Iterator& iterator) {
|
||||
gc_off = true;
|
||||
|
||||
/* The nursery can't be iterated because there may be gaps between
|
||||
the objects (see factor_vm::reallot_array) so we require it to
|
||||
be empty first. */
|
||||
FACTOR_ASSERT(nursery.occupied_space() == 0);
|
||||
|
||||
gc_off = true;
|
||||
each_object(data->tenured, iterator);
|
||||
each_object(data->aging, iterator);
|
||||
each_object(data->nursery, iterator);
|
||||
|
||||
gc_off = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue