Instrument pattern matching for feature-specific profiling.
This commit is contained in:
parent
5502bf5b1b
commit
fc512ba78d
|
@ -428,13 +428,16 @@
|
||||||
([fail (make-rename-transformer
|
([fail (make-rename-transformer
|
||||||
(quote-syntax #,esc))])
|
(quote-syntax #,esc))])
|
||||||
#,(Row-rhs (car blocks)))])
|
#,(Row-rhs (car blocks)))])
|
||||||
(if (Row-unmatch (car blocks))
|
(define unmatch (Row-unmatch (car blocks)))
|
||||||
#`(call-with-continuation-prompt
|
(if unmatch
|
||||||
(lambda () (let ([#,(Row-unmatch (car blocks))
|
(quasisyntax/loc unmatch
|
||||||
(lambda () (abort-current-continuation match-prompt-tag))])
|
(call-with-continuation-prompt
|
||||||
|
(lambda () (let ([#,unmatch
|
||||||
|
(lambda ()
|
||||||
|
(abort-current-continuation match-prompt-tag))])
|
||||||
rhs))
|
rhs))
|
||||||
match-prompt-tag
|
match-prompt-tag
|
||||||
(lambda () (#,esc)))
|
(lambda () (#,esc))))
|
||||||
#'rhs))])
|
#'rhs))])
|
||||||
;; then compile the rest, with our name as the esc
|
;; then compile the rest, with our name as the esc
|
||||||
(loop (cdr blocks) #'f (cons #'[f (lambda () c)] acc)))))])
|
(loop (cdr blocks) #'f (cons #'[f (lambda () c)] acc)))))])
|
||||||
|
|
|
@ -55,7 +55,11 @@
|
||||||
'match (format "wrong number of match clauses, expected ~a and got ~a" len lp) pats))
|
'match (format "wrong number of match clauses, expected ~a and got ~a" len lp) pats))
|
||||||
(define (mk unm rhs)
|
(define (mk unm rhs)
|
||||||
(make-Row (for/list ([p (syntax->list pats)]) (parse p))
|
(make-Row (for/list ([p (syntax->list pats)]) (parse p))
|
||||||
#`(let () . #,rhs) unm null))
|
(syntax-property
|
||||||
|
(quasisyntax/loc stx
|
||||||
|
(let () . #,rhs))
|
||||||
|
'feature-profile:pattern-matching 'antimark)
|
||||||
|
unm null))
|
||||||
(syntax-parse rhs
|
(syntax-parse rhs
|
||||||
[()
|
[()
|
||||||
(raise-syntax-error
|
(raise-syntax-error
|
||||||
|
@ -72,7 +76,12 @@
|
||||||
[_ (mk #f rhs)])))
|
[_ (mk #f rhs)])))
|
||||||
(define/with-syntax body
|
(define/with-syntax body
|
||||||
(compile* (syntax->list #'(xs ...)) parsed-clauses #'outer-fail))
|
(compile* (syntax->list #'(xs ...)) parsed-clauses #'outer-fail))
|
||||||
|
(define/with-syntax (exprs* ...)
|
||||||
|
(for/list ([e (in-list (syntax->list #'(exprs ...)))])
|
||||||
|
(syntax-property e 'feature-profile:pattern-matching 'antimark)))
|
||||||
|
(syntax-property
|
||||||
(quasisyntax/loc stx
|
(quasisyntax/loc stx
|
||||||
(let ([xs exprs] ...)
|
(let ([xs exprs*] ...)
|
||||||
(define (outer-fail) raise-error)
|
(define (outer-fail) raise-error)
|
||||||
body))]))
|
body))
|
||||||
|
'feature-profile:pattern-matching #t)]))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user