Skip to content

Commit a6bafe5

Browse files
committed
when doing online expansion, never use errortrace annotations
also, fix a likely bug introduced by the possibility of 'lang-default in the simple-settings annotations field
1 parent 34fade1 commit a6bafe5

6 files changed

Lines changed: 41 additions & 36 deletions

File tree

drracket-core-lib/drracket/private/expanding-place.rkt

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@
125125
(parameterize ([current-custodian cust])
126126
(thread
127127
(λ ()
128-
(define no-annotations?
129-
;; if there is an annotation set up, then this compiled
130-
;; code won't be the right compiled code, so don't save it
131-
(equal? (prefab-module-settings-annotations settings) 'none))
132128
(ep-log-info "expanding-place.rkt: 00 starting monitors")
133129
(for ([handler (in-list handlers)])
134130
(define pc (handler-monitor-pc handler))
@@ -168,11 +164,6 @@
168164
loaded-paths))
169165
(cl path mod-name))))
170166
(ep-log-info "expanding-place.rkt: 03 setting module language parameters")
171-
(when (equal? (prefab-module-settings-annotations settings) 'debug)
172-
(current-compile
173-
(make-debug-compile-handler/errortrace-annotate
174-
(current-compile)
175-
errortrace-annotate)))
176167
(set-module-language-parameters settings
177168
module-language-parallel-lock-client
178169
null
@@ -222,15 +213,12 @@
222213
(namespace-syntax-introduce stx)
223214
raise-hopeless-syntax-error))
224215
(define log-io? (log-level? expanding-place-logger 'warning))
225-
(define-values (in out)
226-
(if (or log-io? no-annotations?)
227-
(make-pipe)
228-
(values #f (open-output-nowhere))))
216+
(define-values (in out) (make-pipe))
229217
(define the-io (make-channel))
230218
(cond
231219
[log-io?
232220
(thread (λ () (catch-and-log in the-io)))]
233-
[no-annotations?
221+
[else
234222
(thread (λ () (catch-and-check-non-empty in the-io)))])
235223
(ep-log-info "expanding-place.rkt: 09 starting expansion")
236224
(define expanded
@@ -239,11 +227,9 @@
239227
(expand transformed-stx)))
240228
(ep-log-info "expanding-place.rkt: 10 finished expansion")
241229
(define no-io-happened?
242-
(cond
243-
[(or log-io? no-annotations?)
244-
(close-output-port out)
245-
(channel-get the-io)]
246-
[else #f]))
230+
(begin
231+
(close-output-port out)
232+
(channel-get the-io)))
247233
(channel-put old-registry-chan
248234
(namespace-module-registry (current-namespace)))
249235
(place-channel-put pc-status-expanding-place 'finished-expansion)
@@ -278,13 +264,12 @@
278264
(ep-log-info "expanding-place.rkt: 12 handlers finished")
279265
(define compiled-bytes
280266
(cond
281-
[(and no-annotations?
282-
;; we don't try to reuse the compiled bytes
283-
;; if there was any IO because we cannot tell
284-
;; which part is to be replayed and which
285-
;; isn't; just re-run the expansion on the
286-
;; user's side so they see the IO directly
287-
no-io-happened?)
267+
[no-io-happened?
268+
;; we don't try to reuse the compiled bytes
269+
;; if there was any IO because we cannot tell
270+
;; which part is to be replayed and which
271+
;; isn't; just re-run the expansion on the
272+
;; user's side so they see the IO directly
288273
(define compiled (compile expanded))
289274
(define bp (open-output-bytes))
290275
(define write-succeeded?

drracket-core-lib/drracket/private/language.rkt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"rep.rkt"
3131
"local-member-names.rkt"
3232
"compiled-dir.rkt"
33+
"insulated-read-language.rkt"
3334
(prefix-in pict-snip: "pict-snip.rkt"))
3435

3536
(import [prefix drracket:debug: drracket:debug^]
@@ -235,6 +236,14 @@
235236
(define make-simple-settings make-drracket:language:simple-settings)
236237
(define simple-settings make-simple-settings)
237238

239+
(define (get-simple-settings-annotations settings the-irl)
240+
(cond
241+
[(equal? (drracket:language:simple-settings-annotations settings) 'lang-default)
242+
(call-read-language the-irl
243+
'drracket:default-instrumentation
244+
'debug)]
245+
[else (drracket:language:simple-settings-annotations settings)]))
246+
238247
(define (simple-settings->vector s)
239248
(vector (drracket:language:simple-settings-case-sensitive s)
240249
(drracket:language:simple-settings-printing-style s)

drracket-core-lib/drracket/private/module-language.rkt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,18 @@
142142
(collection-paths command-line-args auto-text compilation-on? full-trace? submodules-to-run
143143
enforce-module-constants))
144144

145-
(define (module-language-settings->prefab-module-settings settings)
145+
(define (module-language-settings->prefab-module-settings settings #:irl the-irl)
146146
(prefab-module-settings (module-language-settings-command-line-args settings)
147147
(module-language-settings-collection-paths settings)
148148
(module-language-settings-compilation-on? settings)
149149
(module-language-settings-full-trace? settings)
150-
(drracket:language:simple-settings-annotations settings)
150+
(cond
151+
[(not the-irl)
152+
;; when we don't have an irl, we're doing
153+
;; online expansion which we never instrument
154+
'none]
155+
[else
156+
(drracket:language:get-simple-settings-annotations settings the-irl)])
151157
(module-language-settings-enforce-module-constants settings)))
152158

153159
(define default-compilation-on? #t)
@@ -390,7 +396,7 @@
390396
(run-in-user-thread
391397
(λ ()
392398
(set-module-language-parameters
393-
(module-language-settings->prefab-module-settings settings)
399+
(module-language-settings->prefab-module-settings settings #:irl the-irl)
394400
module-language-parallel-lock-client
395401
currently-open-files)))))
396402

@@ -428,7 +434,8 @@
428434

429435
(define-values (name lang module-expr)
430436
(cond
431-
[(drracket:rep:current-pre-compiled-transform-module-results)
437+
[(and (drracket:rep:current-pre-compiled-transform-module-results)
438+
(equal? (drracket:language:get-simple-settings-annotations settings the-irl) 'none))
432439
=>
433440
(λ (transform-module-results)
434441
(define compiled-expression
@@ -2379,7 +2386,7 @@
23792386
(define settings (tab-in-module-language dirty/pending-tab))
23802387
(send-to-place editor-contents
23812388
filename/loc
2382-
(module-language-settings->prefab-module-settings settings)
2389+
(module-language-settings->prefab-module-settings settings #:irl #f)
23832390
(λ (res) (oc-finished res))
23842391
(λ (a b) (oc-status-message a b))
23852392
(λ (key val) (oc-monitor-value key val))

drracket-core/scribblings/drracket/status.scrbl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,13 @@ left to right:
5858
go and which how renaming any given variable affects
5959
any of the others. If it is green, DrRacket's online
6060
expansion has finished. If it is a spiky green ball
61-
(instead of a round green ball), then DrRacket will use
61+
(instead of a round green ball), and the language settings
62+
do not imply errortrace annotations, then DrRacket will use
6263
the result of the online expansion to speed up the
6364
@onscreen{Run} button. That is, when the green spiky ball
64-
is present, DrRacket will not
65-
expand or compile your program, but just run it directly.
65+
is present, DrRacket will have already
66+
expanded and compiled your program, and can reuse that work,
67+
as long as errortrace debugging, profiling, and test suite
68+
coverage are turned off.
6669
}
6770
]

drracket-plugin-lib/drracket/private/drsig.rkt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@
381381
simple-module-based-language-render-value/format
382382
add-menu-shortcut
383383
mouse-event-uses-shortcut-prefix?
384-
lang-default-annotations))
384+
lang-default-annotations
385+
get-simple-settings-annotations))
385386

386387
(define-signature drracket:multi-file-search-cm^
387388
())

drracket-test/tests/drracket/online-compilation-zo-creation.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
(find-relative-path tmp-dir file))]
7272
[else
7373
'()]))
74-
(define expected-file (build-path compiled-dir "drracket/errortrace/y_rkt.zo"))
74+
(define expected-file (build-path compiled-dir "drracket/y_rkt.zo"))
7575
(unless (member expected-file compiled-dir-files)
7676
(eprintf "expected to find ~s in compiled dir but it contained ~s\n"
7777
expected-file compiled-dir-files))

0 commit comments

Comments
 (0)