Manuel Jacob via llvm-dev
2015-Dec-31 02:51 UTC
[llvm-dev] [GC / Statepoints] Collector supports only base pointers as stack roots
Hi, My collector supports only base pointers as stack roots. This wasn't a problem until I tried to run some optimizations before RS4GC, which introduced (interior) derived pointers. The statepoint documentation mentions that these collectors exist, but doesn't mention whether and how this is currently supported. What could I do to make it work? -Manuel
Philip Reames via llvm-dev
2016-Jan-04 17:27 UTC
[llvm-dev] [GC / Statepoints] Collector supports only base pointers as stack roots
Fundamentally, the optimizer expects to be able to introduce derived pointers (both interior and exterior) in the form of GEPs. This is unavoidable. If you collector is non-relocating, you can simply ignore the derived portion of the relocation record. We report both the base pointer and the derived pointer for each derived pointer. If you take all the reported base pointers, then unique the set, you should have all of the objects you need to report as roots. If your collector is relocating, you'll need to give more information. In particular, I'm not sure you how you can implement a relocating collector which doesn't know about derived pointers without some really messy hacks. Philip On 12/30/2015 06:51 PM, Manuel Jacob wrote:> Hi, > > My collector supports only base pointers as stack roots. This wasn't > a problem until I tried to run some optimizations before RS4GC, which > introduced (interior) derived pointers. The statepoint documentation > mentions that these collectors exist, but doesn't mention whether and > how this is currently supported. What could I do to make it work? > > -Manuel
Manuel Jacob via llvm-dev
2016-Jan-04 22:30 UTC
[llvm-dev] [GC / Statepoints] Collector supports only base pointers as stack roots
On 2016-01-04 18:27, Philip Reames wrote:> Fundamentally, the optimizer expects to be able to introduce derived > pointers (both interior and exterior) in the form of GEPs. This is > unavoidable.Sure.> If you collector is non-relocating, you can simply ignore the derived > portion of the relocation record. We report both the base pointer and > the derived pointer for each derived pointer. If you take all the > reported base pointers, then unique the set, you should have all of > the objects you need to report as roots.Sure.> If your collector is relocating, you'll need to give more information. > In particular, I'm not sure you how you can implement a relocating > collector which doesn't know about derived pointers without some > really messy hacks.Can you explain how a collector could possibly handle derived pointers? In the meantime I found a solution, but I'm not sure it works in the general case and whether it qualifies as a "really messy hack": The collector, for each base, relocates the base pointer, computes an offset between the old and the new address, and applies that offset to all derived pointers from this base. -Manuel> Philip > > On 12/30/2015 06:51 PM, Manuel Jacob wrote: >> Hi, >> >> My collector supports only base pointers as stack roots. This wasn't >> a problem until I tried to run some optimizations before RS4GC, which >> introduced (interior) derived pointers. The statepoint documentation >> mentions that these collectors exist, but doesn't mention whether and >> how this is currently supported. What could I do to make it work? >> >> -Manuel