robert-strandh / SICL

A fresh implementation of Common Lisp
Other
1.07k stars 79 forks source link

Type inference #42

Closed Bike closed 8 years ago

Bike commented 8 years ago

Approximately a million changes here. Major ones:

This code hasn't been tested on large code. The transforms especially are tentative.

Here is how I imagine type-related phases going:

  1. in safe code, thes->typeqs is run to turn declarations into assertions.
  2. run infer-types
  3. run any transforms that need type information. the fact that they can alter the graph is problematic for maintaining the coherence of the type dictionary, but it should be okay some of the time, and if there is a problem you could just rerun infer-types on an altered graph. The most important transform to run is probably prune-typeqs, which can cut out big parts of the instruction graph.
  4. in unsafe code (or in mostly-safe code to axe the-values), delete-the is run to eliminate the now useless instructions before MIR generation.

but of course running any transforms is optional.

Current limitations:

The merge conflict seems to be in ast-to-source. sorry about that. I think this is something you resolve? Just use the version in this commit instead of master so that THE-ASTs display correctly.