Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2010-02-07 18:21:32 +13:00
commit 55b27baf3a
16 changed files with 78 additions and 81 deletions

View File

@ -187,16 +187,11 @@ void factor_vm::primitive_fread()
data_root<byte_array> buf(allot_uninitialized_array<byte_array>(size),this); data_root<byte_array> buf(allot_uninitialized_array<byte_array>(size),this);
for(;;)
{
int c = safe_fread(buf.untagged() + 1,1,size,file); int c = safe_fread(buf.untagged() + 1,1,size,file);
if(c == 0) if(c == 0)
{ {
if(feof(file)) if(feof(file))
{
ctx->push(false_object); ctx->push(false_object);
break;
}
else else
io_error(); io_error();
} }
@ -210,8 +205,6 @@ void factor_vm::primitive_fread()
} }
ctx->push(buf.value()); ctx->push(buf.value());
break;
}
} }
} }

View File

@ -37,8 +37,6 @@ u64 system_micros()
- EPOCH_OFFSET) / 10; - EPOCH_OFFSET) / 10;
} }
/* On VirtualBox, QueryPerformanceCounter does not increment
the high part every time the low part overflows. Workaround. */
u64 nano_count() u64 nano_count()
{ {
LARGE_INTEGER count; LARGE_INTEGER count;
@ -53,8 +51,14 @@ u64 nano_count()
if(ret == 0) if(ret == 0)
fatal_error("QueryPerformanceFrequency", 0); fatal_error("QueryPerformanceFrequency", 0);
if(count.LowPart < lo) #ifdef FACTOR_64
hi += 1; hi = count.HighPart;
#else
/* On VirtualBox, QueryPerformanceCounter does not increment
the high part every time the low part overflows. Workaround. */
if(lo > count.LowPart)
hi++;
#endif
lo = count.LowPart; lo = count.LowPart;
return (u64)((((u64)hi << 32) | (u64)lo)*(1000000000.0/frequency.QuadPart)); return (u64)((((u64)hi << 32) | (u64)lo)*(1000000000.0/frequency.QuadPart));
@ -91,7 +95,7 @@ LONG factor_vm::exception_handler(PEXCEPTION_POINTERS pe)
case STATUS_FLOAT_UNDERFLOW: case STATUS_FLOAT_UNDERFLOW:
case STATUS_FLOAT_MULTIPLE_FAULTS: case STATUS_FLOAT_MULTIPLE_FAULTS:
case STATUS_FLOAT_MULTIPLE_TRAPS: case STATUS_FLOAT_MULTIPLE_TRAPS:
#ifdef FACTOR_AMD64 #ifdef FACTOR_64
signal_fpu_status = fpu_status(MXCSR(c)); signal_fpu_status = fpu_status(MXCSR(c));
#else #else
signal_fpu_status = fpu_status(X87SW(c) | MXCSR(c)); signal_fpu_status = fpu_status(X87SW(c) | MXCSR(c));

View File

@ -128,7 +128,7 @@ segment::~segment()
long getpagesize() long getpagesize()
{ {
static long g_pagesize = 0; static long g_pagesize = 0;
if (! g_pagesize) if(!g_pagesize)
{ {
SYSTEM_INFO system_info; SYSTEM_INFO system_info;
GetSystemInfo (&system_info); GetSystemInfo (&system_info);