Skip to content

Conversation

@huoyaoyuan
Copy link
Member

@huoyaoyuan huoyaoyuan commented Nov 5, 2025

Continuation of #116422. Contains most usages except I/O redirection for new process.
Combined with little refactors for reading file contents.

@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 5, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Nov 5, 2025
@dotnet-policy-service
Copy link
Contributor

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

#include "jitmetadatalist.h"

fw.Print("\n");
fs << std::endl;
Copy link
Member

@jakobbotsch jakobbotsch Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fs << std::endl;
fs << "\n";

std::endl will flush the output stream. We do not want to do that for every context we are processing.
Can you please validate the performance of these changes when running superpmi with the -details argument, especially on slower storage mediums?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well an error occurs when doing the test with changed executable. I'm going to debug it first.

Data for main with release exe, testing the 72MB mch generated by tests\JIT\superpmi\superpmicollect:
NVMe:925ms HDD:945ms

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR using "\n": NVMe:1050ms HDD:1060ms

Seems that flushing won't be a problem, but formatting becomes less efficiency.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing fstream usage reverts the performance back to 945ms.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jakobbotsch is it acceptable now? Any other concerns?

char* nameOfFile1;
char* nameOfFile2;
char* nameOfFile3;
int indexCount;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're using a vector now, can we remove the indexCount member?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also used as a sentinel for not using the indices. I haven't looked about it in depth.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's passed into MethodContextReader which doesn't make a good lifetime. I tried to use shared_ptr<vector> to pass the list but got really confused. I'd like to limit the refactor and touch types that directly interact with the IO.

cr->applyRelocs(&rc, coldCodeBlock, coldCodeSize, orig_coldCodeBlock);
cr->applyRelocs(&rc, roDataBlock, roDataSize, orig_roDataBlock);

#ifdef USE_MSVCDIS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be defined in internal builds. See standardpch.h. The @dotnet/jit-contrib should weight in on if this is still used in some scenarios. There are several places with USE_MSVCDIS.

#include "logging.h"

bool MCList::processArgAsMCL(char* input, int* count, int** list)
bool MCList::processArgAsMCL(char* input, std::vector<int>& list)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior here is now quite different as this now assumes the list is empty. Please assert that is the case.

huoyaoyuan and others added 2 commits January 6, 2026 17:35
Co-authored-by: Aaron R Robinson <arobins@microsoft.com>
}

bool WriteArrayToMCL(char* mclFilename, int* arr, int count)
bool WriteArrayToMCL(char* mclFilename, std::vector<int>& MCL)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool WriteArrayToMCL(char* mclFilename, std::vector<int>& MCL)
bool WriteArrayToMCL(char* mclFilename, const std::vector<int>& MCL)

@huoyaoyuan
Copy link
Member Author

Is there any remaining issue for this?

Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I defer to @dotnet/jit-contrib for the official sign off. This seems like a noisy PR with lots of subtle changes that might impact stability. Ideally it would be smaller and more targeted, but I get that may not be feasible. Another set of eyes is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants