Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Fix NYI's for Function Pointers, fixes #8199
Browse files Browse the repository at this point in the history
  • Loading branch information
Suchiman committed Jun 9, 2020
1 parent 343a4ac commit faf2d43
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,9 @@ public static NativeLayoutTypeSignatureVertexNode NewTypeSignatureVertexNode(Nod
return new NativeLayoutGenericVarSignatureVertexNode(factory, type);

// TODO Internal.TypeSystem.TypeFlags.FunctionPointer (Runtime parsing also not yet implemented)
// Pretend for now it's an IntPtr, may need to be revisited depending on https://github.com/dotnet/runtime/issues/11354
case Internal.TypeSystem.TypeFlags.FunctionPointer:
throw new NotImplementedException("FunctionPointer signature");
return new NativeLayoutEETypeSignatureVertexNode(factory, factory.TypeSystemContext.GetWellKnownType(WellKnownType.IntPtr));

default:
{
Expand Down
16 changes: 12 additions & 4 deletions src/ILCompiler.Compiler/src/Compiler/MetadataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public virtual void AddToReadyToRunHeader(ReadyToRunHeaderNode header, NodeFacto

DynamicInvokeTemplateData = new DynamicInvokeTemplateDataNode(commonFixupsTableNode);
header.Add(BlobIdToReadyToRunSection(ReflectionMapBlob.DynamicInvokeTemplateData), DynamicInvokeTemplateData, DynamicInvokeTemplateData, DynamicInvokeTemplateData.EndSymbol);

var invokeMapNode = new ReflectionInvokeMapNode(commonFixupsTableNode);
header.Add(BlobIdToReadyToRunSection(ReflectionMapBlob.InvokeMap), invokeMapNode, invokeMapNode, invokeMapNode.EndSymbol);

Expand Down Expand Up @@ -151,7 +151,7 @@ public virtual void AddToReadyToRunHeader(ReadyToRunHeaderNode header, NodeFacto

var stackTraceMethodMappingNode = new StackTraceMethodMappingNode();
header.Add(BlobIdToReadyToRunSection(ReflectionMapBlob.BlobIdStackTraceMethodRvaToTokenMapping), stackTraceMethodMappingNode, stackTraceMethodMappingNode, stackTraceMethodMappingNode.EndSymbol);

// The external references tables should go last
header.Add(BlobIdToReadyToRunSection(ReflectionMapBlob.NativeReferences), nativeReferencesTableNode, nativeReferencesTableNode, nativeReferencesTableNode.EndSymbol);
header.Add(BlobIdToReadyToRunSection(ReflectionMapBlob.NativeStatics), nativeStaticsTableNode, nativeStaticsTableNode, nativeStaticsTableNode.EndSymbol);
Expand Down Expand Up @@ -499,7 +499,7 @@ void ICompilationRootProvider.AddCompilationRoots(IRootingServiceProvider rootPr
}

protected abstract void ComputeMetadata(NodeFactory factory,
out byte[] metadataBlob,
out byte[] metadataBlob,
out List<MetadataMapping<MetadataType>> typeMappings,
out List<MetadataMapping<MethodDesc>> methodMappings,
out List<MetadataMapping<FieldDesc>> fieldMappings,
Expand Down Expand Up @@ -660,7 +660,15 @@ public bool IsReflectionBlocked(TypeDesc type)
return IsReflectionBlocked(((ParameterizedType)type).ParameterType);

case TypeFlags.FunctionPointer:
throw new NotImplementedException();
var signature = ((FunctionPointerType)type).Signature;
for (int i = 0; i < signature.Length; i++)
{
if (IsReflectionBlocked(signature[i]))
{
return true;
}
}
return false;

default:
Debug.Assert(type.IsDefType);
Expand Down

0 comments on commit faf2d43

Please sign in to comment.