[vm] Implemented swap_table and swap_in/swap_out functions