value-based dirty checking on reference types