The main challenge here has been the alignment checking, otherwise this is a pretty straightforward setup of translating to LLVM and always-expand intrinsics in the frontend.
Diffs are more or less as expected. A few regressions that could be avoided with a smarter isAddressAligned, but I deferred that for the time being.
; Note that these diffs were taken with inlining disabled (on both sides), to avoid noise
Summary of Code Size diffs:
(Lower is better)
Total bytes of base: 3201085
Total bytes of diff: 3199494
Total bytes of delta: -1591 (-0.05% % of base)
Average relative delta: -4.16%
diff is an improvement
average relative diff is an improvement
Top method regressions (percentages):
1297 (159.73% of base) : 1104.dasm - S_P_CoreLib_System_Runtime_CompilerServices_CastCache__TrySet
118 (64.48% of base) : 1044.dasm - S_P_CoreLib_System_Threading_ManagedThreadId__RecycleId
118 (38.56% of base) : 1043.dasm - S_P_CoreLib_System_Threading_ManagedThreadId__AllocateId
109 (26.27% of base) : 1008.dasm - S_P_CoreLib_System_Threading_ObjectHeader__TryAcquireUncommon
14 (25.93% of base) : 1080.dasm - S_P_CoreLib_System_Threading_LowLevelSpinWaiter__SpinWaitForCondition$F1_Finally
20 (22.73% of base) : 1066.dasm - S_P_TypeLoader_Internal_TypeSystem_LockFreeReaderHashtableOfPointers_2<S_P_CoreLib_System_RuntimeTypeHandle__S_P_CoreLib_System_RuntimeTypeHandle>__TryWriteSentinelToLocation
20 (22.73% of base) : 1063.dasm - S_P_TypeLoader_Internal_TypeSystem_LockFreeReaderHashtableOfPointers_2<S_P_TypeLoader_Internal_TypeSystem_TypeSystemContext_FunctionPointerTypeKey__S_P_CoreLib_System_RuntimeTypeHandle>__TryWriteSentinelToLocation
20 (22.73% of base) : 1093.dasm - S_P_TypeLoader_Internal_TypeSystem_LockFreeReaderHashtableOfPointers_2<System___Canon__S_P_CoreLib_System_Runtime_InteropServices_GCHandle>__TryWriteSentinelToLocation
67 (18.72% of base) : 1006.dasm - S_P_CoreLib_System_Threading_ObjectHeader__AssignHashCode
27 ( 6.60% of base) : 1021.dasm - S_P_CoreLib_System_Threading_ObjectHeader__SetSyncEntryIndex
83 ( 4.10% of base) : 1031.dasm - S_P_CoreLib_System_Runtime_CompilerServices_GenericCache_2<S_P_CoreLib_System_Runtime_TypeLoaderExports_Key__S_P_CoreLib_System_Runtime_TypeLoaderExports_Value>__TrySet
19 ( 3.37% of base) : 1099.dasm - S_P_CoreLib_System_Threading_Monitor__Enter
17 ( 3.35% of base) : 1100.dasm - S_P_CoreLib_System_Threading_Monitor__Exit
33 ( 3.06% of base) : 1005.dasm - S_P_CoreLib_System_RuntimeExceptionHelpers__FailFast
10 ( 1.63% of base) : 1092.dasm - S_P_CoreLib_System_Globalization_CultureInfo__GetCalendarInstanceRare
15 ( 0.76% of base) : 1090.dasm - S_P_CoreLib_System_Reflection_Runtime_TypeInfos_RuntimeArrayTypeInfo__get_SyntheticMethods_d__20__MoveNext
8 ( 0.62% of base) : 1041.dasm - S_P_CoreLib_System_Buffers_SharedArrayPool_1<Int32>__Trim
8 ( 0.62% of base) : 1036.dasm - S_P_CoreLib_System_Buffers_SharedArrayPool_1<UInt8>__Trim
8 ( 0.62% of base) : 1037.dasm - S_P_CoreLib_System_Buffers_SharedArrayPool_1<Char>__Trim
8 ( 0.61% of base) : 1074.dasm - S_P_CoreLib_System_Buffers_SharedArrayPool_1<System___Canon>__Trim
Top methods only present in diff:
83 ( ∞ of base) : 1123.dasm - S_P_CoreLib_System_DataMisalignedException___ctor
90 ( ∞ of base) : 1121.dasm - S_P_CoreLib_System_Threading_Interlocked__CompareExchange_2
61 ( ∞ of base) : 1120.dasm - S_P_CoreLib_Internal_Runtime_CompilerHelpers_ThrowHelpers__ThrowDataMisalignedException
81 ( ∞ of base) : 1122.dasm - S_P_CoreLib_System_Threading_Interlocked__Exchange_2
Top method improvements (percentages):
-84 (-44.92% of base) : 1029.dasm - HelloWasm_Program__TestInterlockedExchange
-42 (-40.38% of base) : 1020.dasm - S_P_CoreLib_System_Threading_Volatile__Write_1
-88 (-37.13% of base) : 1113.dasm - S_P_CoreLib_System_Threading_Thread__DecrementRunningForeground
-53 (-31.18% of base) : 1026.dasm - S_P_CoreLib_System_Threading_Thread__StopThread
-49 (-28.99% of base) : 1025.dasm - S_P_CoreLib_System_Threading_WaitSubsystem_LockHolder__Dispose
-106 (-28.19% of base) : 1004.dasm - S_P_CoreLib_System_Threading_Thread__set_IsBackground
-46 (-24.86% of base) : 1076.dasm - S_P_CoreLib_System_Threading_Lock__Exit_1
-58 (-24.27% of base) : 1117.dasm - S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__SignalEvent
-91 (-21.41% of base) : 1022.dasm - S_P_CoreLib_System_Threading_WaitSubsystem__SetEvent_0
-40 (-19.61% of base) : 1018.dasm - S_P_CoreLib_System_Threading_Lock__Exit_0
-84 (-19.00% of base) : 1027.dasm - S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__OnThreadExiting
-21 (-18.42% of base) : 1112.dasm - S_P_CoreLib_System_Threading_WaitSubsystem_ThreadWaitInfo__Wait$F1_Finally
-165 (-18.27% of base) : 1065.dasm - S_P_TypeLoader_Internal_TypeSystem_LockFreeReaderHashtableOfPointers_2<S_P_CoreLib_System_RuntimeTypeHandle__S_P_CoreLib_System_RuntimeTypeHandle>__TryAddOrGetExisting
-83 (-17.77% of base) : 1060.dasm - S_P_CoreLib_System_Threading_WaitSubsystem_WaitableObject__OnDeleteHandle
-158 (-17.06% of base) : 1062.dasm - S_P_TypeLoader_Internal_TypeSystem_LockFreeReaderHashtableOfPointers_2<S_P_TypeLoader_Internal_TypeSystem_TypeSystemContext_FunctionPointerTypeKey__S_P_CoreLib_System_RuntimeTypeHandle>__TryAddOrGetExisting
-182 (-16.59% of base) : 1069.dasm - S_P_CoreLib_Internal_TypeSystem_LockFreeReaderHashtable_2<S_P_TypeLoader_Internal_TypeSystem_TypeSystemContext_ArrayTypeKey__System___Canon>__TryAddOrGetExisting
-172 (-16.37% of base) : 1040.dasm - S_P_TypeLoader_Internal_TypeSystem_LockFreeReaderHashtableOfPointers_2<System___Canon__S_P_CoreLib_System_Runtime_InteropServices_GCHandle>__TryAddOrGetExisting
-182 (-16.32% of base) : 1085.dasm - S_P_CoreLib_Internal_TypeSystem_LockFreeReaderHashtable_2<S_P_TypeLoader_Internal_TypeSystem_TypeSystemContext_RuntimeMethodKey__System___Canon>__TryAddOrGetExisting
-182 (-16.32% of base) : 1119.dasm - S_P_CoreLib_Internal_TypeSystem_LockFreeReaderHashtable_2<IntPtr__System___Canon>__TryAddOrGetExisting
-182 (-16.32% of base) : 1033.dasm - S_P_CoreLib_Internal_TypeSystem_LockFreeReaderHashtable_2<S_P_TypeLoader_Internal_Runtime_TypeLoader_TypeLoaderEnvironment_GenericTypeLookupData__System___Canon>__TryAddOrGetExisting
Top methods only present in base:
-26 (-100.00% of base) : 1000.dasm - RhpLockCmpXchg32
-26 (-100.00% of base) : 1001.dasm - RhpLockCmpXchg64
124 total methods with Code Size differences (99 improved, 25 regressed)
The main challenge here has been the alignment checking, otherwise this is a pretty straightforward setup of translating to LLVM and always-expand intrinsics in the frontend.
Diffs are more or less as expected. A few regressions that could be avoided with a smarter
isAddressAligned
, but I deferred that for the time being.Depends on #2446. Contributes to #2307.