Pre-calculate offsets for attributes of class

Signed-off-by: Julien Pagès <julien.projet@gmail.com>