* Fixed a bug in the GC that caused performance to degrade when

ik_alloc extends the heap (by 128KB) and the heap size remains set
  to that value (causing more frequent GCs than usual).  Now, after
  ik_collect, if the heapsize is less than 4MB, it's extended to
  4MB (minimum).
This commit is contained in:
Abdulaziz Ghuloum 2007-09-15 01:54:45 -04:00
parent a2ed662821
commit 82a00e2628
9 changed files with 20 additions and 7 deletions

Binary file not shown.

View File

@ -376,7 +376,6 @@ ik_collect(int mem_req, ikpcb* pcb){
add_to_collect_count(pcb, bytes);
}
struct rusage t0, t1;
struct timeval rt0, rt1;
gettimeofday(&rt0, 0);
@ -496,11 +495,13 @@ ik_collect(int mem_req, ikpcb* pcb){
int free_space =
((unsigned int)pcb->allocation_redline) -
((unsigned int)pcb->allocation_pointer);
if(free_space <= mem_req){
#define HEAPSIZE (1024 * 4096)
if((free_space <= mem_req) || (pcb->heap_size < HEAPSIZE)){
#ifndef NDEBUG
fprintf(stderr, "REQ=%d, got %d\n", mem_req, free_space);
#endif
int memsize = align_to_next_page(mem_req);
int memsize = (mem_req>HEAPSIZE) ? mem_req : HEAPSIZE;
memsize = align_to_next_page(memsize);
ik_munmap_from_segment(
pcb->heap_base,
pcb->heap_size,

View File

@ -457,7 +457,6 @@ char* ik_uuid(char* str){
static const char* uuid_chars =
"!$%&/0123456789<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
static int uuid_strlen = 1;
ikp ik_uuid(ikp str){
static int fd = -1;
if(fd == -1){

Binary file not shown.

View File

@ -250,7 +250,9 @@
(error 'fxarithmetic-shift "~s is not a fixnum" y))
(if ($fx>= y 0)
($fxsll x y)
($fxsra x ($fx- 0 y)))))
(if ($fx< x -100) ;;; arbitrary number < (fixnum-width)
($fxsra x 32)
($fxsra x ($fx- 0 y))))))
(define (fxpositive? x)
(if (fixnum? x)

View File

@ -1,13 +1,15 @@
(library (ikarus singular-objects)
(export base-rtd eof-object void)
(export base-rtd eof-object void #;fixnum-width)
(import
(rename (ikarus system $records) (base-rtd sys:base-rtd))
(rename (ikarus)
(void sys:void)
#; (fixnum-width sys:fixnum-width)
(eof-object sys:eof-object)))
(define (void) (sys:void))
#; (define (fixnum-width) (sys:fixnum-width))
(define (eof-object) (sys:eof-object))
(define (base-rtd) (sys:base-rtd)))

View File

@ -459,6 +459,7 @@
[fxarithmetic-shift i]
[fxmin i]
[fxmax i]
[fixnum-width i]
[for-each i r]
[map i r]

View File

@ -545,6 +545,15 @@
[(P x) (tag-test (T x) fixnum-mask fixnum-tag)]
[(E x) (nop)])
;(define-primop foo safe
; [(V) (K 0)])
;(define-primop fixnum-width safe
; [(V) (K 0)] ;(K (fxsll (- (* wordsize 8) fx-shift) fx-shift))]
; ;[(E) (nop)]
; ;[(P) (K #t)]
; )
(define-primop $fxzero? unsafe
[(P x) (prm '= (T x) (K 0))]
[(E x) (nop)])

View File

@ -18,7 +18,6 @@
(define fixnum-mask 3))
(module primops (primop? get-primop set-primop!)
(define cookie (gensym))
(define (primop? x)
(and (getprop x cookie) #t))