VM now compiles with GCC 3.4 on Windows
parent
cc9ac345fa
commit
56597b65f4
|
@ -303,7 +303,7 @@ cell heap_size(heap *heap)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute where each block is going to go, after compaction */
|
/* Compute where each block is going to go, after compaction */
|
||||||
cell compute_heap_forwarding(heap *heap, std::tr1::unordered_map<heap_block *,char *> &forwarding)
|
cell compute_heap_forwarding(heap *heap, unordered_map<heap_block *,char *> &forwarding)
|
||||||
{
|
{
|
||||||
heap_block *scan = first_block(heap);
|
heap_block *scan = first_block(heap);
|
||||||
char *address = (char *)first_block(heap);
|
char *address = (char *)first_block(heap);
|
||||||
|
@ -324,7 +324,7 @@ cell heap_size(heap *heap)
|
||||||
return (cell)address - heap->seg->start;
|
return (cell)address - heap->seg->start;
|
||||||
}
|
}
|
||||||
|
|
||||||
void compact_heap(heap *heap, std::tr1::unordered_map<heap_block *,char *> &forwarding)
|
void compact_heap(heap *heap, unordered_map<heap_block *,char *> &forwarding)
|
||||||
{
|
{
|
||||||
heap_block *scan = first_block(heap);
|
heap_block *scan = first_block(heap);
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@ void unmark_marked(heap *heap);
|
||||||
void free_unmarked(heap *heap, heap_iterator iter);
|
void free_unmarked(heap *heap, heap_iterator iter);
|
||||||
void heap_usage(heap *h, cell *used, cell *total_free, cell *max_free);
|
void heap_usage(heap *h, cell *used, cell *total_free, cell *max_free);
|
||||||
cell heap_size(heap *h);
|
cell heap_size(heap *h);
|
||||||
cell compute_heap_forwarding(heap *h, std::tr1::unordered_map<heap_block *,char *> &forwarding);
|
cell compute_heap_forwarding(heap *h, unordered_map<heap_block *,char *> &forwarding);
|
||||||
void compact_heap(heap *h, std::tr1::unordered_map<heap_block *,char *> &forwarding);
|
void compact_heap(heap *h, unordered_map<heap_block *,char *> &forwarding);
|
||||||
|
|
||||||
inline static heap_block *next_block(heap *h, heap_block *block)
|
inline static heap_block *next_block(heap *h, heap_block *block)
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,7 +119,7 @@ PRIMITIVE(code_room)
|
||||||
dpush(tag_fixnum(max_free / 1024));
|
dpush(tag_fixnum(max_free / 1024));
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::tr1::unordered_map<heap_block *,char *> forwarding;
|
static unordered_map<heap_block *,char *> forwarding;
|
||||||
|
|
||||||
code_block *forward_xt(code_block *compiled)
|
code_block *forward_xt(code_block *compiled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -241,7 +241,7 @@ cell unaligned_object_size(object *pointer)
|
||||||
return callstack_size(untag_fixnum(((callstack *)pointer)->length));
|
return callstack_size(untag_fixnum(((callstack *)pointer)->length));
|
||||||
default:
|
default:
|
||||||
critical_error("Invalid header",(cell)pointer);
|
critical_error("Invalid header",(cell)pointer);
|
||||||
return -1; /* can't happen */
|
return 0; /* can't happen */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ cell binary_payload_start(object *pointer)
|
||||||
return sizeof(wrapper);
|
return sizeof(wrapper);
|
||||||
default:
|
default:
|
||||||
critical_error("Invalid header",(cell)pointer);
|
critical_error("Invalid header",(cell)pointer);
|
||||||
return -1; /* can't happen */
|
return 0; /* can't happen */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ static cell lookup_hairy_method(cell obj, cell methods)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
critical_error("Bad methods array",methods);
|
critical_error("Bad methods array",methods);
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ static cell determine_inline_cache_type(array *cache_entries)
|
||||||
if(!seen_hi_tag && !seen_tuple) return PIC_TAG;
|
if(!seen_hi_tag && !seen_tuple) return PIC_TAG;
|
||||||
|
|
||||||
critical_error("Oops",0);
|
critical_error("Oops",0);
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_pic_count(cell type)
|
static void update_pic_count(cell type)
|
||||||
|
|
|
@ -93,6 +93,9 @@ class object;
|
||||||
struct header {
|
struct header {
|
||||||
cell value;
|
cell value;
|
||||||
|
|
||||||
|
/* Default ctor to make gcc 3.x happy */
|
||||||
|
header() { abort(); }
|
||||||
|
|
||||||
header(cell value_) : value(value_ << TAG_BITS) {}
|
header(cell value_) : value(value_ << TAG_BITS) {}
|
||||||
|
|
||||||
void check_header() {
|
void check_header() {
|
||||||
|
|
|
@ -22,7 +22,15 @@
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
/* C++ headers */
|
/* C++ headers */
|
||||||
#include <tr1/unordered_map>
|
#if __GNUC__ == 4
|
||||||
|
#include <tr1/unordered_map>
|
||||||
|
#define unordered_map std::tr1::unordered_map
|
||||||
|
#elif __GNUC__ == 3
|
||||||
|
#include <boost/unordered_map.hpp>
|
||||||
|
#define unordered_map boost::unordered_map
|
||||||
|
#else
|
||||||
|
#error Factor requires GCC 3.x or later
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Factor headers */
|
/* Factor headers */
|
||||||
#include "layouts.hpp"
|
#include "layouts.hpp"
|
||||||
|
|
|
@ -377,7 +377,7 @@ VM_C_API fixnum to_fixnum(cell tagged)
|
||||||
return bignum_to_fixnum(untag<bignum>(tagged));
|
return bignum_to_fixnum(untag<bignum>(tagged));
|
||||||
default:
|
default:
|
||||||
type_error(FIXNUM_TYPE,tagged);
|
type_error(FIXNUM_TYPE,tagged);
|
||||||
return -1; /* can't happen */
|
return 0; /* can't happen */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +444,7 @@ VM_C_API s64 to_signed_8(cell obj)
|
||||||
return bignum_to_long_long(untag<bignum>(obj));
|
return bignum_to_long_long(untag<bignum>(obj));
|
||||||
default:
|
default:
|
||||||
type_error(BIGNUM_TYPE,obj);
|
type_error(BIGNUM_TYPE,obj);
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ VM_C_API u64 to_unsigned_8(cell obj)
|
||||||
return bignum_to_ulong_long(untag<bignum>(obj));
|
return bignum_to_ulong_long(untag<bignum>(obj));
|
||||||
default:
|
default:
|
||||||
type_error(BIGNUM_TYPE,obj);
|
type_error(BIGNUM_TYPE,obj);
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ s64 current_micros()
|
||||||
- EPOCH_OFFSET) / 10;
|
- EPOCH_OFFSET) / 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
long exception_handler(PEXCEPTION_POINTERS pe)
|
FACTOR_STDCALL LONG exception_handler(PEXCEPTION_POINTERS pe)
|
||||||
{
|
{
|
||||||
PEXCEPTION_RECORD e = (PEXCEPTION_RECORD)pe->ExceptionRecord;
|
PEXCEPTION_RECORD e = (PEXCEPTION_RECORD)pe->ExceptionRecord;
|
||||||
CONTEXT *c = (CONTEXT*)pe->ContextRecord;
|
CONTEXT *c = (CONTEXT*)pe->ContextRecord;
|
||||||
|
@ -43,10 +43,10 @@ long exception_handler(PEXCEPTION_POINTERS pe)
|
||||||
|
|
||||||
void c_to_factor_toplevel(cell quot)
|
void c_to_factor_toplevel(cell quot)
|
||||||
{
|
{
|
||||||
if(!AddVectoredExceptionHandler(0, exception_handler))
|
if(!AddVectoredExceptionHandler(0, (PVECTORED_EXCEPTION_HANDLER)exception_handler))
|
||||||
fatal_error("AddVectoredExceptionHandler failed", 0);
|
fatal_error("AddVectoredExceptionHandler failed", 0);
|
||||||
c_to_factor(quot);
|
c_to_factor(quot);
|
||||||
RemoveVectoredExceptionHandler((void*)exception_handler);
|
RemoveVectoredExceptionHandler((void *)exception_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void open_console()
|
void open_console()
|
||||||
|
|
|
@ -17,8 +17,10 @@ typedef char symbol_char;
|
||||||
#define FACTOR_DLL L"factor.dll"
|
#define FACTOR_DLL L"factor.dll"
|
||||||
#define FACTOR_DLL_NAME "factor.dll"
|
#define FACTOR_DLL_NAME "factor.dll"
|
||||||
|
|
||||||
|
#define FACTOR_STDCALL __attribute__((stdcall))
|
||||||
|
|
||||||
void c_to_factor_toplevel(cell quot);
|
void c_to_factor_toplevel(cell quot);
|
||||||
long exception_handler(PEXCEPTION_POINTERS pe);
|
FACTOR_STDCALL LONG exception_handler(PEXCEPTION_POINTERS pe);
|
||||||
void open_console();
|
void open_console();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue