Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpreter GC info stage 2: Generate empty GC info and add baseline implementation of EnumGcRefs #113948

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

kg
Copy link
Member

@kg kg commented Mar 26, 2025

Depends on #113900, currently based on it

  • Modify GcInfoEncoder and its sibling files so that they can be successfully linked into the interpreter module; added new gcinfohelpers.h file with support code and macros
    • This required disabling a lot of logging and assertion code temporarily, so we need to figure out the right approach for that stuff before this lands.
    • There are a couple load-bearing asserts inside the encoder that need to be evaluated for safemath to not explode in debug builds of crossgen2.
    • I replaced all the existing assertions and logging with new GCINFO_ASSERT and GCINFO_LOG macros so we can easily come back and change this later and reduce the blast area of any weird tricks we pull, instead of redefining _ASSERTE or LOG.
  • Add new InterpreterGcInfoEncoder and InterpreterGcInfoDecoder
  • Link gcinfo into the interpreter so the encoder and decoder are available
  • At the end of interpreter method compilation, use InterpreterGcInfoEncoder to generate gc info for the method. EnumGcRefs will fail if we don't do this. We need to specifically do this at the end after the code header has been allocated, we can't do it earlier.
  • Add placeholder implementation of EnumGcRefs for the interpreter, modeled on the existing one for the JIT.
  • Add placeholder interp opcode that triggers a GC, so that we can easily test gcinfo and stackwalking in various interpreter scenarios.

janvorli and others added 8 commits March 25, 2025 22:38
This change adds support for walking stack with interpreter frames
present. The StackFrameIterator now considers the interpreter frames to
be frameless frames like regular JITted / crossgened folder.
This is a basis for GC, EH and debugger stack walking. The SOS
`clrstack` and `clrstack -i` both display correct stack trace with
interpreter frames on the stack with this change.

I have added some extra handling of the case when the interpreter frames
are on top of the stack so that the clrstack can dump them.
…that invokes the GC so we can test interpreter stack walking
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

kg added 3 commits March 26, 2025 15:07
Make GCINFO_ASSERT call _DbgBreak on assertion failure in debug builds (better than nothing)
… will use ICorJitInfo::doAssert on assertion failure to flow the assertion failure info through
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants