Generational behavior for the garbage collector

Same as #5227 but living in this repo & squashed.

```ffs``` stands for find first set (also named count leading zeros). I thought this was provided by the libc everywhere.
We may need a few defines in some headers if the name of the function is not the same (or provide it ourselves).