Update gc2 based on an error found by Robby's student

This commit is contained in:
Jay McCarthy 2013-08-09 09:07:50 -06:00
parent 585551d942
commit 086a1b7525
3 changed files with 15 additions and 8 deletions

View File

@ -268,14 +268,13 @@
leftovers
(cons (make-root 'closure-root
(λ () this-loc)
(λ (v)
(set! this-loc v)
(this-setter v)
(for ([root (in-list this-other-roots)])
(set-root! v))))
(λ (v) (set! this-loc v)
(this-setter v)
(for ([root (in-list this-other-roots)])
(set-root! v))))
closure-roots))])))
(parameterize ([active-roots remaining-roots])
(collector:closure closure closure-roots)))
(collector:closure closure (reverse closure-roots))))
(define-syntax (mutator-app stx)
(syntax-case stx ()
@ -627,7 +626,7 @@
(apply (closure-code-proc v)
(append
(for/list ([i (in-range (closure-code-env-count v))])
(collector:closure-env-ref proc/loc i))
(collector:closure-env-ref proc/loc i))
args)))]
[else
(error 'procedure-application "expected procedure, given ~e" v)]))

View File

@ -93,7 +93,7 @@ A collector for use in testing the random mutator generator.
(define (gc:first pr-ptr)
(if (equal? (heap-ref pr-ptr) 'pair)
(heap-ref (+ pr-ptr 1))
(error 'first "non pair")))
(error 'first "non pair: loc ~e val ~e" pr-ptr (heap-ref pr-ptr))))
(test (with-heap (vector 'free 'flat 3 'pair 0 1)
(gc:first 3))

View File

@ -0,0 +1,8 @@
#lang plai/gc2/mutator
(allocator-setup "../good-collectors/good-collector.rkt" 255)
(define (f b) 17)
(define (g l f)
((lambda (x) (f (first l)))
1))
(g '(3) f)