Skip to content

Commit 54ebe83

Browse files
committed
Merge branch 'main' into Fix_saved_pinned_plug_index
2 parents e144645 + a761b9f commit 54ebe83

File tree

4,414 files changed

+168955
-191031
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,414 files changed

+168955
-191031
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
]
1616
},
1717
"microsoft.dotnet.xharness.cli": {
18-
"version": "1.0.0-prerelease.21527.1",
18+
"version": "1.0.0-prerelease.21558.2",
1919
"commands": [
2020
"xharness"
2121
]

.devcontainer/devcontainer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
// Use 'onCreateCommand' to run pre-build commands inside the codespace
2424
"onCreateCommand": "${containerWorkspaceFolder}/.devcontainer/scripts/onCreateCommand.sh",
2525

26+
// Use 'postCreateCommand' to run commands after the container is created.
27+
"postCreateCommand": "${containerWorkspaceFolder}/.devcontainer/scripts/postCreateCommand.sh",
28+
2629
// Add the locally installed dotnet to the path to ensure that it is activated
2730
// This allows developers to just use 'dotnet build' on the command-line, and the local dotnet version will be used.
2831
"remoteEnv": {

.devcontainer/scripts/onCreateCommand.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ set -e
44

55
# prebuild the repo, so it is ready for development
66
./build.sh libs+clr -rc Release
7+
8+
# save the commit hash of the currently built assemblies, so developers know which version was built
9+
git rev-parse HEAD > ./artifacts/prebuild.sha
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# reset the repo to the commit hash that was used to build the prebuilt Codespace
6+
git reset --hard $(cat ./artifacts/prebuild.sha)

.vsconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"Microsoft.Net.Component.4.7.TargetingPack",
2828
"Microsoft.VisualStudio.Component.ClassDesigner",
2929
"Microsoft.VisualStudio.Component.GraphDocument",
30-
"Microsoft.VisualStudio.Component.CodeMap",
3130
"Microsoft.VisualStudio.Component.VC.CoreIde",
3231
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
3332
"Microsoft.VisualStudio.Component.Windows10SDK.19041",
@@ -37,7 +36,6 @@
3736
"Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging",
3837
"Microsoft.VisualStudio.Workload.ManagedDesktop",
3938
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
40-
"Microsoft.VisualStudio.ComponentGroup.ArchitectureTools.Native",
4139
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
4240
"Microsoft.VisualStudio.Component.VC.Tools.ARM64",
4341
"Microsoft.VisualStudio.Component.VC.CLI.Support",

Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<_hostOS Condition="'$(TargetOS)' == 'Browser'">Browser</_hostOS>
2121
<TargetOS Condition="'$(TargetOS)' == ''">$(_hostOS)</TargetOS>
2222
<TargetsMobile Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator' or '$(TargetOS)' == 'Android' or '$(TargetOS)' == 'Browser'">true</TargetsMobile>
23+
<TargetsAppleMobile Condition="'$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator'">true</TargetsAppleMobile>
2324
</PropertyGroup>
2425

2526
<!-- Platform property is required by RepoLayout.props in Arcade SDK. -->
@@ -122,7 +123,7 @@
122123
<_parseDistroRid>$(__DistroRid)</_parseDistroRid>
123124
<_parseDistroRid Condition="'$(_parseDistroRid)' == '' and '$(MSBuildRuntimeType)' == 'core'">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</_parseDistroRid>
124125
<_parseDistroRid Condition="'$(_parseDistroRid)' == '' and '$(MSBuildRuntimeType)' != 'core'">win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant)</_parseDistroRid>
125-
<_distroRidIndex>$(_parseDistroRid.LastIndexOfAny("-"))</_distroRidIndex>
126+
<_distroRidIndex>$(_parseDistroRid.LastIndexOf('-'))</_distroRidIndex>
126127

127128
<_runtimeOS>$(RuntimeOS)</_runtimeOS>
128129
<_runtimeOS Condition="'$(_runtimeOS)' == ''">$(_parseDistroRid.SubString(0, $(_distroRidIndex)))</_runtimeOS>

docs/area-owners.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Note: Editing this file doesn't update the mapping used by the `@msftbot` issue
5353
| area-Microsoft.Extensions | @ericstj | @maryamariyan @michaelgsharp @safern @tarekgh | Consultants: @eerhardt |
5454
| area-Microsoft.VisualBasic | @jaredpar | @cston @333fred | Archived component - limited churn/contributions (see [#27790](https://github.com/dotnet/runtime/issues/27790)) |
5555
| area-Microsoft.Win32 | @ericstj | @Anipik @ViktorHofer | Including System.Windows.Extensions |
56+
| area-NativeAOT-coreclr | @agocke | @MichalStrehovsky @jkotas | |
5657
| area-PAL-coreclr | @mangod9 | @janvorli | |
5758
| area-PAL-libraries | @jeffhandley | @bartonjs @GrabYourPitchforks | |
5859
| area-Performance-mono | @SamMonoRT | @SamMonoRT | |

docs/design/coreclr/botr/corelib.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ The pointers to common unmanaged EE structures should be wrapped into handle typ
7474

7575
Passing object references in and out of QCalls is done by wrapping a pointer to a local variable in a handle. It is intentionally cumbersome and should be avoided if reasonably possible. See the `StringHandleOnStack` in the example below. Returning objects, especially strings, from QCalls is the only common pattern where passing the raw objects is widely acceptable. (For reasoning on why this set of restrictions helps make QCalls less prone to GC holes, read the ["GC Holes, FCall, and QCall"](#gcholes) section below.)
7676

77+
QCalls should be implemented with a C-style method signature. This makes it easier for AOT tooling in the future to connect a QCall on the managed side to the implementation on the native side.
78+
7779
### QCall example - managed
7880

7981
Do not replicate the comments into your actual QCall implementation. This is for illustrative purposes.
@@ -82,7 +84,7 @@ Do not replicate the comments into your actual QCall implementation. This is for
8284
class Foo
8385
{
8486
// All QCalls should have the following DllImport attribute
85-
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
87+
[DllImport(RuntimeHelpers.QCall, EntryPoint = "Foo_BarInternal", CharSet = CharSet.Unicode)]
8688

8789
// QCalls should always be static extern.
8890
private static extern bool BarInternal(int flags, string inString, StringHandleOnStack retString);
@@ -110,20 +112,13 @@ class Foo
110112

111113
Do not replicate the comments into your actual QCall implementation.
112114

113-
The QCall entrypoint has to be registered in tables in [vm\ecalllist.h][ecalllist] using `QCFuncEntry` macro. See ["Registering your QCall or FCall Method"](#register) below.
115+
The QCall entrypoint has to be registered in tables in [vm\qcallentrypoints.cpp][qcall-entrypoints] using the `DllImportEntry` macro. See ["Registering your QCall or FCall Method"](#register) below.
114116

115-
[ecalllist]: https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/ecalllist.h
117+
[qcall-entrypoints]: https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/qcallentrypoints.cpp
116118

117119
```C++
118-
class FooNative
119-
{
120-
public:
121-
// All QCalls should be static and tagged with QCALLTYPE
122-
static
123-
BOOL QCALLTYPE BarInternal(int flags, LPCWSTR wszString, QCall::StringHandleOnStack retString);
124-
};
125-
126-
BOOL QCALLTYPE FooNative::BarInternal(int flags, LPCWSTR wszString, QCall::StringHandleOnStack retString)
120+
// All QCalls should be free functions and tagged with QCALLTYPE and extern "C"
121+
extern "C" BOOL QCALLTYPE Foo_BarInternal(int flags, LPCWSTR wszString, QCall::StringHandleOnStack retString)
127122
{
128123
// All QCalls should have QCALL_CONTRACT.
129124
// It is alias for THROWS; GC_TRIGGERS; MODE_PREEMPTIVE.
@@ -221,6 +216,8 @@ public partial sealed class String
221216

222217
The FCall entrypoint has to be registered in tables in [vm\ecalllist.h][ecalllist] using `FCFuncEntry` macro. See ["Registering your QCall or FCall Method"](#register).
223218

219+
[ecalllist]: https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/ecalllist.h
220+
224221
This method is an instance method in managed code, with the "this" parameter passed as the first argument. We use `StringObject*` as the argument type, then copy it into a `STRINGREF` so we get some error checking when we use it.
225222

226223
```C++
@@ -250,7 +247,7 @@ FCIMPLEND
250247
251248
## <a name="register"></a> Registering your QCall or FCall method
252249
253-
The CLR must know the name of your QCall and FCall methods, both in terms of the managed class and method names, as well as which native methods to call. That is done in [ecalllist.h][ecalllist], with two arrays. The first array maps namespace and class names to an array of function elements. That array of function elements then maps individual method names and signatures to function pointers.
250+
The CLR must know the name of your QCall and FCall methods, both in terms of the managed class and method names, as well as which native methods to call. For FCalls, registration is done in [ecalllist.h][ecalllist], with two arrays. The first array maps namespace and class names to an array of function elements. That array of function elements then maps individual method names and signatures to function pointers.
254251
255252
Say we defined an FCall method for `String.IsInterned()`, in the example above. First, we need to ensure that we have an array of function elements for the String class.
256253
@@ -271,7 +268,16 @@ FCFuncStart(gStringFuncs)
271268
FCFuncEnd()
272269
```
273270
274-
There is a parallel `QCFuncElement` macro.
271+
QCalls are registered in [qcallentrypoints.cpp][qcall-entrypoints] in the `s_QCall` array with the `DllImportEntry` macro as follows:
272+
273+
```C++
274+
static const Entry s_QCall[] =
275+
{
276+
...
277+
DllImportEntry(MyQCall),
278+
...
279+
};
280+
```
275281

276282
## Naming convention
277283

@@ -285,9 +291,9 @@ Certain managed types must have a representation available in both managed and n
285291

286292
The CLR provides a binder for this purpose. After you define your managed and native classes, you should provide some clues to the binder to help ensure that the field offsets remain the same to quickly spot when someone accidentally adds a field to only one definition of a type.
287293

288-
In [mscorlib.h][mscorlib.h], use macros ending in "_U" to describe a type, the name of fields in managed code, and the name of fields in a corresponding native data structure. Additionally, you can specify a list of methods, and reference them by name when you attempt to call them later.
294+
In [corelib.h][corelib.h], use macros ending in "_U" to describe a type, the name of fields in managed code, and the name of fields in a corresponding native data structure. Additionally, you can specify a list of methods, and reference them by name when you attempt to call them later.
289295

290-
[mscorlib.h]: https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/mscorlib.h
296+
[corelib.h]: https://github.com/dotnet/runtime/blob/main/src/coreclr/vm/corelib.h
291297

292298
``` C++
293299
DEFINE_CLASS_U(SAFE_HANDLE, Interop, SafeHandle, SafeHandle)
@@ -345,7 +351,7 @@ When the CLR starts up, CoreLib is loaded by a method called `SystemDomain::Load
345351

346352
For FCalls, look in [fcall.h][fcall] for infrastructure, and [ecalllist.h][ecalllist] to properly inform the runtime about your FCall method.
347353

348-
For QCalls, look in [qcall.h][qcall] for associated infrastructure, and [ecalllist.h][ecalllist] to properly inform the runtime about your QCall method.
354+
For QCalls, look in [qcall.h][qcall] for associated infrastructure, and [qcallentrypoints.cpp][qcall-entrypoints] to properly inform the runtime about your QCall method.
349355

350356
More general infrastructure and some native type definitions can be found in [object.h][object.h]. The binder uses `mscorlib.h` to associate managed and native classes.
351357

0 commit comments

Comments
 (0)