Improve handling of constants by the universal backend so that they are only created once