factor out some VM-target stuff
Fix codegen of pointer differences