Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Extend EETypes with information about generic composition - #1171

Merged
MichalStrehovsky merged 2 commits into
dotnet:masterfrom
MichalStrehovsky:eeTypeGenericComposition
Apr 22, 2016
Merged

MichalStrehovsky merged 2 commits into
dotnet:masterfrom
MichalStrehovsky:eeTypeGenericComposition

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

In CoreRT we will not be using the GenericInstanceDesc mechanism from
Redhawk/Project N. Instead, generic composition (the generic type
definition, generic type arguments, arity, and variance) will be
directly available from the EEType by following two new rare fields.

The rare fields being added:

  • ETF_GenericDefinition: pointer to the EEType of the generic type
    definition
  • ETF_GenericComposition: pointer to a variable sized stream of data
    with the following grammar: ARITY | GENERIC_TYPE_ARGUMENT+ |
    GENERIC_VARIANCE*. Generic variance is present only when
    GenericVarianceFlag is set on the EEType.

In CoreRT we will not be using the `GenericInstanceDesc` mechanism from
Redhawk/Project N. Instead, generic composition (the generic type
definition, generic type arguments, arity, and variance) will be
directly available from the EEType by following two new rare fields.

The rare fields being added:
* `ETF_GenericDefinition`: pointer to the EEType of the generic type
definition
* `ETF_GenericComposition`: pointer to a variable sized stream of data
with the following grammar: ARITY | GENERIC_TYPE_ARGUMENT+ |
GENERIC_VARIANCE*. Generic variance is present only when
GenericVarianceFlag is set on the EEType.
@MichalStrehovsky

Copy link
Copy Markdown
Member Author

@jkotas @davidwrighton PTAL

CC @PeterSolMS @smosier

I'm also thinking about putting all the uses of GenericInstanceDesc within the runtime under an !CORERT ifdef. Would it make sense?

MichalStrehovsky added a commit to MichalStrehovsky/corert that referenced this pull request Apr 20, 2016
Depends on the updated runtime data structure from dotnet#1171.

This change is to emit the new rare fields within the EEType so that at
runtime, we can perform variant interface calls (example: call
`IEnumerable<object>.GetEnumerator()` on `string[]`).
ASSERT(IsGeneric());
return cbOffset;
}
if (IsGeneric())

@davidwrighton davidwrighton Apr 20, 2016 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do open generics have the IsGeneric flag set? Also, the new code must be under #ifdef CORERT

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do open generics have the IsGeneric flag set

Nope, the only bits the binder sets are: EEType::GenericTypeDefEEType, EEType::ValueTypeFlag, and EEType::IsInterfaceFlag.

@jkotas

jkotas commented Apr 22, 2016

Copy link
Copy Markdown
Member

LGTM

@MichalStrehovsky
MichalStrehovsky merged commit 6dd0e94 into dotnet:master Apr 22, 2016
@MichalStrehovsky
MichalStrehovsky deleted the eeTypeGenericComposition branch April 22, 2016 03:59
#if CORERT
*pArity = pEEType->get_GenericArity();
*ppInstantiation = pEEType->get_GenericArguments();
if (pEEType->HasGenericVariance())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion, just do pEEType->get_GenericVariance() and have the implementation return NULL when it has no variance mark.

Also adding an ASSERT that pEEType is indeed generic would be useful.

MichalStrehovsky added a commit to MichalStrehovsky/corert that referenced this pull request Apr 23, 2016
Depends on the updated runtime data structure from dotnet#1171.

This change is to emit the new rare fields within the EEType so that at
runtime, we can perform variant interface calls (example: call
`IEnumerable<object>.GetEnumerator()` on `string[]`).
MichalStrehovsky added a commit to MichalStrehovsky/corert that referenced this pull request Apr 25, 2016
Depends on the updated runtime data structure from dotnet#1171.

This change is to emit the new rare fields within the EEType so that at
runtime, we can perform variant interface calls (example: call
`IEnumerable<object>.GetEnumerator()` on `string[]`).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants