Skip to content

[Mono] Implement small types atomic intrinsics for CompareExchange and Exchange #93488

Closed
@lambdageek

Description

@lambdageek

Update After #99011 Mono now uses the slower managed fallback implementations of these methods from src/libraries/System.Private.CoreLib/src/System/Threading/Interlocked.cs:

    public static byte CompareExchange(ref byte location1, byte value, byte comparand);
    public static sbyte CompareExchange(ref sbyte location1, sbyte value, sbyte comparand);
    public static short CompareExchange(ref short location1, short value, short comparand);
    public static ushort CompareExchange(ref ushort location1, ushort value, ushort comparand);

and

    public static byte Exchange(ref byte location1, byte value);
    public static sbyte Exchange(ref sbyte location1, sbyte value);
    public static short Exchange(ref short location1, short value);
    public static ushort Exchange(ref ushort location1, ushort value);

We should implement intrinsics for them in the JIT and interpreter, instead.


Original issue

After #92974 is merged, we will have icalls for CompareExchange and Exchange for byte, sbyte, shortandushort`

We should also implement these intrinsics directly in the JIT/AOT and interpreter

Part of #64658

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions