Imported changes from Rubinius.