Skip to content

Commit 4dc9a08

Browse files
Merge main
2 parents 8d25498 + e0bfb35 commit 4dc9a08

336 files changed

Lines changed: 16795 additions & 10816 deletions

File tree

Some content is hidden

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

docs/project/list-of-diagnostics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ The diagnostic id values reserved for .NET Libraries analyzer warnings are `SYSL
274274
| __`SYSLIB1226`__ | 'JsonIgnoreCondition.Always' is not valid on type-level 'JsonIgnoreAttribute' annotations. |
275275
| __`SYSLIB1227`__ | Union case types cannot be unambiguously classified by JSON value type. |
276276
| __`SYSLIB1228`__ | Union type shape is not a valid C# union. |
277-
| __`SYSLIB1229`__ | _`SYSLIB1220`-`SYSLIB1229` reserved for System.Text.Json.SourceGeneration._ |
277+
| __`SYSLIB1229`__ | Open generic derived type could not be resolved for the polymorphic base type. |
278278
| __`SYSLIB1230`__ | Deriving from a `GeneratedComInterface`-attributed interface defined in another assembly is not supported. |
279279
| __`SYSLIB1231`__ | _`SYSLIB1230`-`SYSLIB1239` reserved for Microsoft.Interop.ComInterfaceGenerator._ |
280280
| __`SYSLIB1232`__ | _`SYSLIB1230`-`SYSLIB1239` reserved for Microsoft.Interop.ComInterfaceGenerator._ |

eng/AcquireWasiSdk.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88
<Project>
99
<PropertyGroup>
10-
<_WasiSdkVersion>25.0</_WasiSdkVersion>
10+
<_WasiSdkVersion>33.0</_WasiSdkVersion>
1111
<_RuntimeLocalWasiSdkPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'wasi-sdk'))</_RuntimeLocalWasiSdkPath>
1212
</PropertyGroup>
1313

eng/native/gen-buildsys.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ if /i "%__Arch%" == "wasm" (
7070
set "WASI_SDK_PATH=%__repoRoot%\artifacts\wasi-sdk"
7171
)
7272
set __CmakeGenerator=Ninja
73-
set __ExtraCmakeParams=%__ExtraCmakeParams% -DCLR_CMAKE_TARGET_OS=wasi "-DCMAKE_TOOLCHAIN_FILE=!WASI_SDK_PATH!/share/cmake/wasi-sdk-p2.cmake" "-DCMAKE_CROSSCOMPILING_EMULATOR=node --experimental-wasm-bigint --experimental-wasi-unstable-preview1"
73+
set __ExtraCmakeParams=%__ExtraCmakeParams% -DCLR_CMAKE_TARGET_OS=wasi "-DCMAKE_TOOLCHAIN_FILE=!WASI_SDK_PATH!/share/cmake/wasi-sdk-p2.cmake"
7474
)
7575
) else (
7676
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_SYSTEM_VERSION=10.0"

eng/native/gen-buildsys.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ if [[ "$host_arch" == "wasm" ]]; then
115115
exit 1
116116
fi
117117
fi
118-
cmake_extra_defines_wasm=("-DCLR_CMAKE_TARGET_OS=wasi" "-DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p2.cmake" "-DCMAKE_CROSSCOMPILING_EMULATOR=node --experimental-wasm-bigint --experimental-wasi-unstable-preview1")
118+
cmake_extra_defines_wasm=("-DCLR_CMAKE_TARGET_OS=wasi" "-DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p2.cmake")
119119
else
120120
echo "target_os was not specified"
121121
exit 1

eng/testing/BrowserVersions.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<Project>
22
<PropertyGroup>
3-
<linux_ChromeVersion>148.0.7778.96</linux_ChromeVersion>
4-
<linux_ChromeRevision>1610480</linux_ChromeRevision>
5-
<linux_ChromeBaseSnapshotUrl>https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1610483</linux_ChromeBaseSnapshotUrl>
6-
<linux_V8Version>14.8.178</linux_V8Version>
3+
<linux_ChromeVersion>149.0.7827.53</linux_ChromeVersion>
4+
<linux_ChromeRevision>1625079</linux_ChromeRevision>
5+
<linux_ChromeBaseSnapshotUrl>https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1625084</linux_ChromeBaseSnapshotUrl>
6+
<linux_V8Version>14.9.207</linux_V8Version>
77
<macos_ChromeVersion>143.0.7499.40</macos_ChromeVersion>
88
<macos_ChromeRevision>1536371</macos_ChromeRevision>
99
<macos_ChromeBaseSnapshotUrl>https://storage.googleapis.com/chromium-browser-snapshots/Mac_Arm/1536376</macos_ChromeBaseSnapshotUrl>

eng/testing/tests.wasi.targets

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<_XHarnessArgs >$(_XHarnessArgs) --engine-arg=--wasi --engine-arg=tcp</_XHarnessArgs>
5151
<_XHarnessArgs >$(_XHarnessArgs) --engine-arg=--wasi --engine-arg=udp</_XHarnessArgs>
5252
<_XHarnessArgs >$(_XHarnessArgs) --engine-arg=--wasi --engine-arg=allow-ip-name-lookup</_XHarnessArgs>
53+
<_XHarnessArgs >$(_XHarnessArgs) --engine-arg=--wasi --engine-arg=hostcall-fuel=4294967295</_XHarnessArgs>
5354
<_XHarnessArgs >$(_XHarnessArgs) --engine-arg=--env --engine-arg=DOTNET_WASI_PRINT_EXIT_CODE=1</_XHarnessArgs>
5455
<_XHarnessArgs Condition="'$(WasmXHarnessArgsCli)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgsCli)</_XHarnessArgs>
5556

@@ -87,6 +88,13 @@
8788
<PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' != 'true'">
8889
<WasmBuildOnlyAfterPublish>true</WasmBuildOnlyAfterPublish>
8990

91+
<!-- Test projects are libraries (OutputType=Library), for which WasmGenerateAppBundle defaults to false.
92+
Unlike browser (where the WebAssembly SDK bundles via static web assets), wasi has no such SDK, so the
93+
in-tree WasiAppBuilder must run to populate the AppBundle. Force it on for local wasi test builds.
94+
Set unconditionally: WasmApp.Common.targets is imported earlier and already defaulted this to 'false',
95+
so a '== ''' guard would not take effect. A '/p:' override remains a global property and still wins. -->
96+
<WasmGenerateAppBundle>true</WasmGenerateAppBundle>
97+
9098
<!-- wasm's publish targets will trigger publish, so we shouldn't do that -->
9199
<PublishTestAsSelfContainedDependsOn />
92100
<WasmNestedPublishAppDependsOn>PrepareForWasiBuildApp;$(WasmNestedPublishAppDependsOn)</WasmNestedPublishAppDependsOn>

src/coreclr/debug/daccess/dacdbiimpl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6052,7 +6052,8 @@ HRESULT STDMETHODCALLTYPE DacDbiInterfaceImpl::GetThreadOwningMonitorLock(VMPTR_
60526052

60536053
DWORD threadId = 0;
60546054
DWORD recursionCount = 0;
6055-
BOOL isLockHeld = pObj->GetHeader()->PassiveGetSyncBlock()->TryGetLockInfo(&threadId, &recursionCount);
6055+
SyncBlock* psb = pObj->GetHeader()->PassiveGetSyncBlock();
6056+
BOOL isLockHeld = psb != NULL && psb->TryGetLockInfo(&threadId, &recursionCount);
60566057

60576058
if (!isLockHeld)
60586059
{

src/coreclr/dlls/mscoree/exports.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ int coreclr_initialize(
262262
&hostContract);
263263

264264
#ifdef TARGET_UNIX
265-
DWORD error = PAL_InitializeCoreCLR(exePath, g_coreclr_embedded);
265+
DWORD error = PAL_InitializeCoreCLR(g_coreclr_embedded);
266266
hr = HRESULT_FROM_WIN32(error);
267267

268268
// If PAL initialization failed, then we should return right away and avoid

src/coreclr/jit/codegencommon.cpp

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3799,6 +3799,14 @@ void CodeGen::genCheckUseBlockInit()
37993799
JITDUMP("must init a tracked V%02u because it a struct with a GC ref\n", varNum);
38003800
mustInitThisVar = true;
38013801
}
3802+
#ifdef TARGET_WASM
3803+
else if (hasGCPtr)
3804+
{
3805+
// On wasm all GC vars are reported as untracked, so the slot must be zero-inited.
3806+
JITDUMP("must init V%02u because wasm reports tracked GC vars as untracked\n", varNum);
3807+
mustInitThisVar = true;
3808+
}
3809+
#endif
38023810
else
38033811
{
38043812
// We are done with tracked or GC vars, now look at untracked vars without GC refs.
@@ -3858,7 +3866,12 @@ void CodeGen::genCheckUseBlockInit()
38583866
// If this logic changes, Compiler::fgVarNeedsExplicitZeroInit needs
38593867
// to be modified.
38603868

3861-
#ifdef TARGET_64BIT
3869+
#ifdef TARGET_WASM
3870+
3871+
// On WASM we always use a single memory.fill for prolog zeroing.
3872+
genUseBlockInit = (genInitStkLclCnt > 0);
3873+
3874+
#elif defined(TARGET_64BIT)
38623875
#if defined(TARGET_AMD64)
38633876

38643877
// We can clear using aligned SIMD so the threshold is lower,
@@ -5107,7 +5120,52 @@ void CodeGen::genFnProlog()
51075120
regMaskTP initFltRegs = RBM_NONE; // FP registers which must be init'ed.
51085121
regMaskTP initDblRegs = RBM_NONE;
51095122

5110-
#ifndef TARGET_WASM
5123+
#ifdef TARGET_WASM
5124+
// For Wasm we only need to zero locals on the shadow stack; wasm locals are
5125+
// automatically zeroed.
5126+
for (unsigned varNum = 0; varNum < m_compiler->lvaCount; ++varNum)
5127+
{
5128+
LclVarDsc* varDsc = m_compiler->lvaGetDesc(varNum);
5129+
5130+
if (varDsc->lvIsParam && !varDsc->lvIsRegArg)
5131+
{
5132+
continue;
5133+
}
5134+
if (!varDsc->lvOnFrame || !varDsc->lvMustInit)
5135+
{
5136+
continue;
5137+
}
5138+
if (m_compiler->lvaIsUnknownSizeLocal(varNum))
5139+
{
5140+
continue;
5141+
}
5142+
// Defensively skip the wasm frame-header locals so we never overwrite the
5143+
// funclet info written by genAllocLclFrame at fp[0].
5144+
if ((varNum == m_compiler->lvaWasmFunctionIndex) || (varNum == m_compiler->lvaWasmVirtualIP) ||
5145+
(varNum == m_compiler->lvaWasmResumeIP))
5146+
{
5147+
continue;
5148+
}
5149+
5150+
signed int loOffs = varDsc->GetStackOffset();
5151+
signed int hiOffs = loOffs + m_compiler->lvaLclStackHomeSize(varNum);
5152+
5153+
hasUntrLcl = true;
5154+
5155+
if (loOffs < untrLclLo)
5156+
{
5157+
untrLclLo = loOffs;
5158+
}
5159+
if (hiOffs > untrLclHi)
5160+
{
5161+
untrLclHi = hiOffs;
5162+
}
5163+
}
5164+
5165+
// GC spill temps are not produced on wasm today.
5166+
assert(regSet.tmpAllFree());
5167+
assert(regSet.tmpListBeg() == nullptr);
5168+
#else // !TARGET_WASM
51115169
unsigned varNum;
51125170
LclVarDsc* varDsc;
51135171

@@ -5266,6 +5324,7 @@ void CodeGen::genFnProlog()
52665324
untrLclHi = hiOffs;
52675325
}
52685326
}
5327+
#endif // !TARGET_WASM
52695328

52705329
// TODO-Cleanup: Add suitable assert for the OSR case.
52715330
assert(m_compiler->opts.IsOSR() || ((genInitStkLclCnt > 0) == hasUntrLcl));
@@ -5281,6 +5340,7 @@ void CodeGen::genFnProlog()
52815340
}
52825341
#endif
52835342

5343+
#ifndef TARGET_WASM
52845344
#ifdef TARGET_ARM
52855345
// On the ARM we will spill any incoming struct args in the first instruction in the prolog
52865346
// Ditto for all enregistered user arguments in a varargs method.
@@ -5569,13 +5629,13 @@ void CodeGen::genFnProlog()
55695629
}
55705630
#endif // TARGET_ARM
55715631

5572-
#ifndef TARGET_WASM // TODO-WASM: temporary; un-undefine as needed.
55735632
//
55745633
// Zero out the frame as needed
55755634
//
55765635

55775636
genZeroInitFrame(untrLclHi, untrLclLo, initReg, &initRegZeroed);
55785637

5638+
#ifndef TARGET_WASM // TODO-WASM: enable as needed.
55795639
genReportGenericContextArg(initReg, &initRegZeroed);
55805640

55815641
#ifdef JIT32_GCENCODER

src/coreclr/jit/codegenwasm.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,53 @@ void CodeGen::genEnregisterOSRArgsAndLocals(regNumber initReg, bool* pInitRegZer
199199
unreached(); // OSR not supported on WASM.
200200
}
201201

202+
//------------------------------------------------------------------------
203+
// genZeroInitFrame: zero the lvMustInit untracked range of the frame using
204+
// a single memory.fill.
205+
//
206+
// Arguments:
207+
// untrLclHi - High offset (exclusive) of the untracked range relative to FP.
208+
// untrLclLo - Low offset of the untracked range relative to FP.
209+
// initReg - Unused on WASM (no scratch register concept).
210+
// pInitRegZeroed - Unused on WASM.
211+
//
212+
void CodeGen::genZeroInitFrame(int untrLclHi, int untrLclLo, regNumber initReg, bool* pInitRegZeroed)
213+
{
214+
assert(m_compiler->compGeneratingProlog);
215+
if (!genUseBlockInit)
216+
{
217+
// Nothing to zero (genCheckUseBlockInit forces block-init for any non-empty range on wasm).
218+
assert(genInitStkLclCnt == 0);
219+
return;
220+
}
221+
assert(untrLclHi > untrLclLo);
222+
assert(untrLclLo >= 0); // Wasm locals are at non-negative offsets from FP.
223+
224+
emitter* emit = GetEmitter();
225+
226+
// Push destination address: FP (+ untrLclLo if non-zero).
227+
emit->emitIns_I(INS_local_get, EA_PTRSIZE, GetFramePointerRegIndex());
228+
if (untrLclLo != 0)
229+
{
230+
emit->emitIns_I(INS_I_const, EA_PTRSIZE, untrLclLo);
231+
emit->emitIns(INS_I_add);
232+
}
233+
// Push fill value (zero, always i32 per memory.fill spec).
234+
emit->emitIns_I(INS_i32_const, EA_4BYTE, 0);
235+
// Push length (pointer-sized: i32 on wasm32, i64 on wasm64).
236+
emit->emitIns_I(INS_I_const, EA_PTRSIZE, untrLclHi - untrLclLo);
237+
// memory.fill 0
238+
emit->emitIns_I(INS_memory_fill, EA_4BYTE, LINEAR_MEMORY_INDEX);
239+
}
240+
241+
//------------------------------------------------------------------------
242+
// genZeroInitFrameUsingBlockInit: Unused on WASM (genZeroInitFrame handles block init inline).
243+
//
244+
void CodeGen::genZeroInitFrameUsingBlockInit(int untrLclHi, int untrLclLo, regNumber initReg, bool* pInitRegZeroed)
245+
{
246+
unreached();
247+
}
248+
202249
//------------------------------------------------------------------------
203250
// genOSRHandleTier0CalleeSavedRegistersAndFrame:
204251
// Not called for WASM without OSR support.

0 commit comments

Comments
 (0)