* disabled gzipped fasl files. too slow :-(
This commit is contained in:
parent
580481d8fc
commit
fb48ef12bd
BIN
bin/ikarus
BIN
bin/ikarus
Binary file not shown.
|
@ -19,7 +19,7 @@
|
||||||
#define RTLD_DEFAULT 0
|
#define RTLD_DEFAULT 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USE_ZLIB 1
|
#define USE_ZLIB 0
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#if USE_ZLIB
|
#if USE_ZLIB
|
||||||
|
@ -473,6 +473,49 @@ static ikp do_read(ikpcb* pcb, fasl_port* p){
|
||||||
}
|
}
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
else if(c == 'l'){
|
||||||
|
int len = (unsigned char) fasl_read_byte(p);
|
||||||
|
if(len < 0){
|
||||||
|
fprintf(stderr, "invalid len=%d\n", len);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
ikp pair = ik_alloc(pcb, pair_size * (len+1)) + pair_tag;
|
||||||
|
if(put_mark_index){
|
||||||
|
p->marks[put_mark_index] = pair;
|
||||||
|
}
|
||||||
|
int i; ikp pt = pair;
|
||||||
|
for(i=0; i<len; i++){
|
||||||
|
ref(pt, off_car) = do_read(pcb, p);
|
||||||
|
ref(pt, off_cdr) = pt + pair_size;
|
||||||
|
pt += pair_size;
|
||||||
|
}
|
||||||
|
ref(pt, off_car) = do_read(pcb, p);
|
||||||
|
ref(pt, off_cdr) = do_read(pcb, p);
|
||||||
|
return pair;
|
||||||
|
}
|
||||||
|
else if(c == 'L'){
|
||||||
|
int len;
|
||||||
|
fasl_read_buf(p, &len, sizeof(int));
|
||||||
|
if(len < 0){
|
||||||
|
fprintf(stderr, "invalid len=%d\n", len);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
ikp pair = ik_alloc(pcb, pair_size * (len+1)) + pair_tag;
|
||||||
|
if(put_mark_index){
|
||||||
|
p->marks[put_mark_index] = pair;
|
||||||
|
}
|
||||||
|
int i; ikp pt = pair;
|
||||||
|
for(i=0; i<len; i++){
|
||||||
|
ref(pt, off_car) = do_read(pcb, p);
|
||||||
|
ref(pt, off_cdr) = pt + pair_size;
|
||||||
|
pt += pair_size;
|
||||||
|
}
|
||||||
|
ref(pt, off_car) = do_read(pcb, p);
|
||||||
|
ref(pt, off_cdr) = do_read(pcb, p);
|
||||||
|
return pair;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "invalid type '%c' (0x%02x) found in fasl file\n", c, c);
|
fprintf(stderr, "invalid type '%c' (0x%02x) found in fasl file\n", c, c);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
|
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -3,6 +3,7 @@
|
||||||
(export fasl-write)
|
(export fasl-write)
|
||||||
(import
|
(import
|
||||||
(ikarus system $codes)
|
(ikarus system $codes)
|
||||||
|
(ikarus system $pairs)
|
||||||
(ikarus system $records)
|
(ikarus system $records)
|
||||||
(ikarus system $io)
|
(ikarus system $io)
|
||||||
(ikarus system $bytevectors)
|
(ikarus system $bytevectors)
|
||||||
|
@ -48,13 +49,42 @@
|
||||||
(and ($char<= ($string-ref s i) ($fixnum->char 127))
|
(and ($char<= ($string-ref s i) ($fixnum->char 127))
|
||||||
(f s ($fxadd1 i) n)))))
|
(f s ($fxadd1 i) n)))))
|
||||||
|
|
||||||
|
(define (count-unshared-cdrs x h n)
|
||||||
|
(cond
|
||||||
|
[(and (pair? x) (eq? (get-hash-table h x #f) 0))
|
||||||
|
(count-unshared-cdrs ($cdr x) h ($fxadd1 n))]
|
||||||
|
[else n]))
|
||||||
|
|
||||||
|
(define (write-pairs x p h m n)
|
||||||
|
(cond
|
||||||
|
[($fx= n 0) (fasl-write-object x p h m)]
|
||||||
|
[else
|
||||||
|
(write-pairs (cdr x) p h
|
||||||
|
(fasl-write-object (car x) p h m)
|
||||||
|
($fxsub1 n))]))
|
||||||
|
|
||||||
(define do-write
|
(define do-write
|
||||||
(lambda (x p h m)
|
(lambda (x p h m)
|
||||||
(cond
|
(cond
|
||||||
[(pair? x)
|
[(pair? x)
|
||||||
|
(let ([d ($cdr x)])
|
||||||
|
(let ([n (count-unshared-cdrs d h 0)])
|
||||||
|
(cond
|
||||||
|
[($fx= n 0)
|
||||||
(write-char #\P p)
|
(write-char #\P p)
|
||||||
(fasl-write-object (cdr x) p h
|
(fasl-write-object d p h
|
||||||
(fasl-write-object (car x) p h m))]
|
(fasl-write-object (car x) p h m))]
|
||||||
|
[else
|
||||||
|
(cond
|
||||||
|
[($fx<= n 255)
|
||||||
|
(write-char #\l p)
|
||||||
|
(write-byte n p)]
|
||||||
|
[else
|
||||||
|
(write-char #\L p)
|
||||||
|
(write-int n p)])
|
||||||
|
(write-pairs d p h
|
||||||
|
(fasl-write-object (car x) p h m)
|
||||||
|
n)])))]
|
||||||
[(vector? x)
|
[(vector? x)
|
||||||
(write-char #\V p)
|
(write-char #\V p)
|
||||||
(write-int (vector-length x) p)
|
(write-int (vector-length x) p)
|
||||||
|
|
|
@ -843,14 +843,14 @@
|
||||||
[(assq x locs) => cdr]
|
[(assq x locs) => cdr]
|
||||||
[else
|
[else
|
||||||
(error 'bootstrap "no location for ~s" x)])))
|
(error 'bootstrap "no location for ~s" x)])))
|
||||||
(let ([p (open-output-file "ikarus.tmp" 'replace)])
|
(let ([p (open-output-file "ikarus.boot" 'replace)])
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (x) (compile-core-expr-to-port x p))
|
(lambda (x) (compile-core-expr-to-port x p))
|
||||||
core*)
|
core*)
|
||||||
(close-output-port p)))))
|
(close-output-port p)))))
|
||||||
|
|
||||||
(system "gzip -f ikarus.tmp")
|
;(system "gzip -f ikarus.boot.uncompressed")
|
||||||
(system "mv ikarus.tmp.gz ikarus.boot")
|
;(system "mv ikarus.boot.uncompressed.gz ikarus.boot")
|
||||||
|
|
||||||
(printf "Happy Happy Joy Joy\n")
|
(printf "Happy Happy Joy Joy\n")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue