This is an archive of the discontinued LLVM Phabricator instance.

Add a GCStrategy for CoreCLR
ClosedPublic

Authored by swaroop.sridhar on May 13 2015, 4:31 PM.

Details

Summary

This change adds a new GC strategy for supporting the CoreCLR runtime.

This strategy is currently identical to Statepoint-example GC,
but is necessary for several upcoming changes specific to CoreCLR, such as:

  1. Base-pointers are not explicitly reported for interior pointers
  2. Use a different format for stack-map encoding
  3. Location of Safe-point polls: polls are only needed before loop-back edges and before tail-calls (not needed at function-entry)
  4. Runtime specific handshake between calls to managed/unmanaged functions.

Diff Detail

Event Timeline

swaroop.sridhar retitled this revision from to Add a GCStrategy for CoreCLR .
swaroop.sridhar updated this object.
swaroop.sridhar edited the test plan for this revision. (Show Details)
swaroop.sridhar changed the visibility from "Public (No Login Required)" to "swaroop.sridhar (Swaroop Sridhar)".
swaroop.sridhar changed the visibility from "swaroop.sridhar (Swaroop Sridhar)" to "Public (No Login Required)".
swaroop.sridhar added a subscriber: Unknown Object (MLST).
sanjoy edited edge metadata.May 14 2015, 11:07 AM

Minor nit inline that can be fixed post-commit. Otherwise I don't see any issues with this change, but I'll wait for @reames to take a look.

lib/Transforms/Scalar/PlaceSafepoints.cpp
509

In a later change, I think we can change both "statepoint-example" and "coreclr" to be llvm::StringRefs and not std::strings to avoid allocation and deallocation on each call to shouldRewriteFunction.

lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
1933

Same comment w.r.t. std::string vs. llvm::StringRef here.

swaroop.sridhar edited edge metadata.

Replace two uses of std::string with llvm::StringRef

  • address Sanjoy's code review feedback.
pgavlin edited edge metadata.May 18 2015, 10:59 AM

Code changes LGTM. @reames, is there a list of available GC strategies that we should update?

reames accepted this revision.May 18 2015, 4:48 PM
reames edited edge metadata.

LGTM.

I would ask that you update the builtin GC documentation (http://llvm.org/docs/GarbageCollection.html#built-in-gc-strategies) to include your newly added one. Doing this as a follow on commit is fine.

lib/CodeGen/CoreCLRGC.cpp
44

Comment is stale, please fix.

54

This is the registration mechanism you were asking about. It's a nasty misuse of initializers, but I haven't gotten around to ripping it apart and rewriting yet.

This revision is now accepted and ready to land.May 18 2015, 4:48 PM
pgavlin added inline comments.May 18 2015, 4:50 PM
lib/CodeGen/CoreCLRGC.cpp
54

I had actually intended to ask which documentation we need to update, if any. Sorry for the confusion :)