DynamoDS/Dynamo — pull request #2650 by ke-yu (2014-10-09 08:58:44+00:00)
Title: Mark and Sweep implementation - part 2

This pull request continues the implementation for mark and sweep garbage collection.

The difficulty is to get gc root properly. We need to consider the following cases:
1. Replication. Suppose function returns an object instance/array/string, call site will save the return value from each replicated function and finally allocate an array for these values. If garbage collection kicks in, as these values are not referenced by any variable, they will be garbage collected. We have to cache these values somewhere so that they won't be GCed. In this pull request I simply put them in the core, see core's ``callSiteGCRoot``.
2. ``RX`` register should be one of GC roots. For associative language, GC will happen after each ``DEP`` instruction. For imperative language, GC will happen after each ``SETEXPUID`` instruciton, but this instruction may be executed before the value gets assigned to some variable. For example, it may happen in for-loop.
3. Gathering gc roots is in executive's ``GC()`` which traverses stack frames and gets all symbols.

Mark and Sweep is disabled now (compilation flag ``GC_MARK_AND_SWEEP``, now is ``GC_REFERENCE_COUNTING``) as there are around 200 errors and failures in ProtoTest. I'll address then in the following pull requests.

@junmendoza , @lukechurch , please review it. Thanks.