Skip to content

Commit

Permalink
Scan calli dependencies (#72413)
Browse files Browse the repository at this point in the history
Contributes to #72316
  • Loading branch information
jkotas authored Jul 19, 2022
1 parent 62075f1 commit 07b9113
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,6 @@ private void EndImportingInstruction()
_isReadOnly = false;
}

private void ImportJmp(int token)
{
// JMP is kind of like a tail call (with no arguments pushed on the stack).
ImportCall(ILOpcode.call, token);
}

private void ImportCasting(ILOpcode opcode, int token)
{
TypeDesc type = (TypeDesc)_methodIL.GetObject(token);
Expand Down Expand Up @@ -767,6 +761,31 @@ private void ImportLdFtn(int token, ILOpcode opCode)
ImportCall(opCode, token);
}

private void ImportJmp(int token)
{
// JMP is kind of like a tail call (with no arguments pushed on the stack).
ImportCall(ILOpcode.call, token);
}

private void ImportCalli(int token)
{
MethodSignature signature = (MethodSignature)_methodIL.GetObject(token);

// Managed calli
if ((signature.Flags & MethodSignatureFlags.UnmanagedCallingConventionMask) == 0)
return;

// Calli in marshaling stubs
if (_methodIL is Internal.IL.Stubs.PInvokeILStubMethodIL)
return;

MethodDesc stub = _compilation.PInvokeILProvider.GetCalliStub(
signature,
((MetadataType)_methodIL.OwningMethod.OwningType).Module);

_dependencies.Add(_factory.CanonicalEntrypoint(stub), "calli");
}

private void ImportBranch(ILOpcode opcode, BasicBlock target, BasicBlock fallthrough)
{
ImportFallthrough(target);
Expand Down Expand Up @@ -1316,7 +1335,6 @@ private void ImportStoreVar(int index, bool argument) { }
private void ImportAddressOfVar(int index, bool argument) { }
private void ImportDup() { }
private void ImportPop() { }
private void ImportCalli(int token) { }
private void ImportLoadNull() { }
private void ImportReturn() { }
private void ImportLoadInt(long value, StackValueKind kind) { }
Expand Down

0 comments on commit 07b9113

Please sign in to comment.