|
2599 | 2599 | (typ-svec (caddr sig-svec)) |
2600 | 2600 | (tvars (cddr (cadddr sig-svec))) |
2601 | 2601 | (argtypes (cdddr typ-svec)) |
2602 | | - (functionloc (cadr (caddddr sig-svec)))) |
2603 | | - (let* ((argtype (foldl (lambda (var ex) `(call (core UnionAll) ,var ,ex)) |
2604 | | - (expand-forms `(curly (core Tuple) ,@argtypes)) |
2605 | | - (reverse tvars)))) |
2606 | | - `(_opaque_closure ,(or argt argtype) ,rt_lb ,rt_ub ,isva ,(length argtypes) ,allow-partial ,functionloc ,lam)))) |
| 2602 | + (functionloc (cadr (caddddr sig-svec))) |
| 2603 | + (argtype (foldl (lambda (var ex) `(call (core UnionAll) ,var ,ex)) |
| 2604 | + (expand-forms `(curly (core Tuple) ,@argtypes)) |
| 2605 | + (reverse tvars))) |
| 2606 | + (argtype (or argt argtype)) |
| 2607 | + (argtype (if (null? stmts) argtype `(block ,@stmts ,argtype)))) |
| 2608 | + `(_opaque_closure ,argtype ,rt_lb ,rt_ub ,isva ,(length argtypes) ,allow-partial ,functionloc ,lam))) |
2607 | 2609 |
|
2608 | 2610 | 'block |
2609 | 2611 | (lambda (e) |
@@ -5232,6 +5234,14 @@ f(x) = yt(x) |
5232 | 5234 | (define (set-lineno! lineinfo num) |
5233 | 5235 | (set-car! (cddr lineinfo) num)) |
5234 | 5236 |
|
| 5237 | +;; note that the 'list and 'block atoms make all lists 1-indexed. |
| 5238 | +;; returns a 5-element vector containing: |
| 5239 | +;; code: `(block ,@(n expressions)) |
| 5240 | +;; locs: list of line-table index, where code[i] has lineinfo line-table[locs[i]] |
| 5241 | +;; line-table: list of `(lineinfo file.jl 123 0)' |
| 5242 | +;; ssavalue-table: table of (ssa-num . code-index) |
| 5243 | +;; where ssavalue references in `code` need this remapping |
| 5244 | +;; label-table: table of (label . code-index) |
5235 | 5245 | (define (compact-ir body file line) |
5236 | 5246 | (let ((code '(block)) |
5237 | 5247 | (locs '(list)) |
@@ -5338,7 +5348,7 @@ f(x) = yt(x) |
5338 | 5348 | e) |
5339 | 5349 | ((ssavalue? e) |
5340 | 5350 | (let ((idx (get ssavalue-table (cadr e) #f))) |
5341 | | - (if (not idx) (begin (prn e) (prn lam) (error "ssavalue with no def"))) |
| 5351 | + (if (not idx) (error "internal bug: ssavalue with no def")) |
5342 | 5352 | `(ssavalue ,idx))) |
5343 | 5353 | ((eq? (car e) 'goto) |
5344 | 5354 | `(goto ,(get label-table (cadr e)))) |
|
0 commit comments