[llvm-dev] RFC: Strong GC References in LLVM

Sanjoy Das via llvm-dev
Mon, 11 Jul 2016 22:55:03 -0000

[+CC Jingyue Wu, John Criswell]

Updating with some informal discussion on IRC.

Chandler Carruth wrote:
 > My high-level comment is that I'm not really sure we need a new type
 > here. I'm curious whether we can make non-zero-address-space pointers
 > have the semantics you need in a conservative model.

That's close to what I suggested in the 'Proposed Solution' section,
but I didn't explicitly mention anything about being conservative for
unknown address spaces, and being precise/more aggressive for
explicitly enumerated address spaces.  That's a reasonable stance, but
I'd like to hear from other users of exotic address spaces (CC'ed).

[snip]

 > I think this is the interesting thing. It is essentially saying that
 > loads of a non-zero address space pointer are control dependent which I
 > don't think is necessarily true with our current definitions of
address
 > spaces, but I think this might be a very reasonable desire.
 >
 > If anything, we might want something in the datalayout that identifies
 > whether particular address spaces can be speculatively loaded from. This

This is an interesting point worth stressing -- the new thing here is
that we're making the semantics of stores and loads a function of the
pointee *type* i.e. the address space of the pointer we are loading or
storing, not just the address space of the pointer type we're loading
*from* or storing *to*.  This is new because so far (at least
informally) they've been a function of just the pointee *size*, and
the address space of the location being stored to / loaded from.

[snip]

 > So I'm curious whether this seems reasonable to you (and others). To
 > summarize: make address spaces sufficiently conservative by default to
 > satisfy the requirements for GC pointers, and add "opt-in"
mechanisms
 > for generic transforms that existing users of non-zero address spaces
 > actually desire.

This sounds good.

 > Alternatively, I'm interested in any examples that more firmly
 > illustrate the reasons why address spaces are fundamentally the wrong
 > *model* for GC pointers.

As discussed on IRC, that's what I had in mind initially.

-- Sanjoy