Skip to content

Instantly share code, notes, and snippets.

@greghendershott
Created March 5, 2015 21:06
Show Gist options
  • Save greghendershott/a8f49988cac07b19afa5 to your computer and use it in GitHub Desktop.
Save greghendershott/a8f49988cac07b19afa5 to your computer and use it in GitHub Desktop.
Fully expanding and instrumenting
(module simple racket
(+ 1 1))
;; Fully expanded
(module simple racket
(#%module-begin
(module configure-runtime '#%kernel
(#%module-begin (#%require racket/runtime-config) (#%app configure '#f)))
(#%app call-with-values (lambda () (#%app + '1 '1)) print-values)))
;; Then instrumented for:
;; 1. Better stack traces
;; 2. Test coverage
;; 3. Profiling
(begin
(#%plain-app set-mcar! {#f . covered?} #t)
(module simple racket
(#%module-begin
(module configure-runtime '#%kernel
(#%module-begin
(#%require racket/runtime-config)
(#%app configure '#f)))
(begin
(#%plain-app set-mcar! {#f . covered?} #t)
(with-continuation-mark
'#<procedure:errortrace-key>
'((+ 1 1) #<path:/tmp/simple.rkt> 2 0 14 7)
(#%app
call-with-values
(begin
(#%plain-app set-mcar! {#f . covered?} #t)
(lambda ()
(let ((g1906
(#%plain-app
'#<procedure:register-profile-start>
'profile-point1905)))
(with-continuation-mark
'g1876
'profile-point1905
(begin
(begin
(#%plain-app set-mcar! {#f . covered?} #t)
(with-continuation-mark
'#<procedure:errortrace-key>
'((+ 1 1) #<path:/tmp/simple.rkt> 2 0 14 7)
(#%app
(begin (#%plain-app set-mcar! {#f . covered?} #t) +)
(begin (#%plain-app set-mcar! {#f . covered?} #t) '1)
(begin
(#%plain-app set-mcar! {#f . covered?} #t)
(begin
(#%plain-app
'#<procedure:register-profile-done>
'profile-point1905
g1906)
'1))))))))))
print-values))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment