Opened 5 years ago

Last modified 4 years ago

#9289 new feature request

add anyToAddr# :: (#a#)-> Addr# primop (inverse of addrToAny#)

Reported by: carter Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


I was talking with Reid Barton, and he pointed out that having a primop with type

anyToAddr# :: (#a#)-> Addr#

would help with a lot of performance hacking.

One use case would be running prefetch on lifted values without evaluating them.

Change History (8)

comment:1 Changed 5 years ago by rwbarton

In particular, you could use it to prefetch a heap object without making any assumptions about the representation of pointers to heap objects (imagine if we used a pointer tagging scheme that used bits 48-62 on x86_64, or compressed pointers). Not sure off-hand what else it would be useful for given that the GC could move the object after we get the Addr#; maybe it makes more sense to add a variant of prefetch a -> Int# -> (# a #) instead.

comment:2 Changed 5 years ago by carter

Thats a good idea!

comment:3 Changed 5 years ago by schyler

A more appropriate name addrOf# maybe.

comment:4 Changed 5 years ago by carter

It won't be an address.

In general, it could also be an Int# or Word# casted to an Addr# :)

comment:5 Changed 5 years ago by thoughtpolice


Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:6 Changed 4 years ago by thoughtpolice


Milestone renamed

comment:7 Changed 4 years ago by thomie

Type of failure: None/UnknownRuntime performance bug

comment:8 Changed 4 years ago by thomie

Milestone: 8.0.1
Note: See TracTickets for help on using tickets.