269
269
270
270
const IRVar = Union{Core. SSAValue, Core. SlotNumber}
271
271
272
- function bind_var! (var_literal, bindings:: Bindings , ir:: Core.CodeInfo )
273
- # for literal constants
274
- push! (bindings, var_literal)
272
+ function bind_var! (var, bindings:: Bindings , ir:: Core.CodeInfo )
273
+ # for literal constants, and statuc parameter
274
+ var = Meta. isexpr (var, :static_parameter ) ? ir. parent. sparam_vals[var. args[1 ]] : var
275
+ push! (bindings, var)
275
276
idx = length (bindings)
276
277
return idx
277
278
end
@@ -412,12 +413,8 @@ function translate!!(var::IRVar, line::Expr,
412
413
bindings:: Bindings , isconst:: Bool , ir:: Core.CodeInfo )
413
414
head = line. head
414
415
_bind_fn = (x) -> bind_var! (x, bindings, ir)
415
- # expand static parameter
416
- _expand_sp = (x) -> begin
417
- Meta. isexpr (x, :static_parameter ) ? ir. parent. sparam_vals[x. args[1 ]] : x
418
- end
419
416
if head === :new
420
- args = map (_bind_fn ∘ _expand_sp , line. args)
417
+ args = map (_bind_fn, line. args)
421
418
return Instruction (__new__, args |> Tuple, _bind_fn (var))
422
419
elseif head === :call
423
420
# Only some of the function calls can be optimized even though many of their results are
@@ -427,7 +424,7 @@ function translate!!(var::IRVar, line::Expr,
427
424
v = ir. ssavaluetypes[var. id]. val
428
425
_canbeoptimized (v) && return _const_instruction (var, v, bindings, ir)
429
426
end
430
- args = map (_bind_fn ∘ _expand_sp , line. args)
427
+ args = map (_bind_fn, line. args)
431
428
# args[1] is the function
432
429
func = line. args[1 ]
433
430
if Meta. isexpr (func, :static_parameter ) # func is a type parameter
0 commit comments