Skip to content

Commit 49fbf7c

Browse files
committed
rebase
1 parent f6ddcf5 commit 49fbf7c

File tree

36 files changed

+2882
-74
lines changed

36 files changed

+2882
-74
lines changed

eng/testing/tests.browser.targets

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<EMSDK_PATH Condition="'$(EMSDK_PATH)' == '' and '$(ContinuousIntegrationBuild)' == 'true' and '$(MonoProjectRoot)' != ''">$([MSBuild]::NormalizeDirectory($(BrowserProjectRoot), 'emsdk'))</EMSDK_PATH>
1313

1414
<WasmEmitSymbolMap Condition="'$(WasmEmitSymbolMap)' == ''">true</WasmEmitSymbolMap>
15+
<InvariantGlobalization Condition="'$(InvariantGlobalization)' == ''">false</InvariantGlobalization>
1516

1617
<_WasmMainJSFileName Condition="'$(WasmMainJSPath)' != ''">$([System.IO.Path]::GetFileName('$(WasmMainJSPath)'))</_WasmMainJSFileName>
1718
<_WasmStrictVersionMatch Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</_WasmStrictVersionMatch>
@@ -34,6 +35,9 @@
3435
<UseSystemResourceKeys Condition="'$(UseSystemResourceKeys)' == ''">false</UseSystemResourceKeys>
3536
<EventSourceSupport Condition="'$(EventSourceSupport)' == ''">true</EventSourceSupport>
3637
<NullabilityInfoContextSupport Condition="'$(NullabilityInfoContextSupport)' == ''">true</NullabilityInfoContextSupport>
38+
39+
<!-- TODO-WASM https://github.com/dotnet/runtime/issues/120248 -->
40+
<WasmEnableWebcil Condition="'$(RuntimeFlavor)' == 'CoreCLR'">false</WasmEnableWebcil>
3741
</PropertyGroup>
3842

3943
<!-- We expect WASM users to indicate they would like to have bigger download size by adding WasmIncludeFullIcuData, -->

eng/testing/workloads-browser.targets

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<Target Name="_GetWorkloadsToInstall" DependsOnTargets="_SetPackageVersionForWorkloadsTesting" Returns="@(WorkloadIdForTesting);@(WorkloadCombinationsToInstall)">
1010
<Error Condition="'$(RIDForWorkload)' == ''" Text="$(RIDForWorkload) is unset" />
11-
<ItemGroup>
11+
<ItemGroup Condition="'$(RuntimeFlavor)' == 'Mono'">
1212
<WorkloadIdForTesting Include="wasm-tools;wasm-experimental"
1313
ManifestName="Microsoft.NET.Workload.Mono.ToolChain.Current"
1414
Variant="latest"
@@ -67,11 +67,15 @@
6767
</_DefaultRuntimePackNuGetPath>
6868
</PropertyGroup>
6969

70-
<ItemGroup>
70+
<ItemGroup Condition="'$(RuntimeFlavor)' == 'Mono'">
7171
<_RuntimePackNugetAvailable Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono.$(RIDForWorkload).*$(PackageVersionForWorkloadManifests).nupkg" />
7272
<_RuntimePackNugetAvailable Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.Mono.*.$(RIDForWorkload).*$(PackageVersionForWorkloadManifests).nupkg" />
7373
<_RuntimePackNugetAvailable Remove="@(_RuntimePackNugetAvailable)" Condition="$([System.String]::new('%(_RuntimePackNugetAvailable.FileName)').EndsWith('.symbols'))" />
7474
</ItemGroup>
75+
<ItemGroup Condition="'$(RuntimeFlavor)' == 'CoreCLR'">
76+
<_RuntimePackNugetAvailable Include="$(LibrariesShippingPackagesDir)Microsoft.NETCore.App.Runtime.$(RIDForWorkload).*$(PackageVersionForWorkloadManifests).nupkg" />
77+
<_RuntimePackNugetAvailable Remove="@(_RuntimePackNugetAvailable)" Condition="$([System.String]::new('%(_RuntimePackNugetAvailable.FileName)').EndsWith('.symbols'))" />
78+
</ItemGroup>
7579

7680
<Error Condition="@(_RuntimePackNugetAvailable -> Count()) != 2 and @(_RuntimePackNugetAvailable -> Count()) != 1"
7781
Text="Expected to find either one or two in $(LibrariesShippingPackagesDir): @(_RuntimePackNugetAvailable->'%(FileName)%(Extension)')" />
@@ -87,7 +91,7 @@
8791
</ItemGroup>
8892

