Fixing up a few things in zo-parse/etc

This commit is contained in:
Jay McCarthy 2010-07-26 12:18:01 -06:00
parent 8eeed89982
commit 28432037af
4 changed files with 16 additions and 12 deletions

View File

@ -1,6 +1,7 @@
#lang scheme/base
(require compiler/zo-structs
scheme/port
racket/vector
scheme/match
scheme/contract
scheme/local
@ -633,6 +634,7 @@
(bloop b2))]
[else
(encode-wrapped b)])))]
; XXX Cylic list error possible
[len (let loop ([datum datum][len 0])
(cond
[(null? datum) #f]
@ -643,14 +645,15 @@
(if len
(cons len p)
p))]
[(box x) (box (encode-wrapped x))]
[(vector a ...) (list->vector
(map encode-wrapped a))]
[(box x)
(box (encode-wrapped x))]
[(? vector? v)
(vector-map encode-wrapped v)]
[(? prefab-struct-key)
(let ([l (vector->list (struct->vector datum))])
(make-prefab-struct
(car l)
(map encode-wrapped (cdr l))))]
(define l (vector->list (struct->vector datum)))
(make-prefab-struct
(car l)
(map encode-wrapped (cdr l)))]
[_ datum])]
[p (cons enc-datum
(encode-wraps wraps))])

View File

@ -502,7 +502,6 @@
(if (integer? v)
(unmarshal-stx-get/decode cp v decode-stx)
(let loop ([v v])
;(printf "~s~n" v)
(let-values ([(cert-marks v encoded-wraps)
(match v
[`#((,datum . ,wraps) ,cert-marks) (values cert-marks datum wraps)]

View File

@ -11,7 +11,7 @@
@defmodule[compiler/zo-parse]
@defproc[(zo-parse [in input-port?]) compilation-top?]{
@defproc[(zo-parse [in input-port? (current-input-port)]) compilation-top?]{
Parses a port (typically the result of opening a @filepath{.zo} file)
containing bytecode. Beware that the structure types used to represent the

View File

@ -316,15 +316,15 @@ exec racket -t "$0" -- -s -t 60 -v -R $*
[compare-marshalled-to-marshalled-marshalled
#f
(bytes-not-equal?-error marshal-parsed marshal-marshalled)]
#;[show-orig-and-marshal-parsed
#f
(print-bytes read-orig marshal-parsed)]
#;[replace-with-marshalled
#t
(replace-file file marshal-marshalled)]
[decompile-parsed
#t
(decompile parse-orig)]
[show-orig-and-marshal-parsed
#f
(print-bytes read-orig marshal-parsed)]
[c-parse-marshalled
#t
(read-compiled-bytes marshal-parsed)]
@ -333,6 +333,8 @@ exec racket -t "$0" -- -s -t 60 -v -R $*
(bytes-not-equal?-error read-orig marshal-parsed)])
(define (run-test file)
(when (debugging?)
(printf "~a\n" file))
(run-with-limit
file
(* 1024 1024 128)