Skip to content

Commit 1f862c8

Browse files
Add acquire barrier to populate bit reading (#117523)
The setting of the NDirectMethodDesc::kNDirectPopulated bit is done via an interlocked operation. This bit is used to indicate if the NDirectMethodDesc has been populated with the needed information to load the P/Invoke. The reading of this bit however was missing an acquire barrier and thus setting of fields between the check and set weren't being observed correctly.
1 parent f1867b7 commit 1f862c8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/coreclr/vm/method.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3180,7 +3180,7 @@ class NDirectMethodDesc : public MethodDesc
31803180
BOOL IsPopulated()
31813181
{
31823182
LIMITED_METHOD_CONTRACT;
3183-
return (ndirect.m_wFlags & kNDirectPopulated) != 0;
3183+
return (VolatileLoad(&ndirect.m_wFlags) & kNDirectPopulated) != 0;
31843184
}
31853185

31863186
ULONG DefaultDllImportSearchPathsAttributeCachedValue()

0 commit comments

Comments
 (0)