Storable and constant memory

Roman Leshchinskiy rl at cse.unsw.edu.au
Fri Apr 23 02:54:49 EDT 2010


Simon,

On 23/04/2010, at 16:49, Simon Peyton-Jones wrote:

> | foo v x = ... case readIntOffAddr# p# i# realWorld# of { (# s#,  n# #) ->
> |               case touch# fp s# of { _ -> 
>                foo v (Just (I# n# }})) ...
> 
> I'll implement that fix.  It should catch cases like this where the primops involves are
> 	- ok-for-speculation
> 	- have just one result (ie only one case alternative

I don't think touch# is ok-for-speculation.

primop TouchOp "touch#" GenPrimOp
   o -> State# RealWorld -> State# RealWorld
   with
   has_side_effects = True

Note the has_side_effects part. In fact, wouldn't it be eliminated altogether in this case if it was ok-for-speculation?

Roman




More information about the Libraries mailing list