vm: Abstract working with tagged pointers in VM using macro accessors.

Based on issues raised during recent review and inconsistency of different
implementations.