-
Notifications
You must be signed in to change notification settings - Fork 510
CppCodeGen: implement shared generics and support generic virtual methods #6467
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,14 +19,14 @@ namespace ILCompiler.DependencyAnalysis | |
/// Similarly, the dependencies that we track for canonicl type instantiations are minimal, and are just the ones used | ||
/// by the dynamic type loader | ||
/// </summary> | ||
internal sealed class CanonicalEETypeNode : EETypeNode | ||
public sealed class CanonicalEETypeNode : EETypeNode | ||
{ | ||
public CanonicalEETypeNode(NodeFactory factory, TypeDesc type) : base(factory, type) | ||
{ | ||
Debug.Assert(!type.IsCanonicalDefinitionType(CanonicalFormKind.Any)); | ||
Debug.Assert(type.IsCanonicalSubtype(CanonicalFormKind.Any)); | ||
Debug.Assert(type == type.ConvertToCanonForm(CanonicalFormKind.Specific)); | ||
Debug.Assert(!type.IsMdArray); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not be ending up with canonical EETypes for MdArrays - the template type loader doesn't need templates for these because there's nothing generic about them (they don't implement the generic interfaces that normal arrays do, such as What stack are you hitting this assert from? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm hitting following stacktrace:
when compiling this method: public override void M<T>(T t)
{
T[,] a = new T[2, 2];
System.Console.WriteLine("Virtual B " + t + " " + a);
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's change the assert to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Thank you! |
||
Debug.Assert(!type.IsMdArray || factory.Target.Abi == TargetAbi.CppCodegen); | ||
} | ||
|
||
public override bool StaticDependenciesAreComputed => true; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do all these things types need to be public now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is forced by CppCodegen living in a separate assembly and having to special cases these node types in the CppWriter. I never really liked that that's where we ended up with for CppWriter (the other object writers only deal with
ObjectNode
and don't have to be aware of the specific type).It might be nice at some point to see if we can make CppWriter more general purpose so that it doesn't have to be aware of specific node types. But that's a future nice to have.