PRIMITIVE(array);
PRIMITIVE(resize_array);
-
}
&& (bignum_equal_p_unsigned (x, y))));
}
-
enum bignum_comparison factorvm::bignum_compare(bignum * x, bignum * y)
{
return
: (bignum_compare_unsigned (x, y))));
}
-
/* allocates memory */
bignum *factorvm::bignum_add(bignum * x, bignum * y)
{
: (bignum_subtract_unsigned (x, y))))));
}
-
/* allocates memory */
bignum *factorvm::bignum_multiply(bignum * x, bignum * y)
{
return (bignum_multiply_unsigned (x, y, negative_p));
}
-
/* allocates memory */
void factorvm::bignum_divide(bignum * numerator, bignum * denominator, bignum * * quotient, bignum * * remainder)
{
}
}
-
/* allocates memory */
bignum *factorvm::bignum_quotient(bignum * numerator, bignum * denominator)
{
}
}
-
/* allocates memory */
bignum *factorvm::bignum_remainder(bignum * numerator, bignum * denominator)
{
}
}
-
#define FOO_TO_BIGNUM(name,type,utype) \
bignum * factorvm::name##_to_bignum(type n) \
{ \
}
}
-
#define DTB_WRITE_DIGIT(factor) \
{ \
significand *= (factor); \
}
}
-
#undef DTB_WRITE_DIGIT
/* Comparisons */
}
}
-
enum bignum_comparison factorvm::bignum_compare_unsigned(bignum * x, bignum * y)
{
bignum_length_type x_length = (BIGNUM_LENGTH (x));
return (bignum_comparison_equal);
}
-
/* Addition */
/* allocates memory */
}
}
-
/* Subtraction */
/* allocates memory */
}
}
-
/* Multiplication
Maximum value for product_low or product_high:
((R * R) + (R * (R - 2)) + (R - 1))
}
}
-
/* allocates memory */
bignum *factorvm::bignum_multiply_unsigned_small_factor(bignum * x, bignum_digit_type y,int negative_p)
{
return (bignum_trim (p));
}
-
void factorvm::bignum_destructive_add(bignum * bignum, bignum_digit_type n)
{
bignum_digit_type * scan = (BIGNUM_START_PTR (bignum));
}
}
-
void factorvm::bignum_destructive_scale_up(bignum * bignum, bignum_digit_type factor)
{
bignum_digit_type carry = 0;
#undef product_high
}
-
/* Division */
/* For help understanding this algorithm, see:
return;
}
-
void factorvm::bignum_divide_unsigned_normalized(bignum * u, bignum * v, bignum * q)
{
bignum_length_type u_length = (BIGNUM_LENGTH (u));
#undef qj
}
-
bignum_digit_type factorvm::bignum_divide_subtract(bignum_digit_type * v_start, bignum_digit_type * v_end, bignum_digit_type guess, bignum_digit_type * u_start)
{
bignum_digit_type * v_scan = v_start;
return (guess - 1);
}
-
/* allocates memory */
void factorvm::bignum_divide_unsigned_medium_denominator(bignum * numerator,bignum_digit_type denominator, bignum * * quotient, bignum * * remainder,int q_negative_p, int r_negative_p)
{
return;
}
-
void factorvm::bignum_destructive_normalization(bignum * source, bignum * target, int shift_left)
{
bignum_digit_type digit;
return;
}
-
void factorvm::bignum_destructive_unnormalization(bignum * bignum, int shift_right)
{
bignum_digit_type * start = (BIGNUM_START_PTR (bignum));
return;
}
-
/* This is a reduced version of the division algorithm, applied to the
case of dividing two bignum digits by one bignum digit. It is
assumed that the numerator, denominator are normalized. */
return (HD_CONS ((u[2]), (u[3])));
}
-
#undef BDD_STEP
#define BDDS_MULSUB(vn, un, carry_in) \
return (guess - 1);
}
-
#undef BDDS_MULSUB
#undef BDDS_ADD
return;
}
-
/* Given (denominator > 1), it is fairly easy to show that
(quotient_high < BIGNUM_RADIX_ROOT), after which it is easy to see
that all digits are < BIGNUM_RADIX. */
#undef quotient_high
}
-
/* allocates memory */
bignum * factorvm::bignum_remainder_unsigned_small_denominator(bignum * n, bignum_digit_type d, int negative_p)
{
return (bignum_digit_to_bignum (r, negative_p));
}
-
/* allocates memory */
bignum *factorvm::bignum_digit_to_bignum(bignum_digit_type digit, int negative_p)
{
}
}
-
/* allocates memory */
bignum *factorvm::allot_bignum(bignum_length_type length, int negative_p)
{
return (result);
}
-
/* allocates memory */
bignum * factorvm::allot_bignum_zeroed(bignum_length_type length, int negative_p)
{
return (result);
}
-
#define BIGNUM_REDUCE_LENGTH(source, length) \
source = reallot_array(source,length + 1)
return (bignum);
}
-
/* allocates memory */
bignum *factorvm::bignum_trim(bignum * bignum)
{
return (bignum);
}
-
/* Copying */
/* allocates memory */
return (result);
}
-
/* allocates memory */
bignum *factorvm::bignum_maybe_new_sign(bignum * x, int negative_p)
{
}
}
-
void factorvm::bignum_destructive_copy(bignum * source, bignum * target)
{
bignum_digit_type * scan_source = (BIGNUM_START_PTR (source));
return;
}
-
/*
* Added bitwise operations (and oddp).
*/
return bignum_subtract(BIGNUM_ONE(1), x);
}
-
/* allocates memory */
bignum *factorvm::bignum_arithmetic_shift(bignum * arg1, fixnum n)
{
return bignum_magnitude_ash(arg1, n);
}
-
#define AND_OP 0
#define IOR_OP 1
#define XOR_OP 2
);
}
-
/* allocates memory */
bignum *factorvm::bignum_bitwise_ior(bignum * arg1, bignum * arg2)
{
);
}
-
/* allocates memory */
bignum *factorvm::bignum_bitwise_xor(bignum * arg1, bignum * arg2)
{
);
}
-
/* allocates memory */
/* ash for the magnitude */
/* assume arg1 is a big number, n is a long */
return (bignum_trim (result));
}
-
/* allocates memory */
bignum *factorvm::bignum_pospos_bitwise_op(int op, bignum * arg1, bignum * arg2)
{
return bignum_trim(result);
}
-
/* allocates memory */
bignum *factorvm::bignum_posneg_bitwise_op(int op, bignum * arg1, bignum * arg2)
{
return bignum_trim(result);
}
-
/* allocates memory */
bignum *factorvm::bignum_negneg_bitwise_op(int op, bignum * arg1, bignum * arg2)
{
return bignum_trim(result);
}
-
void factorvm::bignum_negate_magnitude(bignum * arg)
{
bignum_digit_type *scan;
}
}
-
/* Allocates memory */
bignum *factorvm::bignum_integer_length(bignum * x)
{
return (bignum_trim (result));
}
-
/* Allocates memory */
int factorvm::bignum_logbitp(int shift, bignum * arg)
{
: bignum_unsigned_logbitp (shift,arg));
}
-
int factorvm::bignum_unsigned_logbitp(int shift, bignum * bignum)
{
bignum_length_type len = (BIGNUM_LENGTH (bignum));
return (digit & mask) ? 1 : 0;
}
-
/* Allocates memory */
bignum *factorvm::digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int, factorvm*), unsigned int radix, int negative_p)
{
}
}
-
}
/* BIGNUM_EXCEPTION is invoked to handle assertion violations. */
#define BIGNUM_EXCEPTION abort
-
#define BIGNUM_DIGIT_LENGTH (((sizeof (bignum_digit_type)) * CHAR_BIT) - 2)
#define BIGNUM_HALF_DIGIT_LENGTH (BIGNUM_DIGIT_LENGTH / 2)
#define BIGNUM_RADIX (bignum_digit_type)(((cell) 1) << BIGNUM_DIGIT_LENGTH)
namespace factor
{
-
VM_C_API void box_boolean(bool value, factorvm *vm);
VM_C_API bool to_boolean(cell value, factorvm *vm);
return array;
}
-
inline void factorvm::primitive_byte_array()
{
cell size = unbox_array_size();
PRIMITIVE(uninitialized_byte_array);
PRIMITIVE(resize_byte_array);
-
}
return (code_block *)frame->xt - 1;
}
-
cell factorvm::frame_type(stack_frame *frame)
{
return frame_code(frame)->type;
VM_ASM_API void save_callstack_bottom(stack_frame *callstack_bottom,factorvm *vm);
-
}
memset(&heap->free,0,sizeof(heap_free_list));
}
-
/* This malloc-style heap code is reasonably generic. Maybe in the future, it
will be used for the data heap too, if we ever get incremental
mark/sweep/compact GC. */
clear_free_list(heap);
}
-
void factorvm::add_to_free_list(heap *heap, free_heap_block *block)
{
if(block->size < free_list_count * block_size_increment)
}
}
-
/* Called after reading the code heap from the image file, and after code GC.
In the former case, we must add a large free block from compiling.base + size to
}
-
void factorvm::assert_free_block(free_heap_block *block)
{
if(block->status != B_FREE)
return NULL;
}
-
free_heap_block *factorvm::split_free_block(heap *heap, free_heap_block *block, cell size)
{
if(block->size != size )
return block;
}
-
/* Allocate a block of memory from the mark and sweep GC heap */
heap_block *factorvm::heap_allot(heap *heap, cell size)
{
return NULL;
}
-
/* Deallocates a block manually */
void factorvm::heap_free(heap *heap, heap_block *block)
{
add_to_free_list(heap,(free_heap_block *)block);
}
-
void factorvm::mark_block(heap_block *block)
{
/* If already marked, do nothing */
}
}
-
/* If in the middle of code GC, we have to grow the heap, data GC restarts from
scratch, so we have to unmark any marked blocks. */
void factorvm::unmark_marked(heap *heap)
}
}
-
/* After code GC, all referenced code blocks have status set to B_MARKED, so any
which are allocated and not marked can be reclaimed. */
void factorvm::free_unmarked(heap *heap, heap_iterator iter)
add_to_free_list(heap,(free_heap_block *)prev);
}
-
/* Compute total sum of sizes of free blocks, and size of largest free block */
void factorvm::heap_usage(heap *heap, cell *used, cell *total_free, cell *max_free)
{
}
}
-
/* The size of the heap, not including the last block if it's free */
cell factorvm::heap_size(heap *heap)
{
return heap->seg->size;
}
-
/* Compute where each block is going to go, after compaction */
cell factorvm::compute_heap_forwarding(heap *heap, unordered_map<heap_block *,char *> &forwarding)
{
return (cell)address - heap->seg->start;
}
-
void factorvm::compact_heap(heap *heap, unordered_map<heap_block *,char *> &forwarding)
{
heap_block *scan = first_block(heap);
if(word->pic_tail_def != F) jit_compile(word->pic_tail_def,relocate);
}
-
/* Apply a function to every code block */
void factorvm::iterate_code_heap(code_heap_iterator iter)
{
}
}
-
/* Copy literals referenced from all code blocks to newspace. Only for
aging and nursery collections */
void factorvm::copy_code_heap_roots()
iterate_code_heap(factor::copy_literal_references);
}
-
/* Update pointers to words referenced from all code blocks. Only after
defining a new word. */
void factorvm::update_code_heap_words()
iterate_code_heap(factor::update_word_references);
}
-
inline void factorvm::primitive_modify_code_heap()
{
gc_root<array> alist(dpop(),this);
PRIMITIVE_GETVM()->primitive_code_room();
}
-
code_block *factorvm::forward_xt(code_block *compiled)
{
return (code_block *)forwarding[compiled];
}
-
void factorvm::forward_frame_xt(stack_frame *frame)
{
cell offset = (cell)FRAME_RETURN_ADDRESS(frame) - (cell)frame_code(frame);
end_scan();
}
-
/* Set the XT fields now that the heap has been compacted */
void factorvm::fixup_object_xts()
{
end_scan();
}
-
/* Move all free space to the end of the code heap. This is not very efficient,
since it makes several passes over the code and data heaps, but we only ever
do this before saving a deployed image and exiting, so performaance is not
namespace factor
{
-
void factorvm::reset_datastack()
{
ds = ds_bot - sizeof(cell);
mov NV_TEMP_REG,ARG1
jmp *QUOT_XT_OFFSET(ARG0)
-
DEF(F_FASTCALL void,lazy_jit_compile,(CELL quot, void *vm)):
mov ARG1,NV_TEMP_REG /* stash vm ptr */
mov STACK_REG,ARG1 /* Save stack pointer */
add $STACK_PADDING,%rsp
jmp *%rax
-
DEF(void,get_sse_env,(void*)):
stmxcsr (%rdi)
ret
return z->end;
}
-
void factorvm::init_card_decks()
{
cell start = align(data->seg->start,deck_size);
return data;
}
-
data_heap *factorvm::grow_data_heap(data_heap *data, cell requested_bytes)
{
cell new_tenured_size = (data->tenured_size * 2) + requested_bytes;
new_tenured_size);
}
-
void factorvm::dealloc_data_heap(data_heap *data)
{
dealloc_segment(data->seg);
free(data);
}
-
void factorvm::clear_cards(cell from, cell to)
{
/* NOTE: reverse order due to heap layout. */
memset(first_card,0,last_card - first_card);
}
-
void factorvm::clear_decks(cell from, cell to)
{
/* NOTE: reverse order due to heap layout. */
memset(first_deck,0,last_deck - first_deck);
}
-
void factorvm::clear_allot_markers(cell from, cell to)
{
/* NOTE: reverse order due to heap layout. */
memset(first_card,invalid_allot_marker,last_card - first_card);
}
-
void factorvm::reset_generation(cell i)
{
zone *z = (i == data->nursery() ? &nursery : &data->generations[i]);
memset((void*)z->start,69,z->size);
}
-
/* After garbage collection, any generations which are now empty need to have
their allocation pointers and cards reset. */
void factorvm::reset_generations(cell from, cell to)
clear_allot_markers(from,to);
}
-
void factorvm::set_data_heap(data_heap *data_)
{
data = data_;
clear_allot_markers(data->nursery(),data->tenured());
}
-
void factorvm::init_data_heap(cell gens,cell young_size,cell aging_size,cell tenured_size,bool secure_gc_)
{
set_data_heap(alloc_data_heap(gens,young_size,aging_size,tenured_size));
init_data_gc();
}
-
/* Size of the object pointed to by a tagged pointer */
cell factorvm::object_size(cell tagged)
{
return untagged_object_size(untag<object>(tagged));
}
-
/* Size of the object pointed to by an untagged pointer */
cell factorvm::untagged_object_size(object *pointer)
{
return align8(unaligned_object_size(pointer));
}
-
/* Size of the data area of an object pointed to by an untagged pointer */
cell factorvm::unaligned_object_size(object *pointer)
{
}
}
-
inline void factorvm::primitive_size()
{
box_unsigned_cell(object_size(dpop()));
}
}
-
/* Push memory usage statistics in data heap */
inline void factorvm::primitive_data_room()
{
gc_off = true;
}
-
void factorvm::end_scan()
{
gc_off = false;
}
-
inline void factorvm::primitive_begin_scan()
{
begin_scan();
return tag_dynamic(obj);
}
-
/* Push object at heap scan cursor and advance; pushes f when done */
inline void factorvm::primitive_next_object()
{
end_scan();
}
-
namespace
{
return accum.words.elements.value();
}
-
}
namespace factor
{
-
/* generational copying GC divides memory into zones */
struct zone {
/* allocation pointer is 'here'; its offset is hardcoded in the
bool have_aging_p() { return gen_count > 2; }
};
-
static const cell max_gen_count = 3;
inline static bool in_zone(zone *z, object *pointer)
namespace factor
{
-
void factorvm::print_chars(string* str)
{
cell i;
putchar(string_nth(str,i));
}
-
void factorvm::print_word(word* word, cell nesting)
{
if(tagged<object>(word->vocabulary).type_p(STRING_TYPE))
}
}
-
void factorvm::print_factor_string(string* str)
{
putchar('"');
putchar('"');
}
-
void factorvm::print_array(array* array, cell nesting)
{
cell length = array_capacity(array);
print_string("...");
}
-
void factorvm::print_tuple(tuple *tuple, cell nesting)
{
tuple_layout *layout = untag<tuple_layout>(tuple->layout);
print_string("...");
}
-
void factorvm::print_nested_obj(cell obj, fixnum nesting)
{
if(nesting <= 0 && !full_output)
}
}
-
void factorvm::print_obj(cell obj)
{
print_nested_obj(obj,10);
}
-
void factorvm::print_objects(cell *start, cell *end)
{
for(; start <= end; start++)
}
}
-
void factorvm::print_datastack()
{
print_string("==== DATA STACK:\n");
print_objects((cell *)ds_bot,(cell *)ds);
}
-
void factorvm::print_retainstack()
{
print_string("==== RETAIN STACK:\n");
print_objects((cell *)rs_bot,(cell *)rs);
}
-
void factorvm::print_stack_frame(stack_frame *frame)
{
print_obj(frame_executing(frame));
iterate_callstack(top,bottom,factor::print_stack_frame);
}
-
void factorvm::dump_cell(cell x)
{
print_cell_hex_pad(x); print_string(": ");
nl();
}
-
void factorvm::dump_memory(cell from, cell to)
{
from = UNTAG(from);
dump_cell(from);
}
-
void factorvm::dump_zone(zone *z)
{
print_string("Start="); print_cell(z->start);
print_string(", here="); print_cell(z->here - z->start); nl();
}
-
void factorvm::dump_generations()
{
cell i;
nl();
}
-
void factorvm::dump_objects(cell type)
{
gc();
}
-
void factorvm::find_data_references_step(cell *scan)
{
if(look_for == *scan)
end_scan();
}
-
/* Dump all code blocks for debugging */
void factorvm::dump_code_heap()
{
print_cell(literal_size); print_string(" bytes of literal data\n");
}
-
void factorvm::factorbug()
{
if(fep_disabled)
}
}
-
inline void factorvm::primitive_die()
{
print_string("The die word was called by the library. Unless you called it yourself,\n");
namespace factor
{
-
PRIMITIVE(die);
}
tag_fixnum(error),arg1,arg2),callstack_top);
}
-
void factorvm::type_error(cell type, cell tagged)
{
general_error(ERROR_TYPE,tag_fixnum(type),tagged,NULL);
general_error(ERROR_NOT_IMPLEMENTED,F,F,NULL);
}
-
/* Test if 'fault' is in the guard page at the top or bottom (depending on
offset being 0 or -1) of area+area_size */
bool factorvm::in_page(cell fault, cell area, cell area_size, int offset)
unnest_stacks();
}
-
char *factorvm::factor_eval_string(char *string)
{
char *(*callback)(char *) = (char *(*)(char *))alien_offset(userenv[EVAL_CALLBACK_ENV]);
return 0;
}
-
VM_C_API void start_standalone_factor(int argc, vm_char **argv)
{
factorvm *newvm = new factorvm;
bignum_neg_one = h->bignum_neg_one;
}
-
-
void factorvm::load_data_heap(FILE *file, image_header *h, vm_parameters *p)
{
cell good_size = h->data_size + (1 << 20);
data_relocation_base = h->data_relocation_base;
}
-
-
void factorvm::load_code_heap(FILE *file, image_header *h, vm_parameters *p)
{
if(h->code_size > p->code_size)
build_free_list(&code,h->code_size);
}
-
/* Save the current image to disk */
bool factorvm::save_image(const vm_char *filename)
{
return ok;
}
-
inline void factorvm::primitive_save_image()
{
/* do a full GC to push everything into tenured space */
*handle = new_ptr;
}
-
void factorvm::fixup_word(word *word)
{
if(word->code)
code_fixup(&word->xt);
}
-
void factorvm::fixup_quotation(quotation *quot)
{
if(quot->code)
quot->xt = (void *)lazy_jit_compile;
}
-
void factorvm::fixup_alien(alien *d)
{
d->expired = T;
}
-
void factorvm::fixup_stack_frame(stack_frame *frame)
{
code_fixup(&frame->xt);
iterate_callstack_object(stack,factor::fixup_stack_frame);
}
-
/* Initialize an object in a newly-loaded image */
void factorvm::relocate_object(object *object)
{
}
}
-
/* Since the image might have been saved with a different base address than
where it is loaded, we need to fix up pointers in the image. */
void factorvm::relocate_data()
}
}
-
void factorvm::fixup_code_block(code_block *compiled)
{
/* relocate literal table data */
iterate_code_heap(factor::fixup_code_block);
}
-
/* Read an image file from disk, only done once during startup */
/* This function also initializes the data and code heaps */
void factorvm::load_image(vm_parameters *p)
userenv[IMAGE_ENV] = allot_alien(F,(cell)p->image_path);
}
-
}
namespace factor
{
-
void factorvm::init_inline_caching(int max_size)
{
max_pic_size = max_size;
return VM_PTR->inline_cache_miss(return_address);
}
-
inline void factorvm::primitive_reset_inline_cache_stats()
{
cold_call_to_ic_transitions = ic_to_pic_transitions = pic_to_mega_transitions = 0;
return (card*)(((cell)(a) >> card_bits) + cards_offset);
}
-
inline cell factorvm::card_to_addr(card *c)
{
return ((cell)c - cards_offset) << card_bits;
}
-
inline cell factorvm::card_offset(card *c)
{
return *(c - (cell)data->cards + (cell)data->allot_markers);
*ptr = ((cell)address & addr_card_mask);
}
-
//data_gc.hpp
inline bool factorvm::collecting_accumulation_gen_p()
{
}
}
-
// data_heap.hpp
/* Every object has a regular representation in the runtime, which makes GC
much simpler. Every slot of the object until binary_payload_start is a pointer
userenv[STDERR_ENV] = allot_alien(F,(cell)stderr);
}
-
void factorvm::io_error()
{
#ifndef WINCE
general_error(ERROR_IO,tag_fixnum(errno),F,NULL);
}
-
inline void factorvm::primitive_fopen()
{
gc_root<byte_array> mode(dpop(),this);
return KERN_SUCCESS;
}
-
/* The main function of the thread listening for exceptions. */
static void *
mach_exception_thread (void *arg)
exception thread directly. */
extern "C" boolean_t exc_server (mach_msg_header_t *request_msg, mach_msg_header_t *reply_msg);
-
/* http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/catch_exception_raise.html
These functions are defined in this file, and called by exc_server.
FIXME: What needs to be done when this code is put into a shared library? */
return x >> (WORD_SIZE - 1);
}
-
inline fixnum factorvm::branchless_max(fixnum x, fixnum y)
{
return (x - ((x - y) & sign_mask(x - y)));
}
-
inline fixnum factorvm::branchless_abs(fixnum x)
{
return (x ^ sign_mask(x)) - sign_mask(x);
}
-
inline void factorvm::primitive_fixnum_shift()
{
fixnum y = untag_fixnum(dpop());
return 0; /* can't happen */
}
-
inline void factorvm::primitive_fixnum_to_float()
{
drepl(allot_float(fixnum_to_float(dpeek())));
return thread;
}
-
pthread_key_t tlsKey = 0;
void init_platform_globals()
-
inline void factorvm::primitive_existsp()
{
struct stat sb;
}
-
void factorvm::memory_signal_handler(int signal, siginfo_t *siginfo, void *uap)
{
signal_fault_addr = (cell)siginfo->si_addr;
SIGNAL_VM_PTR()->memory_signal_handler(signal,siginfo,uap);
}
-
void factorvm::misc_signal_handler(int signal, siginfo_t *siginfo, void *uap)
{
signal_number = signal;
return ret;
}
-
void factorvm::windows_image_path(vm_char *full_path, vm_char *temp_path, unsigned int length)
{
snwprintf(temp_path, length-1, L"%s.image", full_path);
return safe_strdup(full_path);
}
-
inline void factorvm::primitive_existsp()
{
vm_char *path = untag_check<byte_array>(dpop())->data<vm_char>();
/* Difference between Jan 1 00:00:00 1601 and Jan 1 00:00:00 1970 */
#define EPOCH_OFFSET 0x019db1ded53e8000LL
-
inline static void init_signals() {}
inline static void early_init() {}
namespace factor
{
-
void factorvm::init_profiler()
{
profiling_p = false;
}
-
/* Allocates memory */
code_block *factorvm::compile_profiling_stub(cell word_)
{
return jit.to_code_block();
}
-
/* Allocates memory */
void factorvm::set_profiling(bool profiling)
{
iterate_code_heap(factor::relocate_code_block);
}
-
inline void factorvm::primitive_profiling()
{
set_profiling(to_boolean(dpop()));
namespace factor
{
-
inline void factorvm::primitive_getenv()
{
fixnum e = untag_fixnum(dpeek());
}
}
-
void factorvm::set_string_nth_fast(string *str, cell index, cell ch)
{
str->data()[index] = ch;
}
-
void factorvm::set_string_nth_slow(string *str_, cell index, cell ch)
{
gc_root<string> str(str_,this);
aux->data<u16>()[index] = ((ch >> 7) ^ 1);
}
-
/* allocates memory */
void factorvm::set_string_nth(string *str, cell index, cell ch)
{
set_string_nth_slow(str,index,ch);
}
-
/* Allocates memory */
string *factorvm::allot_string_internal(cell capacity)
{
return str;
}
-
/* Allocates memory */
void factorvm::fill_string(string *str_, cell start, cell capacity, cell fill)
{
}
}
-
/* Allocates memory */
string *factorvm::allot_string(cell capacity, cell fill)
{
return str.untagged();
}
-
inline void factorvm::primitive_string()
{
cell initial = to_cell(dpop());
&& capacity <= string_capacity(str);
}
-
string* factorvm::reallot_string(string *str_, cell capacity)
{
gc_root<string> str(str_,this);
}
}
-
inline void factorvm::primitive_resize_string()
{
string* str = untag_check<string>(dpop());
return ptr;
}
-
/* We don't use printf directly, because format directives are not portable.
Instead we define the common cases here. */
void nl()
fputs(str,stdout);
}
-
void print_cell(cell x)
{
printf(CELL_FORMAT,x);
inline void write_barrier(object *obj);
inline void allot_barrier(object *address);
-
//data_gc
void init_data_gc();
object *copy_untagged_object_impl(object *pointer, cell size);
void compact_code_heap();
inline void check_code_pointer(cell ptr);
-
//image
void init_objects(image_header *h);
void load_data_heap(FILE *file, image_header *h, vm_parameters *p);
template<typename T> void iterate_callstack(cell top, cell bottom, T &iterator);
inline void do_slots(cell obj, void (* iter)(cell *,factorvm*));
-
//alien
char *pinned_alien_offset(cell obj);
cell allot_alien(cell delegate_, cell displacement);
void print_vm_data();
};
-
#ifndef FACTOR_REENTRANT
#define FACTOR_SINGLE_THREADED_SINGLETON
#endif
using namespace factor;
-
static const cell card_size = (1<<card_bits);
static const cell addr_card_mask = (card_size-1);
-
typedef u8 card_deck;
static const cell deck_bits = (card_bits + 10);