8993
<Message
90-
Condition="@(_RuntimePackNugetAvailable -> Count()) == 1"
94+
Condition="'$(RuntimeFlavor)' == 'Mono' and @(_RuntimePackNugetAvailable -> Count()) == 1"
9195
Importance="High"
9296
Text="
9397
********************

src/coreclr/vm/wasm/callhelpers.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,27 @@ extern "C" void SystemJS_ExecuteTimerCallback()
785785
Call_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler();
786786
}
787787

788+
static MethodDesc* MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_IntPtr_RetVoid = nullptr;
789+
static void Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace(void* arg0)
790+
{
791+
int64_t args[1] =
792+
{
793+
(int64_t)arg0
794+
};
795+
796+
// Lazy lookup of MethodDesc for the function export scenario.
797+
if (!MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_IntPtr_RetVoid)
798+
{
799+
LookupMethodByName("System.Runtime.InteropServices.JavaScript.JavaScriptExports", "GetManagedStackTrace", &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_IntPtr_RetVoid);
800+
}
801+
ExecuteInterpretedMethodFromUnmanaged(MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_IntPtr_RetVoid, (int8_t*)args, sizeof(args), nullptr);
802+
}
803+
804+
extern "C" void SystemInteropJS_GetManagedStackTrace(void* arg0)
805+
{
806+
Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace(arg0);
807+
}
808+
788809
extern const ReverseThunkMapEntry g_ReverseThunks[] =
789810
{
790811
{ 100678287, { &MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid, (void*)&Call_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler } },

src/coreclr/vm/wasm/helpers.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,10 @@ namespace
618618
if (!GetSignatureKey(sig, keyBuffer, keyBufferLen))
619619
return NULL;
620620

621+
void* thunk = LookupThunk(keyBuffer);
622+
if (thunk == NULL)
623+
printf("WASM Calli missing for Key: %s\n", keyBuffer);
624+
621625
return LookupThunk(keyBuffer);
622626
}
623627

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System;
5+
using System.Reflection;
6+
using System.Runtime.CompilerServices;
7+
using System.Runtime.InteropServices;
8+
9+
internal static partial class Interop
10+
{
11+
internal static unsafe partial class Runtime
12+
{
13+
[LibraryImport(Libraries.JavaScriptNative, EntryPoint = "SystemInteropJS_BindJSImportST")]
14+
public static unsafe partial nint BindJSImportST(void* signature);
15+
16+
[LibraryImport(Libraries.JavaScriptNative, EntryPoint = "SystemInteropJS_InvokeJSImportST")]
17+
public static partial void InvokeJSImportST(int importHandle, nint args);
18+
19+
[LibraryImport(Libraries.JavaScriptNative, EntryPoint = "SystemInteropJS_ReleaseCSOwnedObject")]
20+
internal static partial void ReleaseCSOwnedObject(nint jsHandle);
21+
22+
[LibraryImport(Libraries.JavaScriptNative, EntryPoint = "SystemInteropJS_InvokeJSFunction")]
23+
public static partial void InvokeJSFunction(nint functionHandle, nint data);
24+
25+
[LibraryImport(Libraries.JavaScriptNative, EntryPoint = "SystemInteropJS_ResolveOrRejectPromise")]
26+
public static partial void ResolveOrRejectPromise(nint data);
27+
28+
[LibraryImport(Libraries.JavaScriptNative, EntryPoint = "SystemInteropJS_RegisterGCRoot")]
29+
public static partial nint RegisterGCRoot(void* start, int bytesSize, IntPtr name);
30+
[LibraryImport(Libraries.JavaScriptNative, EntryPoint = "SystemInteropJS_DeregisterGCRoot")]
31+
public static partial void DeregisterGCRoot(nint handle);
32+
33+
[LibraryImport(Libraries.JavaScriptNative, EntryPoint = "SystemInteropJS_CancelPromise")]
34+
public static partial void CancelPromise(nint gcHandle);
35+
36+
[LibraryImport(Libraries.JavaScriptNative, EntryPoint = "SystemInteropJS_BindAssemblyExports")]
37+
public static partial void BindAssemblyExports(IntPtr assemblyNamePtr);
38+
[LibraryImport(Libraries.JavaScriptNative, EntryPoint = "SystemInteropJS_GetAssemblyExport")]
39+
public static partial void GetAssemblyExport(IntPtr assemblyNamePtr, IntPtr namespacePtr, IntPtr classnamePtr, IntPtr methodNamePtr, int signatureHash, IntPtr* monoMethodPtrPtr);
40+
41+
// TODO-WASM: delete once we switch to CoreCLR only
42+
[LibraryImport(Libraries.JavaScriptNative, EntryPoint = "SystemInteropJS_AssemblyGetEntryPoint")]
43+
public static partial void AssemblyGetEntryPoint(IntPtr assemblyNamePtr, int auto_insert_breakpoint, void** monoMethodPtrPtr);
44+
}
45+
}

