Cleanup dead delegate code#129662
Conversation
|
|
||
| internal void StoreDynamicMethod(MethodInfo dynamicMethod) | ||
| { | ||
| Debug.Assert(_invocationCount == 0); |
There was a problem hiding this comment.
This assert was incorrect for oven virtual delegates.
There was a problem hiding this comment.
This method is only ever used to create dynamic method delegate. I do not think there is a way to have open virtual delegate that points to dynamic method.
We may want to delete this method instead (see my other feedback).
|
Tagging subscribers to this area: @agocke |
| // in the other cases we return the method desc for the invoke | ||
| innerDel = (DELEGATEREF) thisDel->GetInvocationList(); | ||
| bool fOpenVirtualDelegate = false; | ||
| // or _invocationList points to a LoaderAllocator/DynamicResolver |
There was a problem hiding this comment.
I do not think _invocationList ever points to a LoaderAllocator/DynamicResolver in the current implementation. Do you agree? I think all comments and code (e.g. InvocationListLogicallyNull ) that deal with it can be deleted.
There was a problem hiding this comment.
Ah right I've only moved it there in my other PR. Since that makes it the case, I'd not touch this however.
There was a problem hiding this comment.
Before this delta, the comment was referring to wrapper Delegate so one can guess it is obsolete. After this delta, the comment is simply incorrect that is not an improvement.
I understand that some of the changes will conflict. It is the cost of splitting large changes into multiple PRs. It is important that each of the split PRs is coherent on its own as much as possible.
| @@ -379,8 +379,7 @@ | |||
|
|
|||
| // Initialize the method... | |||
There was a problem hiding this comment.
| // Initialize the method... |
Non-sensical comment
| Delegate d = InternalAlloc(rtType); | ||
| // This is a new internal API added in Whidbey. Currently it's only | ||
| // used by the dynamic method code to generate a wrapper delegate. | ||
| // This is a new internal API added in Whidbey. |
There was a problem hiding this comment.
| // This is a new internal API added in Whidbey. |
Whibey shipped in 2005. This is not new anymore.
| @@ -3268,7 +3268,6 @@ DacDbiInterfaceImpl::DelegateType DacDbiInterfaceImpl::GetDelegateType(VMPTR_Obj | |||
| { | |||
| // If this delegate points to a static function or this is a open virtual delegate, this should be non-null | |||
There was a problem hiding this comment.
Is this comment correct? Open virtual delegate is going to have _invocationCount != 0.
There was a problem hiding this comment.
There was a problem hiding this comment.
I've fixed that in the other PR so I'd rather not touch this here.
There was a problem hiding this comment.
I thought that the primary goal of this PR is to delete all remnants of the wrapper stubs that I have missed.
| // internal implementation details (FCALLS and utilities) | ||
| // | ||
|
|
||
| // V2 internal API. |
| // | ||
|
|
||
| // V2 internal API. | ||
| internal static Delegate CreateDelegateNoSecurityCheck(Type type, object? target, RuntimeMethodHandle method) |
There was a problem hiding this comment.
| internal static Delegate CreateDelegateForDynamicMethod(Type type, object? target, RuntimeMethodHandle method) |
We may want to give this method more self-describing name.
Also, we may want to pass in MethodInfo as an argument and delete StoreDynamicMethod.
.
|
|
||
| internal void StoreDynamicMethod(MethodInfo dynamicMethod) | ||
| { | ||
| Debug.Assert(_invocationCount == 0); |
There was a problem hiding this comment.
This method is only ever used to create dynamic method delegate. I do not think there is a way to have open virtual delegate that points to dynamic method.
We may want to delete this method instead (see my other feedback).
| fOpenVirtualDelegate = true; | ||
| } | ||
| } | ||
| // we return the method desc for the invoke |
There was a problem hiding this comment.
This looks like unfinished sentence. Should this say "... for the first two cases" or something?
Split off from #99200
cc @jkotas