[runtime] Fix the calculation of the instance size of ptr/var types. (#3790)