vm: Try to abstract dealing with tagged pointers in VM using macros.

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