Lines Matching +refs:bulk +refs:provide

19 ;;  - (table-with-bulk-bindings hash[as above] list-of-bulk-binding-at)
22 ;; supplied (for the same scope sets) in the bulk bindings.
24 (provide empty-binding-table
26 binding-table-add-bulk
30 in-full-non-bulk-binding-table
34 prop:bulk-binding
35 (struct-out bulk-binding-class)
41 deserialize-table-with-bulk-bindings
42 deserialize-bulk-binding-at)
46 (struct table-with-bulk-bindings (syms
48 bulk-bindings)
51 (ser-push! 'tag '#:table-with-bulk-bindings)
52 (ser-push! (table-with-bulk-bindings-syms/serialize twbb))
53 (ser-push! (table-with-bulk-bindings-bulk-bindings twbb)))
56 (define (deserialize-table-with-bulk-bindings syms bulk-bindings)
57 (table-with-bulk-bindings syms syms bulk-bindings))
61 (struct bulk-binding-at (scopes ; scope set
62 bulk) ; bulk-binding
66 (ser-push! 'tag '#:bulk-binding-at)
67 (ser-push! (bulk-binding-at-scopes bba))
68 (ser-push! (bulk-binding-at-bulk bba)))
71 ;; bulk bindings are pruned depending on whether all scopes
77 (define (deserialize-bulk-binding-at scopes bulk)
78 (bulk-binding-at scopes bulk))
82 (define-values (prop:bulk-binding bulk-binding? bulk-binding-ref)
83 (make-struct-type-property 'bulk-binding))
85 ;; Value of `prop:bulk-binding`
86 (struct bulk-binding-class (get-symbols ; bulk-binding list-of-shift -> sym -> binding-info
87 create ; bulk-binding -> binding-info sym -> binding
88 modname)) ; bulk-binding list-of-shift -> resolved-module-path
89 (define (bulk-binding-symbols b s extra-shifts)
91 ((bulk-binding-class-get-symbols (bulk-binding-ref b))
94 (define (bulk-binding-create b)
95 (bulk-binding-class-create (bulk-binding-ref b)))
97 (define (force-bulk-bindings b bulk-shifts)
98 (define modname-ht (car bulk-shifts))
99 (define extra-shifts (cdr bulk-shifts))
101 (hash-set! modname-ht b ((bulk-binding-class-modname (bulk-binding-ref b)) b extra-shifts))
103 (bulk-binding-symbols b #f extra-shifts))
117 (binding-table-add (table-with-bulk-bindings-syms bt)
125 ;; with bulk representations of binding and they're used only to
126 ;; communicate to `provide`.
129 [just-for-nominal? (table-with-bulk-bindings-syms/serialize bt)]
130 [(eq? (table-with-bulk-bindings-syms bt)
131 (table-with-bulk-bindings-syms/serialize bt))
133 [else (binding-table-add (table-with-bulk-bindings-syms/serialize bt)
138 (struct-copy table-with-bulk-bindings bt
146 (define (binding-table-add-bulk bt scopes bulk
149 [(table-with-bulk-bindings? bt)
150 (define new-syms (remove-matching-bindings (table-with-bulk-bindings-syms bt)
152 bulk
154 (define new-syms/serialize (if (eq? (table-with-bulk-bindings-syms bt)
155 (table-with-bulk-bindings-syms/serialize bt))
157 … (remove-matching-bindings (table-with-bulk-bindings-syms/serialize bt)
159 bulk
161 (table-with-bulk-bindings new-syms
163 (cons (bulk-binding-at scopes bulk)
164 (table-with-bulk-bindings-bulk-bindings bt)))]
166 (binding-table-add-bulk (table-with-bulk-bindings bt bt null) scopes bulk)]))
168 ;; The bindings of `bulk` at `scopes` should shadow any existing
170 (define (remove-matching-bindings syms scopes bulk #:except except)
171 (define bulk-symbols (bulk-binding-symbols bulk #f null))
173 [((hash-count syms) . < . (hash-count bulk-symbols))
176 (if (hash-ref bulk-symbols sym #f)
180 ;; Faster to consider each sym in `bulk-symbols`
181 (for/fold ([syms syms]) ([sym (in-immutable-hash-keys bulk-symbols)])
205 ;; loading bulk bindings.
214 ([(ht bulk-bindings)
218 (values (hash-ref (table-with-bulk-bindings-syms table) sym #hash())
219 (table-with-bulk-bindings-bulk-bindings table))))]
225 ;; for walking down the list of bulk bindings
227 bulk-bindings)])
228 ;; We're done when we've moved on to the bulk-binding part
235 [(pair? i) (bulk-binding-at-scopes (car i))]
239 (define bulk (bulk-binding-at-bulk (car i)))
241 … (hash-ref (bulk-binding-symbols bulk s extra-shifts) sym #f)))
243 ((bulk-binding-create bulk) bulk b-info sym))]
251 bulk-bindings)])])]])))
255 ;; Iterate through all non-bulk symbol+scope+binding combinations.
259 (define-sequence-syntax in-full-non-bulk-binding-table
260 (lambda () #'do-not-use-in-full-non-bulk-binding-table-as-an-expression)
270 (table-with-bulk-bindings-syms table)))])
308 (define-values (ht bulk-bindings)
311 (values (table-with-bulk-bindings-syms table)
312 (table-with-bulk-bindings-bulk-bindings table))))
318 (for*/seteq ([bba (in-list bulk-bindings)]
319 #:when (subset? (bulk-binding-at-scopes bba) scs)
321 (bulk-binding-symbols (bulk-binding-at-bulk bba) s extra-shifts))])
334 (table-with-bulk-bindings-syms/serialize bt)))]
342 (define new-bulk-bindings
345 (for/list ([bba (in-list (table-with-bulk-bindings-bulk-bindings bt))]
346 #:when (subset? (bulk-binding-at-scopes bba) reachable-scopes))
347 (struct-copy bulk-binding-at bba
348 [scopes (intern-scopes (bulk-binding-at-scopes bba) state)]))))
350 (if (pair? new-bulk-bindings)
351 (table-with-bulk-bindings new-syms new-syms new-bulk-bindings)
353 (hash-set! (serialize-state-bulk-bindings-intern state) bt new-bt)
356 (define (binding-table-register-reachable bt get-reachable-scopes bulk-shifts reach register-trigge…
361 … (table-with-bulk-bindings-syms/serialize bt)))]
365 (scopes-register-reachable scopes v get-reachable-scopes bulk-shifts reach register-trigger))
366 ;; Need to check bulk-binding scopes for implicitly reachable
367 (when (table-with-bulk-bindings? bt)
368 (for ([bba (in-list (table-with-bulk-bindings-bulk-bindings bt))])
369 …(when bulk-shifts ; indicates that bulk bindings will be retained, and maybe they need to be reifi…
370 (force-bulk-bindings (bulk-binding-at-bulk bba) bulk-shifts))
371 …(scopes-register-reachable (bulk-binding-at-scopes bba) #f get-reachable-scopes bulk-shifts reach …
373 (define (scopes-register-reachable scopes v get-reachable-scopes bulk-shifts reach register-trigger)
377 (reach v bulk-shifts)]
391 (reach v bulk-shifts)
394 (reach sc bulk-shifts)))))