Closed marvinborner closed 2 months ago
After PolymorphismBoxing, the above is:
interface Eff2384[A2383] {
eff2390: (A2383) => Unit374
}
def foo2387(){f2386} =
try { (){Eff$capability3800} =>
val v_coe_34833801: BoxedInt283 = f2386[BoxedInt283](boxInt285(42), Eff$capability3800);
unboxInt287(v_coe_34833801);
()
} with Eff2384[Int378] {
def eff2390(a2391: Int378){resume2392} =
println6(a2391)
};
def main2388() =
foo2387({ [T2393](x2394: T2393){Eff$capability3802} =>
Eff$capability3802.eff(x2394);
x2394
})
Where the parameter a
is incorrectly annotated / not transformed.
This would need to be fixed somewhere here, I think: https://github.com/effekt-lang/effekt/blob/458fc9cb0cfbeed87fd98273cc5e23414ad5f0c7/effekt/shared/src/main/scala/effekt/core/PolymorphismBoxing.scala#L226-L240
by making sure that blockType
is the actual (polymorphic) type of the operation in the interface (which we'd probably need to look up at the definition via a DeclarationContext / the PContext)
Remaining bugs:
// leaks cons
def main() = { [1,2,3].map { a => println(a) }; () }
// array is never freed
def main() = { allocate(5000); () }
I think we can merge this for now and work on the remaining issues later.
I guess a few splices are missing, hence the errors (the LLVM backend now also properly splices parameters).
Only one, I just chose the wrong version during merging.
This is an ongoing effort to fix some of the broken LLVM tests.
Already fixed:
For better diagnosing and a more reliable RTS overall, I also enabled and fixed GCC warnings.
Also, I believe there's a bug in polymorphism boxing:
This generates a function invocation
where
functionPointer_62
is actually a reference to(note the third argument boxed int
%Pos
vsi64
)Maybe @marzipankaiser can help?