removed a bunch of superflous blank lines
parent
46bab62689
commit
e566656e46
|
@ -13,5 +13,4 @@ inline cell array_nth(array *array, cell slot)
|
|||
PRIMITIVE(array);
|
||||
PRIMITIVE(resize_array);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,6 @@ int factorvm::bignum_equal_p(bignum * x, bignum * y)
|
|||
&& (bignum_equal_p_unsigned (x, y))));
|
||||
}
|
||||
|
||||
|
||||
enum bignum_comparison factorvm::bignum_compare(bignum * x, bignum * y)
|
||||
{
|
||||
return
|
||||
|
@ -96,7 +95,6 @@ enum bignum_comparison factorvm::bignum_compare(bignum * x, bignum * y)
|
|||
: (bignum_compare_unsigned (x, y))));
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
bignum *factorvm::bignum_add(bignum * x, bignum * y)
|
||||
{
|
||||
|
@ -133,7 +131,6 @@ bignum *factorvm::bignum_subtract(bignum * x, bignum * y)
|
|||
: (bignum_subtract_unsigned (x, y))))));
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
bignum *factorvm::bignum_multiply(bignum * x, bignum * y)
|
||||
{
|
||||
|
@ -166,7 +163,6 @@ 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)
|
||||
{
|
||||
|
@ -238,7 +234,6 @@ void factorvm::bignum_divide(bignum * numerator, bignum * denominator, bignum *
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
bignum *factorvm::bignum_quotient(bignum * numerator, bignum * denominator)
|
||||
{
|
||||
|
@ -291,7 +286,6 @@ bignum *factorvm::bignum_quotient(bignum * numerator, bignum * denominator)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
bignum *factorvm::bignum_remainder(bignum * numerator, bignum * denominator)
|
||||
{
|
||||
|
@ -336,7 +330,6 @@ bignum *factorvm::bignum_remainder(bignum * numerator, bignum * denominator)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#define FOO_TO_BIGNUM(name,type,utype) \
|
||||
bignum * factorvm::name##_to_bignum(type n) \
|
||||
{ \
|
||||
|
@ -408,7 +401,6 @@ double factorvm::bignum_to_double(bignum * bignum)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#define DTB_WRITE_DIGIT(factor) \
|
||||
{ \
|
||||
significand *= (factor); \
|
||||
|
@ -451,7 +443,6 @@ bignum *factorvm::double_to_bignum(double x)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#undef DTB_WRITE_DIGIT
|
||||
|
||||
/* Comparisons */
|
||||
|
@ -473,7 +464,6 @@ int factorvm::bignum_equal_p_unsigned(bignum * x, bignum * y)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
enum bignum_comparison factorvm::bignum_compare_unsigned(bignum * x, bignum * y)
|
||||
{
|
||||
bignum_length_type x_length = (BIGNUM_LENGTH (x));
|
||||
|
@ -499,7 +489,6 @@ enum bignum_comparison factorvm::bignum_compare_unsigned(bignum * x, bignum * y)
|
|||
return (bignum_comparison_equal);
|
||||
}
|
||||
|
||||
|
||||
/* Addition */
|
||||
|
||||
/* allocates memory */
|
||||
|
@ -567,7 +556,6 @@ bignum *factorvm::bignum_add_unsigned(bignum * x, bignum * y, int negative_p)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Subtraction */
|
||||
|
||||
/* allocates memory */
|
||||
|
@ -642,7 +630,6 @@ bignum *factorvm::bignum_subtract_unsigned(bignum * x, bignum * y)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Multiplication
|
||||
Maximum value for product_low or product_high:
|
||||
((R * R) + (R * (R - 2)) + (R - 1))
|
||||
|
@ -720,7 +707,6 @@ bignum *factorvm::bignum_multiply_unsigned(bignum * x, bignum * y, int negative_
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
bignum *factorvm::bignum_multiply_unsigned_small_factor(bignum * x, bignum_digit_type y,int negative_p)
|
||||
{
|
||||
|
@ -736,7 +722,6 @@ bignum *factorvm::bignum_multiply_unsigned_small_factor(bignum * x, bignum_digit
|
|||
return (bignum_trim (p));
|
||||
}
|
||||
|
||||
|
||||
void factorvm::bignum_destructive_add(bignum * bignum, bignum_digit_type n)
|
||||
{
|
||||
bignum_digit_type * scan = (BIGNUM_START_PTR (bignum));
|
||||
|
@ -760,7 +745,6 @@ void factorvm::bignum_destructive_add(bignum * bignum, bignum_digit_type n)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void factorvm::bignum_destructive_scale_up(bignum * bignum, bignum_digit_type factor)
|
||||
{
|
||||
bignum_digit_type carry = 0;
|
||||
|
@ -790,7 +774,6 @@ void factorvm::bignum_destructive_scale_up(bignum * bignum, bignum_digit_type fa
|
|||
#undef product_high
|
||||
}
|
||||
|
||||
|
||||
/* Division */
|
||||
|
||||
/* For help understanding this algorithm, see:
|
||||
|
@ -856,7 +839,6 @@ void factorvm::bignum_divide_unsigned_large_denominator(bignum * numerator, bign
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
void factorvm::bignum_divide_unsigned_normalized(bignum * u, bignum * v, bignum * q)
|
||||
{
|
||||
bignum_length_type u_length = (BIGNUM_LENGTH (u));
|
||||
|
@ -931,7 +913,6 @@ void factorvm::bignum_divide_unsigned_normalized(bignum * u, bignum * v, bignum
|
|||
#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;
|
||||
|
@ -1007,7 +988,6 @@ bignum_digit_type factorvm::bignum_divide_subtract(bignum_digit_type * 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)
|
||||
{
|
||||
|
@ -1067,7 +1047,6 @@ void factorvm::bignum_divide_unsigned_medium_denominator(bignum * numerator,bign
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
void factorvm::bignum_destructive_normalization(bignum * source, bignum * target, int shift_left)
|
||||
{
|
||||
bignum_digit_type digit;
|
||||
|
@ -1091,7 +1070,6 @@ void factorvm::bignum_destructive_normalization(bignum * source, bignum * target
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
void factorvm::bignum_destructive_unnormalization(bignum * bignum, int shift_right)
|
||||
{
|
||||
bignum_digit_type * start = (BIGNUM_START_PTR (bignum));
|
||||
|
@ -1110,7 +1088,6 @@ void factorvm::bignum_destructive_unnormalization(bignum * bignum, int shift_rig
|
|||
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. */
|
||||
|
@ -1175,7 +1152,6 @@ bignum_digit_type factorvm::bignum_digit_divide(bignum_digit_type uh, bignum_dig
|
|||
return (HD_CONS ((u[2]), (u[3])));
|
||||
}
|
||||
|
||||
|
||||
#undef BDD_STEP
|
||||
|
||||
#define BDDS_MULSUB(vn, un, carry_in) \
|
||||
|
@ -1239,7 +1215,6 @@ bignum_digit_type factorvm::bignum_digit_divide_subtract(bignum_digit_type v1, b
|
|||
return (guess - 1);
|
||||
}
|
||||
|
||||
|
||||
#undef BDDS_MULSUB
|
||||
#undef BDDS_ADD
|
||||
|
||||
|
@ -1263,7 +1238,6 @@ void factorvm::bignum_divide_unsigned_small_denominator(bignum * numerator, bign
|
|||
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. */
|
||||
|
@ -1290,7 +1264,6 @@ bignum_digit_type factorvm::bignum_destructive_scale_down(bignum * bignum, bignu
|
|||
#undef quotient_high
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
bignum * factorvm::bignum_remainder_unsigned_small_denominator(bignum * n, bignum_digit_type d, int negative_p)
|
||||
{
|
||||
|
@ -1310,7 +1283,6 @@ bignum * factorvm::bignum_remainder_unsigned_small_denominator(bignum * n, bignu
|
|||
return (bignum_digit_to_bignum (r, negative_p));
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
bignum *factorvm::bignum_digit_to_bignum(bignum_digit_type digit, int negative_p)
|
||||
{
|
||||
|
@ -1324,7 +1296,6 @@ 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)
|
||||
{
|
||||
|
@ -1334,7 +1305,6 @@ 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)
|
||||
{
|
||||
|
@ -1346,7 +1316,6 @@ 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)
|
||||
|
||||
|
@ -1363,7 +1332,6 @@ bignum *factorvm::bignum_shorten_length(bignum * bignum, bignum_length_type leng
|
|||
return (bignum);
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
bignum *factorvm::bignum_trim(bignum * bignum)
|
||||
{
|
||||
|
@ -1382,7 +1350,6 @@ bignum *factorvm::bignum_trim(bignum * bignum)
|
|||
return (bignum);
|
||||
}
|
||||
|
||||
|
||||
/* Copying */
|
||||
|
||||
/* allocates memory */
|
||||
|
@ -1395,7 +1362,6 @@ bignum *factorvm::bignum_new_sign(bignum * x, int negative_p)
|
|||
return (result);
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
bignum *factorvm::bignum_maybe_new_sign(bignum * x, int negative_p)
|
||||
{
|
||||
|
@ -1410,7 +1376,6 @@ 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));
|
||||
|
@ -1422,7 +1387,6 @@ void factorvm::bignum_destructive_copy(bignum * source, bignum * target)
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Added bitwise operations (and oddp).
|
||||
*/
|
||||
|
@ -1433,7 +1397,6 @@ bignum *factorvm::bignum_bitwise_not(bignum * x)
|
|||
return bignum_subtract(BIGNUM_ONE(1), x);
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
bignum *factorvm::bignum_arithmetic_shift(bignum * arg1, fixnum n)
|
||||
{
|
||||
|
@ -1443,7 +1406,6 @@ 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
|
||||
|
@ -1462,7 +1424,6 @@ bignum *factorvm::bignum_bitwise_and(bignum * arg1, bignum * arg2)
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
bignum *factorvm::bignum_bitwise_ior(bignum * arg1, bignum * arg2)
|
||||
{
|
||||
|
@ -1477,7 +1438,6 @@ bignum *factorvm::bignum_bitwise_ior(bignum * arg1, bignum * arg2)
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
bignum *factorvm::bignum_bitwise_xor(bignum * arg1, bignum * arg2)
|
||||
{
|
||||
|
@ -1492,7 +1452,6 @@ 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 */
|
||||
|
@ -1556,7 +1515,6 @@ bignum *factorvm::bignum_magnitude_ash(bignum * arg1, fixnum n)
|
|||
return (bignum_trim (result));
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
bignum *factorvm::bignum_pospos_bitwise_op(int op, bignum * arg1, bignum * arg2)
|
||||
{
|
||||
|
@ -1591,7 +1549,6 @@ 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)
|
||||
{
|
||||
|
@ -1644,7 +1601,6 @@ 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)
|
||||
{
|
||||
|
@ -1705,7 +1661,6 @@ 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;
|
||||
|
@ -1733,7 +1688,6 @@ void factorvm::bignum_negate_magnitude(bignum * arg)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Allocates memory */
|
||||
bignum *factorvm::bignum_integer_length(bignum * x)
|
||||
{
|
||||
|
@ -1755,7 +1709,6 @@ bignum *factorvm::bignum_integer_length(bignum * x)
|
|||
return (bignum_trim (result));
|
||||
}
|
||||
|
||||
|
||||
/* Allocates memory */
|
||||
int factorvm::bignum_logbitp(int shift, bignum * arg)
|
||||
{
|
||||
|
@ -1764,7 +1717,6 @@ 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));
|
||||
|
@ -1777,7 +1729,6 @@ int factorvm::bignum_unsigned_logbitp(int shift, bignum * 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)
|
||||
{
|
||||
|
@ -1815,5 +1766,4 @@ bignum *factorvm::digit_stream_to_bignum(unsigned int n_digits, unsigned int (*p
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -54,7 +54,6 @@ typedef fixnum bignum_length_type;
|
|||
/* 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)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
namespace factor
|
||||
{
|
||||
|
||||
|
||||
VM_C_API void box_boolean(bool value, factorvm *vm);
|
||||
VM_C_API bool to_boolean(cell value, factorvm *vm);
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ byte_array *factorvm::allot_byte_array(cell size)
|
|||
return array;
|
||||
}
|
||||
|
||||
|
||||
inline void factorvm::primitive_byte_array()
|
||||
{
|
||||
cell size = unbox_array_size();
|
||||
|
|
|
@ -5,5 +5,4 @@ PRIMITIVE(byte_array);
|
|||
PRIMITIVE(uninitialized_byte_array);
|
||||
PRIMITIVE(resize_byte_array);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -89,7 +89,6 @@ code_block *factorvm::frame_code(stack_frame *frame)
|
|||
return (code_block *)frame->xt - 1;
|
||||
}
|
||||
|
||||
|
||||
cell factorvm::frame_type(stack_frame *frame)
|
||||
{
|
||||
return frame_code(frame)->type;
|
||||
|
|
|
@ -16,5 +16,4 @@ PRIMITIVE(set_innermost_stack_frame_quot);
|
|||
VM_ASM_API void save_callstack_bottom(stack_frame *callstack_bottom,factorvm *vm);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ void factorvm::clear_free_list(heap *heap)
|
|||
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. */
|
||||
|
@ -21,7 +20,6 @@ void factorvm::new_heap(heap *heap, cell size)
|
|||
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)
|
||||
|
@ -37,7 +35,6 @@ void factorvm::add_to_free_list(heap *heap, free_heap_block *block)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* 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
|
||||
|
@ -94,7 +91,6 @@ void factorvm::build_free_list(heap *heap, cell size)
|
|||
|
||||
}
|
||||
|
||||
|
||||
void factorvm::assert_free_block(free_heap_block *block)
|
||||
{
|
||||
if(block->status != B_FREE)
|
||||
|
@ -142,7 +138,6 @@ free_heap_block *factorvm::find_free_block(heap *heap, cell size)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
free_heap_block *factorvm::split_free_block(heap *heap, free_heap_block *block, cell size)
|
||||
{
|
||||
if(block->size != size )
|
||||
|
@ -159,7 +154,6 @@ free_heap_block *factorvm::split_free_block(heap *heap, free_heap_block *block,
|
|||
return block;
|
||||
}
|
||||
|
||||
|
||||
/* Allocate a block of memory from the mark and sweep GC heap */
|
||||
heap_block *factorvm::heap_allot(heap *heap, cell size)
|
||||
{
|
||||
|
@ -177,7 +171,6 @@ heap_block *factorvm::heap_allot(heap *heap, cell size)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Deallocates a block manually */
|
||||
void factorvm::heap_free(heap *heap, heap_block *block)
|
||||
{
|
||||
|
@ -185,7 +178,6 @@ 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 */
|
||||
|
@ -202,7 +194,6 @@ void factorvm::mark_block(heap_block *block)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* 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)
|
||||
|
@ -218,7 +209,6 @@ 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)
|
||||
|
@ -268,7 +258,6 @@ 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)
|
||||
{
|
||||
|
@ -298,7 +287,6 @@ void factorvm::heap_usage(heap *heap, cell *used, cell *total_free, cell *max_fr
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* The size of the heap, not including the last block if it's free */
|
||||
cell factorvm::heap_size(heap *heap)
|
||||
{
|
||||
|
@ -315,7 +303,6 @@ 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)
|
||||
{
|
||||
|
@ -338,7 +325,6 @@ cell factorvm::compute_heap_forwarding(heap *heap, unordered_map<heap_block *,ch
|
|||
return (cell)address - heap->seg->start;
|
||||
}
|
||||
|
||||
|
||||
void factorvm::compact_heap(heap *heap, unordered_map<heap_block *,char *> &forwarding)
|
||||
{
|
||||
heap_block *scan = first_block(heap);
|
||||
|
|
|
@ -28,7 +28,6 @@ void factorvm::jit_compile_word(cell word_, cell def_, bool relocate)
|
|||
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)
|
||||
{
|
||||
|
@ -42,7 +41,6 @@ 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()
|
||||
|
@ -50,7 +48,6 @@ 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()
|
||||
|
@ -58,7 +55,6 @@ 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);
|
||||
|
@ -131,13 +127,11 @@ PRIMITIVE(code_room)
|
|||
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);
|
||||
|
@ -193,7 +187,6 @@ void factorvm::forward_object_xts()
|
|||
end_scan();
|
||||
}
|
||||
|
||||
|
||||
/* Set the XT fields now that the heap has been compacted */
|
||||
void factorvm::fixup_object_xts()
|
||||
{
|
||||
|
@ -223,7 +216,6 @@ 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
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace factor
|
||||
{
|
||||
|
||||
|
||||
void factorvm::reset_datastack()
|
||||
{
|
||||
ds = ds_bot - sizeof(cell);
|
||||
|
|
|
@ -93,7 +93,6 @@ DEF(F_FASTCALL void,throw_impl,(CELL quot, F_STACK_FRAME *rewind_to, void *vm)):
|
|||
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 */
|
||||
|
|
|
@ -89,7 +89,6 @@ DEF(void,primitive_inline_cache_miss_tail,(void *vm)):
|
|||
add $STACK_PADDING,%rsp
|
||||
jmp *%rax
|
||||
|
||||
|
||||
DEF(void,get_sse_env,(void*)):
|
||||
stmxcsr (%rdi)
|
||||
ret
|
||||
|
|
|
@ -11,7 +11,6 @@ cell factorvm::init_zone(zone *z, cell size, cell start)
|
|||
return z->end;
|
||||
}
|
||||
|
||||
|
||||
void factorvm::init_card_decks()
|
||||
{
|
||||
cell start = align(data->seg->start,deck_size);
|
||||
|
@ -84,7 +83,6 @@ data_heap *factorvm::alloc_data_heap(cell gens, cell young_size,cell aging_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;
|
||||
|
@ -95,7 +93,6 @@ data_heap *factorvm::grow_data_heap(data_heap *data, cell requested_bytes)
|
|||
new_tenured_size);
|
||||
}
|
||||
|
||||
|
||||
void factorvm::dealloc_data_heap(data_heap *data)
|
||||
{
|
||||
dealloc_segment(data->seg);
|
||||
|
@ -107,7 +104,6 @@ void factorvm::dealloc_data_heap(data_heap *data)
|
|||
free(data);
|
||||
}
|
||||
|
||||
|
||||
void factorvm::clear_cards(cell from, cell to)
|
||||
{
|
||||
/* NOTE: reverse order due to heap layout. */
|
||||
|
@ -116,7 +112,6 @@ void factorvm::clear_cards(cell from, cell to)
|
|||
memset(first_card,0,last_card - first_card);
|
||||
}
|
||||
|
||||
|
||||
void factorvm::clear_decks(cell from, cell to)
|
||||
{
|
||||
/* NOTE: reverse order due to heap layout. */
|
||||
|
@ -125,7 +120,6 @@ void factorvm::clear_decks(cell from, cell to)
|
|||
memset(first_deck,0,last_deck - first_deck);
|
||||
}
|
||||
|
||||
|
||||
void factorvm::clear_allot_markers(cell from, cell to)
|
||||
{
|
||||
/* NOTE: reverse order due to heap layout. */
|
||||
|
@ -134,7 +128,6 @@ void factorvm::clear_allot_markers(cell from, cell to)
|
|||
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]);
|
||||
|
@ -144,7 +137,6 @@ void factorvm::reset_generation(cell 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)
|
||||
|
@ -158,7 +150,6 @@ void factorvm::reset_generations(cell from, cell to)
|
|||
clear_allot_markers(from,to);
|
||||
}
|
||||
|
||||
|
||||
void factorvm::set_data_heap(data_heap *data_)
|
||||
{
|
||||
data = data_;
|
||||
|
@ -169,7 +160,6 @@ void factorvm::set_data_heap(data_heap *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));
|
||||
|
@ -177,7 +167,6 @@ void factorvm::init_data_heap(cell gens,cell young_size,cell aging_size,cell ten
|
|||
init_data_gc();
|
||||
}
|
||||
|
||||
|
||||
/* Size of the object pointed to by a tagged pointer */
|
||||
cell factorvm::object_size(cell tagged)
|
||||
{
|
||||
|
@ -187,14 +176,12 @@ 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)
|
||||
{
|
||||
|
@ -230,7 +217,6 @@ cell factorvm::unaligned_object_size(object *pointer)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
inline void factorvm::primitive_size()
|
||||
{
|
||||
box_unsigned_cell(object_size(dpop()));
|
||||
|
@ -278,7 +264,6 @@ cell factorvm::binary_payload_start(object *pointer)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Push memory usage statistics in data heap */
|
||||
inline void factorvm::primitive_data_room()
|
||||
{
|
||||
|
@ -311,13 +296,11 @@ void factorvm::begin_scan()
|
|||
gc_off = true;
|
||||
}
|
||||
|
||||
|
||||
void factorvm::end_scan()
|
||||
{
|
||||
gc_off = false;
|
||||
}
|
||||
|
||||
|
||||
inline void factorvm::primitive_begin_scan()
|
||||
{
|
||||
begin_scan();
|
||||
|
@ -341,7 +324,6 @@ cell factorvm::next_object()
|
|||
return tag_dynamic(obj);
|
||||
}
|
||||
|
||||
|
||||
/* Push object at heap scan cursor and advance; pushes f when done */
|
||||
inline void factorvm::primitive_next_object()
|
||||
{
|
||||
|
@ -373,7 +355,6 @@ template<typename TYPE> void factorvm::each_object(TYPE &functor)
|
|||
end_scan();
|
||||
}
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
@ -401,5 +382,4 @@ cell factorvm::find_all_words()
|
|||
return accum.words.elements.value();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
namespace factor
|
||||
{
|
||||
|
||||
|
||||
/* generational copying GC divides memory into zones */
|
||||
struct zone {
|
||||
/* allocation pointer is 'here'; its offset is hardcoded in the
|
||||
|
@ -45,7 +44,6 @@ struct data_heap {
|
|||
bool have_aging_p() { return gen_count > 2; }
|
||||
};
|
||||
|
||||
|
||||
static const cell max_gen_count = 3;
|
||||
|
||||
inline static bool in_zone(zone *z, object *pointer)
|
||||
|
|
20
vm/debug.cpp
20
vm/debug.cpp
|
@ -3,7 +3,6 @@
|
|||
namespace factor
|
||||
{
|
||||
|
||||
|
||||
void factorvm::print_chars(string* str)
|
||||
{
|
||||
cell i;
|
||||
|
@ -11,7 +10,6 @@ void factorvm::print_chars(string* str)
|
|||
putchar(string_nth(str,i));
|
||||
}
|
||||
|
||||
|
||||
void factorvm::print_word(word* word, cell nesting)
|
||||
{
|
||||
if(tagged<object>(word->vocabulary).type_p(STRING_TYPE))
|
||||
|
@ -30,7 +28,6 @@ void factorvm::print_word(word* word, cell nesting)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void factorvm::print_factor_string(string* str)
|
||||
{
|
||||
putchar('"');
|
||||
|
@ -38,7 +35,6 @@ void factorvm::print_factor_string(string* str)
|
|||
putchar('"');
|
||||
}
|
||||
|
||||
|
||||
void factorvm::print_array(array* array, cell nesting)
|
||||
{
|
||||
cell length = array_capacity(array);
|
||||
|
@ -63,7 +59,6 @@ void factorvm::print_array(array* array, cell nesting)
|
|||
print_string("...");
|
||||
}
|
||||
|
||||
|
||||
void factorvm::print_tuple(tuple *tuple, cell nesting)
|
||||
{
|
||||
tuple_layout *layout = untag<tuple_layout>(tuple->layout);
|
||||
|
@ -93,7 +88,6 @@ void factorvm::print_tuple(tuple *tuple, cell nesting)
|
|||
print_string("...");
|
||||
}
|
||||
|
||||
|
||||
void factorvm::print_nested_obj(cell obj, fixnum nesting)
|
||||
{
|
||||
if(nesting <= 0 && !full_output)
|
||||
|
@ -144,13 +138,11 @@ void factorvm::print_nested_obj(cell obj, fixnum nesting)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void factorvm::print_obj(cell obj)
|
||||
{
|
||||
print_nested_obj(obj,10);
|
||||
}
|
||||
|
||||
|
||||
void factorvm::print_objects(cell *start, cell *end)
|
||||
{
|
||||
for(; start <= end; start++)
|
||||
|
@ -160,21 +152,18 @@ void factorvm::print_objects(cell *start, cell *end)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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));
|
||||
|
@ -205,7 +194,6 @@ void factorvm::print_callstack()
|
|||
iterate_callstack(top,bottom,factor::print_stack_frame);
|
||||
}
|
||||
|
||||
|
||||
void factorvm::dump_cell(cell x)
|
||||
{
|
||||
print_cell_hex_pad(x); print_string(": ");
|
||||
|
@ -214,7 +202,6 @@ void factorvm::dump_cell(cell x)
|
|||
nl();
|
||||
}
|
||||
|
||||
|
||||
void factorvm::dump_memory(cell from, cell to)
|
||||
{
|
||||
from = UNTAG(from);
|
||||
|
@ -223,7 +210,6 @@ void factorvm::dump_memory(cell from, cell to)
|
|||
dump_cell(from);
|
||||
}
|
||||
|
||||
|
||||
void factorvm::dump_zone(zone *z)
|
||||
{
|
||||
print_string("Start="); print_cell(z->start);
|
||||
|
@ -231,7 +217,6 @@ void factorvm::dump_zone(zone *z)
|
|||
print_string(", here="); print_cell(z->here - z->start); nl();
|
||||
}
|
||||
|
||||
|
||||
void factorvm::dump_generations()
|
||||
{
|
||||
cell i;
|
||||
|
@ -258,7 +243,6 @@ void factorvm::dump_generations()
|
|||
nl();
|
||||
}
|
||||
|
||||
|
||||
void factorvm::dump_objects(cell type)
|
||||
{
|
||||
gc();
|
||||
|
@ -280,7 +264,6 @@ void factorvm::dump_objects(cell type)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void factorvm::find_data_references_step(cell *scan)
|
||||
{
|
||||
if(look_for == *scan)
|
||||
|
@ -309,7 +292,6 @@ void factorvm::find_data_references(cell look_for_)
|
|||
end_scan();
|
||||
}
|
||||
|
||||
|
||||
/* Dump all code blocks for debugging */
|
||||
void factorvm::dump_code_heap()
|
||||
{
|
||||
|
@ -351,7 +333,6 @@ void factorvm::dump_code_heap()
|
|||
print_cell(literal_size); print_string(" bytes of literal data\n");
|
||||
}
|
||||
|
||||
|
||||
void factorvm::factorbug()
|
||||
{
|
||||
if(fep_disabled)
|
||||
|
@ -496,7 +477,6 @@ void factorvm::factorbug()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
inline void factorvm::primitive_die()
|
||||
{
|
||||
print_string("The die word was called by the library. Unless you called it yourself,\n");
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
namespace factor
|
||||
{
|
||||
|
||||
|
||||
PRIMITIVE(die);
|
||||
|
||||
}
|
||||
|
|
|
@ -76,7 +76,6 @@ void factorvm::general_error(vm_error_type error, cell arg1, cell arg2, stack_fr
|
|||
tag_fixnum(error),arg1,arg2),callstack_top);
|
||||
}
|
||||
|
||||
|
||||
void factorvm::type_error(cell type, cell tagged)
|
||||
{
|
||||
general_error(ERROR_TYPE,tag_fixnum(type),tagged,NULL);
|
||||
|
@ -87,7 +86,6 @@ void factorvm::not_implemented_error()
|
|||
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)
|
||||
|
|
|
@ -183,7 +183,6 @@ void factorvm::start_factor(vm_parameters *p)
|
|||
unnest_stacks();
|
||||
}
|
||||
|
||||
|
||||
char *factorvm::factor_eval_string(char *string)
|
||||
{
|
||||
char *(*callback)(char *) = (char *(*)(char *))alien_offset(userenv[EVAL_CALLBACK_ENV]);
|
||||
|
@ -231,7 +230,6 @@ void* start_standalone_factor_thread(void *arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
VM_C_API void start_standalone_factor(int argc, vm_char **argv)
|
||||
{
|
||||
factorvm *newvm = new factorvm;
|
||||
|
|
15
vm/image.cpp
15
vm/image.cpp
|
@ -14,8 +14,6 @@ void factorvm::init_objects(image_header *h)
|
|||
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);
|
||||
|
@ -49,8 +47,6 @@ void factorvm::load_data_heap(FILE *file, image_header *h, vm_parameters *p)
|
|||
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)
|
||||
|
@ -76,7 +72,6 @@ void factorvm::load_code_heap(FILE *file, image_header *h, vm_parameters *p)
|
|||
build_free_list(&code,h->code_size);
|
||||
}
|
||||
|
||||
|
||||
/* Save the current image to disk */
|
||||
bool factorvm::save_image(const vm_char *filename)
|
||||
{
|
||||
|
@ -123,7 +118,6 @@ 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 */
|
||||
|
@ -191,7 +185,6 @@ template <typename TYPE> void factorvm::code_fixup(TYPE **handle)
|
|||
*handle = new_ptr;
|
||||
}
|
||||
|
||||
|
||||
void factorvm::fixup_word(word *word)
|
||||
{
|
||||
if(word->code)
|
||||
|
@ -201,7 +194,6 @@ void factorvm::fixup_word(word *word)
|
|||
code_fixup(&word->xt);
|
||||
}
|
||||
|
||||
|
||||
void factorvm::fixup_quotation(quotation *quot)
|
||||
{
|
||||
if(quot->code)
|
||||
|
@ -213,13 +205,11 @@ void factorvm::fixup_quotation(quotation *quot)
|
|||
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);
|
||||
|
@ -236,7 +226,6 @@ void factorvm::fixup_callstack_object(callstack *stack)
|
|||
iterate_callstack_object(stack,factor::fixup_stack_frame);
|
||||
}
|
||||
|
||||
|
||||
/* Initialize an object in a newly-loaded image */
|
||||
void factorvm::relocate_object(object *object)
|
||||
{
|
||||
|
@ -281,7 +270,6 @@ 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()
|
||||
|
@ -309,7 +297,6 @@ void factorvm::relocate_data()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void factorvm::fixup_code_block(code_block *compiled)
|
||||
{
|
||||
/* relocate literal table data */
|
||||
|
@ -329,7 +316,6 @@ void factorvm::relocate_code()
|
|||
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)
|
||||
|
@ -366,5 +352,4 @@ void factorvm::load_image(vm_parameters *p)
|
|||
userenv[IMAGE_ENV] = allot_alien(F,(cell)p->image_path);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace factor
|
||||
{
|
||||
|
||||
|
||||
void factorvm::init_inline_caching(int max_size)
|
||||
{
|
||||
max_pic_size = max_size;
|
||||
|
@ -251,7 +250,6 @@ VM_C_API void *inline_cache_miss(cell return_address, factorvm *myvm)
|
|||
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;
|
||||
|
|
|
@ -18,13 +18,11 @@ inline card *factorvm::addr_to_card(cell a)
|
|||
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);
|
||||
|
@ -66,7 +64,6 @@ inline void factorvm::allot_barrier(object *address)
|
|||
*ptr = ((cell)address & addr_card_mask);
|
||||
}
|
||||
|
||||
|
||||
//data_gc.hpp
|
||||
inline bool factorvm::collecting_accumulation_gen_p()
|
||||
{
|
||||
|
@ -372,7 +369,6 @@ template<typename TYPE> void factorvm::iterate_callstack(cell top, cell bottom,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// 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
|
||||
|
|
|
@ -21,7 +21,6 @@ void factorvm::init_c_io()
|
|||
userenv[STDERR_ENV] = allot_alien(F,(cell)stderr);
|
||||
}
|
||||
|
||||
|
||||
void factorvm::io_error()
|
||||
{
|
||||
#ifndef WINCE
|
||||
|
@ -32,7 +31,6 @@ void factorvm::io_error()
|
|||
general_error(ERROR_IO,tag_fixnum(errno),F,NULL);
|
||||
}
|
||||
|
||||
|
||||
inline void factorvm::primitive_fopen()
|
||||
{
|
||||
gc_root<byte_array> mode(dpop(),this);
|
||||
|
|
|
@ -150,7 +150,6 @@ catch_exception_raise (mach_port_t exception_port,
|
|||
return KERN_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* The main function of the thread listening for exceptions. */
|
||||
static void *
|
||||
mach_exception_thread (void *arg)
|
||||
|
|
|
@ -38,7 +38,6 @@ Modified for Factor by Slava Pestov */
|
|||
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? */
|
||||
|
|
|
@ -71,19 +71,16 @@ inline fixnum factorvm::sign_mask(fixnum x)
|
|||
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());
|
||||
|
@ -397,7 +394,6 @@ cell factorvm::unbox_array_size()
|
|||
return 0; /* can't happen */
|
||||
}
|
||||
|
||||
|
||||
inline void factorvm::primitive_fixnum_to_float()
|
||||
{
|
||||
drepl(allot_float(fixnum_to_float(dpeek())));
|
||||
|
|
|
@ -17,7 +17,6 @@ THREADHANDLE start_thread(void *(*start_routine)(void *),void *args)
|
|||
return thread;
|
||||
}
|
||||
|
||||
|
||||
pthread_key_t tlsKey = 0;
|
||||
|
||||
void init_platform_globals()
|
||||
|
@ -78,7 +77,6 @@ void factorvm::ffi_dlclose(dll *dll)
|
|||
|
||||
|
||||
|
||||
|
||||
inline void factorvm::primitive_existsp()
|
||||
{
|
||||
struct stat sb;
|
||||
|
@ -148,7 +146,6 @@ stack_frame *factorvm::uap_stack_pointer(void *uap)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void factorvm::memory_signal_handler(int signal, siginfo_t *siginfo, void *uap)
|
||||
{
|
||||
signal_fault_addr = (cell)siginfo->si_addr;
|
||||
|
@ -161,7 +158,6 @@ void memory_signal_handler(int signal, siginfo_t *siginfo, void *uap)
|
|||
SIGNAL_VM_PTR()->memory_signal_handler(signal,siginfo,uap);
|
||||
}
|
||||
|
||||
|
||||
void factorvm::misc_signal_handler(int signal, siginfo_t *siginfo, void *uap)
|
||||
{
|
||||
signal_number = signal;
|
||||
|
|
|
@ -56,7 +56,6 @@ bool factorvm::windows_stat(vm_char *path)
|
|||
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);
|
||||
|
@ -91,7 +90,6 @@ const vm_char *factorvm::vm_executable_path()
|
|||
return safe_strdup(full_path);
|
||||
}
|
||||
|
||||
|
||||
inline void factorvm::primitive_existsp()
|
||||
{
|
||||
vm_char *path = untag_check<byte_array>(dpop())->data<vm_char>();
|
||||
|
|
|
@ -41,7 +41,6 @@ typedef wchar_t 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() {}
|
||||
|
||||
|
|
|
@ -3,13 +3,11 @@
|
|||
namespace factor
|
||||
{
|
||||
|
||||
|
||||
void factorvm::init_profiler()
|
||||
{
|
||||
profiling_p = false;
|
||||
}
|
||||
|
||||
|
||||
/* Allocates memory */
|
||||
code_block *factorvm::compile_profiling_stub(cell word_)
|
||||
{
|
||||
|
@ -21,7 +19,6 @@ code_block *factorvm::compile_profiling_stub(cell word_)
|
|||
return jit.to_code_block();
|
||||
}
|
||||
|
||||
|
||||
/* Allocates memory */
|
||||
void factorvm::set_profiling(bool profiling)
|
||||
{
|
||||
|
@ -50,7 +47,6 @@ void factorvm::set_profiling(bool profiling)
|
|||
iterate_code_heap(factor::relocate_code_block);
|
||||
}
|
||||
|
||||
|
||||
inline void factorvm::primitive_profiling()
|
||||
{
|
||||
set_profiling(to_boolean(dpop()));
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
namespace factor
|
||||
{
|
||||
|
||||
|
||||
inline void factorvm::primitive_getenv()
|
||||
{
|
||||
fixnum e = untag_fixnum(dpeek());
|
||||
|
|
|
@ -22,13 +22,11 @@ cell factorvm::string_nth(string* str, cell index)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
@ -56,7 +54,6 @@ void factorvm::set_string_nth_slow(string *str_, cell index, cell ch)
|
|||
aux->data<u16>()[index] = ((ch >> 7) ^ 1);
|
||||
}
|
||||
|
||||
|
||||
/* allocates memory */
|
||||
void factorvm::set_string_nth(string *str, cell index, cell ch)
|
||||
{
|
||||
|
@ -66,7 +63,6 @@ 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)
|
||||
{
|
||||
|
@ -79,7 +75,6 @@ string *factorvm::allot_string_internal(cell capacity)
|
|||
return str;
|
||||
}
|
||||
|
||||
|
||||
/* Allocates memory */
|
||||
void factorvm::fill_string(string *str_, cell start, cell capacity, cell fill)
|
||||
{
|
||||
|
@ -96,7 +91,6 @@ void factorvm::fill_string(string *str_, cell start, cell capacity, cell fill)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Allocates memory */
|
||||
string *factorvm::allot_string(cell capacity, cell fill)
|
||||
{
|
||||
|
@ -105,7 +99,6 @@ string *factorvm::allot_string(cell capacity, cell fill)
|
|||
return str.untagged();
|
||||
}
|
||||
|
||||
|
||||
inline void factorvm::primitive_string()
|
||||
{
|
||||
cell initial = to_cell(dpop());
|
||||
|
@ -125,7 +118,6 @@ bool factorvm::reallot_string_in_place_p(string *str, cell capacity)
|
|||
&& capacity <= string_capacity(str);
|
||||
}
|
||||
|
||||
|
||||
string* factorvm::reallot_string(string *str_, cell capacity)
|
||||
{
|
||||
gc_root<string> str(str_,this);
|
||||
|
@ -168,7 +160,6 @@ string* factorvm::reallot_string(string *str_, cell capacity)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
inline void factorvm::primitive_resize_string()
|
||||
{
|
||||
string* str = untag_check<string>(dpop());
|
||||
|
|
|
@ -18,7 +18,6 @@ vm_char *safe_strdup(const vm_char *str)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
/* We don't use printf directly, because format directives are not portable.
|
||||
Instead we define the common cases here. */
|
||||
void nl()
|
||||
|
@ -31,7 +30,6 @@ void print_string(const char *str)
|
|||
fputs(str,stdout);
|
||||
}
|
||||
|
||||
|
||||
void print_cell(cell x)
|
||||
{
|
||||
printf(CELL_FORMAT,x);
|
||||
|
|
|
@ -166,7 +166,6 @@ struct factorvm : factorvmdata {
|
|||
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);
|
||||
|
@ -454,7 +453,6 @@ struct factorvm : factorvmdata {
|
|||
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);
|
||||
|
@ -498,7 +496,6 @@ struct factorvm : factorvmdata {
|
|||
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);
|
||||
|
@ -614,7 +611,6 @@ struct factorvm : factorvmdata {
|
|||
void print_vm_data();
|
||||
};
|
||||
|
||||
|
||||
#ifndef FACTOR_REENTRANT
|
||||
#define FACTOR_SINGLE_THREADED_SINGLETON
|
||||
#endif
|
||||
|
|
|
@ -2,4 +2,3 @@
|
|||
|
||||
using namespace factor;
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ static const cell card_bits = 8;
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue