forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Share TypedReference managed code between CoreCLR and Mono (dotnet#60636
) * [mono] Rename common TypedReference fields to the same names as CoreCLR * Share TypedReference managed code between CoreCLR and Mono The field layout is different. Although both have `_value` as a pointer to the value (and this PR updates mono to use a `ByReference<byte>` for that pointer, same as CoreCLR), and a `_type` which is a type handle (`MonoClass` in mono on the native side), in addition, mono also has a RuntimeTypeHandle (`MonoType` in mono on the native side) that is used to help the JIT. But the managed code is identical and only uses `_value` and `_type`.
- Loading branch information
1 parent
353c27d
commit ab10871
Showing
7 changed files
with
43 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/coreclr/System.Private.CoreLib/src/System/TypedReference.CoreCLR.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
// TypedReference is basically only ever seen on the call stack, and in param arrays. | ||
// These are blob that must be dealt with by the compiler. | ||
|
||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using Internal.Runtime.CompilerServices; | ||
|
||
namespace System | ||
{ | ||
[System.Runtime.Versioning.NonVersionable] // This only applies to field layout | ||
public ref partial struct TypedReference | ||
{ | ||
private readonly ByReference<byte> _value; | ||
private readonly IntPtr _type; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/mono/System.Private.CoreLib/src/System/TypedReference.Mono.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using Internal.Runtime.CompilerServices; | ||
|
||
namespace System | ||
{ | ||
public ref partial struct TypedReference | ||
{ | ||
#region sync with object-internals.h | ||
#pragma warning disable CA1823 // used by runtime | ||
private readonly RuntimeTypeHandle type; | ||
private readonly ByReference<byte> _value; | ||
private readonly IntPtr _type; | ||
#pragma warning restore CA1823 | ||
#endregion | ||
} | ||
} |
108 changes: 0 additions & 108 deletions
108
src/mono/System.Private.CoreLib/src/System/TypedReference.cs
This file was deleted.
Oops, something went wrong.