You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mono work necessary to support IL-based invoke #68928
Per this issue and comment here's the Mono work necessary to support the IL Emit fast-path. This effort will also be used to support the planned new Invoke() APIs to support byref-like types.
Native changes
In RuntimeMethodInfo.InternalInvoke, apply the same changes as made to CoreClr's RuntimeMethodHandle::Invoke including:
Pass parameters byref instead of by System.Object. This primarily means value types are no longer required to be boxed; this will be leveraged more when we support byref-like types later. Also, when we do that the return value and obj parameter will also need to be changed to be byref or use TypedReference pending design.
All conversions removed such as from Int to Long (moved to managed).
No exception handling for TargetInvocationException (moved to managed). Also see the breaking change issue.
A null byref for a byref-like parameter should just throw now instead of passing default().
Invalid ctor parameters for size should just throw wrapped in TIE instead of outside the TIE.
Nullable<T> is now passed as a true Nullable<T>, not as a boxed T or null.
Managed changes
Change the various Invoker and shared invoke code to remove Mono special casing.
Search for // Temporary until Mono is updated and remove the corresponding #ifs.
In the Method and Constructor invoker classes, Mono should use the same exception handling as Core which is basically try\catch(Exception) without any one-off catches for misc exception types.
Update RuntimeType.CheckValue() (see the Core implementation)
Perform validation and conversions that were probably handled in native code before; Core added InvokeUtils.ConvertOrWiden which should be able to be re-used.
Add special Nullable<T> calls to create true nullables (see the Core implementation)
Implementing this would make invoke on mono jit a bit over 2x faster. However there is still a bit of work for the implementation and there is a bit of risk shipping it so late in the release cycle. This will be implemented early for the 8.0 previews to support future API's leveraging it.
I found monovm side work always slower, always inconsistent, and seems the team always forgets to continue work on it until the deadline of milestone.
I think it may be some risk and difficulty, you need to keep not introducing bugs first.
but it is so sad for those who love in c#.
Activity
steveharter commentedon May 5, 2022
cc @lambdageek
lambdageek commentedon May 5, 2022
Thanks Steve!
/cc @SamMonoRT
SamMonoRT commentedon May 9, 2022
@naricc will investigate this work.
srxqds commentedon Jul 4, 2022
hope, this can be made in .net7 milestone.
BrzVlad commentedon Aug 4, 2022
Implementing this would make invoke on mono jit a bit over 2x faster. However there is still a bit of work for the implementation and there is a bit of risk shipping it so late in the release cycle. This will be implemented early for the 8.0 previews to support future API's leveraging it.
srxqds commentedon Aug 5, 2022
hope you can merge the pr first on 7.0 branch, and you can disable it, but we can merge your later pr pushed on 8.0 by ourself
srxqds commentedon Aug 5, 2022
I found monovm side work always slower, always inconsistent, and seems the team always forgets to continue work on it until the deadline of milestone.
I think it may be some risk and difficulty, you need to keep not introducing bugs first.
but it is so sad for those who love in c#.