|
2583 | 2583 | (typ-svec (caddr sig-svec)) |
2584 | 2584 | (tvars (cddr (cadddr sig-svec))) |
2585 | 2585 | (argtypes (cdddr typ-svec)) |
2586 | | - (functionloc (cadr (caddddr sig-svec)))) |
2587 | | - (let* ((argtype (foldl (lambda (var ex) `(call (core UnionAll) ,var ,ex)) |
2588 | | - (expand-forms `(curly (core Tuple) ,@argtypes)) |
2589 | | - (reverse tvars)))) |
2590 | | - `(_opaque_closure ,(or argt argtype) ,rt_lb ,rt_ub ,isva ,(length argtypes) ,allow-partial ,functionloc ,lam)))) |
| 2586 | + (functionloc (cadr (caddddr sig-svec))) |
| 2587 | + (argtype (foldl (lambda (var ex) `(call (core UnionAll) ,var ,ex)) |
| 2588 | + (expand-forms `(curly (core Tuple) ,@argtypes)) |
| 2589 | + (reverse tvars))) |
| 2590 | + (argtype (or argt argtype)) |
| 2591 | + (argtype (if (null? stmts) argtype `(block ,@stmts ,argtype)))) |
| 2592 | + `(_opaque_closure ,argtype ,rt_lb ,rt_ub ,isva ,(length argtypes) ,allow-partial ,functionloc ,lam))) |
2591 | 2593 |
|
2592 | 2594 | 'block |
2593 | 2595 | (lambda (e) |
@@ -5175,6 +5177,14 @@ f(x) = yt(x) |
5175 | 5177 | (define (set-lineno! lineinfo num) |
5176 | 5178 | (set-car! (cddr lineinfo) num)) |
5177 | 5179 |
|
| 5180 | +;; note that the 'list and 'block atoms make all lists 1-indexed. |
| 5181 | +;; returns a 5-element vector containing: |
| 5182 | +;; code: `(block ,@(n expressions)) |
| 5183 | +;; locs: list of line-table index, where code[i] has lineinfo line-table[locs[i]] |
| 5184 | +;; line-table: list of `(lineinfo file.jl 123 0)' |
| 5185 | +;; ssavalue-table: table of (ssa-num . code-index) |
| 5186 | +;; where ssavalue references in `code` need this remapping |
| 5187 | +;; label-table: table of (label . code-index) |
5178 | 5188 | (define (compact-ir body file line) |
5179 | 5189 | (let ((code '(block)) |
5180 | 5190 | (locs '(list)) |
@@ -5281,7 +5291,7 @@ f(x) = yt(x) |
5281 | 5291 | e) |
5282 | 5292 | ((ssavalue? e) |
5283 | 5293 | (let ((idx (get ssavalue-table (cadr e) #f))) |
5284 | | - (if (not idx) (begin (prn e) (prn lam) (error "ssavalue with no def"))) |
| 5294 | + (if (not idx) (error "internal bug: ssavalue with no def")) |
5285 | 5295 | `(ssavalue ,idx))) |
5286 | 5296 | ((eq? (car e) 'goto) |
5287 | 5297 | `(goto ,(get label-table (cadr e)))) |
|
0 commit comments