Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion src/coreclr/jit/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,8 @@ void HelperCallProperties::init()
break;

case CORINFO_HELP_GETCURRENTMANAGEDTHREADID:
isPure = true;
// In runtime async methods, execution may resume on a different thread after suspension.
// So managed thread ID is not a constant/pure value, but the helper is still no-throw.
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
5 changes: 0 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
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