Conversation
|
Tagging subscribers to this area: @mangod9 |
543d2ae to
ad38529
Compare
|
@EgorBot -amd -arm using System.Reflection;
using BenchmarkDotNet.Attributes;
public class Bench
{
public readonly int AReadonlyIntField = 42;
[Benchmark]
public int ReflectionFieldBoxing()
{
FieldInfo fieldInfo = typeof(Bench).GetTypeInfo().GetDeclaredField(nameof(AReadonlyIntField));
Bench myInstance = new();
object current = fieldInfo.GetValue(myInstance);
fieldInfo.SetValue(myInstance, int.MinValue);
return (int)current + (int)fieldInfo.GetValue(myInstance);
}
} |
aaadc26 to
bf23c6d
Compare
|
@EgorBot -windows_intel -amd -arm using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes;
public class Bench
{
[Benchmark] public object Box8() => Box(new Buffer8());
[Benchmark] public object Box16() => Box(new Buffer16());
[Benchmark] public object Box32() => Box(new Buffer32());
[Benchmark] public object Box256() => Box(new Buffer256());
[MethodImpl(MethodImplOptions.NoInlining |
MethodImplOptions.NoOptimization)]
static object Box<T>(T value) => (object)value;
}
[InlineArray(1)] public struct Buffer8 {
long _element0;
}
[InlineArray(2)] public struct Buffer16 {
long _element0;
}
[InlineArray(4)] public struct Buffer32 {
long _element0;
}
[InlineArray(32)] public struct Buffer256 {
long _element0;
} |
src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs
Show resolved
Hide resolved
|
@EgorBot -windows_intel -amd -arm using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes;
public class Bench
{
[Benchmark] public object Box8() => Box(new Buffer8());
[Benchmark] public object Box16() => Box(new Buffer16());
[Benchmark] public object Box32() => Box(new Buffer32());
[Benchmark] public object Box256() => Box(new Buffer256());
[MethodImpl(MethodImplOptions.NoInlining |
MethodImplOptions.NoOptimization)]
static object Box<T>(T value) => (object)value;
}
[InlineArray(1)] public struct Buffer8 {
long _element0;
}
[InlineArray(2)] public struct Buffer16 {
long _element0;
}
[InlineArray(4)] public struct Buffer32 {
long _element0;
}
[InlineArray(32)] public struct Buffer256 {
long _element0;
} |
|
arm32 doesn't seem to be happy with the TLV commit despite |
arm32 had the special alignment code path (RequiresAlign8) |
10ef59b to
841c89e
Compare
...coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs
Show resolved
Hide resolved
0b8d8f9 to
0f4cd04
Compare
src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs
Outdated
Show resolved
Hide resolved
0f4cd04 to
7468c56
Compare
src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs
Outdated
Show resolved
Hide resolved
|
NativeAOT's AllocFast mechanism is much efficient, maybe coreclr can reuse it via asm sharing being introduced in #114982? Alternatively, JIT can optimize/inline |
src/coreclr/System.Private.CoreLib/src/System/MulticastDelegate.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastHelpers.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs
Outdated
Show resolved
Hide resolved
100647b to
9dbafa3
Compare
9d00363 to
113056f
Compare
|
Thanks @jkotas, @EgorBo and @filipnavara for the help! Do you think we can bring the rest of these to the same plan: runtime/src/coreclr/vm/jitinterfacegen.cpp Lines 84 to 87 in 9e490ef |
I'd think that they are good candidate for implementing in assembly and sharing with NativeAOT (as per #115134 (comment)). For some of them it looks like a quite straightforward mapping but perhaps I was just lucky to look at the ones that match up closely... |
|
Sounds good. Then we can follow @davidwrighton's footsteps once #114982 is completed. :) |
JFYI I have a prototype on top of #114982 that moves AllocFast.S/asm to the shared code base and replaces most of the helpers. Still needs a bit of love but wanted to let you know to avoid working on the same thing... |
|
Thanks! Can't wait to see |
No description provided.