diff --git a/vm/alien.cpp b/vm/alien.cpp index 52b8a7800d..d0fdec6312 100755 --- a/vm/alien.cpp +++ b/vm/alien.cpp @@ -27,6 +27,7 @@ char *factor_vm::pinned_alien_offset(cell obj) } } +/* Allocates memory */ /* make an alien */ cell factor_vm::allot_alien(cell delegate_, cell displacement) { @@ -52,11 +53,13 @@ cell factor_vm::allot_alien(cell delegate_, cell displacement) return new_alien.value(); } +/* Allocates memory */ cell factor_vm::allot_alien(void *address) { return allot_alien(false_object,(cell)address); } +/* Allocates memory */ /* make an alien pointing at an offset of another alien */ void factor_vm::primitive_displaced_alien() { @@ -117,6 +120,7 @@ void factor_vm::primitive_dlopen() ctx->push(library.value()); } +/* Allocates memory */ /* look up a symbol in a native library */ void factor_vm::primitive_dlsym() { @@ -139,6 +143,7 @@ void factor_vm::primitive_dlsym() ctx->push(allot_alien(ffi_dlsym(NULL,sym))); } +/* Allocates memory */ /* look up a symbol in a native library */ void factor_vm::primitive_dlsym_raw() { diff --git a/vm/arrays.cpp b/vm/arrays.cpp index 0d599a6c96..5896325bbc 100644 --- a/vm/arrays.cpp +++ b/vm/arrays.cpp @@ -3,6 +3,7 @@ namespace factor { +/* Allocates memory */ array *factor_vm::allot_array(cell capacity, cell fill_) { data_root fill(fill_,this); @@ -11,6 +12,7 @@ array *factor_vm::allot_array(cell capacity, cell fill_) return new_array; } +/* Allocates memory */ void factor_vm::primitive_array() { data_root fill(ctx->pop(),this); @@ -20,6 +22,7 @@ void factor_vm::primitive_array() ctx->push(tag(new_array)); } +/* Allocates memory */ cell factor_vm::allot_array_1(cell obj_) { data_root obj(obj_,this); @@ -28,6 +31,7 @@ cell factor_vm::allot_array_1(cell obj_) return a.value(); } +/* Allocates memory */ cell factor_vm::allot_array_2(cell v1_, cell v2_) { data_root v1(v1_,this); @@ -38,6 +42,7 @@ cell factor_vm::allot_array_2(cell v1_, cell v2_) return a.value(); } +/* Allocates memory */ cell factor_vm::allot_array_4(cell v1_, cell v2_, cell v3_, cell v4_) { data_root v1(v1_,this); @@ -52,6 +57,7 @@ cell factor_vm::allot_array_4(cell v1_, cell v2_, cell v3_, cell v4_) return a.value(); } +/* Allocates memory */ void factor_vm::primitive_resize_array() { data_root a(ctx->pop(),this); @@ -60,6 +66,7 @@ void factor_vm::primitive_resize_array() ctx->push(tag(reallot_array(a.untagged(),capacity))); } +/* Allocates memory */ cell factor_vm::std_vector_to_array(std::vector &elements) { cell element_count = elements.size(); @@ -73,6 +80,7 @@ cell factor_vm::std_vector_to_array(std::vector &elements) return objects.value(); } +/* Allocates memory */ void growable_array::add(cell elt_) { factor_vm *parent = elements.parent; @@ -83,6 +91,7 @@ void growable_array::add(cell elt_) parent->set_array_nth(elements.untagged(),count++,elt.value()); } +/* Allocates memory */ void growable_array::append(array *elts_) { factor_vm *parent = elements.parent; @@ -98,6 +107,7 @@ void growable_array::append(array *elts_) parent->set_array_nth(elements.untagged(),count++,array_nth(elts.untagged(),index)); } +/* Allocates memory */ void growable_array::trim() { factor_vm *parent = elements.parent; diff --git a/vm/byte_arrays.cpp b/vm/byte_arrays.cpp index 467e41029d..907cf3ee63 100644 --- a/vm/byte_arrays.cpp +++ b/vm/byte_arrays.cpp @@ -3,6 +3,7 @@ namespace factor { +/* Allocates memory */ byte_array *factor_vm::allot_byte_array(cell size) { byte_array *array = allot_uninitialized_array(size); @@ -10,18 +11,21 @@ byte_array *factor_vm::allot_byte_array(cell size) return array; } +/* Allocates memory */ void factor_vm::primitive_byte_array() { cell size = unbox_array_size(); ctx->push(tag(allot_byte_array(size))); } +/* Allocates memory */ void factor_vm::primitive_uninitialized_byte_array() { cell size = unbox_array_size(); ctx->push(tag(allot_uninitialized_array(size))); } +/* Allocates memory */ void factor_vm::primitive_resize_byte_array() { data_root array(ctx->pop(),this); @@ -30,6 +34,7 @@ void factor_vm::primitive_resize_byte_array() ctx->push(tag(reallot_array(array.untagged(),capacity))); } +/* Allocates memory */ void growable_byte_array::grow_bytes(cell len) { count += len; @@ -37,6 +42,7 @@ void growable_byte_array::grow_bytes(cell len) elements = elements.parent->reallot_array(elements.untagged(),count * 2); } +/* Allocates memory */ void growable_byte_array::append_bytes(void *elts, cell len) { cell old_count = count; @@ -44,6 +50,7 @@ void growable_byte_array::append_bytes(void *elts, cell len) memcpy(&elements->data()[old_count],elts,len); } +/* Allocates memory */ void growable_byte_array::append_byte_array(cell byte_array_) { data_root byte_array(byte_array_,elements.parent); @@ -59,6 +66,7 @@ void growable_byte_array::append_byte_array(cell byte_array_) count += len; } +/* Allocates memory */ void growable_byte_array::trim() { factor_vm *parent = elements.parent; diff --git a/vm/callbacks.cpp b/vm/callbacks.cpp index fafcbef54f..70058dad77 100755 --- a/vm/callbacks.cpp +++ b/vm/callbacks.cpp @@ -125,6 +125,7 @@ void callback_heap::update() each_callback(updater); } +/* Allocates memory */ void factor_vm::primitive_callback() { cell return_rewind = to_cell(ctx->pop()); diff --git a/vm/contexts.cpp b/vm/contexts.cpp index fc10e3d8c8..4c3480e961 100644 --- a/vm/contexts.cpp +++ b/vm/contexts.cpp @@ -143,11 +143,13 @@ context *factor_vm::new_context() return new_context; } +/* Allocates memory */ void factor_vm::init_context(context *ctx) { ctx->context_objects[OBJ_CONTEXT] = allot_alien(ctx); } +/* Allocates memory */ context *new_context(factor_vm *parent) { context *new_context = parent->new_context(); @@ -173,12 +175,14 @@ VM_C_API void delete_context(factor_vm *parent, context *old_context) parent->delete_context(old_context); } +/* Allocates memory */ VM_C_API void reset_context(factor_vm *parent, context *ctx) { ctx->reset(); parent->init_context(ctx); } +/* Allocates memory */ cell factor_vm::begin_callback(cell quot_) { data_root quot(quot_,this); @@ -233,6 +237,7 @@ void factor_vm::primitive_context_object_for() ctx->push(other_ctx->context_objects[n]); } +/* Allocates memory */ cell factor_vm::stack_to_array(cell bottom, cell top) { fixnum depth = (fixnum)(top - bottom + sizeof(cell)); diff --git a/vm/errors.cpp b/vm/errors.cpp index 5fc9b1d200..c1d66dde0a 100755 --- a/vm/errors.cpp +++ b/vm/errors.cpp @@ -41,6 +41,7 @@ void out_of_memory() abort(); } +/* Allocates memory */ void factor_vm::general_error(vm_error_type error, cell arg1_, cell arg2_) { data_root arg1(arg1_,this); diff --git a/vm/gc.cpp b/vm/gc.cpp index aa0fe224e4..e7367cbcb3 100755 --- a/vm/gc.cpp +++ b/vm/gc.cpp @@ -290,6 +290,7 @@ void factor_vm::primitive_compact_gc() true /* trace contexts? */); } +/* Allocates memory */ /* * It is up to the caller to fill in the object's fields in a meaningful * fashion! diff --git a/vm/jit.cpp b/vm/jit.cpp index 9f3d7b5ed7..2b27539e7f 100644 --- a/vm/jit.cpp +++ b/vm/jit.cpp @@ -78,6 +78,7 @@ void jit::emit(cell code_template_) code.append_byte_array(insns.value()); } +/* Allocates memory */ void jit::emit_with_literal(cell code_template_, cell argument_) { data_root code_template(code_template_,parent); data_root argument(argument_,parent); @@ -85,6 +86,7 @@ void jit::emit_with_literal(cell code_template_, cell argument_) { emit(code_template.value()); } +/* Allocates memory */ void jit::emit_with_parameter(cell code_template_, cell argument_) { data_root code_template(code_template_,parent); data_root argument(argument_,parent); @@ -92,6 +94,7 @@ void jit::emit_with_parameter(cell code_template_, cell argument_) { emit(code_template.value()); } +/* Allocates memory */ bool jit::emit_subprimitive(cell word_, bool tail_call_p, bool stack_frame_p) { data_root word(word_,parent); @@ -99,6 +102,7 @@ bool jit::emit_subprimitive(cell word_, bool tail_call_p, bool stack_frame_p) parameters.append(untag(array_nth(code_template.untagged(),0))); literals.append(untag(array_nth(code_template.untagged(),1))); emit(array_nth(code_template.untagged(),2)); + if(array_capacity(code_template.untagged()) == 5) { if(tail_call_p) diff --git a/vm/sampling_profiler.cpp b/vm/sampling_profiler.cpp index aa3f6a7dbe..caf349f1a0 100644 --- a/vm/sampling_profiler.cpp +++ b/vm/sampling_profiler.cpp @@ -122,6 +122,7 @@ void factor_vm::primitive_sampling_profiler() set_sampling_profiler(to_fixnum(ctx->pop())); } +/* Allocates memory */ void factor_vm::primitive_get_samples() { if (atomic::load(&sampling_profiler_p) || samples.empty()) {