Dynamic translation of runtime environments for heterogeneous computing