Use C++ namespaces
parent
8e17e0a01e
commit
edecac508e
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* gets the address of an object representing a C pointer, with the
|
/* gets the address of an object representing a C pointer, with the
|
||||||
intention of storing the pointer across code which may potentially GC. */
|
intention of storing the pointer across code which may potentially GC. */
|
||||||
char *pinned_alien_offset(CELL object)
|
char *pinned_alien_offset(CELL object)
|
||||||
|
@ -222,3 +225,5 @@ VM_C_API void box_medium_struct(CELL x1, CELL x2, CELL x3, CELL x4, CELL size)
|
||||||
data[3] = x4;
|
data[3] = x4;
|
||||||
box_value_struct(data,size);
|
box_value_struct(data,size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
CELL allot_alien(CELL delegate, CELL displacement);
|
CELL allot_alien(CELL delegate, CELL displacement);
|
||||||
|
|
||||||
PRIMITIVE(displaced_alien);
|
PRIMITIVE(displaced_alien);
|
||||||
|
@ -42,3 +45,5 @@ VM_C_API void to_value_struct(CELL src, void *dest, CELL size);
|
||||||
VM_C_API void box_value_struct(void *src, CELL size);
|
VM_C_API void box_value_struct(void *src, CELL size);
|
||||||
VM_C_API void box_small_struct(CELL x, CELL y, CELL size);
|
VM_C_API void box_small_struct(CELL x, CELL y, CELL size);
|
||||||
VM_C_API void box_medium_struct(CELL x1, CELL x2, CELL x3, CELL x4, CELL size);
|
VM_C_API void box_medium_struct(CELL x1, CELL x2, CELL x3, CELL x4, CELL size);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* make a new array with an initial element */
|
/* make a new array with an initial element */
|
||||||
F_ARRAY *allot_array(CELL capacity, CELL fill_)
|
F_ARRAY *allot_array(CELL capacity, CELL fill_)
|
||||||
{
|
{
|
||||||
|
@ -80,3 +83,5 @@ void growable_array::trim()
|
||||||
{
|
{
|
||||||
array = reallot_array(array.untagged(),count);
|
array = reallot_array(array.untagged(),count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
inline static CELL array_nth(F_ARRAY *array, CELL slot)
|
inline static CELL array_nth(F_ARRAY *array, CELL slot)
|
||||||
{
|
{
|
||||||
#ifdef FACTOR_DEBUG
|
#ifdef FACTOR_DEBUG
|
||||||
|
@ -36,3 +39,5 @@ struct growable_array {
|
||||||
void add(CELL elt);
|
void add(CELL elt);
|
||||||
void trim();
|
void trim();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,9 @@ MIT in each case. */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Exports */
|
/* Exports */
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1841,3 +1844,5 @@ digit_stream_to_bignum(unsigned int n_digits,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* :tabSize=2:indentSize=2:noTabs=true:
|
/* :tabSize=2:indentSize=2:noTabs=true:
|
||||||
|
|
||||||
Copyright (C) 1989-1992 Massachusetts Institute of Technology
|
Copyright (C) 1989-1992 Massachusetts Institute of Technology
|
||||||
|
@ -124,3 +127,5 @@ F_BIGNUM * digit_stream_to_bignum(unsigned int n_digits,
|
||||||
unsigned int (*producer)(unsigned int),
|
unsigned int (*producer)(unsigned int),
|
||||||
unsigned int radix,
|
unsigned int radix,
|
||||||
int negative_p);
|
int negative_p);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -33,6 +33,9 @@ Technology nor of any adaptation thereof in any advertising,
|
||||||
promotional, or sales literature without prior written consent from
|
promotional, or sales literature without prior written consent from
|
||||||
MIT in each case. */
|
MIT in each case. */
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Internal Interface to Bignum Code */
|
/* Internal Interface to Bignum Code */
|
||||||
#undef BIGNUM_ZERO_P
|
#undef BIGNUM_ZERO_P
|
||||||
#undef BIGNUM_NEGATIVE_P
|
#undef BIGNUM_NEGATIVE_P
|
||||||
|
@ -98,3 +101,5 @@ typedef F_FIXNUM bignum_length_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* not BIGNUM_DISABLE_ASSERTION_CHECKS */
|
#endif /* not BIGNUM_DISABLE_ASSERTION_CHECKS */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
VM_C_API void box_boolean(bool value)
|
VM_C_API void box_boolean(bool value)
|
||||||
{
|
{
|
||||||
dpush(value ? T : F);
|
dpush(value ? T : F);
|
||||||
|
@ -9,3 +12,5 @@ VM_C_API bool to_boolean(CELL value)
|
||||||
{
|
{
|
||||||
return value != F;
|
return value != F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
inline static CELL tag_boolean(CELL untagged)
|
inline static CELL tag_boolean(CELL untagged)
|
||||||
{
|
{
|
||||||
return (untagged ? T : F);
|
return (untagged ? T : F);
|
||||||
|
@ -5,3 +8,5 @@ inline static CELL tag_boolean(CELL untagged)
|
||||||
|
|
||||||
VM_C_API void box_boolean(bool value);
|
VM_C_API void box_boolean(bool value);
|
||||||
VM_C_API bool to_boolean(CELL value);
|
VM_C_API bool to_boolean(CELL value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
F_BYTE_ARRAY *allot_byte_array(CELL size)
|
F_BYTE_ARRAY *allot_byte_array(CELL size)
|
||||||
{
|
{
|
||||||
F_BYTE_ARRAY *array = allot_array_internal<F_BYTE_ARRAY>(size);
|
F_BYTE_ARRAY *array = allot_array_internal<F_BYTE_ARRAY>(size);
|
||||||
|
@ -57,3 +60,5 @@ void growable_byte_array::trim()
|
||||||
{
|
{
|
||||||
array = reallot_array(array.untagged(),count);
|
array = reallot_array(array.untagged(),count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
F_BYTE_ARRAY *allot_byte_array(CELL size);
|
F_BYTE_ARRAY *allot_byte_array(CELL size);
|
||||||
|
|
||||||
PRIMITIVE(byte_array);
|
PRIMITIVE(byte_array);
|
||||||
|
@ -16,3 +19,5 @@ struct growable_byte_array {
|
||||||
|
|
||||||
void trim();
|
void trim();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
static void check_frame(F_STACK_FRAME *frame)
|
static void check_frame(F_STACK_FRAME *frame)
|
||||||
{
|
{
|
||||||
#ifdef FACTOR_DEBUG
|
#ifdef FACTOR_DEBUG
|
||||||
|
@ -223,3 +226,5 @@ VM_ASM_API void save_callstack_bottom(F_STACK_FRAME *callstack_bottom)
|
||||||
{
|
{
|
||||||
stack_chain->callstack_bottom = callstack_bottom;
|
stack_chain->callstack_bottom = callstack_bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
inline static CELL callstack_size(CELL size)
|
inline static CELL callstack_size(CELL size)
|
||||||
{
|
{
|
||||||
return sizeof(F_CALLSTACK) + size;
|
return sizeof(F_CALLSTACK) + size;
|
||||||
|
@ -24,3 +27,5 @@ PRIMITIVE(innermost_stack_frame_scan);
|
||||||
PRIMITIVE(set_innermost_stack_frame_quot);
|
PRIMITIVE(set_innermost_stack_frame_quot);
|
||||||
|
|
||||||
VM_ASM_API void save_callstack_bottom(F_STACK_FRAME *callstack_bottom);
|
VM_ASM_API void save_callstack_bottom(F_STACK_FRAME *callstack_bottom);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
void flush_icache_for(F_CODE_BLOCK *block)
|
void flush_icache_for(F_CODE_BLOCK *block)
|
||||||
{
|
{
|
||||||
flush_icache((CELL)block,block->block.size);
|
flush_icache((CELL)block,block->block.size);
|
||||||
|
@ -321,7 +324,10 @@ void *get_rel_symbol(F_ARRAY *literals, CELL index)
|
||||||
if(sym)
|
if(sym)
|
||||||
return sym;
|
return sym;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
printf("%s\n",name);
|
||||||
return (void *)undefined_symbol;
|
return (void *)undefined_symbol;
|
||||||
|
}
|
||||||
case ARRAY_TYPE:
|
case ARRAY_TYPE:
|
||||||
CELL i;
|
CELL i;
|
||||||
F_ARRAY *names = untag<F_ARRAY>(symbol);
|
F_ARRAY *names = untag<F_ARRAY>(symbol);
|
||||||
|
@ -485,3 +491,5 @@ F_CODE_BLOCK *add_code_block(
|
||||||
|
|
||||||
return compiled;
|
return compiled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/* arg is a primitive number */
|
/* arg is a primitive number */
|
||||||
RT_PRIMITIVE,
|
RT_PRIMITIVE,
|
||||||
|
@ -85,3 +88,5 @@ inline static bool stack_traces_p(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
F_CODE_BLOCK *add_code_block(CELL type, CELL code, CELL labels, CELL relocation, CELL literals);
|
F_CODE_BLOCK *add_code_block(CELL type, CELL code, CELL labels, CELL relocation, CELL literals);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
static void clear_free_list(F_HEAP *heap)
|
static void clear_free_list(F_HEAP *heap)
|
||||||
{
|
{
|
||||||
memset(&heap->free,0,sizeof(F_HEAP_FREE_LIST));
|
memset(&heap->free,0,sizeof(F_HEAP_FREE_LIST));
|
||||||
|
@ -334,3 +337,5 @@ void compact_heap(F_HEAP *heap)
|
||||||
scan = next;
|
scan = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define FREE_LIST_COUNT 16
|
#define FREE_LIST_COUNT 16
|
||||||
#define BLOCK_SIZE_INCREMENT 32
|
#define BLOCK_SIZE_INCREMENT 32
|
||||||
|
|
||||||
|
@ -43,3 +46,5 @@ inline static F_BLOCK *last_block(F_HEAP *heap)
|
||||||
{
|
{
|
||||||
return (F_BLOCK *)heap->segment->end;
|
return (F_BLOCK *)heap->segment->end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
F_HEAP code_heap;
|
F_HEAP code_heap;
|
||||||
|
|
||||||
/* Allocate a code heap during startup */
|
/* Allocate a code heap during startup */
|
||||||
|
@ -220,3 +223,5 @@ void compact_code_heap(void)
|
||||||
the end */
|
the end */
|
||||||
build_free_list(&code_heap,size);
|
build_free_list(&code_heap,size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* compiled code */
|
/* compiled code */
|
||||||
extern F_HEAP code_heap;
|
extern F_HEAP code_heap;
|
||||||
|
|
||||||
|
@ -25,3 +28,5 @@ inline static void check_code_pointer(CELL pointer)
|
||||||
assert(pointer >= code_heap.segment->start && pointer < code_heap.segment->end);
|
assert(pointer >= code_heap.segment->start && pointer < code_heap.segment->end);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
F_CONTEXT *stack_chain;
|
factor::F_CONTEXT *stack_chain;
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
CELL ds_size, rs_size;
|
CELL ds_size, rs_size;
|
||||||
F_CONTEXT *unused_contexts;
|
F_CONTEXT *unused_contexts;
|
||||||
|
|
||||||
|
@ -184,3 +188,5 @@ PRIMITIVE(check_datastack)
|
||||||
dpush(T);
|
dpush(T);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Assembly code makes assumptions about the layout of this struct:
|
/* Assembly code makes assumptions about the layout of this struct:
|
||||||
- callstack_top field is 0
|
- callstack_top field is 0
|
||||||
- callstack_bottom field is 1
|
- callstack_bottom field is 1
|
||||||
|
@ -33,8 +36,6 @@ struct F_CONTEXT {
|
||||||
F_CONTEXT *next;
|
F_CONTEXT *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern F_CONTEXT *stack_chain;
|
|
||||||
|
|
||||||
extern CELL ds_size, rs_size;
|
extern CELL ds_size, rs_size;
|
||||||
|
|
||||||
#define ds_bot (stack_chain->datastack_region->start)
|
#define ds_bot (stack_chain->datastack_region->start)
|
||||||
|
@ -59,3 +60,7 @@ PRIMITIVE(check_datastack);
|
||||||
VM_C_API void save_stacks(void);
|
VM_C_API void save_stacks(void);
|
||||||
VM_C_API void nest_stacks(void);
|
VM_C_API void nest_stacks(void);
|
||||||
VM_C_API void unnest_stacks(void);
|
VM_C_API void unnest_stacks(void);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
VM_C_API factor::F_CONTEXT *stack_chain;
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define FACTOR_CPU_STRING "arm"
|
#define FACTOR_CPU_STRING "arm"
|
||||||
|
|
||||||
register CELL ds asm("r5");
|
register CELL ds asm("r5");
|
||||||
|
@ -11,3 +14,5 @@ void c_to_factor(CELL quot);
|
||||||
void set_callstack(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *memcpy);
|
void set_callstack(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *memcpy);
|
||||||
void throw_impl(CELL quot, F_STACK_FRAME *rewind);
|
void throw_impl(CELL quot, F_STACK_FRAME *rewind);
|
||||||
void lazy_jit_compile(CELL quot);
|
void lazy_jit_compile(CELL quot);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define FACTOR_CPU_STRING "ppc"
|
#define FACTOR_CPU_STRING "ppc"
|
||||||
#define VM_ASM_API
|
#define VM_ASM_API
|
||||||
|
|
||||||
|
@ -10,3 +13,5 @@ void set_callstack(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *me
|
||||||
void throw_impl(CELL quot, F_STACK_FRAME *rewind);
|
void throw_impl(CELL quot, F_STACK_FRAME *rewind);
|
||||||
void lazy_jit_compile(CELL quot);
|
void lazy_jit_compile(CELL quot);
|
||||||
void flush_icache(CELL start, CELL len);
|
void flush_icache(CELL start, CELL len);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define FACTOR_CPU_STRING "x86.32"
|
#define FACTOR_CPU_STRING "x86.32"
|
||||||
|
|
||||||
register CELL ds asm("esi");
|
register CELL ds asm("esi");
|
||||||
register CELL rs asm("edi");
|
register CELL rs asm("edi");
|
||||||
|
|
||||||
#define VM_ASM_API extern "C" __attribute__ ((regparm (2)))
|
#define VM_ASM_API extern "C" __attribute__ ((regparm (2)))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define FACTOR_CPU_STRING "x86.64"
|
#define FACTOR_CPU_STRING "x86.64"
|
||||||
|
|
||||||
register CELL ds asm("r14");
|
register CELL ds asm("r14");
|
||||||
register CELL rs asm("r15");
|
register CELL rs asm("r15");
|
||||||
|
|
||||||
#define VM_ASM_API extern "C"
|
#define VM_ASM_API extern "C"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define FRAME_RETURN_ADDRESS(frame) *(XT *)(frame_successor(frame) + 1)
|
#define FRAME_RETURN_ADDRESS(frame) *(XT *)(frame_successor(frame) + 1)
|
||||||
|
|
||||||
inline static void flush_icache(CELL start, CELL len) {}
|
inline static void flush_icache(CELL start, CELL len) {}
|
||||||
|
@ -37,3 +40,5 @@ VM_C_API void set_callstack(F_STACK_FRAME *to,
|
||||||
F_STACK_FRAME *from,
|
F_STACK_FRAME *from,
|
||||||
CELL length,
|
CELL length,
|
||||||
void *(*memcpy)(void*,const void*, size_t));
|
void *(*memcpy)(void*,const void*, size_t));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* used during garbage collection only */
|
/* used during garbage collection only */
|
||||||
F_ZONE *newspace;
|
F_ZONE *newspace;
|
||||||
bool performing_gc;
|
bool performing_gc;
|
||||||
|
@ -682,3 +685,5 @@ VM_C_API void minor_gc(void)
|
||||||
{
|
{
|
||||||
garbage_collection(NURSERY,false,0);
|
garbage_collection(NURSERY,false,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* statistics */
|
/* statistics */
|
||||||
struct F_GC_STATS {
|
struct F_GC_STATS {
|
||||||
CELL collections;
|
CELL collections;
|
||||||
|
@ -133,3 +136,5 @@ inline static void check_tagged_pointer(CELL tagged)
|
||||||
|
|
||||||
VM_C_API void minor_gc(void);
|
VM_C_API void minor_gc(void);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
factor::F_ZONE nursery;
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Set by the -securegc command line argument */
|
/* Set by the -securegc command line argument */
|
||||||
bool secure_gc;
|
bool secure_gc;
|
||||||
|
|
||||||
|
@ -11,8 +16,6 @@ bool gc_off;
|
||||||
|
|
||||||
F_DATA_HEAP *data_heap;
|
F_DATA_HEAP *data_heap;
|
||||||
|
|
||||||
F_ZONE nursery;
|
|
||||||
|
|
||||||
CELL init_zone(F_ZONE *z, CELL size, CELL start)
|
CELL init_zone(F_ZONE *z, CELL size, CELL start)
|
||||||
{
|
{
|
||||||
z->size = size;
|
z->size = size;
|
||||||
|
@ -375,3 +378,5 @@ CELL find_all_words(void)
|
||||||
words.trim();
|
words.trim();
|
||||||
return words.array.value();
|
return words.array.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Set by the -securegc command line argument */
|
/* Set by the -securegc command line argument */
|
||||||
extern bool secure_gc;
|
extern bool secure_gc;
|
||||||
|
|
||||||
|
@ -46,9 +49,6 @@ extern F_DATA_HEAP *data_heap;
|
||||||
#define MIN_GEN_COUNT 1
|
#define MIN_GEN_COUNT 1
|
||||||
#define MAX_GEN_COUNT 3
|
#define MAX_GEN_COUNT 3
|
||||||
|
|
||||||
/* new objects are allocated here */
|
|
||||||
extern F_ZONE nursery;
|
|
||||||
|
|
||||||
inline static bool in_zone(F_ZONE *z, F_OBJECT *pointer)
|
inline static bool in_zone(F_ZONE *z, F_OBJECT *pointer)
|
||||||
{
|
{
|
||||||
return (CELL)pointer >= z->start && (CELL)pointer < z->end;
|
return (CELL)pointer >= z->start && (CELL)pointer < z->end;
|
||||||
|
@ -128,3 +128,7 @@ inline static void do_slots(CELL obj, void (* iter)(CELL *))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* new objects are allocated here */
|
||||||
|
VM_C_API factor::F_ZONE nursery;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
static bool fep_disabled;
|
static bool fep_disabled;
|
||||||
static bool full_output;
|
static bool full_output;
|
||||||
|
|
||||||
|
@ -472,3 +475,5 @@ PRIMITIVE(die)
|
||||||
print_string("you have triggered a bug in Factor. Please report.\n");
|
print_string("you have triggered a bug in Factor. Please report.\n");
|
||||||
factorbug();
|
factorbug();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
void print_obj(CELL obj);
|
void print_obj(CELL obj);
|
||||||
void print_nested_obj(CELL obj, F_FIXNUM nesting);
|
void print_nested_obj(CELL obj, F_FIXNUM nesting);
|
||||||
void dump_generations(void);
|
void dump_generations(void);
|
||||||
|
@ -5,3 +8,5 @@ void factorbug(void);
|
||||||
void dump_zone(F_ZONE *z);
|
void dump_zone(F_ZONE *z);
|
||||||
|
|
||||||
PRIMITIVE(die);
|
PRIMITIVE(die);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
CELL megamorphic_cache_hits;
|
CELL megamorphic_cache_hits;
|
||||||
CELL megamorphic_cache_misses;
|
CELL megamorphic_cache_misses;
|
||||||
|
|
||||||
|
@ -205,3 +208,5 @@ void quotation_jit::emit_mega_cache_lookup(CELL methods_, F_FIXNUM index, CELL c
|
||||||
emit(userenv[JIT_EPILOG]);
|
emit(userenv[JIT_EPILOG]);
|
||||||
emit(userenv[JIT_EXECUTE_JUMP]);
|
emit(userenv[JIT_EXECUTE_JUMP]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
CELL lookup_method(CELL object, CELL methods);
|
CELL lookup_method(CELL object, CELL methods);
|
||||||
PRIMITIVE(lookup_method);
|
PRIMITIVE(lookup_method);
|
||||||
|
|
||||||
|
@ -11,3 +14,5 @@ PRIMITIVE(dispatch_stats);
|
||||||
void jit_emit_class_lookup(jit *jit, F_FIXNUM index, CELL type);
|
void jit_emit_class_lookup(jit *jit, F_FIXNUM index, CELL type);
|
||||||
|
|
||||||
void jit_emit_mega_cache_lookup(jit *jit, CELL methods, F_FIXNUM index, CELL cache);
|
void jit_emit_mega_cache_lookup(jit *jit, CELL methods, F_FIXNUM index, CELL cache);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Global variables used to pass fault handler state from signal handler to
|
/* Global variables used to pass fault handler state from signal handler to
|
||||||
user-space */
|
user-space */
|
||||||
CELL signal_number;
|
CELL signal_number;
|
||||||
|
@ -147,3 +150,5 @@ void misc_signal_handler_impl(void)
|
||||||
{
|
{
|
||||||
signal_error(signal_number,signal_callstack_top);
|
signal_error(signal_number,signal_callstack_top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Runtime errors */
|
/* Runtime errors */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
@ -44,3 +47,5 @@ extern F_STACK_FRAME *signal_callstack_top;
|
||||||
|
|
||||||
void memory_signal_handler_impl(void);
|
void memory_signal_handler_impl(void);
|
||||||
void misc_signal_handler_impl(void);
|
void misc_signal_handler_impl(void);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
VM_C_API void default_parameters(F_PARAMETERS *p)
|
VM_C_API void default_parameters(F_PARAMETERS *p)
|
||||||
{
|
{
|
||||||
p->image_path = NULL;
|
p->image_path = NULL;
|
||||||
|
@ -209,3 +212,5 @@ VM_C_API void factor_sleep(long us)
|
||||||
void (*callback)(long) = (void (*)(long))alien_offset(userenv[SLEEP_CALLBACK_ENV]);
|
void (*callback)(long) = (void (*)(long))alien_offset(userenv[SLEEP_CALLBACK_ENV]);
|
||||||
callback(us);
|
callback(us);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
VM_C_API void default_parameters(F_PARAMETERS *p);
|
VM_C_API void default_parameters(F_PARAMETERS *p);
|
||||||
VM_C_API void init_parameters_from_args(F_PARAMETERS *p, int argc, F_CHAR **argv);
|
VM_C_API void init_parameters_from_args(F_PARAMETERS *p, int argc, F_CHAR **argv);
|
||||||
VM_C_API void init_factor(F_PARAMETERS *p);
|
VM_C_API void init_factor(F_PARAMETERS *p);
|
||||||
|
@ -9,3 +12,5 @@ VM_C_API char *factor_eval_string(char *string);
|
||||||
VM_C_API void factor_eval_free(char *result);
|
VM_C_API void factor_eval_free(char *result);
|
||||||
VM_C_API void factor_yield(void);
|
VM_C_API void factor_yield(void);
|
||||||
VM_C_API void factor_sleep(long ms);
|
VM_C_API void factor_sleep(long ms);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Some functions for converting floating point numbers to binary
|
/* Some functions for converting floating point numbers to binary
|
||||||
representations and vice versa */
|
representations and vice versa */
|
||||||
|
|
||||||
|
@ -38,3 +41,5 @@ inline static float bits_float(u32 y)
|
||||||
b.y = y;
|
b.y = y;
|
||||||
return b.x;
|
return b.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
template<typename T> CELL array_capacity(T *array)
|
template<typename T> CELL array_capacity(T *array)
|
||||||
{
|
{
|
||||||
#ifdef FACTOR_DEBUG
|
#ifdef FACTOR_DEBUG
|
||||||
|
@ -52,3 +55,5 @@ template <typename T> T *reallot_array(T *array_, CELL capacity)
|
||||||
return new_array;
|
return new_array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Certain special objects in the image are known to the runtime */
|
/* Certain special objects in the image are known to the runtime */
|
||||||
static void init_objects(F_IMAGE_HEADER *h)
|
static void init_objects(F_IMAGE_HEADER *h)
|
||||||
{
|
{
|
||||||
|
@ -337,3 +340,5 @@ void load_image(F_PARAMETERS *p)
|
||||||
/* Store image path name */
|
/* Store image path name */
|
||||||
userenv[IMAGE_ENV] = allot_alien(F,(CELL)p->image_path);
|
userenv[IMAGE_ENV] = allot_alien(F,(CELL)p->image_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define IMAGE_MAGIC 0x0f0e0d0c
|
#define IMAGE_MAGIC 0x0f0e0d0c
|
||||||
#define IMAGE_VERSION 4
|
#define IMAGE_VERSION 4
|
||||||
|
|
||||||
|
@ -43,3 +46,5 @@ bool save_image(const F_CHAR *file);
|
||||||
|
|
||||||
PRIMITIVE(save_image);
|
PRIMITIVE(save_image);
|
||||||
PRIMITIVE(save_image_and_exit);
|
PRIMITIVE(save_image_and_exit);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
CELL max_pic_size;
|
CELL max_pic_size;
|
||||||
|
|
||||||
CELL cold_call_to_ic_transitions;
|
CELL cold_call_to_ic_transitions;
|
||||||
|
@ -252,3 +255,5 @@ PRIMITIVE(inline_cache_stats)
|
||||||
stats.trim();
|
stats.trim();
|
||||||
dpush(stats.array.value());
|
dpush(stats.array.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
extern CELL max_pic_size;
|
extern CELL max_pic_size;
|
||||||
|
|
||||||
void init_inline_caching(int max_size);
|
void init_inline_caching(int max_size);
|
||||||
|
@ -7,3 +10,5 @@ PRIMITIVE(inline_cache_stats);
|
||||||
PRIMITIVE(inline_cache_miss);
|
PRIMITIVE(inline_cache_miss);
|
||||||
|
|
||||||
extern "C" XT inline_cache_miss(CELL return_address);
|
extern "C" XT inline_cache_miss(CELL return_address);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Simple wrappers for ANSI C I/O functions, used for bootstrapping.
|
/* Simple wrappers for ANSI C I/O functions, used for bootstrapping.
|
||||||
|
|
||||||
Note the ugly loop logic in almost every function; we have to handle EINTR
|
Note the ugly loop logic in almost every function; we have to handle EINTR
|
||||||
|
@ -222,3 +225,5 @@ VM_C_API void clear_err_no(void)
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
void init_c_io(void);
|
void init_c_io(void);
|
||||||
void io_error(void);
|
void io_error(void);
|
||||||
|
|
||||||
|
@ -17,3 +20,5 @@ PRIMITIVE(read_dir);
|
||||||
|
|
||||||
VM_C_API int err_no(void);
|
VM_C_API int err_no(void);
|
||||||
VM_C_API void clear_err_no(void);
|
VM_C_API void clear_err_no(void);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Simple code generator used by:
|
/* Simple code generator used by:
|
||||||
- profiler (profiler.cpp),
|
- profiler (profiler.cpp),
|
||||||
- quotation compiler (quotations.cpp),
|
- quotation compiler (quotations.cpp),
|
||||||
|
@ -112,3 +115,5 @@ F_CODE_BLOCK *jit::code_block()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
struct jit {
|
struct jit {
|
||||||
CELL type;
|
CELL type;
|
||||||
gc_root<F_OBJECT> owner;
|
gc_root<F_OBJECT> owner;
|
||||||
|
@ -57,3 +60,5 @@ struct jit {
|
||||||
|
|
||||||
F_CODE_BLOCK *code_block();
|
F_CODE_BLOCK *code_block();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
typedef unsigned char u8;
|
typedef unsigned char u8;
|
||||||
typedef unsigned short u16;
|
typedef unsigned short u16;
|
||||||
typedef unsigned int u32;
|
typedef unsigned int u32;
|
||||||
|
@ -324,3 +327,5 @@ struct F_TUPLE : public F_OBJECT {
|
||||||
|
|
||||||
CELL *data() { return (CELL *)(this + 1); }
|
CELL *data() { return (CELL *)(this + 1); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
F_SEGMENT *gc_locals_region;
|
F_SEGMENT *gc_locals_region;
|
||||||
CELL gc_locals;
|
CELL gc_locals;
|
||||||
|
|
||||||
F_SEGMENT *gc_bignums_region;
|
F_SEGMENT *gc_bignums_region;
|
||||||
CELL gc_bignums;
|
CELL gc_bignums;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* If a runtime function needs to call another function which potentially
|
/* If a runtime function needs to call another function which potentially
|
||||||
allocates memory, it must wrap any local variable references to Factor
|
allocates memory, it must wrap any local variable references to Factor
|
||||||
objects in gc_root instances */
|
objects in gc_root instances */
|
||||||
|
@ -40,3 +43,5 @@ struct gc_bignum
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GC_BIGNUM(x) gc_bignum x##__gc_root(&x)
|
#define GC_BIGNUM(x) gc_bignum x##__gc_root(&x)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* Fault handler information. MacOSX version.
|
/* Fault handler information. MacOSX version.
|
||||||
Copyright (C) 1993-1999, 2002-2003 Bruno Haible <clisp.org at bruno>
|
Copyright (C) 1993-1999, 2002-2003 Bruno Haible <clisp.org at bruno>
|
||||||
|
|
||||||
Copyright (C) 2003 Paolo Bonzini <gnu.org at bonzini>
|
Copyright (C) 2003 Paolo Bonzini <gnu.org at bonzini>
|
||||||
|
|
||||||
Used under BSD license with permission from Paolo Bonzini and Bruno Haible,
|
Used under BSD license with permission from Paolo Bonzini and Bruno Haible,
|
||||||
|
@ -11,6 +12,9 @@ Modified for Factor by Slava Pestov */
|
||||||
|
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* The exception port on which our thread listens. */
|
/* The exception port on which our thread listens. */
|
||||||
mach_port_t our_exception_port;
|
mach_port_t our_exception_port;
|
||||||
|
|
||||||
|
@ -164,7 +168,6 @@ mach_exception_thread (void *arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Initialize the Mach exception handler thread. */
|
/* Initialize the Mach exception handler thread. */
|
||||||
void mach_initialize (void)
|
void mach_initialize (void)
|
||||||
{
|
{
|
||||||
|
@ -201,3 +204,5 @@ void mach_initialize (void)
|
||||||
!= KERN_SUCCESS)
|
!= KERN_SUCCESS)
|
||||||
fatal_error("task_set_exception_ports() failed",0);
|
fatal_error("task_set_exception_ports() failed",0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -76,4 +76,9 @@ catch_exception_raise_state_identity (mach_port_t exception_port,
|
||||||
thread_state_t out_state,
|
thread_state_t out_state,
|
||||||
mach_msg_type_number_t *out_state_count);
|
mach_msg_type_number_t *out_state_count);
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
void mach_initialize (void);
|
void mach_initialize (void);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
start_standalone_factor(argc,argv);
|
factor::start_standalone_factor(argc,argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ WinMain(
|
||||||
int nCmdShow)
|
int nCmdShow)
|
||||||
{
|
{
|
||||||
parse_args(&__argc, &__argv, lpCmdLine);
|
parse_args(&__argc, &__argv, lpCmdLine);
|
||||||
start_standalone_factor(__argc,(LPWSTR*)__argv);
|
factor::start_standalone_factor(__argc,(LPWSTR*)__argv);
|
||||||
// memory leak from malloc, wcsdup
|
// memory leak from malloc, wcsdup
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
#include <windows.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <shellapi.h>
|
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
int WINAPI WinMain(
|
int WINAPI WinMain(
|
||||||
|
@ -19,7 +16,7 @@ int WINAPI WinMain(
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
start_standalone_factor(nArgs,szArglist);
|
factor::start_standalone_factor(nArgs,szArglist);
|
||||||
|
|
||||||
LocalFree(szArglist);
|
LocalFree(szArglist);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
CELL bignum_zero;
|
CELL bignum_zero;
|
||||||
CELL bignum_pos_one;
|
CELL bignum_pos_one;
|
||||||
CELL bignum_neg_one;
|
CELL bignum_neg_one;
|
||||||
|
@ -509,3 +512,5 @@ VM_ASM_API void overflow_fixnum_multiply(F_FIXNUM x, F_FIXNUM y)
|
||||||
GC_BIGNUM(by);
|
GC_BIGNUM(by);
|
||||||
drepl(tag<F_BIGNUM>(bignum_multiply(bx,by)));
|
drepl(tag<F_BIGNUM>(bignum_multiply(bx,by)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
extern CELL bignum_zero;
|
extern CELL bignum_zero;
|
||||||
extern CELL bignum_pos_one;
|
extern CELL bignum_pos_one;
|
||||||
extern CELL bignum_neg_one;
|
extern CELL bignum_neg_one;
|
||||||
|
@ -142,3 +145,5 @@ VM_C_API CELL to_cell(CELL tagged);
|
||||||
VM_ASM_API void overflow_fixnum_add(F_FIXNUM x, F_FIXNUM y);
|
VM_ASM_API void overflow_fixnum_add(F_FIXNUM x, F_FIXNUM y);
|
||||||
VM_ASM_API void overflow_fixnum_subtract(F_FIXNUM x, F_FIXNUM y);
|
VM_ASM_API void overflow_fixnum_subtract(F_FIXNUM x, F_FIXNUM y);
|
||||||
VM_ASM_API void overflow_fixnum_multiply(F_FIXNUM x, F_FIXNUM y);
|
VM_ASM_API void overflow_fixnum_multiply(F_FIXNUM x, F_FIXNUM y);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
inline static void *ucontext_stack_pointer(void *uap)
|
inline static void *ucontext_stack_pointer(void *uap)
|
||||||
{
|
{
|
||||||
ucontext_t *ucontext = (ucontext_t *)uap;
|
ucontext_t *ucontext = (ucontext_t *)uap;
|
||||||
|
@ -7,3 +10,5 @@ inline static void *ucontext_stack_pointer(void *uap)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define UAP_PROGRAM_COUNTER(ucontext) (((ucontext_t *)(ucontext))->uc_mcontext.mc_eip)
|
#define UAP_PROGRAM_COUNTER(ucontext) (((ucontext_t *)(ucontext))->uc_mcontext.mc_eip)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
inline static void *ucontext_stack_pointer(void *uap)
|
inline static void *ucontext_stack_pointer(void *uap)
|
||||||
{
|
{
|
||||||
ucontext_t *ucontext = (ucontext_t *)uap;
|
ucontext_t *ucontext = (ucontext_t *)uap;
|
||||||
|
@ -7,3 +10,5 @@ inline static void *ucontext_stack_pointer(void *uap)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define UAP_PROGRAM_COUNTER(ucontext) (((ucontext_t *)(ucontext))->uc_mcontext.mc_rip)
|
#define UAP_PROGRAM_COUNTER(ucontext) (((ucontext_t *)(ucontext))->uc_mcontext.mc_rip)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* From SBCL */
|
/* From SBCL */
|
||||||
const char *vm_executable_path(void)
|
const char *vm_executable_path(void)
|
||||||
{
|
{
|
||||||
|
@ -32,3 +35,5 @@ const char *vm_executable_path(void)
|
||||||
|
|
||||||
return safe_strdup(path);
|
return safe_strdup(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
#include <osreldate.h>
|
#include <osreldate.h>
|
||||||
|
|
||||||
extern int getosreldate(void);
|
|
||||||
|
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
|
extern "C" int getosreldate(void);
|
||||||
|
|
||||||
#ifndef KERN_PROC_PATHNAME
|
#ifndef KERN_PROC_PATHNAME
|
||||||
#define KERN_PROC_PATHNAME 12
|
#define KERN_PROC_PATHNAME 12
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
void c_to_factor_toplevel(CELL quot)
|
void c_to_factor_toplevel(CELL quot)
|
||||||
{
|
{
|
||||||
c_to_factor(quot);
|
c_to_factor(quot);
|
||||||
|
@ -33,3 +36,5 @@ const char *default_image_path(void)
|
||||||
memcpy(new_path + len,SUFFIX,SUFFIX_LEN + 1);
|
memcpy(new_path + len,SUFFIX,SUFFIX_LEN + 1);
|
||||||
return new_path;
|
return new_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define VM_C_API extern "C"
|
#define VM_C_API extern "C"
|
||||||
#define NULL_DLL NULL
|
#define NULL_DLL NULL
|
||||||
|
|
||||||
|
@ -6,3 +9,5 @@ void init_signals(void);
|
||||||
void early_init(void);
|
void early_init(void);
|
||||||
const char *vm_executable_path(void);
|
const char *vm_executable_path(void);
|
||||||
const char *default_image_path(void);
|
const char *default_image_path(void);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
void flush_icache(CELL start, CELL len)
|
void flush_icache(CELL start, CELL len)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
@ -24,3 +27,5 @@ void flush_icache(CELL start, CELL len)
|
||||||
if(result < 0)
|
if(result < 0)
|
||||||
critical_error("flush_icache() failed",result);
|
critical_error("flush_icache() failed",result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
#include <asm/unistd.h>
|
#include <asm/unistd.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
inline static void *ucontext_stack_pointer(void *uap)
|
inline static void *ucontext_stack_pointer(void *uap)
|
||||||
{
|
{
|
||||||
ucontext_t *ucontext = (ucontext_t *)uap;
|
ucontext_t *ucontext = (ucontext_t *)uap;
|
||||||
|
@ -12,3 +15,5 @@ inline static void *ucontext_stack_pointer(void *uap)
|
||||||
(((ucontext_t *)(ucontext))->uc_mcontext.arm_pc)
|
(((ucontext_t *)(ucontext))->uc_mcontext.arm_pc)
|
||||||
|
|
||||||
void flush_icache(CELL start, CELL len);
|
void flush_icache(CELL start, CELL len);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define FRAME_RETURN_ADDRESS(frame) *((XT *)(frame_successor(frame) + 1) + 1)
|
#define FRAME_RETURN_ADDRESS(frame) *((XT *)(frame_successor(frame) + 1) + 1)
|
||||||
|
|
||||||
inline static void *ucontext_stack_pointer(void *uap)
|
inline static void *ucontext_stack_pointer(void *uap)
|
||||||
|
@ -10,3 +13,5 @@ inline static void *ucontext_stack_pointer(void *uap)
|
||||||
|
|
||||||
#define UAP_PROGRAM_COUNTER(ucontext) \
|
#define UAP_PROGRAM_COUNTER(ucontext) \
|
||||||
(((ucontext_t *)(ucontext))->uc_mcontext.uc_regs->gregs[PT_NIP])
|
(((ucontext_t *)(ucontext))->uc_mcontext.uc_regs->gregs[PT_NIP])
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
inline static void *ucontext_stack_pointer(void *uap)
|
inline static void *ucontext_stack_pointer(void *uap)
|
||||||
{
|
{
|
||||||
ucontext_t *ucontext = (ucontext_t *)uap;
|
ucontext_t *ucontext = (ucontext_t *)uap;
|
||||||
|
@ -8,3 +11,5 @@ inline static void *ucontext_stack_pointer(void *uap)
|
||||||
|
|
||||||
#define UAP_PROGRAM_COUNTER(ucontext) \
|
#define UAP_PROGRAM_COUNTER(ucontext) \
|
||||||
(((ucontext_t *)(ucontext))->uc_mcontext.gregs[14])
|
(((ucontext_t *)(ucontext))->uc_mcontext.gregs[14])
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
inline static void *ucontext_stack_pointer(void *uap)
|
inline static void *ucontext_stack_pointer(void *uap)
|
||||||
{
|
{
|
||||||
ucontext_t *ucontext = (ucontext_t *)uap;
|
ucontext_t *ucontext = (ucontext_t *)uap;
|
||||||
|
@ -8,3 +11,5 @@ inline static void *ucontext_stack_pointer(void *uap)
|
||||||
|
|
||||||
#define UAP_PROGRAM_COUNTER(ucontext) \
|
#define UAP_PROGRAM_COUNTER(ucontext) \
|
||||||
(((ucontext_t *)(ucontext))->uc_mcontext.gregs[16])
|
(((ucontext_t *)(ucontext))->uc_mcontext.gregs[16])
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Snarfed from SBCL linux-so.c. You must free() this yourself. */
|
/* Snarfed from SBCL linux-so.c. You must free() this yourself. */
|
||||||
const char *vm_executable_path(void)
|
const char *vm_executable_path(void)
|
||||||
{
|
{
|
||||||
|
@ -56,3 +59,5 @@ int inotify_rm_watch(int fd, u32 wd)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
int inotify_init(void);
|
int inotify_init(void);
|
||||||
int inotify_add_watch(int fd, const char *name, u32 mask);
|
int inotify_add_watch(int fd, const char *name, u32 mask);
|
||||||
int inotify_rm_watch(int fd, u32 wd);
|
int inotify_rm_watch(int fd, u32 wd);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Fault handler information. MacOSX version.
|
/* Fault handler information. MacOSX version.
|
||||||
Copyright (C) 1993-1999, 2002-2003 Bruno Haible <clisp.org at bruno>
|
Copyright (C) 1993-1999, 2002-2003 Bruno Haible <clisp.org at bruno>
|
||||||
Copyright (C) 2003 Paolo Bonzini <gnu.org at bonzini>
|
Copyright (C) 2003 Paolo Bonzini <gnu.org at bonzini>
|
||||||
|
@ -8,8 +13,6 @@ Used under BSD license with permission from Paolo Bonzini and Bruno Haible,
|
||||||
http://sourceforge.net/mailarchive/message.php?msg_name=200503102200.32002.bruno%40clisp.org
|
http://sourceforge.net/mailarchive/message.php?msg_name=200503102200.32002.bruno%40clisp.org
|
||||||
|
|
||||||
Modified for Factor by Slava Pestov */
|
Modified for Factor by Slava Pestov */
|
||||||
#include <ucontext.h>
|
|
||||||
|
|
||||||
#define FRAME_RETURN_ADDRESS(frame) *((XT *)(frame_successor(frame) + 1) + 2)
|
#define FRAME_RETURN_ADDRESS(frame) *((XT *)(frame_successor(frame) + 1) + 2)
|
||||||
|
|
||||||
#define MACH_EXC_STATE_TYPE ppc_exception_state_t
|
#define MACH_EXC_STATE_TYPE ppc_exception_state_t
|
||||||
|
@ -37,3 +40,5 @@ inline static CELL fix_stack_pointer(CELL sp)
|
||||||
{
|
{
|
||||||
return sp;
|
return sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Fault handler information. MacOSX version.
|
/* Fault handler information. MacOSX version.
|
||||||
Copyright (C) 1993-1999, 2002-2003 Bruno Haible <clisp.org at bruno>
|
Copyright (C) 1993-1999, 2002-2003 Bruno Haible <clisp.org at bruno>
|
||||||
Copyright (C) 2003 Paolo Bonzini <gnu.org at bonzini>
|
Copyright (C) 2003 Paolo Bonzini <gnu.org at bonzini>
|
||||||
|
@ -8,8 +13,6 @@ Used under BSD license with permission from Paolo Bonzini and Bruno Haible,
|
||||||
http://sourceforge.net/mailarchive/message.php?msg_name=200503102200.32002.bruno%40clisp.org
|
http://sourceforge.net/mailarchive/message.php?msg_name=200503102200.32002.bruno%40clisp.org
|
||||||
|
|
||||||
Modified for Factor by Slava Pestov */
|
Modified for Factor by Slava Pestov */
|
||||||
#include <ucontext.h>
|
|
||||||
|
|
||||||
#define MACH_EXC_STATE_TYPE i386_exception_state_t
|
#define MACH_EXC_STATE_TYPE i386_exception_state_t
|
||||||
#define MACH_EXC_STATE_FLAVOR i386_EXCEPTION_STATE
|
#define MACH_EXC_STATE_FLAVOR i386_EXCEPTION_STATE
|
||||||
#define MACH_EXC_STATE_COUNT i386_EXCEPTION_STATE_COUNT
|
#define MACH_EXC_STATE_COUNT i386_EXCEPTION_STATE_COUNT
|
||||||
|
@ -35,3 +38,5 @@ inline static CELL fix_stack_pointer(CELL sp)
|
||||||
{
|
{
|
||||||
return ((sp + 4) & ~15) - 4;
|
return ((sp + 4) & ~15) - 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
/* Fault handler information. MacOSX version.
|
/* Fault handler information. MacOSX version.
|
||||||
Copyright (C) 1993-1999, 2002-2003 Bruno Haible <clisp.org at bruno>
|
Copyright (C) 1993-1999, 2002-2003 Bruno Haible <clisp.org at bruno>
|
||||||
Copyright (C) 2003 Paolo Bonzini <gnu.org at bonzini>
|
Copyright (C) 2003 Paolo Bonzini <gnu.org at bonzini>
|
||||||
|
@ -8,8 +13,6 @@ Used under BSD license with permission from Paolo Bonzini and Bruno Haible,
|
||||||
http://sourceforge.net/mailarchive/message.php?msg_name=200503102200.32002.bruno%40clisp.org
|
http://sourceforge.net/mailarchive/message.php?msg_name=200503102200.32002.bruno%40clisp.org
|
||||||
|
|
||||||
Modified for Factor by Slava Pestov and Daniel Ehrenberg */
|
Modified for Factor by Slava Pestov and Daniel Ehrenberg */
|
||||||
#include <ucontext.h>
|
|
||||||
|
|
||||||
#define MACH_EXC_STATE_TYPE x86_exception_state64_t
|
#define MACH_EXC_STATE_TYPE x86_exception_state64_t
|
||||||
#define MACH_EXC_STATE_FLAVOR x86_EXCEPTION_STATE64
|
#define MACH_EXC_STATE_FLAVOR x86_EXCEPTION_STATE64
|
||||||
#define MACH_EXC_STATE_COUNT x86_EXCEPTION_STATE64_COUNT
|
#define MACH_EXC_STATE_COUNT x86_EXCEPTION_STATE64_COUNT
|
||||||
|
@ -35,3 +38,5 @@ inline static CELL fix_stack_pointer(CELL sp)
|
||||||
{
|
{
|
||||||
return ((sp + 8) & ~15) - 8;
|
return ((sp + 8) & ~15) - 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define VM_C_API extern "C" __attribute__((visibility("default")))
|
#define VM_C_API extern "C" __attribute__((visibility("default")))
|
||||||
#define FACTOR_OS_STRING "macosx"
|
#define FACTOR_OS_STRING "macosx"
|
||||||
#define NULL_DLL "libfactor.dylib"
|
#define NULL_DLL "libfactor.dylib"
|
||||||
|
@ -15,3 +18,5 @@ inline static void *ucontext_stack_pointer(void *uap)
|
||||||
}
|
}
|
||||||
|
|
||||||
void c_to_factor_toplevel(CELL quot);
|
void c_to_factor_toplevel(CELL quot);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
void c_to_factor_toplevel(CELL quot)
|
void c_to_factor_toplevel(CELL quot)
|
||||||
{
|
{
|
||||||
for(;;)
|
for(;;)
|
||||||
|
@ -80,3 +83,5 @@ Protocol *objc_getProtocol(char *name)
|
||||||
else
|
else
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define ucontext_stack_pointer(uap) ((void *)_UC_MACHINE_SP((ucontext_t *)uap))
|
#define ucontext_stack_pointer(uap) ((void *)_UC_MACHINE_SP((ucontext_t *)uap))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define ucontext_stack_pointer(uap) \
|
#define ucontext_stack_pointer(uap) \
|
||||||
((void *)(((ucontext_t *)(uap))->uc_mcontext.__gregs[_REG_URSP]))
|
((void *)(((ucontext_t *)(uap))->uc_mcontext.__gregs[_REG_URSP]))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
extern int main();
|
extern int main();
|
||||||
|
|
||||||
const char *vm_executable_path(void)
|
const char *vm_executable_path(void)
|
||||||
|
@ -9,3 +12,5 @@ const char *vm_executable_path(void)
|
||||||
dladdr(main, &info);
|
dladdr(main, &info);
|
||||||
return info.dli_fname;
|
return info.dli_fname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define UAP_PROGRAM_COUNTER(uap) _UC_MACHINE_PC((ucontext_t *)uap)
|
#define UAP_PROGRAM_COUNTER(uap) _UC_MACHINE_PC((ucontext_t *)uap)
|
||||||
|
|
||||||
#define DIRECTORY_P(file) ((file)->d_type == DT_DIR)
|
#define DIRECTORY_P(file) ((file)->d_type == DT_DIR)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include <i386/signal.h>
|
#include <i386/signal.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
inline static void *openbsd_stack_pointer(void *uap)
|
inline static void *openbsd_stack_pointer(void *uap)
|
||||||
{
|
{
|
||||||
struct sigcontext *sc = (struct sigcontext*) uap;
|
struct sigcontext *sc = (struct sigcontext*) uap;
|
||||||
|
@ -8,3 +11,5 @@ inline static void *openbsd_stack_pointer(void *uap)
|
||||||
|
|
||||||
#define ucontext_stack_pointer openbsd_stack_pointer
|
#define ucontext_stack_pointer openbsd_stack_pointer
|
||||||
#define UAP_PROGRAM_COUNTER(uap) (((struct sigcontext*)(uap))->sc_eip)
|
#define UAP_PROGRAM_COUNTER(uap) (((struct sigcontext*)(uap))->sc_eip)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include <amd64/signal.h>
|
#include <amd64/signal.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
inline static void *openbsd_stack_pointer(void *uap)
|
inline static void *openbsd_stack_pointer(void *uap)
|
||||||
{
|
{
|
||||||
struct sigcontext *sc = (struct sigcontext*) uap;
|
struct sigcontext *sc = (struct sigcontext*) uap;
|
||||||
|
@ -8,3 +11,5 @@ inline static void *openbsd_stack_pointer(void *uap)
|
||||||
|
|
||||||
#define ucontext_stack_pointer openbsd_stack_pointer
|
#define ucontext_stack_pointer openbsd_stack_pointer
|
||||||
#define UAP_PROGRAM_COUNTER(uap) (((struct sigcontext*)(uap))->sc_rip)
|
#define UAP_PROGRAM_COUNTER(uap) (((struct sigcontext*)(uap))->sc_rip)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
const char *vm_executable_path(void)
|
const char *vm_executable_path(void)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
inline static void *ucontext_stack_pointer(void *uap)
|
inline static void *ucontext_stack_pointer(void *uap)
|
||||||
{
|
{
|
||||||
ucontext_t *ucontext = (ucontext_t *)uap;
|
ucontext_t *ucontext = (ucontext_t *)uap;
|
||||||
|
@ -8,3 +11,5 @@ inline static void *ucontext_stack_pointer(void *uap)
|
||||||
|
|
||||||
#define UAP_PROGRAM_COUNTER(ucontext) \
|
#define UAP_PROGRAM_COUNTER(ucontext) \
|
||||||
(((ucontext_t *)(ucontext))->uc_mcontext.gregs[EIP])
|
(((ucontext_t *)(ucontext))->uc_mcontext.gregs[EIP])
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
inline static void *ucontext_stack_pointer(void *uap)
|
inline static void *ucontext_stack_pointer(void *uap)
|
||||||
{
|
{
|
||||||
ucontext_t *ucontext = (ucontext_t *)uap;
|
ucontext_t *ucontext = (ucontext_t *)uap;
|
||||||
|
@ -8,3 +11,5 @@ inline static void *ucontext_stack_pointer(void *uap)
|
||||||
|
|
||||||
#define UAP_PROGRAM_COUNTER(ucontext) \
|
#define UAP_PROGRAM_COUNTER(ucontext) \
|
||||||
(((ucontext_t *)(ucontext))->uc_mcontext.gregs[RIP])
|
(((ucontext_t *)(ucontext))->uc_mcontext.gregs[RIP])
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
const char *vm_executable_path(void)
|
const char *vm_executable_path(void)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
void start_thread(void *(*start_routine)(void *))
|
void start_thread(void *(*start_routine)(void *))
|
||||||
{
|
{
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
|
@ -311,3 +314,5 @@ VM_C_API void wait_for_stdin(void)
|
||||||
fatal_error("Error writing control fd",errno);
|
fatal_error("Error writing control fd",errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -8,11 +8,12 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
typedef char F_CHAR;
|
typedef char F_CHAR;
|
||||||
typedef char F_SYMBOL;
|
typedef char F_SYMBOL;
|
||||||
|
|
||||||
#define string_to_native_alien(string) string_to_char_alien(string,true)
|
|
||||||
|
|
||||||
#define STRING_LITERAL(string) string
|
#define STRING_LITERAL(string) string
|
||||||
|
|
||||||
#define SSCANF sscanf
|
#define SSCANF sscanf
|
||||||
|
@ -54,3 +55,5 @@ s64 current_micros(void);
|
||||||
void sleep_micros(CELL usec);
|
void sleep_micros(CELL usec);
|
||||||
|
|
||||||
void open_console(void);
|
void open_console(void);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
s64 current_micros(void)
|
s64 current_micros(void)
|
||||||
{
|
{
|
||||||
SYSTEMTIME st;
|
SYSTEMTIME st;
|
||||||
|
@ -38,3 +41,5 @@ void c_to_factor_toplevel(CELL quot)
|
||||||
}
|
}
|
||||||
|
|
||||||
void open_console(void) { }
|
void open_console(void) { }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
typedef wchar_t F_SYMBOL;
|
typedef wchar_t F_SYMBOL;
|
||||||
|
|
||||||
#define FACTOR_OS_STRING "wince"
|
#define FACTOR_OS_STRING "wince"
|
||||||
|
@ -22,3 +25,5 @@ char *getenv(char *name);
|
||||||
s64 current_micros(void);
|
s64 current_micros(void);
|
||||||
void c_to_factor_toplevel(CELL quot);
|
void c_to_factor_toplevel(CELL quot);
|
||||||
void open_console(void);
|
void open_console(void);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define ESP Esp
|
#define ESP Esp
|
||||||
#define EIP Eip
|
#define EIP Eip
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define ESP Rsp
|
#define ESP Rsp
|
||||||
#define EIP Rip
|
#define EIP Rip
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
s64 current_micros(void)
|
s64 current_micros(void)
|
||||||
{
|
{
|
||||||
FILETIME t;
|
FILETIME t;
|
||||||
|
@ -49,3 +52,5 @@ void c_to_factor_toplevel(CELL quot)
|
||||||
void open_console(void)
|
void open_console(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -5,8 +5,12 @@
|
||||||
#define UNICODE
|
#define UNICODE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <shellapi.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
typedef char F_SYMBOL;
|
typedef char F_SYMBOL;
|
||||||
|
|
||||||
#define FACTOR_OS_STRING "winnt"
|
#define FACTOR_OS_STRING "winnt"
|
||||||
|
@ -16,3 +20,5 @@ typedef char F_SYMBOL;
|
||||||
void c_to_factor_toplevel(CELL quot);
|
void c_to_factor_toplevel(CELL quot);
|
||||||
long exception_handler(PEXCEPTION_POINTERS pe);
|
long exception_handler(PEXCEPTION_POINTERS pe);
|
||||||
void open_console(void);
|
void open_console(void);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
HMODULE hFactorDll;
|
HMODULE hFactorDll;
|
||||||
|
|
||||||
void init_ffi(void)
|
void init_ffi(void)
|
||||||
|
@ -144,3 +147,5 @@ void sleep_micros(u64 usec)
|
||||||
{
|
{
|
||||||
Sleep((DWORD)(usec / 1000));
|
Sleep((DWORD)(usec / 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef wchar_t F_CHAR;
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
#define string_to_native_alien(string) string_to_u16_alien(string,true)
|
typedef wchar_t F_CHAR;
|
||||||
|
|
||||||
#define STRING_LITERAL(string) L##string
|
#define STRING_LITERAL(string) L##string
|
||||||
|
|
||||||
|
@ -55,3 +56,4 @@ long getpagesize (void);
|
||||||
|
|
||||||
s64 current_micros(void);
|
s64 current_micros(void);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
void *primitives[] = {
|
void *primitives[] = {
|
||||||
(void *)primitive_bignum_to_fixnum,
|
(void *)primitive_bignum_to_fixnum,
|
||||||
(void *)primitive_float_to_fixnum,
|
(void *)primitive_float_to_fixnum,
|
||||||
|
@ -152,3 +155,5 @@ void *primitives[] = {
|
||||||
(void *)primitive_inline_cache_stats,
|
(void *)primitive_inline_cache_stats,
|
||||||
(void *)primitive_optimized_p,
|
(void *)primitive_optimized_p,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
//typedef extern "C" void (*F_PRIMITIVE)(void);
|
//typedef extern "C" void (*F_PRIMITIVE)(void);
|
||||||
|
|
||||||
extern void *primitives[];
|
extern void *primitives[];
|
||||||
|
|
||||||
#define PRIMITIVE(name) extern "C" void primitive_##name()
|
#define PRIMITIVE(name) extern "C" void primitive_##name()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
bool profiling_p;
|
bool profiling_p;
|
||||||
|
|
||||||
void init_profiler(void)
|
void init_profiler(void)
|
||||||
|
@ -50,3 +53,5 @@ PRIMITIVE(profiling)
|
||||||
{
|
{
|
||||||
set_profiling(to_boolean(dpop()));
|
set_profiling(to_boolean(dpop()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
|
namespace factor
|
||||||
|
{
|
||||||
|
|
||||||
extern bool profiling_p;
|
extern bool profiling_p;
|
||||||
void init_profiler(void);
|
void init_profiler(void);
|
||||||
F_CODE_BLOCK *compile_profiling_stub(CELL word);
|
F_CODE_BLOCK *compile_profiling_stub(CELL word);
|
||||||
PRIMITIVE(profiling);
|
PRIMITIVE(profiling);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue