VM now compiles with GCC 3.4 on Windows

db4
Slava Pestov 2009-05-05 14:17:02 -05:00
parent cc9ac345fa
commit 56597b65f4
11 changed files with 30 additions and 17 deletions

View File

@ -303,7 +303,7 @@ cell heap_size(heap *heap)
}
/* 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);
char *address = (char *)first_block(heap);
@ -324,7 +324,7 @@ cell heap_size(heap *heap)
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);

View File

@ -25,8 +25,8 @@ void unmark_marked(heap *heap);
void free_unmarked(heap *heap, heap_iterator iter);
void heap_usage(heap *h, cell *used, cell *total_free, cell *max_free);
cell heap_size(heap *h);
cell compute_heap_forwarding(heap *h, std::tr1::unordered_map<heap_block *,char *> &forwarding);
void compact_heap(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, unordered_map<heap_block *,char *> &forwarding);
inline static heap_block *next_block(heap *h, heap_block *block)
{

View File

@ -119,7 +119,7 @@ PRIMITIVE(code_room)
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)
{

4
vm/data_heap.cpp Normal file → Executable file
View File

@ -241,7 +241,7 @@ cell unaligned_object_size(object *pointer)
return callstack_size(untag_fixnum(((callstack *)pointer)->length));
default:
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);
default:
critical_error("Invalid header",(cell)pointer);
return -1; /* can't happen */
return 0; /* can't happen */
}
}

2
vm/dispatch.cpp Normal file → Executable file
View File

@ -103,7 +103,7 @@ static cell lookup_hairy_method(cell obj, cell methods)
break;
default:
critical_error("Bad methods array",methods);
return -1;
return 0;
}
}
}

2
vm/inline_cache.cpp Normal file → Executable file
View File

@ -70,7 +70,7 @@ static cell determine_inline_cache_type(array *cache_entries)
if(!seen_hi_tag && !seen_tuple) return PIC_TAG;
critical_error("Oops",0);
return -1;
return 0;
}
static void update_pic_count(cell type)

View File

@ -93,6 +93,9 @@ class object;
struct header {
cell value;
/* Default ctor to make gcc 3.x happy */
header() { abort(); }
header(cell value_) : value(value_ << TAG_BITS) {}
void check_header() {

10
vm/master.hpp Normal file → Executable file
View File

@ -22,7 +22,15 @@
#include <sys/param.h>
/* 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 */
#include "layouts.hpp"

6
vm/math.cpp Normal file → Executable file
View File

@ -377,7 +377,7 @@ VM_C_API fixnum to_fixnum(cell tagged)
return bignum_to_fixnum(untag<bignum>(tagged));
default:
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));
default:
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));
default:
type_error(BIGNUM_TYPE,obj);
return -1;
return 0;
}
}

View File

@ -11,7 +11,7 @@ s64 current_micros()
- EPOCH_OFFSET) / 10;
}
long exception_handler(PEXCEPTION_POINTERS pe)
FACTOR_STDCALL LONG exception_handler(PEXCEPTION_POINTERS pe)
{
PEXCEPTION_RECORD e = (PEXCEPTION_RECORD)pe->ExceptionRecord;
CONTEXT *c = (CONTEXT*)pe->ContextRecord;
@ -43,10 +43,10 @@ long exception_handler(PEXCEPTION_POINTERS pe)
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);
c_to_factor(quot);
RemoveVectoredExceptionHandler((void*)exception_handler);
RemoveVectoredExceptionHandler((void *)exception_handler);
}
void open_console()

View File

@ -17,8 +17,10 @@ typedef char symbol_char;
#define FACTOR_DLL L"factor.dll"
#define FACTOR_DLL_NAME "factor.dll"
#define FACTOR_STDCALL __attribute__((stdcall))
void c_to_factor_toplevel(cell quot);
long exception_handler(PEXCEPTION_POINTERS pe);
FACTOR_STDCALL LONG exception_handler(PEXCEPTION_POINTERS pe);
void open_console();
}