}
/* 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);
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);
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)
{
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)
{
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 */
}
}
return sizeof(wrapper);
default:
critical_error("Invalid header",(cell)pointer);
- return -1; /* can't happen */
+ return 0; /* can't happen */
}
}
break;
default:
critical_error("Bad methods array",methods);
- return -1;
+ return 0;
}
}
}
if(!seen_hi_tag && !seen_tuple) return PIC_TAG;
critical_error("Oops",0);
- return -1;
+ return 0;
}
static void update_pic_count(cell type)
struct header {
cell value;
+ /* Default ctor to make gcc 3.x happy */
+ header() { abort(); }
+
header(cell value_) : value(value_ << TAG_BITS) {}
void check_header() {
#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"
return bignum_to_fixnum(untag<bignum>(tagged));
default:
type_error(FIXNUM_TYPE,tagged);
- return -1; /* can't happen */
+ return 0; /* can't happen */
}
}
return bignum_to_long_long(untag<bignum>(obj));
default:
type_error(BIGNUM_TYPE,obj);
- return -1;
+ return 0;
}
}
return bignum_to_ulong_long(untag<bignum>(obj));
default:
type_error(BIGNUM_TYPE,obj);
- return -1;
+ return 0;
}
}
- 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;
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()
#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();
}