src/libraries/Common/src/Interop/Unix/Interop.Libraries.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ internal static partial class Libraries
1313
internal const string CryptoNative = "libSystem.Security.Cryptography.Native.OpenSsl";
1414
internal const string CompressionNative = "libSystem.IO.Compression.Native";
1515
internal const string GlobalizationNative = "libSystem.Globalization.Native";
16+
internal const string JavaScriptNative = "libSystem.Runtime.InteropServices.JavaScript.Native";
1617
internal const string IOPortsNative = "libSystem.IO.Ports.Native";
1718
internal const string HostPolicy = "libhostpolicy";
1819
}

src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetPlatformIdentifier)' != 'browser'">SR.SystemRuntimeInteropServicesJavaScript_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
1313
<FeatureWasmManagedThreads Condition="'$(TargetPlatformIdentifier)' == 'browser' and '$(WasmEnableThreads)' == 'true'">true</FeatureWasmManagedThreads>
1414
<WasmEnableJsInteropByValue Condition="'$(TargetPlatformIdentifier)' == 'browser' and '$(WasmEnableJsInteropByValue)' == '' and '$(FeatureWasmManagedThreads)' == 'true'">true</WasmEnableJsInteropByValue>
15+
<WasmEnableJsInteropByValue Condition="'$(TargetPlatformIdentifier)' == 'browser' and '$(WasmEnableJsInteropByValue)' == '' and '$(RuntimeFlavor)' == 'CoreCLR'">true</WasmEnableJsInteropByValue>
1516
<WasmEnableJsInteropByValue Condition="'$(TargetPlatformIdentifier)' == 'browser' and '$(WasmEnableJsInteropByValue)' == ''">false</WasmEnableJsInteropByValue>
1617
<DefineConstants Condition="'$(FeatureWasmManagedThreads)' == 'true'">$(DefineConstants);FEATURE_WASM_MANAGED_THREADS</DefineConstants>
1718
<DefineConstants Condition="'$(WasmEnableJsInteropByValue)' == 'true'">$(DefineConstants);ENABLE_JS_INTEROP_BY_VALUE</DefineConstants>
@@ -23,7 +24,9 @@
2324
</ItemGroup>
2425

2526
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'browser'">
26-
<Compile Include="$(CommonPath)Interop\Browser\Interop.Runtime.cs" Link="System\Runtime\InteropServices\JavaScript\Interop\Interop.Runtime.cs" />
27+
<Compile Include="$(CommonPath)Interop\Browser\Interop.Runtime.Mono.cs" Link="System\Runtime\InteropServices\JavaScript\Interop\Interop.Runtime.Mono.cs" Condition="'$(RuntimeFlavor)' == 'Mono'" />
28+
<Compile Include="$(CommonPath)Interop\Browser\Interop.Runtime.CoreCLR.cs" Link="System\Runtime\InteropServices\JavaScript\Interop\Interop.Runtime.CoreCLR.cs" Condition="'$(RuntimeFlavor)' == 'CoreCLR'" />
29+
<Compile Include="$(CommonPath)Interop\Unix\Interop.Libraries.cs" Link="System\Runtime\InteropServices\JavaScript\Interop\Interop.Libraries.cs" Condition="'$(RuntimeFlavor)' == 'CoreCLR'" />
2730
<Compile Include="System\Runtime\InteropServices\JavaScript\Interop\JavaScriptImports.Generated.cs" />
2831
<Compile Include="System\Runtime\InteropServices\JavaScript\Interop\JavaScriptExports.cs" />
2932

src/libraries/System.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Interop/JavaScriptExports.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ public static void CompleteTask(JSMarshalerArgument* arguments_buffer)
229229
}
230230
}
231231

232+
[UnmanagedCallersOnly(EntryPoint = "SystemInteropJS_GetManagedStackTrace")]
232233
// the marshaled signature is: string GetManagedStackTrace(GCHandle exception)
233234
public static void GetManagedStackTrace(JSMarshalerArgument* arguments_buffer)
234235
{

src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Roslyn3.11.Tests.csproj

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)