mozart/mozart2 — pull request #8 by kennytm (2012-09-17 10:55:24+00:00)
Title: Implement System.gcDo, ozProtect and ozUnprotect.

Some minor changes for the GC.

## System.gcDo

The VM now has an extra boolean, which when set to true will force GC in the next `vm->run()`. This is based on the implementation of that in VM 1.4.

## `ozProtect` and `ozUnprotect`

Similar to OZ_protect and OZ_unprotect in VM 1.4, they prevent a node from being freed after a GC, to safely store Oz nodes inside a C pointer in long term. However, **their usage is
distinct from that of 1.4**. Commit 8165013 described in depth the new API. I didn't made it work like VM 1.4, as I can't think of a safe way to implement that :)

Implementation-wise, the protected nodes in this pull request form a hash set of stable node references (similar to BoostBasedVM::_asyncIONodes), while in VM 1.4 it was a singly linked
list of reference-counted pointers of terms. I did not implement the reference-counting part, and I'm sure protecting the same node twice won't cause problem (it will just create two
different stable node references to the same stable node).