dylan-lang / opendylan

Open Dylan compiler and IDE
http://opendylan.org/
Other
458 stars 69 forks source link

DFMC doesn't implement post-facto call optimization #1187

Open housel opened 5 years ago

housel commented 5 years ago

In 2003, @ggreif proposed Post-Facto Type Inference https://github.com/dylan-hackers/www/blob/master/papers/PostFacto.lout as an optimization for constraining the types of values passed to generic functions. This optimization takes the fact that a GF call has succeeded as "evidence that the contract by types has been fulfilled," and infers the types of uses of these values dominated by the call site accordingly. A limited version of this optimization was implemented in the d2c compiler in 2003-2004.

It may be worthwhile to implement this optimization in dfmc-typist as well.

ggreif commented 5 years ago

Wow, my past comes back to haunt me :-)

Hi @housel!

pedro-w commented 5 years ago

Has anyone got a rendered (PDF?) version of this? I'd never heard of 'lout' before today. If not I will try and download/run the program myself. Thanks!

housel commented 4 years ago

The paper doesn't mention it, but I think it would make sense to unroll loops that contain dynamic dispatch once so that remaining iterations could take advantage of post-facto type constraints from the first iteration.

ggreif commented 4 years ago

I stopped working on the paper after the conference (so please excuse its miserable quality), but I have a PDF. TidBits_ChineseDispatch.lout.pdf