-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Separate code manager for the interpreter #112985
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR introduces a separate code manager dedicated to the interpreter by extracting base classes and adding new interpreter-derived classes for code generation and management.
- Extracted EECodeGenManager and CEECodeGenInfo base classes; added InterpreterJitManager and CInterpreterJitInfo.
- Updated headers to include interpreter-specific versions alongside JIT ones.
- Revised test configuration to use new interpreter environment variables instead of AltJit ones.
Reviewed Changes
File | Description |
---|---|
src/tests/JIT/interpreter/InterpreterTester.cs | Updates the test environment variables to use interpreter-specific keys, ensuring consistency with the new code manager changes. |
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
cc: @BrzVlad |
This conflicts with #111759 because cDAC starts to use the |
My preference would be to solve this by avoiding coupling between the JIT code manager and interpreter code manager. Leave the existing code header for JITed code alone, and define a dedicated code header for interpreted code. There is going to be some duplication for now and that's fine. The advantage is that it allows each of them to evolve independently. |
I am not sure I understand why cdac depends on the name of the code header. The JitCodeHeader / RealJitCodeHeader in my PR are not different from the old CodeHeader / RealCodeHeader, they are just renames of the old ones.
@jkotas do you mean instead of the shared EECodeGenManager base class to have the InterpreterJitManager a copy of almost all of the code from the EEJitManager? |
cdac infrastructure expects the data contract type representation to match the implementation. If you split a type into two types without actually changing the layout, it changes the data contract. You are right that the contract type representation does not have to match the implementation. There is probably a way how to convince the cdac infrastructure to deal with the divergence, but it is not how it is usually done. I am not sure whether we have a prior example.
I am concerned about the code header. I think we want the interpreter bytecode header to be decoupled from JITed code header, so we are free to change one in any way we want without impacting the other. I do not have a strong opinion whether it should be implemented as inheritance hierarchy, or as two types calling into static helpers to facilitate code sharing. |
Ah, so the concern is just the code header and the code that works with it, that makes sense. I also think we may eventually diverge the interpreter and jit code header. I was thinking you were talking about all of the code in the code manager. |
e028232
to
9fc72c4
Compare
1361187
to
fc7b33b
Compare
I've tried to run the dotnet/performance microbenchmarks for EH. All of them are about 5% worse with the last change that separates the code headers completely. With the initial change, the difference was < 2%. I need to think about some other way to solve the code header separation. |
I have reworked it and got rid of all of the regression. I will update this PR on Monday |
@jkotas can you please take another look? The code headers are now completely separated. |
* Refactored GC and EH info allocation * Added Interpreter-TODO at some places * Reverted some changes that were not needed anymore
903fea8
to
f690f1d
Compare
@jkotas I have updated the PR based on your feedback. |
* Get rid of some template usages by small refactoring
/ba-g the wasm failure is unrelated and it is a known infra issue. |
This change adds a separate code manager for the interpreted code. Here is a high level overview of the changes:
EECodeGenManager
was extracted from theEEJitManager
InterpreterJitManager
derived from theEECodeGenManager
was added and implemented.CEECodeGenInfo
was extracted from theCEEJitInfo
CInterpreterJitInfo
derived from theCEECodeGenInfo
was added and implementedCodeHeader
andRealCodeHeader
became base classes andJitCodeHeader
,RealJitCodeHeader
,InterpreterCodeHeader
andRealInterpreterCodeHeader
were added. TheCodeHeader
derivates don't add any extra data, theJitCodeHeader
just provides the methods that are needed to access Jit specific members of theRealJitCodeHeader
.UnsafeJitFunction
was refactored so that the interpreter (if enabled) is invoked first and then the AltJit / Jit ones are called.DOTNET_Interpreter
,DOTNET_InterpreterPath
andDOTNET_InterpreterName
env vars are added to match the existing AltJit ones.