[coop] New local handles implementation.
This is the initial code drop of a new handles implementation.
It differs from the previous one is a few ways:
- It keeps a separate stack of handles which is shared by all "arenas".
This eliminates malloc in the majority of the cases without the need for any tuning
- Custom gc scanning code for the handles stack.
The original implementation registered the chunks as a GC roots. Which is a terribly
slow operation as it takes the GC lock.
Instead of allocating a new handle arena for each icall, we compute a stack mark,
which is the position in the handles stack at icall entry. On exit, we simply restore that
position, which is just a couple of stores.
Since the stack is implemented using arraylets, addressed are stable in the face of
expansion.
Only the typed handles function/macros are in as having both typed and untyped handles
adds extra complexity for no clear value.
The macros only handle what was needed to port a sizeable chunk of locales.c.
This commit just sets the stage for the feature, there's quite some work left
before we can start using it, as it can be seen in the big TODO in handle.c