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

Add support for arrays of pointer types#3192

Merged
MichalStrehovsky merged 1 commit intodotnet:masterfrom
MichalStrehovsky:pointerArrayEETypes
Apr 4, 2017
Merged

Add support for arrays of pointer types#3192
MichalStrehovsky merged 1 commit intodotnet:masterfrom
MichalStrehovsky:pointerArrayEETypes

Conversation

@MichalStrehovsky
Copy link
Member

@MichalStrehovsky MichalStrehovsky commented Apr 3, 2017

Progress towards dotnet/corefx#17480.

On the compiler side:

  • Unblock generation of arrays of pointer EETypes. We were already doing
    the right thing w.r.t. the interface lists (these do not implement the
    generic interface: int*[] does not implement IEnumerable<int*>).
    Nothing else was missing.

On the classlib side:

  • I groveled through the places where we would box/unbox array element
    types, or assume that if the element type is not a value type, it's a
    reference type. Hopefully, I didn't miss anything.
  • One place that might look like I missed is GCHandleValidatePinnedObject,
    but it seems like CoreCLR has this missing too and you can't get a pinned
    handle to an array of pointers...
  • I pre-empted dotnet/coreclr#10646 in my implementation of
    Array.Copy.

On the runtime side:

  • I verified this doesn't affect casting (i.e. we don't allow casting
    uint*[] to int*[]), so no changes should be needed.

Progress towards dotnet/corefx#17480.

On the compiler side:
* Unblock generation of arrays of pointer EETypes. We were already doing
the right thing w.r.t. the interface lists (these *do not* implement the
generic interface: `int*[]` does not implement `IEnumerable<int*>`).
Nothing else was missing.

On the classlib side:
* I groveled through the places where we would box/unbox array element
types, or assume that if the element type is not a value type, it's a
reference type. Hopefully, I didn't miss anything.
* I pre-emptively fixed dotnet/coreclr#10646 in my implementation of
`Array.Copy`.

On the runtime side:
* I verified this doesn't affect casting (i.e. we don't allow casting
`uint*[]` to `int*[]`), so no changes should be needed.
@MichalStrehovsky
Copy link
Member Author

@davidwrighton PTAL.

The code paths that reach the type loader still have a PlatformNotSupportedException for this case. I tried to coerce the type loader into taking void*[] as the template for these and move on with life, but it seems like it needs more work.

Copy link
Member

@davidwrighton davidwrighton left a comment

Choose a reason for hiding this comment

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

This looks good. For the followon change to make the dynamic type loader work, you should look at how multidimensional arrays are generated, not normal arrays. (MDArrays and Pointer arrays both don't need code/interfaces, so the patterns of generation are similar.)

@MichalStrehovsky MichalStrehovsky merged commit 749ddd7 into dotnet:master Apr 4, 2017
@MichalStrehovsky MichalStrehovsky deleted the pointerArrayEETypes branch April 4, 2017 17:57
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.

3 participants