reference count

8 views
Skip to first unread message

dmitry.z...@gmail.com

unread,
Mar 24, 2009, 6:21:33 AM3/24/09
to Phantom OS
I'm considering reference count as primary (fast) GC technique.
Anybody - any clue about how to implement it better - in compiler, in
VM code, split?

It comes to mind that in compiler it looks as:

1. For the object we created - perform escape analysis. If not
escaped, just destroy after last use. (No ref count needed at all,
possibly.) If escaped - set refcount to zero initially.

3. For incoming object - check if it finishes its life here (does not
escape further), if so - dec refcount on leaving object use scope. If
zero - destroy it.

2. For any object - inc refcount on any escape.

VM support is needed for objects coming from kernel code and leaving
to kernel, which is a real pain in the butt, but, well...

NB to myself: i2o must be treated as new.
Reply all
Reply to author
Forward
0 new messages