Implement FFI global references in nitg

Finally follows the spec of the FFI.

Works with the `minesweeper` test case by @Freddrickk, but not with nitvm #582 (more on that later).