Gravar-mail: Optimizing memory transactions for large-scale programs