Skip to content

Commit

Permalink
add GCCover contract docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Charlamb committed Dec 3, 2024
1 parent 9625d22 commit 3cf533a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/design/datacontracts/GCCover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Contract GCCover

This contract encapsulates support for [GCCover](../coreclr/jit/investigate-stress.md) (GC stress testing) in the runtime.

## APIs of contract

```csharp
public virtual TargetPointer? GetGCCoverageInfo(NativeCodeVersionHandle codeVersionHandle);
```

## Version 1

Data descriptors used:
| Data Descriptor Name | Field | Meaning |
| --- | --- | --- |
| NativeCodeVersionNode | GCCoverageInfo | pointer to GC coverage info |

Contracts used:
| Contract Name |
| --- |
| CodeVersions |
| RuntimeTypeSystem |

### Getting GCCoverageInfo for a NativeCodeVersion
```csharp
public virtual TargetPointer? GetGCCoverageInfo(NativeCodeVersionHandle codeVersionHandle);
```
1. If `codeVersionHandle` is synthetic, attempt to read the GCCoverageInfo off of the MethodDesc using the RuntimeTypeSystem contract.
2. If `codeVersionHandle` is explicit, fetch the `NativeCodeVersionNode` and attempt to read the `GCCoverageInfo` pointer. This value will only exist on targets with `HAVE_GCCOVER` enabled. If this value exists return it. Otherwise return null.
3 changes: 3 additions & 0 deletions docs/design/datacontracts/RuntimeTypeSystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ partial interface IRuntimeTypeSystem : IContract
// Get an instruction pointer that can be called to cause the MethodDesc to be executed
public virtual TargetCodePointer GetNativeCode(MethodDescHandle methodDesc);

// Gets the GCCoverageInfo pointer if available.
// If not enabled in the target process, returns null.
public virtual TargetPointer? GetGCCoverageInfo(MethodDescHandle methodDesc);
}
```

Expand Down

0 comments on commit 3cf533a

Please sign in to comment.