Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ad0172f
Hook up initial infrastructure for unmanaged-to-managed vtable stubs.
jkoritzinsky Oct 17, 2022
f571cd0
Make the signatures for the UnmanagedCallersOnly wrapper have the cor…
jkoritzinsky Nov 1, 2022
c2f2fdf
Fix signature and add runtime tests for unmanaged->managed
jkoritzinsky Nov 2, 2022
32f856c
Update incremental generation liveness test to be a theory and add an…
jkoritzinsky Nov 10, 2022
9a38bee
Change IMarshallingGenerator.AsNativeType to return a ManagedTypeInfo…
jkoritzinsky Nov 10, 2022
71fa346
Use MarshalDirection to provide a nice abstraction for determining wh…
jkoritzinsky Nov 10, 2022
8646adf
Implement unmanaged->managed exception handling spec and get compilat…
jkoritzinsky Nov 10, 2022
baf8a36
Initial PR feedback.
jkoritzinsky Nov 10, 2022
6bf9f2c
Merge branch 'main' of github.com:dotnet/runtime into vtable-unmanged…
jkoritzinsky Nov 11, 2022
6819628
Fix function pointer signature
jkoritzinsky Nov 14, 2022
972fd18
Emit a PopulateUnmanagedVirtualMethodTable wrapper function to fill t…
jkoritzinsky Nov 15, 2022
ddaa876
Add methods for providing virtual method table length.
jkoritzinsky Nov 16, 2022
ec57196
Merge branch 'main' of github.com:dotnet/runtime into vtable-unmanged…
jkoritzinsky Nov 21, 2022
7f05abb
PR feedback
jkoritzinsky Nov 21, 2022
4132fd9
Fix bad merge that lost the native-to-managed-this marshaller factory.
jkoritzinsky Nov 21, 2022
96ac635
Enhance docs for the error case
jkoritzinsky Nov 21, 2022
76ce3f5
Internalize the "fallback-to-fowarder" logic to BoundGenerators and h…
jkoritzinsky Nov 29, 2022
8d89495
Pass in the fallback generator to BoundGenerators
jkoritzinsky Nov 30, 2022
7c05d70
Change the BoundGenerators constructor to a factory method.
jkoritzinsky Dec 1, 2022
d4e71c4
Add lots of comments and docs
jkoritzinsky Dec 2, 2022
0a45772
Fix a few missing init properties
jkoritzinsky Dec 2, 2022
9879853
PR feedback and finish wiring up the exception marshallers to actuall…
jkoritzinsky Dec 6, 2022
b7d1ab3
Add diagnostics for ExceptionMarshalling and other misc PR feedback.
jkoritzinsky Dec 7, 2022
8e9e5ca
Allow setting ExceptionMarshallingCustomType without setting Exceptio…
jkoritzinsky Dec 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Pass in the fallback generator to BoundGenerators
  • Loading branch information
jkoritzinsky committed Nov 30, 2022
commit 8d89495de7c677ae494452a5d947e42a9eba105f
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public JSExportCodeGenerator(
NativeToManagedStubCodeContext innerContext = new NativeToManagedStubCodeContext(targetFramework, targetFrameworkVersion, ReturnIdentifier, ReturnIdentifier);
_context = new JSExportCodeContext(attributeData, innerContext);

_marshallers = new BoundGenerators(argTypes, generatorFactory, _context);
_marshallers = new BoundGenerators(argTypes, generatorFactory, _context, new EmptyJSGenerator());
foreach (var failure in _marshallers.GeneratorBindingFailures)
{
marshallingNotSupportedCallback(failure.Info, failure.Exception);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public JSImportCodeGenerator(
_signatureContext = signatureContext;
ManagedToNativeStubCodeContext innerContext = new ManagedToNativeStubCodeContext(targetFramework, targetFrameworkVersion, ReturnIdentifier, ReturnIdentifier);
_context = new JSImportCodeContext(attributeData, innerContext);
_marshallers = new BoundGenerators(argTypes, generatorFactory, _context);
_marshallers = new BoundGenerators(argTypes, generatorFactory, _context, new EmptyJSGenerator());

foreach (var failure in _marshallers.GeneratorBindingFailures)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public ManagedToNativeVTableMethodGenerator(
}

_context = new ManagedToNativeStubCodeContext(targetFramework, targetFrameworkVersion, ReturnIdentifier, ReturnIdentifier);
_marshallers = new BoundGenerators(argTypes, generatorFactory, _context);
_marshallers = new BoundGenerators(argTypes, generatorFactory, _context, new Forwarder());

foreach (var failure in _marshallers.GeneratorBindingFailures)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public UnmanagedToManagedStubGenerator(
IMarshallingGeneratorFactory generatorFactory)
{
_context = new NativeToManagedStubCodeContext(targetFramework, targetFrameworkVersion, ReturnIdentifier, ReturnIdentifier);
_marshallers = new BoundGenerators(argTypes, generatorFactory, _context);
_marshallers = new BoundGenerators(argTypes, generatorFactory, _context, new Forwarder());

foreach (var failure in _marshallers.GeneratorBindingFailures)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private static void AnalyzeSymbol(SymbolAnalysisContext context, INamedTypeSymbo
return forwarder;
}
return generatorFactoryKey.GeneratorFactory.Create(info, stubCodeContext);
}), stubCodeContext);
}), stubCodeContext, forwarder);

