Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add handling of calli in MethodBodyScanner #1325

Merged
merged 1 commit into from Jul 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/linker/Linker.Dataflow/MethodBodyScanner.cs
Expand Up @@ -506,8 +506,22 @@ public void Scan (MethodBody methodBody)
NewKnownStack (knownStacks, ((Instruction) operation.Operand).Offset, currentStack, methodBody);
break;

case Code.Calli:
// TODO: currently not emitted by any mainstream compilers but we should implement
case Code.Calli: {
var signature = (CallSite) operation.Operand;
if (signature.HasThis && !signature.ExplicitThis) {
PopUnknown (currentStack, 1, methodBody, operation.Offset);
}

// Pop arguments
PopUnknown (currentStack, signature.Parameters.Count, methodBody, operation.Offset);

// Pop function pointer
PopUnknown (currentStack, 1, methodBody, operation.Offset);

// Push return value
if (signature.ReturnType.MetadataType != MetadataType.Void)
PushUnknown (currentStack);
}
break;

case Code.Call:
Expand Down