Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/coreclr/jit/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,6 @@ void HelperCallProperties::init()
break;

case CORINFO_HELP_GETCURRENTMANAGEDTHREADID:
isPure = true;
exceptions = ExceptionSetFlags::None;
break;
Comment on lines 1562 to 1566

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot add a comment mentioning that in runtime async methods managed thread ID is not a constant/pure value.
Also check the jit format failures.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 3d1ab57: added a rationale comment in HelperCallProperties::init() that in runtime async methods managed thread ID is not a constant/pure value, while the helper remains no-throw.

I also checked the jit format failure path: local jitformat.py couldn’t download clang-format in this environment, but I verified src/coreclr/jit/utils.cpp is clean with local clang-format -style=file (no diff).


Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14946,11 +14946,6 @@ VNFunc Compiler::fgValueNumberJitHelperMethodVNFunc(CorInfoHelpFunc helpFunc)
vnf = VNF_Unbox_TypeTest;
break;

// A constant within any method.
case CORINFO_HELP_GETCURRENTMANAGEDTHREADID:
vnf = VNF_ManagedThreadId;
break;

case CORINFO_HELP_GETREFANY:
// TODO-CQ: This should really be interpreted as just a struct field reference, in terms of values.
vnf = VNF_GetRefanyVal;
Expand Down Expand Up @@ -15045,6 +15040,11 @@ bool Compiler::fgValueNumberHelperCall(GenTreeCall* call)
bool mayRunCctor = s_helperCallProperties.MayRunCctor(helpFunc);
bool noThrow = s_helperCallProperties.NoThrow(helpFunc);

if (helpFunc == CORINFO_HELP_GETCURRENTMANAGEDTHREADID)
{
pure = false;
}
Comment thread
Copilot marked this conversation as resolved.
Outdated

ValueNumPair vnpExc = ValueNumStore::VNPForEmptyExcSet();

// If the JIT helper can throw an exception make sure that we fill in
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/jit/valuenumfuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ ValueNumFuncDef(LeadingZeroCount, 1, false, false)
ValueNumFuncDef(TrailingZeroCount, 1, false, false)
ValueNumFuncDef(PopCount, 1, false, false)

ValueNumFuncDef(ManagedThreadId, 0, false, false)

ValueNumFuncDef(ObjGetType, 1, false, true)
ValueNumFuncDef(GetGcstaticBase, 1, false, true)
ValueNumFuncDef(GetNongcstaticBase, 1, false, true)
Expand Down
Loading