Implement atomicWriteIORef primitively
Needs ReviewPublic

Authored by dfeuer on Jun 22 2018, 3:56 PM.

Details

Summary

atomicModifyIORef allocates memory. We really don't need that
much power to implement atomicWriteIORef, so we shouldn't
have to eat the cost. Implement it as a new primop instead.

Note: this is an alternative to D4886.

dfeuer created this revision.Jun 22 2018, 3:56 PM
dfeuer edited the summary of this revision. (Show Details)Jun 22 2018, 4:02 PM
dfeuer updated this revision to Diff 17064.Jun 22 2018, 4:33 PM

Fix mistakes

dfeuer updated this revision to Diff 17068.Jun 23 2018, 2:01 AM
  • Take fryguybob's suggestion
  • Rename

Personally I prefer this to D4886. The caution required around laziness in the other approach seemed very subtle.

My question on D4886 applies here too - why do we need a loop?