mayRequireAdditionalWork |= generators.GeneratorBindingFailures.Length > 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public PInvokeStubCodeGenerator(
}

_context = new ManagedToNativeStubCodeContext(targetFramework, targetFrameworkVersion, ReturnIdentifier, ReturnIdentifier);
_marshallers = new BoundGenerators(argTypes, generatorFactory, _context);
_marshallers = new BoundGenerators(argTypes, generatorFactory, _context, new Forwarder());

foreach (var failure in _marshallers.GeneratorBindingFailures)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ namespace Microsoft.Interop

public class BoundGenerators
{
private static readonly Forwarder FallbackGenerator = new();

public BoundGenerators(ImmutableArray<TypePositionInfo> elementTypeInfo, IMarshallingGeneratorFactory generatorFactory, StubCodeContext context)
public BoundGenerators(ImmutableArray<TypePositionInfo> elementTypeInfo, IMarshallingGeneratorFactory generatorFactory, StubCodeContext context, IMarshallingGenerator fallbackGenerator)
{
ImmutableArray<BoundGenerator>.Builder allMarshallers = ImmutableArray.CreateBuilder<BoundGenerator>();
ImmutableArray<BoundGenerator>.Builder nativeParamMarshallers = ImmutableArray.CreateBuilder<BoundGenerator>();
Expand All @@ -29,9 +27,9 @@ public BoundGenerators(ImmutableArray<TypePositionInfo> elementTypeInfo, IMarsha
bool foundNativeRetMarshaller = false;
bool foundManagedRetMarshaller = false;
TypePositionInfo? managedExceptionInfo = null;
NativeReturnMarshaller = new(new TypePositionInfo(SpecialTypeInfo.Void, NoMarshallingInfo.Instance), FallbackGenerator);
ManagedReturnMarshaller = new(new TypePositionInfo(SpecialTypeInfo.Void, NoMarshallingInfo.Instance), FallbackGenerator);
ManagedExceptionMarshaller = new(new TypePositionInfo(SpecialTypeInfo.Void, NoMarshallingInfo.Instance), FallbackGenerator);
NativeReturnMarshaller = new(new TypePositionInfo(SpecialTypeInfo.Void, NoMarshallingInfo.Instance), fallbackGenerator);
ManagedReturnMarshaller = new(new TypePositionInfo(SpecialTypeInfo.Void, NoMarshallingInfo.Instance), fallbackGenerator);
ManagedExceptionMarshaller = new(new TypePositionInfo(SpecialTypeInfo.Void, NoMarshallingInfo.Instance), fallbackGenerator);

foreach (TypePositionInfo argType in elementTypeInfo)
{
Expand Down Expand Up @@ -158,7 +156,7 @@ IMarshallingGenerator CreateGenerator(TypePositionInfo p, IMarshallingGeneratorF
catch (MarshallingNotSupportedException e)
{
bindingFailures.Add((p, e));
return FallbackGenerator;
return fallbackGenerator;
}
}
}
Expand Down