Skip to content

Commit eadc4d4

Browse files
authored
Merge branch 'main' into lazy_jsexport
2 parents 2d4432c + 42a2f25 commit eadc4d4

File tree

120 files changed

+4806
-2460
lines changed

Some content is hidden

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

120 files changed

+4806
-2460
lines changed

.github/copilot-instructions.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ In addition to the rules enforced by `.editorconfig`, you SHOULD:
3737
- [5.1. How To: Identify Affected Libraries](#51-how-to-identify-affected-libraries)
3838
- [5.2. How To: Build and Test Specific Library](#52-how-to-build-and-test-specific-library)
3939
- [6. WebAssembly (WASM) Libraries Workflow](#6-webassembly-wasm-libraries-workflow)
40-
- [7. Additional Notes](#7-additional-notes)
41-
- [7.1. Troubleshooting](#71-troubleshooting)
42-
- [7.2. Windows Command Equivalents](#72-windows-command-equivalents)
43-
- [7.3. References](#73-references)
40+
- [7. Host Workflow](#7-host-workflow)
41+
- [8. Additional Notes](#8-additional-notes)
42+
- [8.1. Troubleshooting](#81-troubleshooting)
43+
- [8.2. Windows Command Equivalents](#82-windows-command-equivalents)
44+
- [8.3. References](#83-references)
4445

4546
## 1. Prerequisites
4647

@@ -54,6 +55,7 @@ Identify which components will be impacted by the changes. If in doubt, analyze
5455
- **Mono Runtime:** Changes in `src/mono/`
5556
- **Libraries:** Changes in `src/libraries/`
5657
- **WASM/WASI Libraries:** Changes in `src/libraries/` *and* the affected library targets WASM or WASI *and* the changes are included for the target (see below for details).
58+
- **Host:** Changes in `src/native/corehost/`, `src/installer/managed/`, or `src/installer/tests/`
5759
- If none above apply, it is most possibly an infra-only or a docs-only change. Skip build and test steps.
5860

5961
**WASM/WASI Library Change Detection**
@@ -76,6 +78,7 @@ Before applying any changes, ensure you have a full successful build of the need
7678
- **Mono Runtime:** `./build.sh mono+libs`
7779
- **Libraries:** `./build.sh clr+libs -rc release`
7880
- **WASM/WASI Libraries:** `./build.sh mono+libs -os browser`
81+
- **Host:** `./build.sh clr+libs+host -rc release -lc release`
7982

8083
3. Verify the build completed without error.
8184
- _If the baseline build failed, report the failure and don't proceed with the changes._
@@ -239,9 +242,24 @@ From the repository root:
239242

240243
---
241244

242-
## 7. Additional Notes
245+
## 7. Host Workflow
243246

244-
### 7.1. Troubleshooting
247+
From the repository root:
248+
249+
- Build:
250+
`./build.sh host -rc release -lc release`
251+
252+
- Run all tests:
253+
`./build.sh host.tests -rc release -lc release -test`
254+
255+
- More info can be found in the dedicated workflow docs:
256+
- [Building and running host tests](/docs/workflow/testing/host/testing.md)
257+
258+
---
259+
260+
## 8. Additional Notes
261+
262+
### 8.1. Troubleshooting
245263

246264
- **Shared Framework Missing**
247265

@@ -273,15 +291,15 @@ From the repository root:
273291

274292
---
275293

276-
### 7.2. Windows Command Equivalents
294+
### 8.2. Windows Command Equivalents
277295

278296
- Use `build.cmd` instead of `build.sh` on Windows.
279297
- Set PATH: `set PATH=%CD%\.dotnet;%PATH%`
280298
- All other commands are similar unless otherwise noted.
281299

282300
---
283301

284-
### 7.3. References
302+
### 8.3. References
285303

286304
- [`.editorconfig`](/.editorconfig)
287305
- [Building CoreCLR Guide](/docs/workflow/building/coreclr/README.md)
@@ -292,3 +310,4 @@ From the repository root:
292310
- [Testing Libraries](/docs/workflow/testing/libraries/testing.md)
293311
- [Build libraries for WebAssembly](/docs/workflow/building/libraries/webassembly-instructions.md)
294312
- [Testing Libraries on WebAssembly](/docs/workflow/testing/libraries/testing-wasm.md)
313+
- [Building and running host tests](/docs/workflow/testing/host/testing.md)

docs/design/datacontracts/RuntimeTypeSystem.md

Lines changed: 45 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,18 @@ partial interface IRuntimeTypeSystem : IContract
5151
// True if the MethodTable represents a type that contains managed references
5252
public virtual bool ContainsGCPointers(TypeHandle typeHandle);
5353
public virtual bool IsDynamicStatics(TypeHandle typeHandle);
54-
public virtual ushort GetNumMethods(TypeHandle typeHandle);
5554
public virtual ushort GetNumInterfaces(TypeHandle typeHandle);
5655

5756
// Returns an ECMA-335 TypeDef table token for this type, or for its generic type definition if it is a generic instantiation
5857
public virtual uint GetTypeDefToken(TypeHandle typeHandle);
58+
public virtual ushort GetNumMethods(TypeHandle typeHandle);
5959
// Returns the ECMA 335 TypeDef table Flags value (a bitmask of TypeAttributes) for this type,
6060
// or for its generic type definition if it is a generic instantiation
6161
public virtual uint GetTypeDefTypeAttributes(TypeHandle typeHandle);
62+
public ushort GetNumInstanceFields(TypeHandle typeHandle);
63+
public ushort GetNumStaticFields(TypeHandle typeHandle);
64+
public ushort GetNumThreadStaticFields(TypeHandle typeHandle);
65+
public TargetPointer GetFieldDescList(TypeHandle typeHandle);
6266
public virtual ReadOnlySpan<TypeHandle> GetInstantiation(TypeHandle typeHandle);
6367
public virtual bool IsGenericTypeDefinition(TypeHandle typeHandle);
6468

@@ -348,6 +352,10 @@ The contract additionally depends on these data descriptors
348352
| `EEClass` | `NumMethods` | Count of methods attached to the EEClass |
349353
| `EEClass` | `NumNonVirtualSlots` | Count of non-virtual slots for the EEClass |
350354
| `EEClass` | `CorTypeAttr` | Various flags |
355+
| `EEClass` | `NumInstanceFields` | Count of instance fields of the EEClass |
356+
| `EEClass` | `NumStaticFields` | Count of static fields of the EEClass |
357+
| `EEClass` | `NumThreadStaticFields` | Count of threadstatic fields of the EEClass |
358+
| `EEClass` | `FieldDescList` | A list of fields in the type |
351359
| `ArrayClass` | `Rank` | Rank of the associated array MethodTable |
352360
| `TypeDesc` | `TypeAndFlags` | The lower 8 bits are the CorElementType of the `TypeDesc`, the upper 24 bits are reserved for flags |
353361
| `ParamTypeDesc` | `TypeArg` | Associated type argument |
@@ -374,11 +382,35 @@ The contract additionally depends on these data descriptors
374382
return TypeHandle { Address = typeHandlePointer }
375383
}
376384

385+
public TargetPointer GetModule(TypeHandle TypeHandle)
386+
{
387+
if (typeHandle.IsMethodTable())
388+
{
389+
return _methodTables[TypeHandle.Address].Module;
390+
}
391+
else if (typeHandle.IsTypeDesc())
392+
{
393+
if (HasTypeParam(typeHandle))
394+
{
395+
return GetModule(GetTypeParam(typeHandle));
396+
}
397+
else if (IsGenericVariable(typeHandle, out TargetPointer genericParamModule, out _))
398+
{
399+
return genericParamModule;
400+
}
401+
}
402+
return TargetPointer.Null;
403+
}
404+
377405
internal static EEClassOrCanonMTBits GetEEClassOrCanonMTBits(TargetPointer eeClassOrCanonMTPtr)
378406
{
379407
return (EEClassOrCanonMTBits)(eeClassOrCanonMTPtr & (ulong)EEClassOrCanonMTBits.Mask);
380408
}
381409

410+
public TargetPointer GetCanonicalMethodTable(TypeHandle TypeHandle) => !typeHandle.IsMethodTable() ? TargetPointer.Null : GetClassData(TypeHandle).MethodTable;
411+
412+
public TargetPointer GetParentMethodTable(TypeHandle TypeHandle) => !typeHandle.IsMethodTable() ? TargetPointer.Null : _methodTables[TypeHandle.Address].ParentMethodTable;
413+
382414
public uint GetBaseSize(TypeHandle TypeHandle) => !typeHandle.IsMethodTable() ? (uint)0 : _methodTables[TypeHandle.Address].Flags.BaseSize;
383415

384416
public uint GetComponentSize(TypeHandle TypeHandle) =>!typeHandle.IsMethodTable() ? (uint)0 : GetComponentSize(_methodTables[TypeHandle.Address]);
@@ -397,36 +429,16 @@ The contract additionally depends on these data descriptors
397429
... // read Data.EEClass data from eeClassPtr
398430
}
399431

400-
401-
public TargetPointer GetCanonicalMethodTable(TypeHandle TypeHandle) => !typeHandle.IsMethodTable() ? TargetPointer.Null : GetClassData(TypeHandle).MethodTable;
402-
403-
public TargetPointer GetModule(TypeHandle TypeHandle)
404-
{
405-
if (typeHandle.IsMethodTable())
406-
{
407-
return _methodTables[TypeHandle.Address].Module;
408-
}
409-
else if (typeHandle.IsTypeDesc())
410-
{
411-
if (HasTypeParam(typeHandle))
412-
{
413-
return GetModule(GetTypeParam(typeHandle));
414-
}
415-
else if (IsGenericVariable(typeHandle, out TargetPointer genericParamModule, out _))
416-
{
417-
return genericParamModule;
418-
}
419-
}
420-
return TargetPointer.Null;
421-
}
422-
423-
public TargetPointer GetParentMethodTable(TypeHandle TypeHandle) => !typeHandle.IsMethodTable() ? TargetPointer.Null : _methodTables[TypeHandle.Address].ParentMethodTable;
424-
425432
public bool IsFreeObjectMethodTable(TypeHandle TypeHandle) => FreeObjectMethodTablePointer == TypeHandle.Address;
426433

427434
public bool IsString(TypeHandle TypeHandle) => !typeHandle.IsMethodTable() ? false : _methodTables[TypeHandle.Address].Flags.IsString;
435+
428436
public bool ContainsGCPointers(TypeHandle TypeHandle) => !typeHandle.IsMethodTable() ? false : _methodTables[TypeHandle.Address].Flags.ContainsGCPointers;
429437

438+
public bool IsDynamicStatics(TypeHandle TypeHandle) => !typeHandle.IsMethodTable() ? false : _methodTables[TypeHandle.Address].Flags.IsDynamicStatics;
439+
440+
public ushort GetNumInterfaces(TypeHandle TypeHandle) => !typeHandle.IsMethodTable() ? 0 : _methodTables[TypeHandle.Address].NumInterfaces;
441+
430442
public uint GetTypeDefToken(TypeHandle TypeHandle)
431443
{
432444
if (!typeHandle.IsMethodTable())
@@ -438,11 +450,15 @@ The contract additionally depends on these data descriptors
438450

439451
public ushort GetNumMethods(TypeHandle TypeHandle) => !typeHandle.IsMethodTable() ? 0 : GetClassData(TypeHandle).NumMethods;
440452

441-
public ushort GetNumInterfaces(TypeHandle TypeHandle) => !typeHandle.IsMethodTable() ? 0 : _methodTables[TypeHandle.Address].NumInterfaces;
442-
443453
public uint GetTypeDefTypeAttributes(TypeHandle TypeHandle) => !typeHandle.IsMethodTable() ? 0 : GetClassData(TypeHandle).CorTypeAttr;
444454

445-
public bool IsDynamicStatics(TypeHandle TypeHandle) => !typeHandle.IsMethodTable() ? false : _methodTables[TypeHandle.Address].Flags.IsDynamicStatics;
455+
public ushort GetNumInstanceFields(TypeHandle typeHandle) => !typeHandle.IsMethodTable() ? (ushort)0 : GetClassData(typeHandle).NumInstanceFields;
456+
457+
public ushort GetNumStaticFields(TypeHandle typeHandle) => !typeHandle.IsMethodTable() ? (ushort)0 : GetClassData(typeHandle).NumStaticFields;
458+
459+
public ushort GetNumThreadStaticFields(TypeHandle typeHandle) => !typeHandle.IsMethodTable() ? (ushort)0 : GetClassData(typeHandle).NumThreadStaticFields;
460+
461+
public TargetPointer GetFieldDescList(TypeHandle typeHandle) => !typeHandle.IsMethodTable() ? TargetPointer.Null : GetClassData(typeHandle).FieldDescList;
446462

447463
public ReadOnlySpan<TypeHandle> GetInstantiation(TypeHandle TypeHandle)
448464
{
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Debug Interface Globals
2+
3+
The following document lists the global variables that are used directly in the debug interface managed code (SOSDacImpl.cs, etc.)
4+
5+
Global variables used
6+
| Global Name | Type | Purpose |
7+
| --- | --- | --- |
8+
| StringMethodTable | TargetPointer | Identify where the string MethodTable exists |
9+
| ObjectMethodTable | TargetPointer | Identify where the object MethodTable exists |
10+
| SystemDomain | TargetPointer | Identify where the SystemDomain exists |
11+
| DirectorySeparator | TargetPointer | Identify where the directory separator exists |
12+
| FeatureCOMInterop | TargetPointer | Identify where the flag for FeatureCOMInterop exists |
13+
| StressLog | TargetPointer | Identify where the StressLog exists |
14+
| AppDomain | TargetPointer | Identify where the AppDomain exists |
15+
| ObjectArrayMethodTable | TargetPointer | Identify where the ObjectArrayMethodTable exists |
16+
| ExceptionMethodTable | TargetPointer | Identify where the ExceptionMethodTable exists |
17+
| FreeObjectMethodTable | TargetPointer | Identify where the FreeObjectMethodTable exists |
18+
| SOSBreakingChangeVersion | TargetPointer | Identify where the SOSBreakingChangeVersion exists |
19+
| DacNotificationFlags | TargetPointer | Identify where the DacNotificationFlags exists |
20+
| MaxClrNotificationArgs | uint32 | Identify the maximum number of CLR notification arguments |
21+
| ClrNotificationArguments | TargetPointer | Identify where the ClrNotificationArguments exists |
22+
| DefaultADID | uint | Identify the default AppDomain ID |

eng/Versions.props

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
<FlagNetStandard1XDependencies Condition="'$(FlagNetStandard1XDependencies)' == ''">true</FlagNetStandard1XDependencies>
2929
<!-- Runtime controls its dependency graph via Traversal projects and doesn't want or need Arcade's ExcludeFrom infrastructure. -->
3030
<DisableArcadeExcludeFromBuildSupport>true</DisableArcadeExcludeFromBuildSupport>
31-
<!-- Use SDK compilers in full VMR builds. -->
32-
<UsingToolMicrosoftNetCompilers Condition="'$(DotNetBuildOrchestrator)' != 'true'">true</UsingToolMicrosoftNetCompilers>
31+
<UsingToolMicrosoftNetCompilers>true</UsingToolMicrosoftNetCompilers>
3332
</PropertyGroup>
3433
<ItemGroup>
3534
<WorkloadSdkBandVersions Include="$(SdkBandVersion)" SupportsMachineArch="true" />

eng/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ initDistroRid()
150150

151151
showSubsetHelp()
152152
{
153-
"$scriptroot/common/build.sh" "-restore" "-build" "/p:Subset=help" "/clp:nosummary /tl:false"
153+
"$scriptroot/common/build.sh" "-restore" "-build" "/p:Subset=help" "/clp:nosummary" "/tl:false"
154154
}
155155

156156
arguments=()

src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3974,6 +3974,11 @@ internal object GetUninitializedObject()
39743974
throw new MissingMethodException(SR.Format(SR.Arg_NoDefCTor, this));
39753975
}
39763976

3977+
if (IsByRefLike)
3978+
{
3979+
throw new NotSupportedException(SR.NotSupported_ByRefLike);
3980+
}
3981+
39773982
// Compat: allocation always takes place outside the try block so that OOMs
39783983
// bubble up to the caller; the ctor invocation is within the try block so
39793984
// that it can be wrapped in TIE if needed.
@@ -3996,6 +4001,8 @@ internal object GetUninitializedObject()
39964001
[DebuggerHidden]
39974002
internal object? CreateInstanceOfT()
39984003
{
4004+
Debug.Assert(!IsValueType);
4005+
39994006
ActivatorCache cache = GetOrCreateCacheEntry<ActivatorCache>();
40004007

40014008
if (!cache.CtorIsPublic)

src/coreclr/debug/runtimeinfo/datadescriptor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,12 @@ CDAC_TYPE_BEGIN(EEClass)
333333
CDAC_TYPE_INDETERMINATE(EEClass)
334334
CDAC_TYPE_FIELD(EEClass, /*pointer*/, MethodTable, cdac_data<EEClass>::MethodTable)
335335
CDAC_TYPE_FIELD(EEClass, /*uint16*/, NumMethods, cdac_data<EEClass>::NumMethods)
336+
CDAC_TYPE_FIELD(EEClass, /*pointer*/, FieldDescList, cdac_data<EEClass>::FieldDescList)
336337
CDAC_TYPE_FIELD(EEClass, /*uint32*/, CorTypeAttr, cdac_data<EEClass>::CorTypeAttr)
337338
CDAC_TYPE_FIELD(EEClass, /*uint8*/, InternalCorElementType, cdac_data<EEClass>::InternalCorElementType)
339+
CDAC_TYPE_FIELD(EEClass, /*uint16*/, NumInstanceFields, cdac_data<EEClass>::NumInstanceFields)
340+
CDAC_TYPE_FIELD(EEClass, /*uint16*/, NumStaticFields, cdac_data<EEClass>::NumStaticFields)
341+
CDAC_TYPE_FIELD(EEClass, /*uint16*/, NumThreadStaticFields, cdac_data<EEClass>::NumThreadStaticFields)
338342
CDAC_TYPE_FIELD(EEClass, /*uint16*/, NumNonVirtualSlots, cdac_data<EEClass>::NumNonVirtualSlots)
339343
CDAC_TYPE_END(EEClass)
340344

@@ -968,6 +972,7 @@ CDAC_GLOBAL_POINTER(StringMethodTable, &::g_pStringClass)
968972
CDAC_GLOBAL_POINTER(SyncTableEntries, &::g_pSyncTable)
969973
CDAC_GLOBAL_POINTER(MiniMetaDataBuffAddress, &::g_MiniMetaDataBuffAddress)
970974
CDAC_GLOBAL_POINTER(MiniMetaDataBuffMaxSize, &::g_MiniMetaDataBuffMaxSize)
975+
CDAC_GLOBAL_POINTER(DacNotificationFlags, &::g_dacNotificationFlags)
971976
CDAC_GLOBAL_POINTER(OffsetOfCurrentThreadInfo, &::g_offsetOfCurrentThreadInfo)
972977
#ifdef TARGET_WINDOWS
973978
CDAC_GLOBAL_POINTER(TlsIndexBase, &::_tls_index)

src/coreclr/jit/compiler.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4741,11 +4741,6 @@ class Compiler
47414741
void getHWIntrinsicImmTypes(NamedIntrinsic intrinsic,
47424742
CORINFO_SIG_INFO* sig,
47434743
unsigned immNumber,
4744-
var_types simdBaseType,
4745-
CorInfoType simdBaseJitType,
4746-
CORINFO_CLASS_HANDLE op1ClsHnd,
4747-
CORINFO_CLASS_HANDLE op2ClsHnd,
4748-
CORINFO_CLASS_HANDLE op3ClsHnd,
47494744
unsigned* immSimdSize,
47504745
var_types* immSimdBaseType);
47514746

@@ -6990,8 +6985,8 @@ class Compiler
69906985
public:
69916986
PhaseStatus optOptimizeBools();
69926987
PhaseStatus optRecognizeAndOptimizeSwitchJumps();
6993-
bool optSwitchConvert(BasicBlock* firstBlock, int testsCount, ssize_t* testValues, weight_t falseLikelihood, GenTree* nodeToTest);
6994-
bool optSwitchDetectAndConvert(BasicBlock* firstBlock, bool testingForConversion = false);
6988+
bool optSwitchConvert(BasicBlock* firstBlock, int testsCount, ssize_t* testValues, weight_t falseLikelihood, GenTree* nodeToTest, bool testingForConversion = false, BitVec* ccmpVec = nullptr);
6989+
bool optSwitchDetectAndConvert(BasicBlock* firstBlock, bool testingForConversion = false, BitVec* ccmpVec = nullptr);
69956990

69966991
PhaseStatus optInvertLoops(); // Invert loops so they're entered at top and tested at bottom.
69976992
PhaseStatus optOptimizeFlow(); // Simplify flow graph and do tail duplication

src/coreclr/jit/gentree.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32399,10 +32399,10 @@ GenTree* Compiler::gtFoldExprHWIntrinsic(GenTreeHWIntrinsic* tree)
3239932399
GenTreeHWIntrinsic* cvtOp1 = op1->AsHWIntrinsic();
3240032400
GenTreeHWIntrinsic* cvtOp2 = (effectiveOper == GT_NOT) ? cvtOp1 : op2->AsHWIntrinsic();
3240132401

32402-
unsigned simdBaseTypeSize = genTypeSize(simdBaseType);
32402+
var_types op1SimdBaseType = cvtOp1->GetSimdBaseType();
32403+
var_types op2SimdBaseType = cvtOp2->GetSimdBaseType();
3240332404

32404-
if ((genTypeSize(cvtOp1->GetSimdBaseType()) == simdBaseTypeSize) &&
32405-
(genTypeSize(cvtOp2->GetSimdBaseType()) == simdBaseTypeSize))
32405+
if (genTypeSize(op1SimdBaseType) == genTypeSize(op2SimdBaseType))
3240632406
{
3240732407
// We need both operands to be the same kind of mask; otherwise
3240832408
// the bitwise operation can differ in how it performs
@@ -32455,6 +32455,12 @@ GenTree* Compiler::gtFoldExprHWIntrinsic(GenTreeHWIntrinsic* tree)
3245532455
tree->gtFlags &= ~GTF_REVERSE_OPS;
3245632456
}
3245732457

32458+
// The bitwise operation is likely normalized to int or uint, while
32459+
// the underlying convert ops may be a small type. We need to preserve
32460+
// such a small type since that indicates how many elements are in the mask.
32461+
simdBaseJitType = cvtOp1->GetSimdBaseJitType();
32462+
tree->SetSimdBaseJitType(simdBaseJitType);
32463+
3245832464
tree->gtType = TYP_MASK;
3245932465
DEBUG_DESTROY_NODE(op1);
3246032466

0 commit comments

Comments
 (0)