vm: Add more Allocates memory comments.

db4
Doug Coleman 2013-03-25 14:41:18 -07:00
parent d25fb6161e
commit 2b33dde782
8 changed files with 11 additions and 0 deletions

View File

@ -5,6 +5,7 @@ namespace factor
* It is up to the caller to fill in the object's fields in a meaningful * It is up to the caller to fill in the object's fields in a meaningful
* fashion! * fashion!
*/ */
/* Allocates memory */
inline object *factor_vm::allot_object(cell type, cell size) inline object *factor_vm::allot_object(cell type, cell size)
{ {
#ifdef FACTOR_DEBUG #ifdef FACTOR_DEBUG

View File

@ -1299,6 +1299,7 @@ bignum * factor_vm::allot_bignum_zeroed(bignum_length_type length, int negative_
} }
/* can allocate if not in nursery or size is larger */ /* can allocate if not in nursery or size is larger */
/* Allocates memory conditionally */
#define BIGNUM_REDUCE_LENGTH(source, length) \ #define BIGNUM_REDUCE_LENGTH(source, length) \
source = reallot_array(source,length + 1) source = reallot_array(source,length + 1)

View File

@ -403,6 +403,7 @@ void factor_vm::fixup_labels(array *labels, code_block *compiled)
} }
/* Might GC */ /* Might GC */
/* Allocates memory */
code_block *factor_vm::allot_code_block(cell size, code_block_type type) code_block *factor_vm::allot_code_block(cell size, code_block_type type)
{ {
code_block *block = code->allocator->allot(size + sizeof(code_block)); code_block *block = code->allocator->allot(size + sizeof(code_block));
@ -431,6 +432,7 @@ code_block *factor_vm::allot_code_block(cell size, code_block_type type)
} }
/* Might GC */ /* Might GC */
/* Allocates memory */
code_block *factor_vm::add_code_block(code_block_type type, cell code_, cell labels_, code_block *factor_vm::add_code_block(code_block_type type, cell code_, cell labels_,
cell owner_, cell relocation_, cell parameters_, cell literals_, cell owner_, cell relocation_, cell parameters_, cell literals_,
cell frame_size_untagged) cell frame_size_untagged)

View File

@ -189,6 +189,7 @@ void factor_vm::initialize_code_blocks()
code->uninitialized_blocks.clear(); code->uninitialized_blocks.clear();
} }
/* Allocates memory */
void factor_vm::primitive_modify_code_heap() void factor_vm::primitive_modify_code_heap()
{ {
bool reset_inline_caches = to_boolean(ctx->pop()); bool reset_inline_caches = to_boolean(ctx->pop());
@ -307,6 +308,7 @@ struct code_block_accumulator {
} }
}; };
/* Allocates memory */
cell factor_vm::code_blocks() cell factor_vm::code_blocks()
{ {
code_block_accumulator accum; code_block_accumulator accum;
@ -314,6 +316,7 @@ cell factor_vm::code_blocks()
return std_vector_to_array(accum.objects); return std_vector_to_array(accum.objects);
} }
/* Allocates memory */
void factor_vm::primitive_code_blocks() void factor_vm::primitive_code_blocks()
{ {
ctx->push(code_blocks()); ctx->push(code_blocks());

View File

@ -148,6 +148,7 @@ data_heap_room factor_vm::data_room()
return room; return room;
} }
/* Allocates memory */
void factor_vm::primitive_data_room() void factor_vm::primitive_data_room()
{ {
data_heap_room room = data_room(); data_heap_room room = data_room();

View File

@ -138,6 +138,7 @@ void factor_vm::primitive_reset_dispatch_stats()
memset(&dispatch_stats,0,sizeof(dispatch_statistics)); memset(&dispatch_stats,0,sizeof(dispatch_statistics));
} }
/* Allocates memory */
void factor_vm::primitive_dispatch_stats() void factor_vm::primitive_dispatch_stats()
{ {
ctx->push(tag<byte_array>(byte_array_from_value(&dispatch_stats))); ctx->push(tag<byte_array>(byte_array_from_value(&dispatch_stats)));

View File

@ -328,6 +328,7 @@ void factor_vm::primitive_enable_gc_events()
gc_events = new std::vector<gc_event>(); gc_events = new std::vector<gc_event>();
} }
/* Allocates memory */
void factor_vm::primitive_disable_gc_events() void factor_vm::primitive_disable_gc_events()
{ {
if(gc_events) if(gc_events)

View File

@ -375,6 +375,7 @@ struct factor_vm
object *allot_object(cell type, cell size); object *allot_object(cell type, cell size);
object *allot_large_object(cell type, cell size); object *allot_large_object(cell type, cell size);
/* Allocates memory */
template<typename Type> Type *allot(cell size) template<typename Type> Type *allot(cell size)
{ {
return (Type *)allot_object(Type::type_number,size); return (Type *)allot_object(Type::type_number,size);