samrushing / irken-compiler

Irken is a statically typed variant of Scheme. Or a lisp-like variant of ML.
http://nightmare.com/rushing/irken.html
BSD 2-Clause "Simplified" License
210 stars 17 forks source link

need to add back in the single-immediate optimization #5

Open samrushing opened 11 years ago

samrushing commented 11 years ago

This was originally in the python compiler, if a datatype contains an alt with a single immediate in it, and this immediate type is not present again in the datatype, then we can skip the box layer and use that immediate directly.

Example:

(datatype thing
  (:level int)
  (:abbrev char)
  )

This version of thing can actually be always stored as an immediate, quite a handy optimization. This version cannot:

(datatype thing
  (:level int)
  (:abbrev int)
  )

... because there is no way at runtime to distinguish between the two ints.

samrushing commented 9 years ago

This might be moot with precise gc and untagged immediates.

jeske commented 7 years ago

I would not bother with this. I think this is premature optimization, and is adding complexity to a tag system that will be moot with untagged immediates and precise gc.