roc/compiler/test_mono/generated/specialize_lowlevel.txt
ayazhafiz 17029cff7e Link aliased lambdas to the partial procs of the original symbol
This ensures that we use the correct specialized variable at the call
site of a function. In #2725 what happened was that a generalized
function was aliased, causing it to undergo generalization again. Then,
we lost the variable used to specialize at the call site. Instead, just
link to the partial proc being aliased directly.

There is an added benefit here, which is that we can avoid the
possibly-quadratic replacement of symbols in the generated statement.

Closes #2725
2022-03-14 16:42:53 -05:00

44 lines
1.4 KiB
Text

procedure Num.22 (#Attr.2, #Attr.3):
let Test.24 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Test.24;
procedure Num.24 (#Attr.2, #Attr.3):
let Test.21 : I64 = lowlevel NumMul #Attr.2 #Attr.3;
ret Test.21;
procedure Test.6 (Test.8, #Attr.12):
let Test.4 : I64 = UnionAtIndex (Id 0) (Index 0) #Attr.12;
let Test.23 : I64 = CallByName Num.22 Test.8 Test.4;
ret Test.23;
procedure Test.7 (Test.9, #Attr.12):
let Test.5 : I64 = UnionAtIndex (Id 1) (Index 0) #Attr.12;
let Test.20 : I64 = CallByName Num.24 Test.9 Test.5;
ret Test.20;
procedure Test.0 ():
let Test.5 : I64 = 2i64;
let Test.4 : I64 = 1i64;
let Test.12 : I64 = 42i64;
joinpoint Test.19 Test.13:
let Test.14 : U8 = GetTagId Test.13;
joinpoint Test.15 Test.11:
ret Test.11;
in
switch Test.14:
case 0:
let Test.16 : I64 = CallByName Test.6 Test.12 Test.13;
jump Test.15 Test.16;
default:
let Test.17 : I64 = CallByName Test.7 Test.12 Test.13;
jump Test.15 Test.17;
in
let Test.22 : Int1 = true;
if Test.22 then
let Test.6 : [C I64, C I64] = ClosureTag(Test.6) Test.4;
jump Test.19 Test.6;
else
let Test.7 : [C I64, C I64] = ClosureTag(Test.7) Test.5;
jump Test.19 Test.7;