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

db4
Slava Pestov 2009-12-14 01:09:40 -06:00
commit dde84a11fb
6 changed files with 23 additions and 6 deletions

View File

@ -27,7 +27,7 @@ TUPLE: buffered-port < port { buffer buffer } ;
TUPLE: input-port < buffered-port ;
M: input-port stream-element-type drop +byte+ ;
M: input-port stream-element-type drop +byte+ ; inline
: <input-port> ( handle -- input-port )
input-port <buffered-port> ;
@ -104,7 +104,7 @@ TUPLE: output-port < buffered-port ;
[ nip ] [ buffer>> buffer-capacity <= ] 2bi
[ drop ] [ stream-flush ] if ; inline
M: output-port stream-element-type stream>> stream-element-type ;
M: output-port stream-element-type stream>> stream-element-type ; inline
M: output-port stream-write1
dup check-disposed

View File

@ -33,9 +33,9 @@ INSTANCE: crc32 checksum
M: crc32 checksum-bytes
init-crc32
[ (crc32) ] each
finish-crc32 ;
finish-crc32 ; inline
M: crc32 checksum-lines
init-crc32
[ [ (crc32) ] each CHAR: \n (crc32) ] each
finish-crc32 ;
finish-crc32 ; inline

View File

@ -99,7 +99,7 @@ SYMBOL: error-stream
} case ; inline
: stream-element-exemplar ( stream -- exemplar )
stream-element-type (stream-element-exemplar) ;
stream-element-type (stream-element-exemplar) ; inline
: element-exemplar ( -- exemplar )
input-stream get stream-element-exemplar ; inline

View File

@ -5,7 +5,7 @@ namespace factor
code_heap::code_heap(cell size)
{
if(size > (1L << (sizeof(cell) * 8 - 6))) fatal_error("Heap too large",size);
if(size > ((u64)1 << (sizeof(cell) * 8 - 6))) fatal_error("Heap too large",size);
seg = new segment(align_page(size),true);
if(!seg) fatal_error("Out of memory in heap allocator",size);
allocator = new free_list_allocator<code_block>(size,seg->start);

View File

@ -37,10 +37,15 @@ u64 system_micros()
- EPOCH_OFFSET) / 10;
}
/* On VirtualBox, QueryPerformanceCounter does not increment
the high part every time the low part overflows. Workaround. */
u64 nano_count()
{
LARGE_INTEGER count;
LARGE_INTEGER frequency;
static u32 hi_correction = 0;
static u32 hi = 0xffffffff;
static u32 lo = 0xffffffff;
BOOL ret;
ret = QueryPerformanceCounter(&count);
if(ret == 0)
@ -49,6 +54,13 @@ u64 nano_count()
if(ret == 0)
fatal_error("QueryPerformanceFrequency", 0);
if((u32)count.LowPart < lo && (u32)count.HighPart == hi)
hi_correction++;
hi = count.HighPart;
lo = count.LowPart;
count.HighPart += hi_correction;
return count.QuadPart*(1000000000/frequency.QuadPart);
}

View File

@ -23,8 +23,13 @@ FACTOR_STDCALL LONG exception_handler(PEXCEPTION_POINTERS pe);
// SSE traps raise these exception codes, which are defined in internal NT headers
// but not winbase.h
#ifndef STATUS_FLOAT_MULTIPLE_FAULTS
#define STATUS_FLOAT_MULTIPLE_FAULTS 0xC00002B4
#endif
#ifndef STATUS_FLOAT_MULTIPLE_TRAPS
#define STATUS_FLOAT_MULTIPLE_TRAPS 0xC00002B5
#endif
typedef HANDLE THREADHANDLE;