Fix regression from RuntimeType.AllocateValueType rewrite#101137
Fix regression from RuntimeType.AllocateValueType rewrite#101137jkoritzinsky merged 4 commits intodotnet:mainfrom
Conversation
|
/benchmark help |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
/benchmark micro aspnet-perf-win runtime --variable filter=System.Reflection.Invoke.StaticMethod |
|
Benchmark started for micro on aspnet-perf-win with runtime and arguments |
micro - aspnet-perf-win
| benchmark | mean (micro.base) | mean (micro.pr) | ratio | allocated (micro.base) | allocated (micro.pr) | ratio |
| --------------------------------------------------------- | ----------------- | --------------- | ----- | ---------------------- | -------------------- | ----- |
| StaticMethod4_arrayNotCached_int_string_struct_class | 31.80 ns | 30.08 ns | 0.95 | 104 B | 104 B | 1.00 |
| StaticMethod4_ByRefParams_int_string_struct_class | 138.6 ns | 137.7 ns | 0.99 | 48 B | 48 B | 1.00 |
| StaticMethod4_int_string_struct_class | 19.52 ns | 19.80 ns | 1.01 | 0 B | 0 B | |
| StaticMethod5_arrayNotCached_int_string_struct_class_bool | 45.05 ns | 43.55 ns | 0.97 | 136 B | 136 B | 1.00 |
| StaticMethod5_ByRefParams_int_string_struct_class_bool | 197.7 ns | 206.7 ns | 1.05 | 72 B | 72 B | 1.00 | |
|
Looks like this helps, but not enough. |
|
/benchmark micro aspnet-perf-win runtime --variable filter=System.Reflection.Invoke.StaticMethod |
|
Benchmark started for micro on aspnet-perf-win with runtime and arguments |
micro - aspnet-perf-win
| benchmark | mean (micro.base) | mean (micro.pr) | ratio | allocated (micro.base) | allocated (micro.pr) | ratio |
| --------------------------------------------------------- | ----------------- | --------------- | ----- | ---------------------- | -------------------- | ----- |
| StaticMethod4_arrayNotCached_int_string_struct_class | 29.41 ns | 30.07 ns | 1.02 | 104 B | 104 B | 1.00 |
| StaticMethod4_ByRefParams_int_string_struct_class | 142.15 ns | 87.21 ns | 0.61 | 48 B | 48 B | 1.00 |
| StaticMethod4_int_string_struct_class | 20.62 ns | 19.83 ns | 0.96 | 0 B | 0 B | |
| StaticMethod5_arrayNotCached_int_string_struct_class_bool | 42.85 ns | 43.83 ns | 1.02 | 136 B | 136 B | 1.00 |
| StaticMethod5_ByRefParams_int_string_struct_class_bool | 192.8 ns | 120.2 ns | 0.62 | 72 B | 72 B | 1.00 | |
|
Tagging subscribers to this area: @mangod9 |
src/coreclr/vm/jitinterfacegen.cpp
Outdated
| SetJitHelperFunction(CORINFO_HELP_NEWARR_1_OBJ, JIT_NewArr1OBJ_UP); | ||
|
|
||
| ECall::DynamicallyAssignFCallImpl(GetEEFuncEntryPoint(AllocateStringFastUP), ECall::FastAllocateString); | ||
| ECall::DynamicallyAssignFCallImpl(GetEEFuncEntryPoint(JIT_BoxFastUP), ECall::NonNullableBox); |
There was a problem hiding this comment.
This block is Windows specific, so this change only helps on Windows. We need an equivalent fix for non-Windows platforms too.
There was a problem hiding this comment.
Yeah I'll probably revert this particular change and make an equivalent one that's more xplat-friendly.
There was a problem hiding this comment.
I've inlined the trail allocation logic into JIT_Box and factored out the rest of the logic to be in a separate framed helper instead of using the dynamic FCALL impl logic.
Let me know if this looks good to you.
db2d27c to
a32aa66
Compare
src/coreclr/System.Private.CoreLib/src/System/RuntimeType.BoxCache.cs
Outdated
Show resolved
Hide resolved
|
/benchmark micro aspnet-perf-win runtime --variable filter=System.Reflection.Invoke.StaticMethod |
|
/ba-g timeouts unrelated |
Testing out fixes for #101134 and #104777