Add annotations for gc allocating.
cell count;
data_root<array> elements;
+ /* Allocates memory */
growable_array(factor_vm* parent, cell capacity = 10)
: count(0),
elements(parent->allot_array(capacity, false_object), parent) {}
cell count;
data_root<byte_array> elements;
+ /* Allocates memory */
growable_byte_array(factor_vm* parent, cell capacity = 40)
: count(0), elements(parent->allot_byte_array(capacity), parent) {}
namespace factor {
+/* Allocates memory (allot) */
callstack* factor_vm::allot_callstack(cell size) {
callstack* stack = allot<callstack>(callstack_object_size(size));
stack->length = tag_fixnum(size);
return frame_top;
}
+/* Allocates memory (allot_callstack) */
cell factor_vm::capture_callstack(context* ctx) {
void* top = second_from_top_stack_frame(ctx);
void* bottom = ctx->callstack_bottom;
return tag<callstack>(stack);
}
+/* Allocates memory (capture_callstack) */
void factor_vm::primitive_callstack() { ctx->push(capture_callstack(ctx)); }
+/* Allocates memory (capture_callstack) */
void factor_vm::primitive_callstack_for() {
context* other_ctx = (context*)pinned_alien_offset(ctx->peek());
ctx->replace(capture_callstack(other_ctx));
factor_vm* parent;
growable_array frames;
+ /* Allocates memory (frames is a growable_array, constructor allocates) */
explicit stack_frame_accumulator(factor_vm* parent)
: parent(parent), frames(parent) {}
+
+ /* Allocates memory (frames.add()) */
void operator()(void* frame_top, cell frame_size, code_block* owner,
void* addr) {
data_root<object> executing_quot(owner->owner_quot(), parent);
ctx->replace(code->code_block_for_address((cell)addr)->scan(this, addr));
}
+/* Allocates memory (jit_compile_quot) */
void factor_vm::primitive_set_innermost_stack_frame_quot() {
data_root<callstack> stack(ctx->pop(), this);
data_root<quotation> quot(ctx->pop(), this);
set_frame_return_address(inner, (char*)quot->entry_point + offset);
}
+/* Allocates memory (allot_alien) */
void factor_vm::primitive_callstack_bounds() {
ctx->push(allot_alien((void*)ctx->callstack_seg->start));
ctx->push(allot_alien((void*)ctx->callstack_seg->end));
/* This is a little tricky. The iterator may allocate memory, so we
keep the callstack in a GC root and use relative offsets */
+/* Allocates memory */
template <typename Iterator, typename Fixup>
inline void factor_vm::iterate_callstack_object(callstack* stack_,
Iterator& iterator,
}
}
+/* Allocates memory */
template <typename Iterator>
inline void factor_vm::iterate_callstack_object(callstack* stack,
Iterator& iterator) {
iterate_callstack_object(stack, iterator, none);
}
+/* Allocates memory */
template <typename Iterator, typename Fixup>
inline void factor_vm::iterate_callstack(context* ctx, Iterator& iterator,
Fixup& fixup) {
}
}
+/* Allocates memory */
template <typename Iterator>
inline void factor_vm::iterate_callstack(context* ctx, Iterator& iterator) {
no_fixup none;
ctx->push(tag<byte_array>(byte_array_from_value(&dispatch_stats)));
}
+/* Allocates memory */
void quotation_jit::emit_mega_cache_lookup(cell methods_, fixnum index,
cell cache_) {
data_root<array> methods(methods_, parent);
}
-/* May allocate memory */
+/* Allocates memory */
void factor_vm::pass_args_to_factor(int argc, vm_char** argv) {
growable_array args(this);
gc_events = new std::vector<gc_event>();
}
-/* Allocates memory */
+/* Allocates memory (byte_array_from_value, result.add) */
void factor_vm::primitive_disable_gc_events() {
if (gc_events) {
growable_array result(this);
cell cache_entries_, bool tail_call_p);
};
+/* Allocates memory */
void inline_cache_jit::emit_check(cell klass) {
cell code_template;
if (TAG(klass) == FIXNUM_TYPE)
/* index: 0 = top of stack, 1 = item underneath, etc
cache_entries: array of class/method pairs */
+/* Allocates memory */
void inline_cache_jit::compile_inline_cache(fixnum index, cell generic_word_,
cell methods_, cell cache_entries_,
bool tail_call_p) {
true); /* stack_frame_p */
}
+/* Allocates memory */
code_block* factor_vm::compile_inline_cache(fixnum index, cell generic_word_,
cell methods_, cell cache_entries_,
bool tail_call_p) {
compaction;
also, the block containing the return address may now be dead. Use a
code_root to take care of the details. */
+/* Allocates memory */
void* factor_vm::inline_cache_miss(cell return_address_) {
code_root return_address(return_address_, this);
check_code_pointer(return_address.value);
return xt;
}
+/* Allocates memory */
VM_C_API void* inline_cache_miss(cell return_address, factor_vm* parent) {
return parent->inline_cache_miss(return_address);
}
- megamorphic caches (dispatch.cpp),
- polymorphic inline caches (inline_cache.cpp) */
-/* Allocates memory */
+/* Allocates memory (`code` and `relocation` initializers create growable_byte_array) */
jit::jit(code_block_type type, cell owner, factor_vm* vm)
: type(type),
owner(owner, vm),
(void)old_count;
}
+/* Allocates memory */
void jit::emit_relocation(cell relocation_template_) {
data_root<byte_array> relocation_template(relocation_template_, parent);
cell capacity =
void emit_relocation(cell relocation_template);
void emit(cell code_template);
+ /* Allocates memory */
void parameter(cell parameter) { parameters.add(parameter); }
void emit_with_parameter(cell code_template_, cell parameter_);
+ /* Allocates memory */
void literal(cell literal) { literals.add(literal); }
void emit_with_literal(cell code_template_, cell literal_);
emit_with_literal(parent->special_objects[JIT_PUSH_IMMEDIATE], literal);
}
+ /* Allocates memory */
void word_jump(cell word_) {
data_root<word> word(word_, parent);
#ifndef FACTOR_AMD64
emit(parent->special_objects[JIT_WORD_JUMP]);
}
+ /* Allocates memory */
void word_call(cell word) {
emit_with_literal(parent->special_objects[JIT_WORD_CALL], word);
}
tagged<object>(array_nth(elements, 0)).type_p(WORD_TYPE);
}
+/* Allocates memory (emit) */
void quotation_jit::emit_prolog(bool safepoint, bool stack_frame) {
if (safepoint)
emit(parent->special_objects[JIT_SAFEPOINT]);
emit(parent->special_objects[JIT_PROLOG]);
}
+/* Allocates memory (emit) */
void quotation_jit::emit_epilog(bool safepoint, bool stack_frame) {
if (safepoint)
emit(parent->special_objects[JIT_SAFEPOINT]);
}
}
-/* Allocates memory */
+/* Allocates memory (parameter(), literal(), emit_prolog, emit_with_literal)*/
void quotation_jit::iterate_quotation() {
bool safepoint = safepoint_p();
bool stack_frame = stack_frame_p();