diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets index 0eb29f9db7da28..e602f23f060464 100644 --- a/eng/liveBuilds.targets +++ b/eng/liveBuilds.targets @@ -24,7 +24,6 @@ $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'sharedFramework')) - $([MSBuild]::NormalizeDirectory('$(LibrariesNativeArtifactsPath)','sharedFramework')) $([MSBuild]::NormalizeDirectory('$(HostArtifactsPath)','sharedFramework')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'corehost')) $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'ilc-published')) @@ -51,6 +50,7 @@ $(MicrosoftNetCoreAppRuntimePackRidLibTfmDir) $([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'bin', 'runtime', '$(NetCoreAppCurrent)-$(LibrariesTargetOSConfigurationArchitecture)')) $([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'bin', 'native', '$(NetCoreAppCurrent)-$(LibrariesTargetOSConfigurationArchitecture)')) + $([MSBuild]::NormalizeDirectory('$(LibrariesNativeArtifactsPath)','sharedFramework')) x64 x86 diff --git a/eng/pipelines/common/templates/browser-wasm-coreclr-build-tests.yml b/eng/pipelines/common/templates/browser-wasm-coreclr-build-tests.yml index fc3838f838ba5c..cdb9b26ba1dd69 100644 --- a/eng/pipelines/common/templates/browser-wasm-coreclr-build-tests.yml +++ b/eng/pipelines/common/templates/browser-wasm-coreclr-build-tests.yml @@ -42,9 +42,9 @@ jobs: jobParameters: dependsOn: - ${{ if eq(platform, 'browser_wasm') }}: - - build_browser_wasm_linux_Release_AllSubsets_CoreCLR + - build_browser_wasm_linux_Release_CoreCLR - ${{ if eq(platform, 'browser_wasm_win') }}: - - build_browser_wasm_windows_Release_AllSubsets_CoreCLR + - build_browser_wasm_windows_Release_CoreCLR isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }} testGroup: innerloop nameSuffix: CoreCLR_WasmBuildTests @@ -55,14 +55,14 @@ jobs: displayName: Download built nugets for singlethreaded runtime inputs: buildType: current - artifactName: 'BuildArtifacts_browser_wasm_$(_hostedOs)_Release_AllSubsets_CoreCLR' + artifactName: 'BuildArtifacts_browser_wasm_$(_hostedOs)_Release_CoreCLR' downloadType: single downloadPath: '$(Build.SourcesDirectory)/artifacts' - task: CopyFiles@2 displayName: Copy single threaded assets inputs: - SourceFolder: '$(Build.SourcesDirectory)/artifacts/BuildArtifacts_browser_wasm_$(_hostedOs)_Release_AllSubsets_CoreCLR' + SourceFolder: '$(Build.SourcesDirectory)/artifacts/BuildArtifacts_browser_wasm_$(_hostedOs)_Release_CoreCLR' TargetFolder: '$(Build.SourcesDirectory)/artifacts' CleanTargetFolder: false @@ -88,14 +88,14 @@ jobs: displayName: Download Wasm.Build.Tests inputs: buildType: current - artifactName: WasmBuildTests_$(_hostedOs)_AllSubsets_CoreCLR + artifactName: WasmBuildTests_$(_hostedOs)_CoreCLR downloadType: single downloadPath: '$(Build.SourcesDirectory)/artifacts' - task: CopyFiles@2 displayName: Copy Wasm.Build.Tests archive inputs: - SourceFolder: '$(Build.SourcesDirectory)/artifacts/WasmBuildTests_$(_hostedOs)_AllSubsets_CoreCLR' + SourceFolder: '$(Build.SourcesDirectory)/artifacts/WasmBuildTests_$(_hostedOs)_CoreCLR' Contents: helix/** TargetFolder: '$(Build.SourcesDirectory)/artifacts' CleanTargetFolder: false diff --git a/eng/pipelines/common/templates/runtimes/run-test-job.yml b/eng/pipelines/common/templates/runtimes/run-test-job.yml index b521530b76836a..3efa4a5944f7ae 100644 --- a/eng/pipelines/common/templates/runtimes/run-test-job.yml +++ b/eng/pipelines/common/templates/runtimes/run-test-job.yml @@ -3,6 +3,7 @@ parameters: archType: '' osGroup: '' osSubgroup: '' + hostedOs: '' container: '' testGroup: '' crossBuild: false @@ -27,6 +28,7 @@ parameters: unifiedArtifactsName: '' unifiedBuildNameSuffix: '' unifiedBuildConfigOverride: '' + extraBuildArgs: '' ### Test run job @@ -40,6 +42,8 @@ jobs: archType: ${{ parameters.archType }} osGroup: ${{ parameters.osGroup }} osSubgroup: ${{ parameters.osSubgroup }} + hostedOs: ${{ parameters.hostedOs }} + extraBuildArgs: ${{ parameters.extraBuildArgs }} container: ${{ parameters.container }} testGroup: ${{ parameters.testGroup }} crossBuild: ${{ parameters.crossBuild }} @@ -64,7 +68,10 @@ jobs: - ${{ if notIn(parameters.testGroup, 'innerloop') }}: - '${{ parameters.runtimeFlavor }}_common_test_build_p1_AnyOS_AnyCPU_${{parameters.buildConfig }}' - ${{ if ne(parameters.unifiedArtifactsName, '')}}: - - 'build_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ coalesce(parameters.unifiedBuildConfigOverride, parameters.buildConfig) }}_${{ parameters.unifiedBuildNameSuffix }}' + - ${{ if eq(parameters.hostedOs, '')}}: + - 'build_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ coalesce(parameters.unifiedBuildConfigOverride, parameters.buildConfig) }}_${{ parameters.unifiedBuildNameSuffix }}' + - ${{ if ne(parameters.hostedOs, '')}}: + - 'build_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.hostedOs }}_${{ coalesce(parameters.unifiedBuildConfigOverride, parameters.buildConfig) }}_${{ parameters.unifiedBuildNameSuffix }}' # Compute job name from template parameters ${{ if in(parameters.testGroup, 'innerloop') }}: @@ -83,6 +90,9 @@ jobs: - name: archType value: ${{ parameters.archType }} + - name: extraBuildArgs + value: ${{ parameters.extraBuildArgs }} + - name: monoAotBuildshCommand value: '' @@ -233,13 +243,13 @@ jobs: # and directly unzip them there after download). Unfortunately the logic to copy # the native artifacts to the final test folders is dependent on availability of the # managed test artifacts. This step also generates the final test execution scripts. - - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) copynativeonly $(logRootNameArg)Native $(testFilterArg) $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(priorityArg) $(librariesOverrideArg) $(codeFlowEnforcementArg) + - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) copynativeonly $(logRootNameArg)Native $(testFilterArg) $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(priorityArg) $(librariesOverrideArg) $(codeFlowEnforcementArg) $(extraBuildArgs) displayName: Copy native test components to test output folder # Compose the Core_Root folder containing all artifacts needed for running # CoreCLR tests. This step also compiles the framework using Crossgen2 # in ReadyToRun jobs. - - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg) -ci + - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) generatelayoutonly $(logRootNameArg)Layout $(runtimeFlavorArgs) $(crossgenArg) $(buildConfig) $(archType) $(crossArg) $(priorityArg) $(librariesOverrideArg) $(runtimeVariantArg) -ci $(extraBuildArgs) displayName: Generate CORE_ROOT # Build a Mono LLVM AOT cross-compiler for non-amd64 targets (in this case, just arm64) diff --git a/eng/pipelines/common/templates/runtimes/test-variables.yml b/eng/pipelines/common/templates/runtimes/test-variables.yml index 9dc85f2fd4d633..f44a9a01415438 100644 --- a/eng/pipelines/common/templates/runtimes/test-variables.yml +++ b/eng/pipelines/common/templates/runtimes/test-variables.yml @@ -28,6 +28,11 @@ variables: value: 10 - name: timeoutPerTestCollectionInMinutes value: 30 + - ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), eq(parameters.osGroup, 'browser')) }}: + - name: timeoutPerTestInMinutes + value: 15 + - name: timeoutPerTestCollectionInMinutes + value: 45 - ${{ if in(parameters.testGroup, 'outerloop') }}: - name: timeoutPerTestCollectionInMinutes value: 120 diff --git a/eng/pipelines/coreclr/templates/build-native-test-assets-step.yml b/eng/pipelines/coreclr/templates/build-native-test-assets-step.yml index e8d1fcfe69cc16..3c2384e1e3c448 100644 --- a/eng/pipelines/coreclr/templates/build-native-test-assets-step.yml +++ b/eng/pipelines/coreclr/templates/build-native-test-assets-step.yml @@ -1,9 +1,10 @@ # Build the native assets for the tests in the src/tests parameters: compiler: '' + extraBuildArgs: '' steps: - - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) skipmanaged skipgeneratelayout $(nativeTestArtifactConfig) $(archType) $(crossArg) $(priorityArg) ${{ parameters.compiler }} + - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) skipmanaged skipgeneratelayout $(nativeTestArtifactConfig) $(archType) $(crossArg) $(priorityArg) ${{ parameters.extraBuildArgs }} ${{ parameters.compiler }} displayName: Build native test components - template: /eng/pipelines/common/upload-artifact-step.yml parameters: diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml index f18fa283f8881f..825b60dadd6da4 100644 --- a/eng/pipelines/runtime.yml +++ b/eng/pipelines/runtime.yml @@ -103,6 +103,7 @@ extends: eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_non_mono_and_wasm.containsChange'], true), eq(variables['isRollingBuild'], true)) + # Release build of browser wasm for WBT - template: /eng/pipelines/common/platform-matrix.yml parameters: jobTemplate: /eng/pipelines/common/global-build-job.yml @@ -111,13 +112,104 @@ extends: - browser_wasm - browser_wasm_win jobParameters: - nameSuffix: AllSubsets_CoreCLR - buildArgs: -s clr+libs+libs.tests+packs -c $(_BuildConfig) -lc Release /p:TestAssemblies=false /p:TestWasmBuildTests=true /p:ArchiveTests=true /p:InstallWorkloadForTesting=false + nameSuffix: CoreCLR + buildArgs: -s clr+libs+libs.tests+packs -c Release -rc $(_BuildConfig) /p:TestAssemblies=false /p:TestWasmBuildTests=true /p:ArchiveTests=true /p:InstallWorkloadForTesting=false timeoutInMinutes: 120 postBuildSteps: - - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests.yml + - template: /eng/pipelines/common/wasm-post-build-steps.yml + parameters: + publishArtifactsForWorkload: true + publishWBT: true + extraVariablesTemplates: + - template: /eng/pipelines/common/templates/runtimes/test-variables.yml + parameters: + testGroup: innerloop + liveLibrariesBuildConfig: Release + condition: >- + or( + eq(variables['wasmDarcDependenciesChanged'], true), + eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'], true), + eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_wasm_coreclr_runtimetests.containsChange'], true), + eq(variables['isRollingBuild'], true)) + + - template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + buildConfig: checked + platforms: + - browser_wasm + jobParameters: + nameSuffix: CoreCLR_ReleaseLibraries + buildArgs: -s clr+libs+libs.tests+packs -c Release -rc $(_BuildConfig) /p:TestAssemblies=false /p:ArchiveTests=true /p:InstallWorkloadForTesting=false + timeoutInMinutes: 120 + postBuildSteps: + - template: /eng/pipelines/coreclr/templates/build-native-test-assets-step.yml + parameters: + extraBuildArgs: -os browser + - template: /eng/pipelines/common/upload-artifact-step.yml + parameters: + rootFolder: $(Build.SourcesDirectory)/artifacts/bin + includeRootFolder: false + archiveType: $(archiveType) + archiveExtension: $(archiveExtension) + tarCompression: $(tarCompression) + artifactName: CoreCLR_ReleaseLibraries_BuildArtifacts_$(osGroup)$(osSubgroup)_$(archType)_$(_BuildConfig) + displayName: Build Assets + - template: /eng/pipelines/common/upload-artifact-step.yml + parameters: + rootFolder: $(Build.SourcesDirectory)/artifacts/helix + includeRootFolder: false + archiveType: $(archiveType) + archiveExtension: $(archiveExtension) + tarCompression: $(tarCompression) + artifactName: CoreCLR_ReleaseLibraries_TestArtifacts_$(osGroup)$(osSubgroup)_$(archType)_$(_BuildConfig) + - template: /eng/pipelines/common/wasm-post-build-steps.yml + parameters: + publishArtifactsForWorkload: true + publishWBT: true + extraVariablesTemplates: + - template: /eng/pipelines/common/templates/runtimes/test-variables.yml + parameters: + testGroup: innerloop + liveLibrariesBuildConfig: Release + - template: /eng/pipelines/common/templates/runtimes/native-test-assets-variables.yml + parameters: + testGroup: innerloop + condition: >- + or( + eq(variables['wasmDarcDependenciesChanged'], true), + eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_tools_illink.containsChange'], true), + eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_wasm_coreclr_runtimetests.containsChange'], true), + eq(variables['isRollingBuild'], true)) + + - template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + buildConfig: checked + platforms: + - browser_wasm_win + jobParameters: + nameSuffix: CoreCLR_ReleaseLibraries + buildArgs: -s clr+libs+libs.tests+packs -c Release -rc $(_BuildConfig) /p:TestAssemblies=false /p:ArchiveTests=true /p:InstallWorkloadForTesting=false + timeoutInMinutes: 120 + postBuildSteps: + - template: /eng/pipelines/common/upload-artifact-step.yml + parameters: + rootFolder: $(Build.SourcesDirectory)/artifacts/bin + includeRootFolder: false + archiveType: $(archiveType) + archiveExtension: $(archiveExtension) + tarCompression: $(tarCompression) + artifactName: CoreCLR_ReleaseLibraries_BuildArtifacts_$(osGroup)$(osSubgroup)_$(archType)_$(_BuildConfig) + displayName: Build Assets + - template: /eng/pipelines/common/upload-artifact-step.yml parameters: - testBuildArgs: test JIT/interpreter/Interpreter.csproj + rootFolder: $(Build.SourcesDirectory)/artifacts/helix + includeRootFolder: false + archiveType: $(archiveType) + archiveExtension: $(archiveExtension) + tarCompression: $(tarCompression) + artifactName: CoreCLR_ReleaseLibraries_TestArtifacts_$(osGroup)$(osSubgroup)_$(archType)_$(_BuildConfig) - template: /eng/pipelines/common/wasm-post-build-steps.yml parameters: publishArtifactsForWorkload: true @@ -1614,6 +1706,26 @@ extends: eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), eq(variables['isRollingBuild'], true)) + - template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml + buildConfig: checked + platforms: + - browser_wasm + helixQueueGroup: pr + helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml + jobParameters: + testGroup: innerloop + liveLibrariesBuildConfig: Release + unifiedArtifactsName: CoreCLR_ReleaseLibraries_BuildArtifacts_$(osGroup)$(osSubgroup)_$(archType)_$(_BuildConfig) + unifiedBuildNameSuffix: CoreCLR_ReleaseLibraries + extraBuildArgs: -os browser -p:HostConfiguration=Release + condition: >- + or( + eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true), + eq(stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true), + eq(variables['isRollingBuild'], true)) + - template: /eng/pipelines/common/platform-matrix.yml parameters: jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml diff --git a/src/coreclr/hosts/corerun/corerun.cpp b/src/coreclr/hosts/corerun/corerun.cpp index c0ee6506726282..a5ce53aedd8b44 100644 --- a/src/coreclr/hosts/corerun/corerun.cpp +++ b/src/coreclr/hosts/corerun/corerun.cpp @@ -613,7 +613,7 @@ static int run(const configuration& config) // The NodeJS process is kept alive by pending async work via safeSetTimeout() -> runtimeKeepalivePush() // The actual exit code would be set by SystemJS_ResolveMainPromise if the managed Main() is async. // Or in Module.onExit handler when managed Main() is synchronous. - return 0; + return exit_code; #else // TARGET_BROWSER return corerun_shutdown(exit_code); #endif // TARGET_BROWSER diff --git a/src/coreclr/hosts/corerun/wasm/libCorerun.js b/src/coreclr/hosts/corerun/wasm/libCorerun.js index 088fdc9849b0e7..40564469cd90d2 100644 --- a/src/coreclr/hosts/corerun/wasm/libCorerun.js +++ b/src/coreclr/hosts/corerun/wasm/libCorerun.js @@ -9,7 +9,8 @@ function libCoreRunFactory() { "$FS", "$NODEFS", "$NODERAWFS", - "corerun_shutdown" + "corerun_shutdown", + "__funcs_on_exit", ]; const mergeCoreRun = { $CORERUN: { @@ -25,24 +26,21 @@ function libCoreRunFactory() { } ENV["DOTNET_SYSTEM_GLOBALIZATION_INVARIANT"] = "true"; - const originalExitJS = exitJS; - exitJS = (status, implicit) => { - if (!implicit) { - EXITSTATUS = status; - ABORT = true; + + Module.preInit = [() => { + const orig_funcs_on_exit = ___funcs_on_exit; + // it would be better to use addOnExit(), but it's called too late. + ___funcs_on_exit = () => { + // this will prevent more timers (like finalizer) to get scheduled during thread destructor if (dotnetBrowserUtilsExports.abortBackgroundTimers) { dotnetBrowserUtilsExports.abortBackgroundTimers(); } - } - if (!keepRuntimeAlive()) { - ABORT = true; - var latched = _corerun_shutdown(EXITSTATUS || 0); - if (EXITSTATUS === undefined) { - EXITSTATUS = latched; - } - } - return originalExitJS(EXITSTATUS, implicit); - }; + EXITSTATUS = _corerun_shutdown(EXITSTATUS || 0); + orig_funcs_on_exit(); + }; + + }, ...(Module.preInit || [])]; + }, }, $CORERUN__postset: "CORERUN.selfInitialize()", diff --git a/src/coreclr/vm/dllimport.cpp b/src/coreclr/vm/dllimport.cpp index afa5b7a2401458..f0182dcd895ae1 100644 --- a/src/coreclr/vm/dllimport.cpp +++ b/src/coreclr/vm/dllimport.cpp @@ -6197,10 +6197,12 @@ EXTERN_C void LookupUnmanagedCallersOnlyMethodByName(const char* fullQualifiedTy && pMD->HasUnmanagedCallersOnlyAttribute()) { *ppMD = pMD; + printf("Found UCO method %s on type %s\n", methodName, fullQualifiedTypeName); return; } } + printf("Did not find UCO method %s on type %s, looking for a method with the given name\n", methodName, fullQualifiedTypeName); // Fallback if no UCO match found. *ppMD = MemberLoader::FindMethodByName(pMT, methodName); } diff --git a/src/coreclr/vm/wasm/callhelpers-interp-to-managed.cpp b/src/coreclr/vm/wasm/callhelpers-interp-to-managed.cpp index df3705f48eb3ad..11709a897c812a 100644 --- a/src/coreclr/vm/wasm/callhelpers-interp-to-managed.cpp +++ b/src/coreclr/vm/wasm/callhelpers-interp-to-managed.cpp @@ -49,6 +49,12 @@ namespace *((double*)pRet) = (*fptr)(ARG_F64(0), ARG_I32(1)); } + static void CallFunc_F64_I32_F64_RetF64(PCODE pcode, int8_t* pArgs, int8_t* pRet) + { + double (*fptr)(double, int32_t, double) = (double (*)(double, int32_t, double))pcode; + *((double*)pRet) = (*fptr)(ARG_F64(0), ARG_I32(1), ARG_F64(2)); + } + static void CallFunc_I32_RetF64(PCODE pcode, int8_t* pArgs, int8_t* pRet) { double (*fptr)(int32_t) = (double (*)(int32_t))pcode; @@ -103,6 +109,12 @@ namespace *((int32_t*)pRet) = (*fptr)(ARG_F64(0)); } + static void CallFunc_F64_F32_I32_RetI32(PCODE pcode, int8_t* pArgs, int8_t* pRet) + { + int32_t (*fptr)(double, float, int32_t) = (int32_t (*)(double, float, int32_t))pcode; + *((int32_t*)pRet) = (*fptr)(ARG_F64(0), ARG_F32(1), ARG_I32(2)); + } + static void CallFunc_F64_I32_RetI32(PCODE pcode, int8_t* pArgs, int8_t* pRet) { int32_t (*fptr)(double, int32_t) = (int32_t (*)(double, int32_t))pcode; @@ -343,6 +355,12 @@ namespace *((int32_t*)pRet) = (*fptr)(ARG_IND(0), ARG_I32(1), ARG_IND(2), ARG_IND(3)); } + static void CallFunc_IND_IND_RetI32(PCODE pcode, int8_t* pArgs, int8_t* pRet) + { + int32_t (*fptr)(int32_t, int32_t) = (int32_t (*)(int32_t, int32_t))pcode; + *((int32_t*)pRet) = (*fptr)(ARG_IND(0), ARG_IND(1)); + } + static void CallFunc_IND_IND_I32_RetI32(PCODE pcode, int8_t* pArgs, int8_t* pRet) { int32_t (*fptr)(int32_t, int32_t, int32_t) = (int32_t (*)(int32_t, int32_t, int32_t))pcode; @@ -367,6 +385,18 @@ namespace *((int64_t*)pRet) = (*fptr)(); } + static void CallFunc_F64_RetI64(PCODE pcode, int8_t* pArgs, int8_t* pRet) + { + int64_t (*fptr)(double) = (int64_t (*)(double))pcode; + *((int64_t*)pRet) = (*fptr)(ARG_F64(0)); + } + + static void CallFunc_F32_RetI64(PCODE pcode, int8_t* pArgs, int8_t* pRet) + { + int64_t (*fptr)(float) = (int64_t (*)(float))pcode; + *((int64_t*)pRet) = (*fptr)(ARG_F32(0)); + } + static void CallFunc_I32_RetI64(PCODE pcode, int8_t* pArgs, int8_t* pRet) { int64_t (*fptr)(int32_t) = (int64_t (*)(int32_t))pcode; @@ -449,6 +479,13 @@ namespace *((int32_t*)pRet) = (*fptr)(ARG_I32(0), ARG_I32(1), ARG_I32(2)); } + static void CallFunc_I32_IND_RetIND(PCODE pcode, int8_t* pArgs, int8_t* pRet) + { + int32_t (*fptr)(int32_t, int32_t) = (int32_t (*)(int32_t, int32_t))pcode; + PORTABILITY_ASSERT("Indirect struct return is not yet implemented."); + *((int32_t*)pRet) = (*fptr)(ARG_I32(0), ARG_IND(1)); + } + static void CallFunc_IND_RetIND(PCODE pcode, int8_t* pArgs, int8_t* pRet) { int32_t (*fptr)(int32_t) = (int32_t (*)(int32_t))pcode; @@ -463,6 +500,13 @@ namespace *((int32_t*)pRet) = (*fptr)(ARG_IND(0), ARG_I32(1)); } + static void CallFunc_IND_IND_RetIND(PCODE pcode, int8_t* pArgs, int8_t* pRet) + { + int32_t (*fptr)(int32_t, int32_t) = (int32_t (*)(int32_t, int32_t))pcode; + PORTABILITY_ASSERT("Indirect struct return is not yet implemented."); + *((int32_t*)pRet) = (*fptr)(ARG_IND(0), ARG_IND(1)); + } + static void CallFunc_Void_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet) { void (*fptr)() = (void (*)())pcode; @@ -499,6 +543,12 @@ namespace (*fptr)(ARG_I32(0)); } + static void CallFunc_I32_F64_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet) + { + void (*fptr)(int32_t, double) = (void (*)(int32_t, double))pcode; + (*fptr)(ARG_I32(0), ARG_F64(1)); + } + static void CallFunc_I32_I32_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet) { void (*fptr)(int32_t, int32_t) = (void (*)(int32_t, int32_t))pcode; @@ -547,6 +597,12 @@ namespace (*fptr)(ARG_I32(0), ARG_I32(1), ARG_I32(2), ARG_IND(3), ARG_IND(4), ARG_I32(5)); } + static void CallFunc_I32_I32_I64_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet) + { + void (*fptr)(int32_t, int32_t, int64_t) = (void (*)(int32_t, int32_t, int64_t))pcode; + (*fptr)(ARG_I32(0), ARG_I32(1), ARG_I64(2)); + } + static void CallFunc_I32_I32_IND_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet) { void (*fptr)(int32_t, int32_t, int32_t) = (void (*)(int32_t, int32_t, int32_t))pcode; @@ -565,6 +621,12 @@ namespace (*fptr)(ARG_I32(0), ARG_I32(1), ARG_IND(2), ARG_IND(3), ARG_I32(4), ARG_I32(5)); } + static void CallFunc_I32_I64_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet) + { + void (*fptr)(int32_t, int64_t) = (void (*)(int32_t, int64_t))pcode; + (*fptr)(ARG_I32(0), ARG_I64(1)); + } + static void CallFunc_I32_IND_RetVoid(PCODE pcode, int8_t* pArgs, int8_t* pRet) { void (*fptr)(int32_t, int32_t) = (void (*)(int32_t, int32_t))pcode; @@ -656,6 +718,7 @@ const StringToWasmSigThunk g_wasmThunks[] = { { "ddd", (void*)&CallFunc_F64_F64_RetF64 }, { "dddd", (void*)&CallFunc_F64_F64_F64_RetF64 }, { "ddi", (void*)&CallFunc_F64_I32_RetF64 }, + { "ddid", (void*)&CallFunc_F64_I32_F64_RetF64 }, { "di", (void*)&CallFunc_I32_RetF64 }, { "dii", (void*)&CallFunc_I32_I32_RetF64 }, { "f", (void*)&CallFunc_Void_RetF32 }, @@ -665,6 +728,7 @@ const StringToWasmSigThunk g_wasmThunks[] = { { "ffi", (void*)&CallFunc_F32_I32_RetF32 }, { "i", (void*)&CallFunc_Void_RetI32 }, { "id", (void*)&CallFunc_F64_RetI32 }, + { "idfi", (void*)&CallFunc_F64_F32_I32_RetI32 }, { "idi", (void*)&CallFunc_F64_I32_RetI32 }, { "if", (void*)&CallFunc_F32_RetI32 }, { "iff", (void*)&CallFunc_F32_F32_RetI32 }, @@ -705,10 +769,13 @@ const StringToWasmSigThunk g_wasmThunks[] = { { "iniiiii", (void*)&CallFunc_IND_I32_I32_I32_I32_I32_RetI32 }, { "inini", (void*)&CallFunc_IND_I32_IND_I32_RetI32 }, { "ininn", (void*)&CallFunc_IND_I32_IND_IND_RetI32 }, + { "inn", (void*)&CallFunc_IND_IND_RetI32 }, { "inni", (void*)&CallFunc_IND_IND_I32_RetI32 }, { "innii", (void*)&CallFunc_IND_IND_I32_I32_RetI32 }, { "innin", (void*)&CallFunc_IND_IND_I32_IND_RetI32 }, { "l", (void*)&CallFunc_Void_RetI64 }, + { "ld", (void*)&CallFunc_F64_RetI64 }, + { "lf", (void*)&CallFunc_F32_RetI64 }, { "li", (void*)&CallFunc_I32_RetI64 }, { "lii", (void*)&CallFunc_I32_I32_RetI64 }, { "liiil", (void*)&CallFunc_I32_I32_I32_I64_RetI64 }, @@ -722,14 +789,17 @@ const StringToWasmSigThunk g_wasmThunks[] = { { "ni", (void*)&CallFunc_I32_RetIND }, { "nii", (void*)&CallFunc_I32_I32_RetIND }, { "niii", (void*)&CallFunc_I32_I32_I32_RetIND }, + { "nin", (void*)&CallFunc_I32_IND_RetIND }, { "nn", (void*)&CallFunc_IND_RetIND }, { "nni", (void*)&CallFunc_IND_I32_RetIND }, + { "nnn", (void*)&CallFunc_IND_IND_RetIND }, { "v", (void*)&CallFunc_Void_RetVoid }, { "vd", (void*)&CallFunc_F64_RetVoid }, { "vdii", (void*)&CallFunc_F64_I32_I32_RetVoid }, { "vf", (void*)&CallFunc_F32_RetVoid }, { "vfii", (void*)&CallFunc_F32_I32_I32_RetVoid }, { "vi", (void*)&CallFunc_I32_RetVoid }, + { "vid", (void*)&CallFunc_I32_F64_RetVoid }, { "vii", (void*)&CallFunc_I32_I32_RetVoid }, { "viii", (void*)&CallFunc_I32_I32_I32_RetVoid }, { "viiii", (void*)&CallFunc_I32_I32_I32_I32_RetVoid }, @@ -738,9 +808,11 @@ const StringToWasmSigThunk g_wasmThunks[] = { { "viiiiiii", (void*)&CallFunc_I32_I32_I32_I32_I32_I32_I32_RetVoid }, { "viiinn", (void*)&CallFunc_I32_I32_I32_IND_IND_RetVoid }, { "viiinni", (void*)&CallFunc_I32_I32_I32_IND_IND_I32_RetVoid }, + { "viil", (void*)&CallFunc_I32_I32_I64_RetVoid }, { "viin", (void*)&CallFunc_I32_I32_IND_RetVoid }, { "viinni", (void*)&CallFunc_I32_I32_IND_IND_I32_RetVoid }, { "viinnii", (void*)&CallFunc_I32_I32_IND_IND_I32_I32_RetVoid }, + { "vil", (void*)&CallFunc_I32_I64_RetVoid }, { "vin", (void*)&CallFunc_I32_IND_RetVoid }, { "vini", (void*)&CallFunc_I32_IND_I32_RetVoid }, { "vinni", (void*)&CallFunc_I32_IND_IND_I32_RetVoid }, diff --git a/src/coreclr/vm/wasm/callhelpers-reverse.cpp b/src/coreclr/vm/wasm/callhelpers-reverse.cpp index eaed7b6944928c..493767ee35bfcf 100644 --- a/src/coreclr/vm/wasm/callhelpers-reverse.cpp +++ b/src/coreclr/vm/wasm/callhelpers-reverse.cpp @@ -586,45 +586,45 @@ static int32_t Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComA extern const ReverseThunkMapEntry g_ReverseThunks[] = { - { 2644319185, 3863938719, { &MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid } } /* alternate key source: g__Callback|72_0#1:System.Private.CoreLib:System:GC */, - { 2644321927, 1336557534, { &MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid, (void*)&Call_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid } } /* alternate key source: BackgroundJobHandler#0:System.Private.CoreLib:System.Threading:ThreadPool */, - { 3685902048, 2901966433, { &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid, (void*)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid } } /* alternate key source: BindAssemblyExports#1:System.Runtime.InteropServices.JavaScript:System.Runtime.InteropServices.JavaScript:JavaScriptExports */, - { 3685901981, 2601830388, { &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid, (void*)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid } } /* alternate key source: CallDelegate#1:System.Runtime.InteropServices.JavaScript:System.Runtime.InteropServices.JavaScript:JavaScriptExports */, - { 3685902049, 433365813, { &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid, (void*)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid } } /* alternate key source: CallJSExport#2:System.Runtime.InteropServices.JavaScript:System.Runtime.InteropServices.JavaScript:JavaScriptExports */, - { 2644318075, 1821934012, { &MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid } } /* alternate key source: CallStartupHook#2:System.Private.CoreLib:System:StartupHookProvider */, - { 2644335770, 3358042195, { &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid } } /* alternate key source: ClearManaged#4:System.Private.CoreLib:System.StubHelpers:MngdRefCustomMarshaler */, - { 2644335772, 2311968855, { &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid } } /* alternate key source: ClearNative#4:System.Private.CoreLib:System.StubHelpers:MngdRefCustomMarshaler */, - { 3685902050, 3113228365, { &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid, (void*)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid } } /* alternate key source: CompleteTask#1:System.Runtime.InteropServices.JavaScript:System.Runtime.InteropServices.JavaScript:JavaScriptExports */, - { 2644319192, 3378852959, { &MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, (void*)&Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid } } /* alternate key source: ConfigCallback#5:System.Private.CoreLib:System:GC */, - { 2644335774, 823296796, { &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid } } /* alternate key source: ConvertContentsToManaged#4:System.Private.CoreLib:System.StubHelpers:MngdRefCustomMarshaler */, - { 2644335776, 3788988216, { &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid } } /* alternate key source: ConvertContentsToNative#4:System.Private.CoreLib:System.StubHelpers:MngdRefCustomMarshaler */, - { 2644338057, 1243134822, { &MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid } } /* alternate key source: Create#2:System.Private.CoreLib:System.Reflection:LoaderAllocator */, - { 2644325561, 1196551088, { &MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid } } /* alternate key source: EnumCalendarInfoCallback#2:System.Private.CoreLib:System.Globalization:CalendarData */, - { 2644360760, 2613312799, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComActivator_GetClassFactoryForTypeInternal_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComActivator_GetClassFactoryForTypeInternal_I32_RetI32 } } /* alternate key source: GetClassFactoryForTypeInternal#1:System.Private.CoreLib:Internal.Runtime.InteropServices:ComActivator */, - { 2644318622, 2605868264, { &MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid } } /* alternate key source: GetCodeInfo#6:System.Private.CoreLib:System:Resolver */, - { 2644360770, 993231473, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 } } /* alternate key source: GetFunctionPointer#6:System.Private.CoreLib:Internal.Runtime.InteropServices:ComponentActivator */, - { 2644318625, 4101188193, { &MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid } } /* alternate key source: GetJitContext#4:System.Private.CoreLib:System:Resolver */, - { 2644318623, 2512220404, { &MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid } } /* alternate key source: GetLocalsSignature#3:System.Private.CoreLib:System:Resolver */, - { 3685902051, 1081971317, { &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid, (void*)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid } } /* alternate key source: GetManagedStackTrace#1:System.Runtime.InteropServices.JavaScript:System.Runtime.InteropServices.JavaScript:JavaScriptExports */, - { 2644318620, 831291767, { &MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid } } /* alternate key source: GetStringLiteral#4:System.Private.CoreLib:System:Resolver */, - { 2644348541, 513042204, { &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid } } /* alternate key source: InitializeDefaultEventSources#1:System.Private.CoreLib:System.Diagnostics.Tracing:EventSource */, - { 2644360775, 3422156547, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 } } /* alternate key source: LoadAssembly#3:System.Private.CoreLib:Internal.Runtime.InteropServices:ComponentActivator */, - { 2644360774, 542185314, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 } } /* alternate key source: LoadAssemblyAndGetFunctionPointer#6:System.Private.CoreLib:Internal.Runtime.InteropServices:ComponentActivator */, - { 2644360773, 3765950975, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 } } /* alternate key source: LoadAssemblyBytes#6:System.Private.CoreLib:Internal.Runtime.InteropServices:ComponentActivator */, - { 2644339256, 343912841, { &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, (void*)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 } } /* alternate key source: NewExternalTypeEntry#2:System.Private.CoreLib:System.Runtime.InteropServices:TypeMapLazyDictionary */, - { 2644339257, 3327247096, { &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, (void*)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 } } /* alternate key source: NewProxyTypeEntry#2:System.Private.CoreLib:System.Runtime.InteropServices:TypeMapLazyDictionary */, - { 2644340379, 3837429452, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid } } /* alternate key source: OnAssemblyLoad#2:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, - { 2644340374, 1632250712, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid } } /* alternate key source: OnAssemblyResolve#4:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, - { 2644340377, 2158495436, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid } } /* alternate key source: OnResourceResolve#4:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, - { 2644340376, 3572430398, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid } } /* alternate key source: OnTypeResolve#4:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, - { 2644360761, 4239234100, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComActivator_RegisterClassForTypeInternal_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComActivator_RegisterClassForTypeInternal_I32_RetI32 } } /* alternate key source: RegisterClassForTypeInternal#1:System.Private.CoreLib:Internal.Runtime.InteropServices:ComActivator */, - { 3685901980, 1403522766, { &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid, (void*)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid } } /* alternate key source: ReleaseJSOwnedObjectByGCHandle#1:System.Runtime.InteropServices.JavaScript:System.Runtime.InteropServices.JavaScript:JavaScriptExports */, - { 2644340375, 225437511, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid } } /* alternate key source: Resolve#4:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, - { 2644340372, 260403842, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid } } /* alternate key source: ResolveSatelliteAssembly#4:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, - { 2644340373, 2533042349, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid } } /* alternate key source: ResolveUsingEvent#4:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, - { 2644317641, 1963568864, { &MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid } } /* alternate key source: Setup#4:System.Private.CoreLib:System:AppContext */, - { 2644321597, 167179540, { &MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid, (void*)&Call_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid } } /* alternate key source: TimerHandler#0:System.Private.CoreLib:System.Threading:TimerQueue */, - { 2644360758, 2150642223, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComActivator_UnregisterClassForTypeInternal_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComActivator_UnregisterClassForTypeInternal_I32_RetI32 } } /* alternate key source: UnregisterClassForTypeInternal#1:System.Private.CoreLib:Internal.Runtime.InteropServices:ComActivator */ + { 2644319182, 3863938719, { &MD_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_GC__RegisterNoGCRegionCallback_g__Callback_7C_72_0_I32_RetVoid } } /* alternate key source: g__Callback|72_0#1:System.Private.CoreLib:System:GC */, + { 2644321744, 1336557534, { &MD_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid, (void*)&Call_System_Private_CoreLib_System_Threading_ThreadPool_BackgroundJobHandler_Void_RetVoid } } /* alternate key source: BackgroundJobHandler#0:System.Private.CoreLib:System.Threading:ThreadPool */, + { 3685902049, 2901966433, { &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid, (void*)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_BindAssemblyExports_I32_RetVoid } } /* alternate key source: BindAssemblyExports#1:System.Runtime.InteropServices.JavaScript:System.Runtime.InteropServices.JavaScript:JavaScriptExports */, + { 3685902050, 2601830388, { &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid, (void*)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallDelegate_I32_RetVoid } } /* alternate key source: CallDelegate#1:System.Runtime.InteropServices.JavaScript:System.Runtime.InteropServices.JavaScript:JavaScriptExports */, + { 3685902054, 433365813, { &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid, (void*)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CallJSExport_I32_I32_RetVoid } } /* alternate key source: CallJSExport#2:System.Runtime.InteropServices.JavaScript:System.Runtime.InteropServices.JavaScript:JavaScriptExports */, + { 2644318070, 1821934012, { &MD_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_StartupHookProvider_CallStartupHook_I32_I32_RetVoid } } /* alternate key source: CallStartupHook#2:System.Private.CoreLib:System:StartupHookProvider */, + { 2644335563, 3358042195, { &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearManaged_I32_I32_I32_I32_RetVoid } } /* alternate key source: ClearManaged#4:System.Private.CoreLib:System.StubHelpers:MngdRefCustomMarshaler */, + { 2644335565, 2311968855, { &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ClearNative_I32_I32_I32_I32_RetVoid } } /* alternate key source: ClearNative#4:System.Private.CoreLib:System.StubHelpers:MngdRefCustomMarshaler */, + { 3685902051, 3113228365, { &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid, (void*)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_CompleteTask_I32_RetVoid } } /* alternate key source: CompleteTask#1:System.Runtime.InteropServices.JavaScript:System.Runtime.InteropServices.JavaScript:JavaScriptExports */, + { 2644319193, 3378852959, { &MD_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid, (void*)&Call_System_Private_CoreLib_System_GC_ConfigCallback_I32_I32_I32_I32_I64_RetVoid } } /* alternate key source: ConfigCallback#5:System.Private.CoreLib:System:GC */, + { 2644335567, 823296796, { &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToManaged_I32_I32_I32_I32_RetVoid } } /* alternate key source: ConvertContentsToManaged#4:System.Private.CoreLib:System.StubHelpers:MngdRefCustomMarshaler */, + { 2644335569, 3788988216, { &MD_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_StubHelpers_MngdRefCustomMarshaler_ConvertContentsToNative_I32_I32_I32_I32_RetVoid } } /* alternate key source: ConvertContentsToNative#4:System.Private.CoreLib:System.StubHelpers:MngdRefCustomMarshaler */, + { 2644337824, 1243134822, { &MD_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Reflection_LoaderAllocator_Create_I32_I32_RetVoid } } /* alternate key source: Create#2:System.Private.CoreLib:System.Reflection:LoaderAllocator */, + { 2644325224, 1196551088, { &MD_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Globalization_CalendarData_EnumCalendarInfoCallback_I32_I32_RetVoid } } /* alternate key source: EnumCalendarInfoCallback#2:System.Private.CoreLib:System.Globalization:CalendarData */, + { 2644360690, 2613312799, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComActivator_GetClassFactoryForTypeInternal_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComActivator_GetClassFactoryForTypeInternal_I32_RetI32 } } /* alternate key source: GetClassFactoryForTypeInternal#1:System.Private.CoreLib:Internal.Runtime.InteropServices:ComActivator */, + { 2644318620, 2605868264, { &MD_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Resolver_GetCodeInfo_I32_I32_I32_I32_I32_I32_RetVoid } } /* alternate key source: GetCodeInfo#6:System.Private.CoreLib:System:Resolver */, + { 2644360700, 993231473, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_GetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 } } /* alternate key source: GetFunctionPointer#6:System.Private.CoreLib:Internal.Runtime.InteropServices:ComponentActivator */, + { 2644318623, 4101188193, { &MD_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Resolver_GetJitContext_I32_I32_I32_I32_RetVoid } } /* alternate key source: GetJitContext#4:System.Private.CoreLib:System:Resolver */, + { 2644318621, 2512220404, { &MD_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Resolver_GetLocalsSignature_I32_I32_I32_RetVoid } } /* alternate key source: GetLocalsSignature#3:System.Private.CoreLib:System:Resolver */, + { 3685902048, 1081971317, { &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid, (void*)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_GetManagedStackTrace_I32_RetVoid } } /* alternate key source: GetManagedStackTrace#1:System.Runtime.InteropServices.JavaScript:System.Runtime.InteropServices.JavaScript:JavaScriptExports */, + { 2644318618, 831291767, { &MD_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Resolver_GetStringLiteral_I32_I32_I32_I32_RetVoid } } /* alternate key source: GetStringLiteral#4:System.Private.CoreLib:System:Resolver */, + { 2644348245, 513042204, { &MD_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Diagnostics_Tracing_EventSource_InitializeDefaultEventSources_I32_RetVoid } } /* alternate key source: InitializeDefaultEventSources#1:System.Private.CoreLib:System.Diagnostics.Tracing:EventSource */, + { 2644360449, 3422156547, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssembly_I32_I32_I32_RetI32 } } /* alternate key source: LoadAssembly#3:System.Private.CoreLib:Internal.Runtime.InteropServices:ComponentActivator */, + { 2644360448, 542185314, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyAndGetFunctionPointer_I32_I32_I32_I32_I32_I32_RetI32 } } /* alternate key source: LoadAssemblyAndGetFunctionPointer#6:System.Private.CoreLib:Internal.Runtime.InteropServices:ComponentActivator */, + { 2644360703, 3765950975, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComponentActivator_LoadAssemblyBytes_I32_I32_I32_I32_I32_I32_RetI32 } } /* alternate key source: LoadAssemblyBytes#6:System.Private.CoreLib:Internal.Runtime.InteropServices:ComponentActivator */, + { 2644339032, 343912841, { &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32, (void*)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewExternalTypeEntry_I32_I32_RetI32 } } /* alternate key source: NewExternalTypeEntry#2:System.Private.CoreLib:System.Runtime.InteropServices:TypeMapLazyDictionary */, + { 2644339033, 3327247096, { &MD_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32, (void*)&Call_System_Private_CoreLib_System_Runtime_InteropServices_TypeMapLazyDictionary_NewProxyTypeEntry_I32_I32_RetI32 } } /* alternate key source: NewProxyTypeEntry#2:System.Private.CoreLib:System.Runtime.InteropServices:TypeMapLazyDictionary */, + { 2644340158, 3837429452, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyLoad_I32_I32_RetVoid } } /* alternate key source: OnAssemblyLoad#2:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, + { 2644340157, 1632250712, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnAssemblyResolve_I32_I32_I32_I32_RetVoid } } /* alternate key source: OnAssemblyResolve#4:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, + { 2644340156, 2158495436, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnResourceResolve_I32_I32_I32_I32_RetVoid } } /* alternate key source: OnResourceResolve#4:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, + { 2644340159, 3572430398, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_OnTypeResolve_I32_I32_I32_I32_RetVoid } } /* alternate key source: OnTypeResolve#4:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, + { 2644360691, 4239234100, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComActivator_RegisterClassForTypeInternal_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComActivator_RegisterClassForTypeInternal_I32_RetI32 } } /* alternate key source: RegisterClassForTypeInternal#1:System.Private.CoreLib:Internal.Runtime.InteropServices:ComActivator */, + { 3685901981, 1403522766, { &MD_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid, (void*)&Call_System_Runtime_InteropServices_JavaScript_System_Runtime_InteropServices_JavaScript_JavaScriptExports_ReleaseJSOwnedObjectByGCHandle_I32_RetVoid } } /* alternate key source: ReleaseJSOwnedObjectByGCHandle#1:System.Runtime.InteropServices.JavaScript:System.Runtime.InteropServices.JavaScript:JavaScriptExports */, + { 2644340154, 225437511, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_Resolve_I32_I32_I32_I32_RetVoid } } /* alternate key source: Resolve#4:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, + { 2644340155, 260403842, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveSatelliteAssembly_I32_I32_I32_I32_RetVoid } } /* alternate key source: ResolveSatelliteAssembly#4:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, + { 2644340152, 2533042349, { &MD_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_Runtime_Loader_AssemblyLoadContext_ResolveUsingEvent_I32_I32_I32_I32_RetVoid } } /* alternate key source: ResolveUsingEvent#4:System.Private.CoreLib:System.Runtime.Loader:AssemblyLoadContext */, + { 2644317636, 1963568864, { &MD_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid, (void*)&Call_System_Private_CoreLib_System_AppContext_Setup_I32_I32_I32_I32_RetVoid } } /* alternate key source: Setup#4:System.Private.CoreLib:System:AppContext */, + { 2644321670, 167179540, { &MD_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid, (void*)&Call_System_Private_CoreLib_System_Threading_TimerQueue_TimerHandler_Void_RetVoid } } /* alternate key source: TimerHandler#0:System.Private.CoreLib:System.Threading:TimerQueue */, + { 2644360688, 2150642223, { &MD_System_Private_CoreLib_Internal_Runtime_InteropServices_ComActivator_UnregisterClassForTypeInternal_I32_RetI32, (void*)&Call_System_Private_CoreLib_Internal_Runtime_InteropServices_ComActivator_UnregisterClassForTypeInternal_I32_RetI32 } } /* alternate key source: UnregisterClassForTypeInternal#1:System.Private.CoreLib:Internal.Runtime.InteropServices:ComActivator */ }; const size_t g_ReverseThunksCount = sizeof(g_ReverseThunks) / sizeof(g_ReverseThunks[0]); diff --git a/src/mono/browser/runtime/logging.ts b/src/mono/browser/runtime/logging.ts index acb184e9630cbf..403d0b61bda3ef 100644 --- a/src/mono/browser/runtime/logging.ts +++ b/src/mono/browser/runtime/logging.ts @@ -185,7 +185,7 @@ function performDeferredSymbolMapParsing () { //# chrome //# at http://127.0.0.1:63817/dotnet.wasm:wasm-function[8963]:0x1e23f4 - regexes.push(/(?[a-z]+:\/\/[^ )]*:wasm-function\[(?\d+)\]:0x[a-fA-F\d]+)/); + regexes.push(/(?[a-z]+:\/\/[a-zA-Z0-9.:/_]*:wasm-function\[(?\d+)\]:0x[a-fA-F\d]+)/); //# .wasm-function[8962] regexes.push(/(?<[^ >]+>[.:]wasm-function\[(?[0-9]+)\])/); diff --git a/src/mono/sample/wasm/browser/wwwroot/main.js b/src/mono/sample/wasm/browser/wwwroot/main.js index 1435d9eff08f90..61543f3149f522 100644 --- a/src/mono/sample/wasm/browser/wwwroot/main.js +++ b/src/mono/sample/wasm/browser/wwwroot/main.js @@ -27,8 +27,8 @@ try { const exports = await getAssemblyExports("Wasm.Browser.Sample"); await exports.Sample.Test.PrintMeaning(delay(2000).then(() => 42)); - console.log("Program has exited normally."); await dotnet.runMainAndExit(); + console.log("Program has exited normally."); } catch (err) { exit(2, err); diff --git a/src/native/corehost/browserhost/CMakeLists.txt b/src/native/corehost/browserhost/CMakeLists.txt index 1870c40091b6f3..acf9a486f0375b 100644 --- a/src/native/corehost/browserhost/CMakeLists.txt +++ b/src/native/corehost/browserhost/CMakeLists.txt @@ -55,7 +55,7 @@ set(SHARED_LIB_DESTINATION set(SHARED_CLR_DESTINATION ${CLR_ARTIFACTS_BIN_DIR}/coreclr/browser.wasm.${CMAKE_BUILD_RUNTIME_CONFIGURATION}/sharedFramework) -# these dependencies assume that you built `libs.native+clr.runtime` subsets first +# CoreCLR runtime .a libraries LIST(APPEND NATIVE_LIBS ${SHARED_CLR_DESTINATION}/libcoreclr_static.a ${SHARED_CLR_DESTINATION}/libnativeresourcestring.a @@ -63,6 +63,10 @@ LIST(APPEND NATIVE_LIBS ${SHARED_CLR_DESTINATION}/libcoreclrminipal.a ${SHARED_CLR_DESTINATION}/libcoreclrpal.a ${SHARED_CLR_DESTINATION}/libminipal.a +) + +# Shared platform .a libraries +list(APPEND NATIVE_LIBS ${SHARED_LIB_DESTINATION}/libSystem.Native.Browser.a ${SHARED_LIB_DESTINATION}/libSystem.Runtime.InteropServices.JavaScript.Native.a ${SHARED_LIB_DESTINATION}/libSystem.Native.a @@ -95,18 +99,13 @@ set_target_properties(browserhost PROPERTIES if (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG) target_link_options(browserhost PRIVATE -# -sVERBOSE -# -sASSERTIONS=1 - --emit-symbol-map +# add -sVERBOSE=1 to debug linking issues + -sASSERTIONS=1 -sLLD_REPORT_UNDEFINED -sERROR_ON_UNDEFINED_SYMBOLS=1 ) endif () -# add -sVERBOSE=1 to debug linking issues -# WASM-TODO -emit-llvm -# WASM-TODO --source-map-base http://microsoft.com -# WASM-TODO -sSEPARATE_DWARF=1, -gseparate-dwarf target_link_options(browserhost PRIVATE -sINITIAL_MEMORY=134217728 -sMAXIMUM_MEMORY=2147483648 @@ -121,6 +120,7 @@ target_link_options(browserhost PRIVATE -sEXPORTED_FUNCTIONS=${CMAKE_EMCC_EXPORTED_FUNCTIONS} -sEXPORT_NAME=createDotnetRuntime -sENVIRONMENT=web,webview,worker,node,shell + --emit-symbol-map -Wl,-error-limit=0) target_link_libraries(browserhost PRIVATE @@ -135,6 +135,8 @@ install(TARGETS browserhost DESTINATION corehost COMPONENT runtime) install(TARGETS browserhost DESTINATION sharedFramework COMPONENT runtime) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dotnet.native.wasm DESTINATION corehost COMPONENT runtime) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dotnet.native.wasm DESTINATION sharedFramework COMPONENT runtime) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dotnet.native.js.symbols DESTINATION corehost COMPONENT runtime) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dotnet.native.js.symbols DESTINATION sharedFramework COMPONENT runtime) set_source_files_properties(${BROWSERHOST_SOURCES} PROPERTIES OBJECT_DEPENDS "${JS_SYSTEM_NATIVE_BROWSER};${JS_SYSTEM_BROWSER_UTILS};${JS_SYSTEM_RUNTIME_INTEROPSERVICES_JAVASCRIPT_NATIVE};${JS_BROWSER_HOST};${JS_SYSTEM_NATIVE_BROWSER_EXPOST}") diff --git a/src/native/corehost/browserhost/browserhost.cpp b/src/native/corehost/browserhost/browserhost.cpp index f16ebfafa9f8e4..96ba4ef1becc0c 100644 --- a/src/native/corehost/browserhost/browserhost.cpp +++ b/src/native/corehost/browserhost/browserhost.cpp @@ -124,13 +124,31 @@ extern "C" int BrowserHost_InitializeCoreCLR(int propertiesCount, const char** p extern "C" int BrowserHost_ExecuteAssembly(const char* assemblyPath, int argc, const char** argv) { - int ignore_exit_code = 0; - int retval = coreclr_execute_assembly(CurrentClrInstance, CurrentAppDomainId, argc, argv, assemblyPath, (uint32_t*)&ignore_exit_code); + int exit_code = 0; + int retval = coreclr_execute_assembly(CurrentClrInstance, CurrentAppDomainId, argc, argv, assemblyPath, (uint32_t*)&exit_code); if (retval < 0) { std::fprintf(stderr, "coreclr_execute_assembly failed - Error: 0x%08x\n", retval); return -1; } - return 0; + return exit_code; +} + +extern "C" int BrowserHost_ShutdownCoreCLR(int exit_code) +{ + int latched_exit_code = 0; + int result = coreclr_shutdown_2(CurrentClrInstance, CurrentAppDomainId, &latched_exit_code); + if (result < 0) + { + std::fprintf(stderr, "coreclr_shutdown_2 failed - Error: 0x%08x\n", result); + exit_code = -1; + } + + if (exit_code != -1) + { + exit_code = latched_exit_code; + } + + return exit_code; } diff --git a/src/native/corehost/browserhost/host/host.ts b/src/native/corehost/browserhost/host/host.ts index a8107f16ee36e4..5d27dc4faf42b0 100644 --- a/src/native/corehost/browserhost/host/host.ts +++ b/src/native/corehost/browserhost/host/host.ts @@ -81,14 +81,14 @@ export async function runMain(mainAssemblyName?: string, args?: string[]): Promi ptrs.push(ptr); _ems_.HEAPU32[(argsvPtr >>> 2) + i] = ptr; } - const res = _ems_._BrowserHost_ExecuteAssembly(mainAssemblyNamePtr, args.length, argsvPtr); + _ems_.EXITSTATUS = _ems_._BrowserHost_ExecuteAssembly(mainAssemblyNamePtr, args.length, argsvPtr); for (const ptr of ptrs) { _ems_._free(ptr); } - if (res != 0) { + if (_ems_.EXITSTATUS == -1) { const reason = new Error("Failed to execute assembly"); - _ems_.dotnetApi.exit(res, reason); + _ems_.dotnetApi.exit(-1, reason); throw reason; } @@ -107,9 +107,9 @@ export async function runMain(mainAssemblyName?: string, args?: string[]): Promi } export async function runMainAndExit(mainAssemblyName?: string, args?: string[]): Promise { - const res = await runMain(mainAssemblyName, args); + const exitCode = await runMain(mainAssemblyName, args); try { - _ems_.dotnetApi.exit(0, null); + _ems_.dotnetApi.exit(exitCode, null); } catch (error: any) { // do not propagate ExitStatus exception if (!error || typeof error.status !== "number") { @@ -118,6 +118,6 @@ export async function runMainAndExit(mainAssemblyName?: string, args?: string[]) } return error.status; } - return res; + return exitCode; } diff --git a/src/native/corehost/browserhost/host/index.ts b/src/native/corehost/browserhost/host/index.ts index 04e131fb67782c..26b0bbb177edda 100644 --- a/src/native/corehost/browserhost/host/index.ts +++ b/src/native/corehost/browserhost/host/index.ts @@ -67,6 +67,18 @@ function setupEmscripten() { _ems_.Module.preInit = [() => { _ems_.FS.createPath("/", loaderConfig.virtualWorkingDirectory!, true, true); _ems_.FS.chdir(loaderConfig.virtualWorkingDirectory!); + + const orig_funcs_on_exit = _ems_.___funcs_on_exit; + // it would be better to use addOnExit(), but it's called too late. + _ems_.___funcs_on_exit = () => { + // this will prevent more timers (like finalizer) to get scheduled during thread destructor + if (_ems_.dotnetBrowserUtilsExports.abortBackgroundTimers) { + _ems_.dotnetBrowserUtilsExports.abortBackgroundTimers(); + } + _ems_.EXITSTATUS = _ems_._BrowserHost_ShutdownCoreCLR(_ems_.EXITSTATUS || 0); + orig_funcs_on_exit(); + }; + }, ...(_ems_.Module.preInit || [])]; } diff --git a/src/native/corehost/browserhost/libBrowserHost.footer.js b/src/native/corehost/browserhost/libBrowserHost.footer.js index bf9eb0489485f1..59eef44f53daf6 100644 --- a/src/native/corehost/browserhost/libBrowserHost.footer.js +++ b/src/native/corehost/browserhost/libBrowserHost.footer.js @@ -22,7 +22,9 @@ function libBrowserHostFactory() { "wasm_load_icu_data", "BrowserHost_CreateHostContract", "BrowserHost_InitializeCoreCLR", - "BrowserHost_ExecuteAssembly" + "BrowserHost_ExecuteAssembly", + "BrowserHost_ShutdownCoreCLR", + "__funcs_on_exit", ]; let commonDeps = [ "$DOTNET", diff --git a/src/native/corehost/browserhost/loader/assets.ts b/src/native/corehost/browserhost/loader/assets.ts index 90352ff8a9cf5a..2c51273887d51c 100644 --- a/src/native/corehost/browserhost/loader/assets.ts +++ b/src/native/corehost/browserhost/loader/assets.ts @@ -1,9 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -import type { JsModuleExports, JsAsset, AssemblyAsset, WasmAsset, IcuAsset, EmscriptenModuleInternal, WebAssemblyBootResourceType, AssetEntryInternal, PromiseCompletionSource, LoadBootResourceCallback, InstantiateWasmSuccessCallback } from "./types"; +import type { JsModuleExports, JsAsset, AssemblyAsset, WasmAsset, IcuAsset, EmscriptenModuleInternal, WebAssemblyBootResourceType, AssetEntryInternal, PromiseCompletionSource, LoadBootResourceCallback, InstantiateWasmSuccessCallback, SymbolsAsset } from "./types"; -import { dotnetAssert, dotnetLogger, dotnetInternals, dotnetBrowserHostExports, dotnetUpdateInternals, Module } from "./cross-module"; +import { dotnetAssert, dotnetLogger, dotnetInternals, dotnetBrowserHostExports, dotnetUpdateInternals, Module, dotnetDiagnosticsExports } from "./cross-module"; import { ENVIRONMENT_IS_SHELL, ENVIRONMENT_IS_NODE, browserVirtualAppBase } from "./per-module"; import { createPromiseCompletionSource, delay } from "./promise-completion-source"; import { locateFile, makeURLAbsoluteWithApplicationBase } from "./bootstrap"; @@ -144,6 +144,19 @@ export async function fetchVfs(asset: AssemblyAsset): Promise { } } +export async function fetchNativeSymbols(asset: SymbolsAsset): Promise { + totalAssetsToDownload++; + const assetInternal = asset as AssetEntryInternal; + if (assetInternal.name && !asset.resolvedUrl) { + asset.resolvedUrl = locateFile(assetInternal.name); + } + assetInternal.behavior = "symbols"; + assetInternal.isOptional = assetInternal.isOptional || loaderConfig.ignorePdbLoadErrors; + const table = await fetchText(assetInternal); + onDownloadedAsset(); + dotnetDiagnosticsExports.installNativeSymbols(table || ""); +} + async function fetchBytes(asset: AssetEntryInternal): Promise { dotnetAssert.check(asset && asset.resolvedUrl, "Bad asset.resolvedUrl"); const response = await loadResource(asset); @@ -158,8 +171,21 @@ async function fetchBytes(asset: AssetEntryInternal): Promise return new Uint8Array(buffer); } +async function fetchText(asset: AssetEntryInternal): Promise { + dotnetAssert.check(asset && asset.resolvedUrl, "Bad asset.resolvedUrl"); + const response = await loadResource(asset); + if (!response.ok) { + if (asset.isOptional) { + dotnetLogger.warn(`Optional resource '${asset.name}' failed to load from '${asset.resolvedUrl}'. HTTP status: ${response.status} ${response.statusText}`); + return null; + } + throw new Error(`Failed to load resource '${asset.name}' from '${asset.resolvedUrl}'. HTTP status: ${response.status} ${response.statusText}`); + } + return response.text(); +} + function loadResource(asset: AssetEntryInternal): Promise { - if ("dotnetwasm" === asset.behavior) { + if (noThrottleNoRetry[asset.behavior]) { // `response.arrayBuffer()` can't be called twice. return loadResourceFetch(asset); } @@ -316,6 +342,7 @@ const behaviorToBlazorAssetTypeMap: { [key: string]: WebAssemblyBootResourceType "icu": "globalization", "vfs": "configuration", "manifest": "manifest", + "symbols": "pdb", "dotnetwasm": "dotnetwasm", "js-module-dotnet": "dotnetjs", "js-module-native": "dotnetjs", @@ -330,5 +357,11 @@ const behaviorToContentTypeMap: { [key: string]: string | undefined } = { "icu": "application/octet-stream", "vfs": "application/octet-stream", "manifest": "application/json", + "symbols": "text/plain; charset=utf-8", "dotnetwasm": "application/wasm", }; + +const noThrottleNoRetry: { [key: string]: number | undefined } = { + "dotnetwasm": 1, + "symbols": 1, +}; diff --git a/src/native/corehost/browserhost/loader/exit.ts b/src/native/corehost/browserhost/loader/exit.ts index 7f400e338d3fb1..6e89fb2941e1ff 100644 --- a/src/native/corehost/browserhost/loader/exit.ts +++ b/src/native/corehost/browserhost/loader/exit.ts @@ -117,7 +117,7 @@ export function exit(exitCode: number, reason: any): void { unregisterExit(); if (!alreadySilent) { if (runtimeState.onExitListeners.length === 0 && !runtimeState.dotnetReady) { - dotnetLogger.error(`Exiting during runtime startup: ${message}`); + dotnetLogger.error(`Exiting during runtime startup`, message); dotnetLogger.debug(() => stack); } for (const listener of runtimeState.onExitListeners) { diff --git a/src/native/corehost/browserhost/loader/index.ts b/src/native/corehost/browserhost/loader/index.ts index 6d0479fac95b62..457f1a1c8825c9 100644 --- a/src/native/corehost/browserhost/loader/index.ts +++ b/src/native/corehost/browserhost/loader/index.ts @@ -16,7 +16,7 @@ import GitHash from "consts:gitHash"; import { loaderConfig, getLoaderConfig } from "./config"; import { exit, isExited, isRuntimeRunning, addOnExitListener, registerExit, quitNow } from "./exit"; import { invokeLibraryInitializers } from "./lib-initializers"; -import { check, error, info, warn, debug, fastCheck } from "./logging"; +import { check, error, info, warn, debug, fastCheck, normalizeException } from "./logging"; import { dotnetAssert, dotnetLoaderExports, dotnetLogger, dotnetUpdateInternals, dotnetUpdateInternalsSubscriber } from "./cross-module"; import { rejectRunMainPromise, resolveRunMainPromise, getRunMainPromise, abortStartup } from "./run"; @@ -66,6 +66,7 @@ export function dotnetInitializeModule(): RuntimeAPI { addOnExitListener, abortStartup, quitNow, + normalizeException, }; Object.assign(dotnetLoaderExports, loaderFunctions); const logger: LoggerType = { @@ -112,6 +113,7 @@ export function dotnetInitializeModule(): RuntimeAPI { dotnetLoaderExports.addOnExitListener, dotnetLoaderExports.abortStartup, dotnetLoaderExports.quitNow, + dotnetLoaderExports.normalizeException, ]; } diff --git a/src/native/corehost/browserhost/loader/logging.ts b/src/native/corehost/browserhost/loader/logging.ts index 65ee07bc4ea8de..836534d2e1bedb 100644 --- a/src/native/corehost/browserhost/loader/logging.ts +++ b/src/native/corehost/browserhost/loader/logging.ts @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. import { loaderConfig } from "./config"; +import { dotnetDiagnosticsExports } from "./cross-module"; export function check(condition: unknown, message: string): asserts condition { if (!condition) { @@ -41,16 +42,45 @@ export function warn(msg: string, ...data: any) { console.warn(prefix + msg, ...data); } -export function error(msg: string, ...data: any) { - if (data && data.length > 0 && data[0] && typeof data[0] === "object") { - // don't log silent errors - if (data[0].silent) { - return; +export function error(msg: string, reason: any) { + console.error(prefix + msg, normalizeException(reason)); +} + +export function normalizeException(reason: any) { + let res = "unknown exception"; + if (reason) { + if (typeof reason === "object" && reason.status === undefined && reason.stack === undefined) { + try { + reason.stack = new Error().stack + ""; + } catch { + // Ignore failure to assign stack; continue logging with what we have. + } + } + if (reason.message) { + res = reason.message; + } else if (typeof reason.toString === "function") { + res = reason.toString(); + } else { + res = reason + ""; } - if (data[0].toString) { - console.error(prefix + msg, data[0].toString()); - return; + const stack = reason.stack; + if (stack) { + // Some JS runtimes insert the error message at the top of the stack, some don't, + // so normalize it by using the stack as the result if it already contains the error + if (stack.startsWith(res)) + res = symbolicateStackTrace(stack); + else + res += "\n" + symbolicateStackTrace(stack); + } else { + res = symbolicateStackTrace(res); } } - console.error(prefix + msg, ...data); + return res; +} + +function symbolicateStackTrace(message: string): string { + if (dotnetDiagnosticsExports.symbolicateStackTrace) { + return dotnetDiagnosticsExports.symbolicateStackTrace(message); + } + return message; } diff --git a/src/native/corehost/browserhost/loader/polyfills.ts b/src/native/corehost/browserhost/loader/polyfills.ts index bae7aed2320ba7..aebf928b616a9f 100644 --- a/src/native/corehost/browserhost/loader/polyfills.ts +++ b/src/native/corehost/browserhost/loader/polyfills.ts @@ -153,6 +153,10 @@ export function responseLike(url: string, body: ArrayBuffer | string | null, opt return Promise.resolve(JSON.parse(body)); }, text: () => { + if (typeof body !== "string" && typeof globalThis.TextDecoder !== "undefined") { + const decoder = new globalThis.TextDecoder("utf-8"); + return Promise.resolve(decoder.decode(body || new Uint8Array())); + } dotnetAssert.check(body !== null && typeof body === "string", "Response body is not a string."); return Promise.resolve(body); } diff --git a/src/native/corehost/browserhost/loader/run.ts b/src/native/corehost/browserhost/loader/run.ts index 5d6838b5ef7969..9b3eb0b8a986e6 100644 --- a/src/native/corehost/browserhost/loader/run.ts +++ b/src/native/corehost/browserhost/loader/run.ts @@ -8,7 +8,7 @@ import { exit, runtimeState } from "./exit"; import { createPromiseCompletionSource } from "./promise-completion-source"; import { getIcuResourceName } from "./icu"; import { loaderConfig, validateLoaderConfig } from "./config"; -import { fetchDll, fetchIcu, fetchPdb, fetchVfs, fetchWasm, loadDotnetModule, loadJSModule, nativeModulePromiseController, verifyAllAssetsDownloaded } from "./assets"; +import { fetchDll, fetchIcu, fetchNativeSymbols, fetchPdb, fetchVfs, fetchWasm, loadDotnetModule, loadJSModule, nativeModulePromiseController, verifyAllAssetsDownloaded } from "./assets"; import { initPolyfills } from "./polyfills"; import { validateWasmFeatures } from "./bootstrap"; @@ -45,6 +45,9 @@ export async function createRuntime(downloadOnly: boolean): Promise { if (loaderConfig.resources.jsModuleDiagnostics && loaderConfig.resources.jsModuleDiagnostics.length > 0) { const diagnosticsModule = await loadDotnetModule(loaderConfig.resources.jsModuleDiagnostics[0]); diagnosticsModule.dotnetInitializeModule(dotnetInternals); + if (loaderConfig.resources.wasmSymbols && loaderConfig.resources.wasmSymbols.length > 0) { + await fetchNativeSymbols(loaderConfig.resources.wasmSymbols[0]); + } } const nativeModulePromise: Promise = loadDotnetModule(loaderConfig.resources.jsModuleNative[0]); const runtimeModulePromise: Promise = loadDotnetModule(loaderConfig.resources.jsModuleRuntime[0]); diff --git a/src/native/corehost/corehost.proj b/src/native/corehost/corehost.proj index d91a4a5414573e..8ac8407f544579 100644 --- a/src/native/corehost/corehost.proj +++ b/src/native/corehost/corehost.proj @@ -181,7 +181,7 @@ <_MicrosoftNetCoreAppRuntimePackNativeDirFiles Include="$(LibrariesSharedFrameworkDir)*.dat" /> <_MicrosoftNetCoreAppRuntimePackNativeDirFiles Include="$(HostSharedFrameworkDir)libBrowserHost.a" /> <_MicrosoftNetCoreAppRuntimePackNativeDirFiles Include="$(HostSharedFrameworkDir)dotnet.native.js" /> - + <_MicrosoftNetCoreAppRuntimePackNativeDirFiles Include="$(HostSharedFrameworkDir)dotnet.native.js.symbols" /> <_MicrosoftNetCoreAppRuntimePackNativeDirFiles Include="$(HostSharedFrameworkDir)dotnet.native.wasm" /> diff --git a/src/native/libs/Common/JavaScript/cross-module/index.ts b/src/native/libs/Common/JavaScript/cross-module/index.ts index e2a5f86213910f..5ebcece430ac25 100644 --- a/src/native/libs/Common/JavaScript/cross-module/index.ts +++ b/src/native/libs/Common/JavaScript/cross-module/index.ts @@ -136,6 +136,7 @@ export function dotnetUpdateInternalsSubscriber() { addOnExitListener: table[14], abortStartup: table[15], quitNow: table[16], + normalizeException: table[17], }; Object.assign(dotnetLoaderExports, loaderExportsLocal); Object.assign(logger, loggerLocal); @@ -179,6 +180,7 @@ export function dotnetUpdateInternalsSubscriber() { function diagnosticsExportsFromTable(table: DiagnosticsExportsTable, interop: DiagnosticsExports): void { const interopLocal: DiagnosticsExports = { symbolicateStackTrace: table[0], + installNativeSymbols: table[1], }; Object.assign(interop, interopLocal); } diff --git a/src/native/libs/Common/JavaScript/types/ems-ambient.ts b/src/native/libs/Common/JavaScript/types/ems-ambient.ts index 15b4f9dcd8611b..058b2d30c382d0 100644 --- a/src/native/libs/Common/JavaScript/types/ems-ambient.ts +++ b/src/native/libs/Common/JavaScript/types/ems-ambient.ts @@ -38,7 +38,7 @@ export type EmsAmbientSymbolsType = EmscriptenModuleInternal & { _SystemInteropJS_ReleaseJSOwnedObjectByGCHandle: (args: JSMarshalerArguments) => void; _SystemInteropJS_BindAssemblyExports: (args: JSMarshalerArguments) => void; _SystemInteropJS_CallJSExport: (methodHandle: CSFnHandle, args: JSMarshalerArguments) => void; - _corerun_shutdown: (code: number) => void; + _BrowserHost_ShutdownCoreCLR: (exitCode: number) => number; FS: { createPath: (parent: string, path: string, canRead?: boolean, canWrite?: boolean) => string; @@ -47,9 +47,18 @@ export type EmsAmbientSymbolsType = EmscriptenModuleInternal & { } ENV: any; - DOTNET: any; - DOTNET_INTEROP: any; - BROWSER_HOST: any; + DOTNET: { + lastScheduledTimerId?: number; + lastScheduledThreadPoolId?: number; + lastScheduledFinalizationId?: number; + cryptoWarnOnce?: boolean; + isAborting?: boolean; + gitHash?: string; + } + DOTNET_INTEROP: { + gitHash?: string; + }; + BROWSER_HOST: {}; Module: EmscriptenModuleInternal; ENVIRONMENT_IS_NODE: boolean; @@ -74,6 +83,7 @@ export type EmsAmbientSymbolsType = EmscriptenModuleInternal & { _exit: (exitCode: number, implicit?: boolean) => void; abort: (reason: any) => void; ___trap: () => void; + ___funcs_on_exit: () => void; safeSetTimeout: (func: Function, timeout: number) => number; exitJS: (status: number, implicit?: boolean | number) => void; runtimeKeepalivePop: () => void; diff --git a/src/native/libs/Common/JavaScript/types/exchange.ts b/src/native/libs/Common/JavaScript/types/exchange.ts index fe634c54feff20..b228f7e2e06f34 100644 --- a/src/native/libs/Common/JavaScript/types/exchange.ts +++ b/src/native/libs/Common/JavaScript/types/exchange.ts @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -import type { check, error, info, warn, debug, fastCheck } from "../../../../corehost/browserhost/loader/logging"; +import type { check, error, info, warn, debug, fastCheck, normalizeException } from "../../../../corehost/browserhost/loader/logging"; import type { resolveRunMainPromise, rejectRunMainPromise, getRunMainPromise, abortStartup } from "../../../../corehost/browserhost/loader/run"; import type { addOnExitListener, isExited, isRuntimeRunning, quitNow } from "../../../../corehost/browserhost/loader/exit"; @@ -18,7 +18,7 @@ import type { resolveOrRejectPromise } from "../../../System.Runtime.InteropServ import type { cancelPromise } from "../../../System.Runtime.InteropServices.JavaScript.Native/interop/cancelable-promise"; import type { abortInteropTimers } from "../../../System.Runtime.InteropServices.JavaScript.Native/interop/scheduling"; -import type { symbolicateStackTrace } from "../../../System.Native.Browser/diagnostics/symbolicate"; +import type { installNativeSymbols, symbolicateStackTrace } from "../../../System.Native.Browser/diagnostics/symbolicate"; import type { EmsAmbientSymbolsType } from "../types"; export type RuntimeExports = { @@ -67,6 +67,7 @@ export type LoaderExports = { addOnExitListener: typeof addOnExitListener, abortStartup: typeof abortStartup, quitNow: typeof quitNow, + normalizeException: typeof normalizeException } export type LoaderExportsTable = [ @@ -87,6 +88,7 @@ export type LoaderExportsTable = [ typeof addOnExitListener, typeof abortStartup, typeof quitNow, + typeof normalizeException, ] export type BrowserHostExports = { @@ -161,8 +163,10 @@ export type BrowserUtilsExportsTable = [ export type DiagnosticsExportsTable = [ typeof symbolicateStackTrace, + typeof installNativeSymbols, ] export type DiagnosticsExports = { symbolicateStackTrace: typeof symbolicateStackTrace, + installNativeSymbols: typeof installNativeSymbols, } diff --git a/src/native/libs/System.Native.Browser/diagnostics/exit.ts b/src/native/libs/System.Native.Browser/diagnostics/exit.ts index fb210820f91ac7..236e5da5969c7d 100644 --- a/src/native/libs/System.Native.Browser/diagnostics/exit.ts +++ b/src/native/libs/System.Native.Browser/diagnostics/exit.ts @@ -5,7 +5,6 @@ import type { LoaderConfigInternal } from "./types"; import { dotnetLogger, dotnetLoaderExports, dotnetApi, dotnetBrowserUtilsExports, dotnetRuntimeExports } from "./cross-module"; import { ENVIRONMENT_IS_NODE, ENVIRONMENT_IS_WEB } from "./per-module"; import { teardownProxyConsole } from "./console-proxy"; -import { symbolicateStackTrace } from "./symbolicate"; let loaderConfig: LoaderConfigInternal = null as any; export function registerExit() { @@ -53,33 +52,23 @@ function onExit(exitCode: number, reason: any, silent: boolean): boolean { return true; } -function logExitReason(exit_code: number, reason: any) { - if (exit_code !== 0 && reason) { - const exitStatus = isExitStatus(reason); - if (typeof reason === "string") { - dotnetLogger.error(reason); +function logExitReason(exitCode: number, reason: any) { + if (exitCode !== 0 && reason) { + const hasExitStatus = typeof reason === "object" && reason.status !== undefined; + if (dotnetLoaderExports.normalizeException) { + reason = dotnetLoaderExports.normalizeException(reason); } else { - if (reason.stack === undefined && !exitStatus) { - reason.stack = new Error().stack + ""; - } - const message = reason.message - ? symbolicateStackTrace(reason.message + "\n" + reason.stack) - : reason.toString(); - - if (exitStatus) { - dotnetLogger.debug(message); - } else { - dotnetLogger.error(message); - } + reason = reason + ""; + } + const msg = "dotnet exited with " + exitCode; + if (hasExitStatus) { + dotnetLogger.debug(msg, reason); + } else { + dotnetLogger.error(msg, reason); } } } -function isExitStatus(reason: any): boolean { - const ExitStatus = dotnetBrowserUtilsExports.getExitStatus(); - return ExitStatus && reason instanceof ExitStatus; -} - function logExitCode(exitCode: number): void { const message = loaderConfig.logExitCode ? "WASM EXIT " + exitCode @@ -164,6 +153,6 @@ async function flushNodeStreams() { await Promise.race([Promise.all([stdoutFlushed, stderrFlushed]), timeout]); clearTimeout(timeoutId); } catch (err) { - dotnetLogger.error(`flushing std* streams failed: ${err}`); + dotnetLogger.error(`flushing std* streams failed`, err); } } diff --git a/src/native/libs/System.Native.Browser/diagnostics/index.ts b/src/native/libs/System.Native.Browser/diagnostics/index.ts index 8550abfb275891..c011132f3df71a 100644 --- a/src/native/libs/System.Native.Browser/diagnostics/index.ts +++ b/src/native/libs/System.Native.Browser/diagnostics/index.ts @@ -8,7 +8,7 @@ import GitHash from "consts:gitHash"; import { dotnetUpdateInternals, dotnetUpdateInternalsSubscriber } from "./cross-module"; import { registerExit } from "./exit"; -import { symbolicateStackTrace } from "./symbolicate"; +import { installNativeSymbols, symbolicateStackTrace } from "./symbolicate"; import { installLoggingProxy } from "./console-proxy"; export function dotnetInitializeModule(internals: InternalExchange): void { @@ -23,6 +23,7 @@ export function dotnetInitializeModule(internals: InternalExchange): void { internals[InternalExchangeIndex.DiagnosticsExportsTable] = diagnosticsExportsToTable({ symbolicateStackTrace, + installNativeSymbols, }); dotnetUpdateInternals(internals, dotnetUpdateInternalsSubscriber); @@ -34,6 +35,7 @@ export function dotnetInitializeModule(internals: InternalExchange): void { // keep in sync with diagnosticsExportsFromTable() return [ map.symbolicateStackTrace, + map.installNativeSymbols, ]; } } diff --git a/src/native/libs/System.Native.Browser/diagnostics/symbolicate.ts b/src/native/libs/System.Native.Browser/diagnostics/symbolicate.ts index d7a76cbbd38b66..00b1f8b078a5af 100644 --- a/src/native/libs/System.Native.Browser/diagnostics/symbolicate.ts +++ b/src/native/libs/System.Native.Browser/diagnostics/symbolicate.ts @@ -1,8 +1,83 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -export function symbolicateStackTrace(stack: string): string { - // WASM-TODO: implement symbolication https://github.com/dotnet/runtime/issues/122647 - return stack; +const symbol_map = new Map(); +let symbolTable: string | undefined; +const regexes: RegExp[] = []; + +export function installNativeSymbols(table: string) { + symbolTable = table; +} + +export function symbolicateStackTrace(message: string): string { + const origMessage = message; + initSymbolMap(); + + if (symbol_map.size === 0) + return message; + + try { + + for (let i = 0; i < regexes.length; i++) { + const newRaw = message.replace(regexes[i], (substring, ...args) => { + const groups = args.find(arg => { + return typeof (arg) == "object" && arg.replaceSection !== undefined; + }); + + if (groups === undefined) + return substring; + + const funcNum = groups.funcNum; + const replaceSection = groups.replaceSection; + const name = symbol_map.get(Number(funcNum)); + + if (name === undefined) + return substring; + + return substring.replace(replaceSection, `${name} (${replaceSection})`); + }); + + if (newRaw !== origMessage) + return newRaw; + } + + return origMessage; + } catch (error) { + console.debug(`failed to symbolicate: ${error}`); + return message; + } } +function initSymbolMap() { + if (!symbolTable) + return; + + // V8 + // at :wasm-function[1900]:0x83f63 + // at dlfree (:wasm-function[18739]:0x2328ef) + regexes.push(/at (?[^:()]+:wasm-function\[(?\d+)\]:0x[a-fA-F\d]+)((?![^)a-fA-F\d])|$)/g); + + //# 5: WASM [009712b2], function #111 (''), pc=0x7c16595c973 (+0x53), pos=38740 (+11) + regexes.push(/(?:WASM \[[\da-zA-Z]+\], (?function #(?[\d]+) \(''\)))/g); + + //# chrome + //# at http://127.0.0.1:63817/dotnet.wasm:wasm-function[8963]:0x1e23f4 + regexes.push(/(?[a-z]+:\/\/[a-zA-Z0-9.:/_]*:wasm-function\[(?\d+)\]:0x[a-fA-F\d]+)/g); + + //# .wasm-function[8962] + regexes.push(/(?<[^ >]+>[.:]wasm-function\[(?[0-9]+)\])/g); + + const text = symbolTable; + symbolTable = undefined; + try { + text.split(/[\r\n]/).forEach((line: string) => { + const parts: string[] = line.split(/:/); + if (parts.length < 2) + return; + + parts[1] = parts.splice(1).join(":").replace(/\\([0-9a-fA-F]{2})/g, (_, hex) => String.fromCharCode(parseInt(hex, 16))); + symbol_map.set(Number(parts[0]), parts[1]); + }); + } catch (exc) { + } +} \ No newline at end of file diff --git a/src/native/libs/System.Native.Browser/libSystem.Native.Browser.Utils.footer.js b/src/native/libs/System.Native.Browser/libSystem.Native.Browser.Utils.footer.js index e269e08ec7d850..b8ca15bb6bfc96 100644 --- a/src/native/libs/System.Native.Browser/libSystem.Native.Browser.Utils.footer.js +++ b/src/native/libs/System.Native.Browser/libSystem.Native.Browser.Utils.footer.js @@ -22,6 +22,7 @@ function libBrowserUtilsFactory() { "$DOTNET", "GetDotNetRuntimeContractDescriptor", "_exit", + "abort", "__trap", "$readI53FromU64", "$readI53FromI64", diff --git a/src/native/libs/System.Native.Browser/native/crypto.ts b/src/native/libs/System.Native.Browser/native/crypto.ts index 013ba19e46f873..650b5470dabc3a 100644 --- a/src/native/libs/System.Native.Browser/native/crypto.ts +++ b/src/native/libs/System.Native.Browser/native/crypto.ts @@ -11,9 +11,9 @@ export function SystemJS_RandomBytes(bufferPtr: number, bufferLength: number): n const batchedQuotaMax = 65536; if (!globalThis.crypto || !globalThis.crypto.getRandomValues) { - if (!_ems_.DOTNET["cryptoWarnOnce"]) { + if (!_ems_.DOTNET.cryptoWarnOnce) { _ems_.dotnetLogger.debug("This engine doesn't support crypto.getRandomValues. Please use a modern version or provide polyfill for 'globalThis.crypto.getRandomValues'."); - _ems_.DOTNET["cryptoWarnOnce"] = true; + _ems_.DOTNET.cryptoWarnOnce = true; } return -1; } diff --git a/src/native/libs/System.Native.Browser/native/scheduling.ts b/src/native/libs/System.Native.Browser/native/scheduling.ts index fab98ca141d587..2e3bb534286c80 100644 --- a/src/native/libs/System.Native.Browser/native/scheduling.ts +++ b/src/native/libs/System.Native.Browser/native/scheduling.ts @@ -4,7 +4,7 @@ import { _ems_ } from "../../Common/JavaScript/ems-ambient"; export function SystemJS_ScheduleTimer(shortestDueTimeMs: number): void { - if (_ems_.ABORT) { + if (_ems_.ABORT || _ems_.DOTNET.isAborting) { // runtime is shutting down return; } @@ -30,7 +30,7 @@ export function SystemJS_ScheduleTimer(shortestDueTimeMs: number): void { } export function SystemJS_ScheduleBackgroundJob(): void { - if (_ems_.ABORT) { + if (_ems_.ABORT || _ems_.DOTNET.isAborting) { // runtime is shutting down return; } @@ -56,7 +56,7 @@ export function SystemJS_ScheduleBackgroundJob(): void { } export function SystemJS_ScheduleFinalization(): void { - if (_ems_.ABORT) { + if (_ems_.ABORT || _ems_.DOTNET.isAborting) { // runtime is shutting down return; } diff --git a/src/native/libs/System.Native.Browser/utils/host.ts b/src/native/libs/System.Native.Browser/utils/host.ts index 2db4f6476176e0..ef76432e137d9a 100644 --- a/src/native/libs/System.Native.Browser/utils/host.ts +++ b/src/native/libs/System.Native.Browser/utils/host.ts @@ -14,7 +14,7 @@ export function getExitStatus(): new (exitCode: number) => any { } export function runBackgroundTimers(): void { - if (_ems_.ABORT) { + if (_ems_.ABORT || _ems_.DOTNET.isAborting) { // runtime is shutting down return; } @@ -32,6 +32,7 @@ export function runBackgroundTimers(): void { } export function abortBackgroundTimers(): void { + _ems_.DOTNET.isAborting = true; if (_ems_.DOTNET.lastScheduledTimerId) { globalThis.clearTimeout(_ems_.DOTNET.lastScheduledTimerId); _ems_.runtimeKeepalivePop(); @@ -53,6 +54,7 @@ export function abortPosix(exitCode: number, reason: any, nativeReady: boolean): try { _ems_.ABORT = true; _ems_.EXITSTATUS = exitCode; + _ems_.DOTNET.isAborting = true; if (exitCode === 0 && nativeReady) { _ems_._exit(0); return; diff --git a/src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/invoke-js.ts b/src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/invoke-js.ts index db9cc557fa16b0..e355d9e3e44157 100644 --- a/src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/invoke-js.ts +++ b/src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/invoke-js.ts @@ -3,13 +3,13 @@ import BuildConfiguration from "consts:configuration"; -import { dotnetBrowserUtilsExports, dotnetApi, dotnetAssert, dotnetLogger, VoidPtrNull, Module } from "./cross-module"; +import { dotnetBrowserUtilsExports, dotnetApi, dotnetAssert, dotnetLogger, VoidPtrNull, Module, dotnetLoaderExports } from "./cross-module"; import type { BindingClosureJS, BoundMarshalerToJs, JSFnHandle, JSFunctionSignature, JSHandle, JSMarshalerArguments, VoidPtr, WrappedJSFunction } from "./types"; import { MarshalerType, MeasuredBlock } from "./types"; import { getSig, getSignatureArgumentCount, getSignatureFunctionName, getSignatureHandle, getSignatureModuleName, getSignatureType, getSignatureVersion, isReceiverShouldFree, jsInteropState } from "./marshal"; -import { assertJsInterop, assertRuntimeRunning, endMeasure, fixupPointer, normalizeException, startMeasure } from "./utils"; +import { assertJsInterop, assertRuntimeRunning, endMeasure, fixupPointer, startMeasure } from "./utils"; import { bindArgMarshalToJs } from "./marshal-to-js"; import { boundJsFunctionSymbol, getJSObjectFromJSHandle, importedJsFunctionSymbol, jsImportWrapperByFnHandle } from "./gc-handles"; import { bindArgMarshalToCs, marshalExceptionToCs } from "./marshal-to-cs"; @@ -29,7 +29,7 @@ export function bindJSImportST(signature: JSFunctionSignature): VoidPtr { bindJsImport(signature); return VoidPtrNull; } catch (ex: any) { - return dotnetBrowserUtilsExports.stringToUTF16Ptr(normalizeException(ex)); + return dotnetBrowserUtilsExports.stringToUTF16Ptr(dotnetLoaderExports.normalizeException(ex)); } } diff --git a/src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/utils.ts b/src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/utils.ts index 425c7267825bdd..64f1d5f1b649b3 100644 --- a/src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/utils.ts +++ b/src/native/libs/System.Runtime.InteropServices.JavaScript.Native/interop/utils.ts @@ -11,26 +11,6 @@ export function fixupPointer(signature: any, shiftAmount: number): any { return ((signature as any) >>> shiftAmount) as any; } -export function normalizeException(ex: any) { - let res = "unknown exception"; - if (ex) { - res = ex.toString(); - const stack = ex.stack; - if (stack) { - // Some JS runtimes insert the error message at the top of the stack, some don't, - // so normalize it by using the stack as the result if it already contains the error - if (stack.startsWith(res)) - res = stack; - else - res += "\n" + stack; - } - if (dotnetDiagnosticsExports.symbolicateStackTrace) { - res = dotnetDiagnosticsExports.symbolicateStackTrace(res); - } - } - return res; -} - export function isRuntimeRunning(): boolean { return dotnetLoaderExports.isRuntimeRunning(); } diff --git a/src/tasks/WasmAppBuilder/coreclr/ManagedToNativeGenerator.cs b/src/tasks/WasmAppBuilder/coreclr/ManagedToNativeGenerator.cs index 33f529a98a9753..88bddf47f040c6 100644 --- a/src/tasks/WasmAppBuilder/coreclr/ManagedToNativeGenerator.cs +++ b/src/tasks/WasmAppBuilder/coreclr/ManagedToNativeGenerator.cs @@ -75,9 +75,11 @@ public override bool Execute() private static readonly string[] missingCookies = [ "d", + "ddid", "dii", "f", "id", + "idfi", "idi", "if", "iff", @@ -89,19 +91,27 @@ public override bool Execute() "iinini", "iinn", "il", + "inn", "lii", + "ld", + "lf", "ll", "lli", "n", "ni", "nii", "niii", + "nin", "nn", "nni", + "nnn", "vd", "vf", "viiiiiii", "viin", + "vid", + "viil", + "vil", "vin", "vinni", "iinini", diff --git a/src/tests/Common/CLRTest.Execute.Bash.targets b/src/tests/Common/CLRTest.Execute.Bash.targets index 4ca37f0d06c0dd..e2bd3d4eb8f50e 100644 --- a/src/tests/Common/CLRTest.Execute.Bash.targets +++ b/src/tests/Common/CLRTest.Execute.Bash.targets @@ -272,19 +272,20 @@ fi @@ -330,8 +331,63 @@ fi ]]> /dev/null; then + kill -9 "$pid" 2>/dev/null + fi + fi + ) & + local watchdog=$! + + # Wait for the command to finish + wait "$pid" + local exit_code=$? + + # Kill watchdog and its children (sleep process) if still running + echo Kill watchdog with PID $watchdog + pkill -P "$watchdog" 2>/dev/null + kill "$watchdog" 2>/dev/null + wait "$watchdog" 2>/dev/null + + # If the process was killed by SIGKILL (128+9 = 137), map to 99 + if [ $exit_code -eq 137 ]; then + return 99 + else + return $exit_code + fi +} + +if [ -z ${RunWithNodeJS+x} ] ; then + cd WasmApp + ./run-v8.sh +else + if [ -z ${__TestTimeout+x} ]; then + __TestTimeout=300000 + fi + + echo Running with node + echo CORE_ROOT: ${CORE_ROOT} + echo ExePath: ${PWD}/${ExePath} + echo CLRTestExecutionArguments: ${CLRTestExecutionArguments[@]} + echo node version: `node -v` + echo Timeout in ms: $__TestTimeout + cmd=( node "${CORE_ROOT}/corerun.js" -c "${CORE_ROOT}" "${PWD}/${ExePath}" "${CLRTestExecutionArguments[@]}" ) + echo Running: "${cmd[@]}" + run_with_timeout $__TestTimeout "${cmd[@]}" +fi CLRTestExitCode=$? ]]> diff --git a/src/tests/Common/CLRTest.Execute.Batch.targets b/src/tests/Common/CLRTest.Execute.Batch.targets index 4b8d7ecfbdb3d9..554e4de099c897 100644 --- a/src/tests/Common/CLRTest.Execute.Batch.targets +++ b/src/tests/Common/CLRTest.Execute.Batch.targets @@ -191,6 +191,15 @@ Exit /b 2 :ReleaseLock if exist %lockFolder% rd /s /q %lockFolder% Exit /b 0 + +:RunWithTimeout +REM Usage: set "__RunCmd=" then call :RunWithTimeout +REM Runs __RunCmd with a timeout, kills the process on timeout, +REM and returns exit code 99 on timeout. +REM Use PowerShell for reliable process management and timeout +set __Timeout=%~1 +powershell -NoProfile -Command "& { $psi = New-Object System.Diagnostics.ProcessStartInfo 'cmd.exe','/c !__RunCmd!'%3B $psi.UseShellExecute = $false%3B $p = [System.Diagnostics.Process]::Start($psi)%3B if (-not $p.WaitForExit(!__Timeout!)) { try { $p.Kill() } catch {} %3B try { taskkill /T /F /PID $p.Id 2>$null } catch {} %3B exit 99 } else { exit $p.ExitCode } }" +Exit /b !ERRORLEVEL! ]]> @@ -253,7 +262,28 @@ REM Local CoreShim requested - see MSBuild property 'CLRTestScriptLocalCoreShim' ECHO Copying '%CORE_ROOT%\CoreShim.dll'... COPY /y %CORE_ROOT%\CoreShim.dll . ]]> - + + + + - + + + 0)) diff --git a/src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs b/src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs index f9d5ff43d30845..5ac0ac068f718e 100644 --- a/src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs +++ b/src/tests/Common/CoreCLRTestLibrary/PlatformDetection.cs @@ -100,8 +100,10 @@ public static bool IsMonoInterpreter OperatingSystem.IsIOS() || OperatingSystem.IsTvOS() || OperatingSystem.IsAndroid() || OperatingSystem.IsBrowser() || OperatingSystem.IsWasi(); public static bool IsAppleMobile => OperatingSystem.IsIOS() || OperatingSystem.IsTvOS() || OperatingSystem.IsMacCatalyst(); + // wasm properties public static bool IsBrowser => OperatingSystem.IsBrowser(); public static bool IsWasi => OperatingSystem.IsWasi(); + public static bool IsWasm => IsBrowser || IsWasi; public static bool IsWasmThreadingSupported => IsBrowser && IsEnvironmentVariableTrue("IsBrowserThreadingSupported"); public static bool IsThreadingSupported => (!IsWasi && !IsBrowser) || IsWasmThreadingSupported; public static bool IsThreadingNotSupported => !IsThreadingSupported; diff --git a/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs b/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs index 2b8e0c8e9a14d9..42f35185e43a28 100644 --- a/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs +++ b/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs @@ -254,10 +254,12 @@ private static void AddRunnerSource(SourceProductionContext context, ImmutableAr bool buildAsMergedRunner = configOptions.GlobalOptions.IsMergedTestRunnerAssembly() && !configOptions.GlobalOptions.BuildAsStandalone(); configOptions.GlobalOptions.TryGetValue("build_property.TargetOS", out string? targetOS); string assemblyName = compData.AssemblyName; + string? targetOSLower = targetOS?.ToLowerInvariant(); if (buildAsMergedRunner) { - if (targetOS?.ToLowerInvariant() is "ios" or "iossimulator" or "tvos" or "tvossimulator" or "maccatalyst" or "android" or "browser") + if ((targetOSLower is "ios" or "iossimulator" or "tvos" or "tvossimulator" or "maccatalyst" or "android") + || ((targetOSLower is "browser") && configOptions.GlobalOptions.RuntimeFlavor().ToLowerInvariant() == "mono")) { context.AddSource("XHarnessRunner.g.cs", GenerateXHarnessTestRunner(methods, aliasMap, assemblyName, targetOS)); } diff --git a/src/tests/Common/helixpublishwitharcade.proj b/src/tests/Common/helixpublishwitharcade.proj index a1f87b9290caf0..b7098efb24af9d 100644 --- a/src/tests/Common/helixpublishwitharcade.proj +++ b/src/tests/Common/helixpublishwitharcade.proj @@ -72,8 +72,13 @@ $([MSBuild]::NormalizeDirectory($(XUnitLogCheckerDirectory))) $(TestBinDir)MergedPayloads\ $([MSBuild]::NormalizeDirectory($(MergedPayloadsRootDirectory))) + false + true + false + true + false AppBundle - wwwroot + wwwroot - + <_AppBundleRunScriptName>RunTests <_AppBundleRunScriptName Condition="'$(TargetsAppleMobile)' == 'true' and '$(NeedsToBuildAppsOnHelix)' == 'true'">build-apple-app @@ -431,7 +436,7 @@ @@ -528,7 +533,7 @@ + Condition="'$(TargetsBrowserOnMono)' == 'true' or ('$(TargetsAppleMobile)' == 'true' and '$(NeedsToBuildAppsOnHelix)' == 'true')"> @@ -587,6 +592,7 @@ + @@ -641,6 +647,7 @@ + @@ -702,7 +709,7 @@ - + sos https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/flat2/dotnet-sos/$(DotnetSosVersion)/dotnet-sos.$(DotnetSosVersion).nupkg diff --git a/src/tests/Common/mergedrunner.targets b/src/tests/Common/mergedrunner.targets index 50fc1ee151a6b0..bff5cf387a99ab 100644 --- a/src/tests/Common/mergedrunner.targets +++ b/src/tests/Common/mergedrunner.targets @@ -18,5 +18,5 @@ - + diff --git a/src/tests/JIT/CodeGenBringUpTests/LocallocLarge.cs b/src/tests/JIT/CodeGenBringUpTests/LocallocLarge.cs index 5824029ca9525c..ae86c58b79e631 100644 --- a/src/tests/JIT/CodeGenBringUpTests/LocallocLarge.cs +++ b/src/tests/JIT/CodeGenBringUpTests/LocallocLarge.cs @@ -4,8 +4,8 @@ using System; using System.Threading; -using Xunit; using TestLibrary; +using Xunit; public class ThreadData { @@ -62,8 +62,7 @@ public static bool RunTest(int n) return ok; } - [ActiveIssue("https://github.com/dotnet/runtime/issues/41472", typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingNotSupported))] - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] public static int TestEntryPoint() { for (int j = 2; j < 1024 * 100; j += 331) diff --git a/src/tests/JIT/Directed/Misc/function_pointer/MutualThdRecur-fptr.il b/src/tests/JIT/Directed/Misc/function_pointer/MutualThdRecur-fptr.il index dcebd2099fa1a3..bf28ce92e7ee27 100644 --- a/src/tests/JIT/Directed/Misc/function_pointer/MutualThdRecur-fptr.il +++ b/src/tests/JIT/Directed/Misc/function_pointer/MutualThdRecur-fptr.il @@ -3,7 +3,10 @@ .assembly extern System.Console { auto } +.assembly extern System.Runtime { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) } .assembly extern xunit.core {} +.assembly extern Microsoft.DotNet.XUnitExtensions { .publickeytoken = (31 BF 38 56 AD 36 4E 35 ) } +.assembly extern TestLibrary { .ver 0:0:0:0 } .assembly extern System.Threading.Thread { auto } .assembly extern legacy library mscorlib { auto } .assembly extern Microsoft.DotNet.XUnitExtensions { .publickeytoken = (31 BF 38 56 AD 36 4E 35 ) } diff --git a/src/tests/JIT/Methodical/Boxing/morph/sin3double.il b/src/tests/JIT/Methodical/Boxing/morph/sin3double.il index dbe6d04d3707bd..aaf4fd9619f17f 100644 --- a/src/tests/JIT/Methodical/Boxing/morph/sin3double.il +++ b/src/tests/JIT/Methodical/Boxing/morph/sin3double.il @@ -14,6 +14,7 @@ } .assembly extern xunit.core {} .assembly extern Microsoft.DotNet.XUnitExtensions { .publickeytoken = (31 BF 38 56 AD 36 4E 35 ) } +.assembly extern TestLibrary { .ver 0:0:0:0 } .namespace Test_sin3double { .class private sequential ansi sealed beforefieldinit VV extends [mscorlib]System.ValueType @@ -203,6 +204,11 @@ 01 00 00 00 ) .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, valuetype [Microsoft.DotNet.XUnitExtensions]Xunit.TestRuntimes) = {string('https://github.com/dotnet/runtime/issues/34196') int32(2)} + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [mscorlib]System.Type, string[]) = { + string('https://github.com/dotnet/runtime/issues/124222') + type([TestLibrary]TestLibrary.PlatformDetection) + string[1] ('IsWasm') + } .entrypoint .locals (int32 V_0, float64 V_1, diff --git a/src/tests/JIT/Methodical/Methodical_others.csproj b/src/tests/JIT/Methodical/Methodical_others.csproj index 2a72d82d07d8a6..656f2a7525413a 100644 --- a/src/tests/JIT/Methodical/Methodical_others.csproj +++ b/src/tests/JIT/Methodical/Methodical_others.csproj @@ -14,6 +14,7 @@ + diff --git a/src/tests/JIT/Methodical/delegate/GSDelegate.cs b/src/tests/JIT/Methodical/delegate/GSDelegate.cs index 00732f168691ae..be35d69e1e2863 100644 --- a/src/tests/JIT/Methodical/delegate/GSDelegate.cs +++ b/src/tests/JIT/Methodical/delegate/GSDelegate.cs @@ -3,6 +3,7 @@ using System; using System.Reflection; +using TestLibrary; using Xunit; public interface IGetContents { @@ -24,6 +25,7 @@ public partial class Program { public delegate (string, int, T) MyDelegate(IGetContents arg); [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/124221", typeof(PlatformDetection), nameof(PlatformDetection.IsWasm))] public static int TestEntryPoint() { int retVal = 100; diff --git a/src/tests/JIT/Methodical/eh/basics/throwinfilter.il b/src/tests/JIT/Methodical/eh/basics/throwinfilter.il index 87f3f5403cfb2d..a455c0f924cc54 100644 --- a/src/tests/JIT/Methodical/eh/basics/throwinfilter.il +++ b/src/tests/JIT/Methodical/eh/basics/throwinfilter.il @@ -30,6 +30,11 @@ type([TestLibrary]TestLibrary.PlatformDetection) string[1] ('IsMonoInterpreter') } + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [mscorlib]System.Type, string[]) = { + string('https://github.com/dotnet/runtime/issues/123793') + type([TestLibrary]TestLibrary.PlatformDetection) + string[1] ('IsWasm') + } .entrypoint .maxstack 2 .locals init ( diff --git a/src/tests/JIT/Methodical/eh/basics/throwinfilter_d.ilproj b/src/tests/JIT/Methodical/eh/basics/throwinfilter_d.ilproj index df798474bd2d94..b71604c62c305b 100644 --- a/src/tests/JIT/Methodical/eh/basics/throwinfilter_d.ilproj +++ b/src/tests/JIT/Methodical/eh/basics/throwinfilter_d.ilproj @@ -10,5 +10,6 @@ + diff --git a/src/tests/JIT/Methodical/eh/basics/throwinfilter_r.ilproj b/src/tests/JIT/Methodical/eh/basics/throwinfilter_r.ilproj index 2f9a5e9e5fe5f9..48e69b65f55bf9 100644 --- a/src/tests/JIT/Methodical/eh/basics/throwinfilter_r.ilproj +++ b/src/tests/JIT/Methodical/eh/basics/throwinfilter_r.ilproj @@ -11,5 +11,6 @@ + diff --git a/src/tests/JIT/Methodical/flowgraph/bug619534/moduleHandleCache.cs b/src/tests/JIT/Methodical/flowgraph/bug619534/moduleHandleCache.cs index 207cc2b205c0e3..29ad67b52dc838 100644 --- a/src/tests/JIT/Methodical/flowgraph/bug619534/moduleHandleCache.cs +++ b/src/tests/JIT/Methodical/flowgraph/bug619534/moduleHandleCache.cs @@ -23,6 +23,7 @@ at Repro.Main() in c:\tests\Dev10\640711\app.cs:line 16 using System; using System.Runtime.CompilerServices; +using TestLibrary; using Xunit; namespace Test_moduleHandleCache_cs @@ -41,6 +42,7 @@ static void Caller(bool b) } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/124222", typeof(PlatformDetection), nameof(PlatformDetection.IsWasm))] public static void TestEntryPoint() { try diff --git a/src/tests/JIT/Methodical/switch/switch6.il b/src/tests/JIT/Methodical/switch/switch6.il index 898b185fb4152b..89bfeed2aa1818 100644 --- a/src/tests/JIT/Methodical/switch/switch6.il +++ b/src/tests/JIT/Methodical/switch/switch6.il @@ -6,6 +6,8 @@ .assembly extern System.Runtime.Extensions { auto } .assembly extern legacy library mscorlib { auto } .assembly extern System.Console { auto } +.assembly extern Microsoft.DotNet.XUnitExtensions { .publickeytoken = (31 BF 38 56 AD 36 4E 35 ) } +.assembly extern TestLibrary { .ver 0:0:0:0 } .assembly 'switch6' { @@ -87,6 +89,11 @@ .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [mscorlib]System.Type, string[]) = { + string('https://github.com/dotnet/runtime/issues/124222') + type([TestLibrary]TestLibrary.PlatformDetection) + string[1] ('IsWasm') + } .entrypoint .maxstack 8 IL_0000: ldc.i4.1 diff --git a/src/tests/JIT/Regression/CLR-x86-JIT/V1-M12-Beta2/b68872/b68872.il b/src/tests/JIT/Regression/CLR-x86-JIT/V1-M12-Beta2/b68872/b68872.il index 4001ca9b95c70c..a486f66befb259 100644 --- a/src/tests/JIT/Regression/CLR-x86-JIT/V1-M12-Beta2/b68872/b68872.il +++ b/src/tests/JIT/Regression/CLR-x86-JIT/V1-M12-Beta2/b68872/b68872.il @@ -9,6 +9,8 @@ } .assembly 'b68872' { } .assembly extern xunit.core {} +.assembly extern TestLibrary { .ver 0:0:0:0 } +.assembly extern Microsoft.DotNet.XUnitExtensions { .publickeytoken = (31 BF 38 56 AD 36 4E 35 ) } .namespace JitTest { .class public auto ansi beforefieldinit Test @@ -20,6 +22,11 @@ .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [mscorlib]System.Type, string[]) = { + string('https://github.com/dotnet/runtime/issues/123793') + type([TestLibrary]TestLibrary.PlatformDetection) + string[1] ('IsWasm') + } .entrypoint // Code size 120 (0x78) .maxstack 2 diff --git a/src/tests/JIT/Regression/CLR-x86-JIT/V1-M12-Beta2/b68872/b68872.ilproj b/src/tests/JIT/Regression/CLR-x86-JIT/V1-M12-Beta2/b68872/b68872.ilproj index 0d771280a81bb9..325cd6a2c33eb5 100644 --- a/src/tests/JIT/Regression/CLR-x86-JIT/V1-M12-Beta2/b68872/b68872.ilproj +++ b/src/tests/JIT/Regression/CLR-x86-JIT/V1-M12-Beta2/b68872/b68872.ilproj @@ -6,4 +6,7 @@ + + + diff --git a/src/tests/JIT/Regression/JitBlue/GitHub_19438/GitHub_19438.cs b/src/tests/JIT/Regression/JitBlue/GitHub_19438/GitHub_19438.cs index 5d292b4fcc37a9..34ce905d156c36 100644 --- a/src/tests/JIT/Regression/JitBlue/GitHub_19438/GitHub_19438.cs +++ b/src/tests/JIT/Regression/JitBlue/GitHub_19438/GitHub_19438.cs @@ -68,7 +68,8 @@ public override string ToString() public static void TestEntryPoint() { const int iterationCount = 10; - const int itemCount = 1000000; + // WASM-TODO: active issue https://github.com/dotnet/runtime/issues/124218 + int itemCount = TestLibrary.PlatformDetection.IsWasm ? 1000 : 1000000; long totalTaskTime = 0; diff --git a/src/tests/JIT/Regression/JitBlue/GitHub_4044/GitHub_4044.cs b/src/tests/JIT/Regression/JitBlue/GitHub_4044/GitHub_4044.cs index 8802a7ce83628f..6b6ba6dad0355e 100644 --- a/src/tests/JIT/Regression/JitBlue/GitHub_4044/GitHub_4044.cs +++ b/src/tests/JIT/Regression/JitBlue/GitHub_4044/GitHub_4044.cs @@ -10,6 +10,7 @@ public class C { [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/114908", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/123793", typeof(PlatformDetection), nameof(PlatformDetection.IsWasm))] [SkipOnMono("needs triage")] public static int TestEntryPoint() { diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_105619/Runtime_105619.cs b/src/tests/JIT/Regression/JitBlue/Runtime_105619/Runtime_105619.cs index 8b1d2934503da3..732db9f22bcfd8 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_105619/Runtime_105619.cs +++ b/src/tests/JIT/Regression/JitBlue/Runtime_105619/Runtime_105619.cs @@ -15,6 +15,7 @@ namespace Runtime_105619; using System; using System.Runtime.CompilerServices; +using TestLibrary; using Xunit; public interface I1 @@ -114,6 +115,7 @@ public class Program public static S2[] s_90; [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/124219", typeof(PlatformDetection), nameof(PlatformDetection.IsWasm))] public static void TestEntryPoint() { try diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_70259/Runtime_70259.cs b/src/tests/JIT/Regression/JitBlue/Runtime_70259/Runtime_70259.cs index a3ad46606faf48..a1cb3d58f367da 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_70259/Runtime_70259.cs +++ b/src/tests/JIT/Regression/JitBlue/Runtime_70259/Runtime_70259.cs @@ -11,6 +11,7 @@ class Runtime_70259 { + [ActiveIssue("https://github.com/dotnet/runtime/issues/124221", typeof(PlatformDetection), nameof(PlatformDetection.IsWasm))] private static int Main() { // This creates an open delegate that goes through shuffle thunk and diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_70259/Runtime_70259.il b/src/tests/JIT/Regression/JitBlue/Runtime_70259/Runtime_70259.il index b188d31e3e5218..c6d5c09c3fa984 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_70259/Runtime_70259.il +++ b/src/tests/JIT/Regression/JitBlue/Runtime_70259/Runtime_70259.il @@ -10,6 +10,7 @@ // Metadata version: v4.0.30319 .assembly extern System.Runtime { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) } .assembly extern xunit.core {} +.assembly extern TestLibrary { .ver 0:0:0:0 } .assembly extern Microsoft.DotNet.XUnitExtensions { .publickeytoken = (31 BF 38 56 AD 36 4E 35 ) } .assembly Runtime_70259 { @@ -71,6 +72,11 @@ string('https://github.com/dotnet/runtime/issues/70279') int32(0x2) // Mono } + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [mscorlib]System.Type, string[]) = { + string('https://github.com/dotnet/runtime/issues/124221') + type([TestLibrary]TestLibrary.PlatformDetection) + string[1] ('IsWasm') + } .entrypoint // Code size 31 (0x1f) .maxstack 8 diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_72265/Runtime_72265.cs b/src/tests/JIT/Regression/JitBlue/Runtime_72265/Runtime_72265.cs index 4a739b8c317bf0..06075a060b921e 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_72265/Runtime_72265.cs +++ b/src/tests/JIT/Regression/JitBlue/Runtime_72265/Runtime_72265.cs @@ -6,12 +6,14 @@ namespace Runtime_72265; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using TestLibrary; using Xunit; public unsafe class Runtime_72265 { [Fact] [SkipOnMono("https://github.com/dotnet/runtime/issues/72016")] + [ActiveIssue("https://github.com/dotnet/runtime/issues/124219", typeof(PlatformDetection), nameof(PlatformDetection.IsWasm))] public static int TestEntryPoint() { var unmanaged = ((delegate* unmanaged)&GetStructUnmanaged)(); diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_79354/Runtime_79354.cs b/src/tests/JIT/Regression/JitBlue/Runtime_79354/Runtime_79354.cs index 0bccc7d5857b07..aeaba1bc3df623 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_79354/Runtime_79354.cs +++ b/src/tests/JIT/Regression/JitBlue/Runtime_79354/Runtime_79354.cs @@ -6,6 +6,7 @@ namespace Runtime_79354; using System; using System.Reflection; +using TestLibrary; using Xunit; public interface IGetContents { @@ -28,6 +29,7 @@ public class Program { public delegate (string, int, string) MyDelegate(IGetContents arg); [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/124221", typeof(PlatformDetection), nameof(PlatformDetection.IsWasm))] public static int TestEntryPoint() { MyStruct str = new MyStruct(); diff --git a/src/tests/JIT/SIMD/Sums.cs b/src/tests/JIT/SIMD/Sums.cs index 5039edaaa6ce83..51625196864a4c 100644 --- a/src/tests/JIT/SIMD/Sums.cs +++ b/src/tests/JIT/SIMD/Sums.cs @@ -45,7 +45,8 @@ public static void TestEntryPoint() System.Diagnostics.Stopwatch clock = new System.Diagnostics.Stopwatch(); clock.Start(); Random random = new Random(Seed); - int N = 10000; + // WASM-TODO: active issue https://github.com/dotnet/runtime/issues/124218 + int N = TestLibrary.PlatformDetection.IsWasm ? 1000 : 10000; Point[] arr = new Point[N]; for (int i = 0; i < N; ++i) { diff --git a/src/tests/JIT/jit64/opt/rngchk/ArrayWithThread.cs b/src/tests/JIT/jit64/opt/rngchk/ArrayWithThread.cs index 0a000910b8941c..62478fb5152116 100644 --- a/src/tests/JIT/jit64/opt/rngchk/ArrayWithThread.cs +++ b/src/tests/JIT/jit64/opt/rngchk/ArrayWithThread.cs @@ -4,8 +4,8 @@ using System; using System.Threading; using System.Runtime.CompilerServices; -using Xunit; using TestLibrary; +using Xunit; namespace ArrayWithThread { @@ -16,9 +16,8 @@ public class Class1 public static AutoResetEvent myResetEvent1 = new AutoResetEvent(false); public static ManualResetEvent myResetEvent2 = new ManualResetEvent(false); [ActiveIssue("times out", typeof(PlatformDetection), nameof(PlatformDetection.IsArmProcess))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/41472", typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingNotSupported))] - [Fact] [SkipOnCoreClr("", RuntimeTestModes.AnyGCStress)] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] public static int TestEntryPoint() { int retVal = 100; diff --git a/src/tests/JIT/jit64/regress/vsw/373472/test.il b/src/tests/JIT/jit64/regress/vsw/373472/test.il index 7aee64a4b25f5b..ba70645e623554 100644 --- a/src/tests/JIT/jit64/regress/vsw/373472/test.il +++ b/src/tests/JIT/jit64/regress/vsw/373472/test.il @@ -50,6 +50,11 @@ type([TestLibrary]TestLibrary.PlatformDetection) string[1] ('IsAppleMobile') } + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [mscorlib]System.Type, string[]) = { + string('https://github.com/dotnet/runtime/issues/120708') + type([TestLibrary]TestLibrary.PlatformDetection) + string[1] ('IsWasm') + } .entrypoint // Code size 40 (0x28) .maxstack 2 diff --git a/src/tests/JIT/opt/Regressions/Regression3_Regressions.cs b/src/tests/JIT/opt/Regressions/Regression3_Regressions.cs index 13aafde5364423..ac8ee0c9d8427b 100644 --- a/src/tests/JIT/opt/Regressions/Regression3_Regressions.cs +++ b/src/tests/JIT/opt/Regressions/Regression3_Regressions.cs @@ -25,6 +25,7 @@ public class Program public static S0[][] s_43 = new S0[][]{new S0[]{new S0()}}; [ActiveIssue("https://github.com/dotnet/runtimelab/issues/155: Assembly.LoadFrom", typeof(Utilities), nameof(Utilities.IsNativeAot))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/124219", typeof(PlatformDetection), nameof(PlatformDetection.IsWasm))] [Fact] public static void TestEntryPoint() { diff --git a/src/tests/Loader/classloader/Casting/Functionpointer.cs b/src/tests/Loader/classloader/Casting/Functionpointer.cs index 633388d11ed6ce..05affc2604e315 100644 --- a/src/tests/Loader/classloader/Casting/Functionpointer.cs +++ b/src/tests/Loader/classloader/Casting/Functionpointer.cs @@ -41,6 +41,7 @@ public static int Function2(int a) { public unsafe class Program { [ActiveIssue("needs triage", typeof(PlatformDetection), nameof(PlatformDetection.IsSimulator))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/124219", typeof(PlatformDetection), nameof(PlatformDetection.IsWasm))] [Fact] public static int TestEntryPoint() { diff --git a/src/tests/Loader/classloader/StaticVirtualMethods/DiamondShape/svm_diamondshape.il b/src/tests/Loader/classloader/StaticVirtualMethods/DiamondShape/svm_diamondshape.il index 8ccecbed64c663..42323a8f79bb6b 100644 --- a/src/tests/Loader/classloader/StaticVirtualMethods/DiamondShape/svm_diamondshape.il +++ b/src/tests/Loader/classloader/StaticVirtualMethods/DiamondShape/svm_diamondshape.il @@ -1528,7 +1528,16 @@ .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [mscorlib]System.Type, string[]) = {string('https://github.com/dotnet/runtime/issues/72589') type([TestLibrary]TestLibrary.Utilities) string[1] ('IsNativeAot') } + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [mscorlib]System.Type, string[]) = { + string('https://github.com/dotnet/runtime/issues/72589') + type([TestLibrary]TestLibrary.Utilities) + string[1] ('IsNativeAot') + } + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [mscorlib]System.Type, string[]) = { + string('https://github.com/dotnet/runtime/issues/124259') + type([TestLibrary]TestLibrary.PlatformDetection) + string[1] ('IsWasm') + } .entrypoint // Code size 23 (0x17) .maxstack 1 diff --git a/src/tests/Loader/classloader/StaticVirtualMethods/NegativeTestCases/AmbiguousImplementationException.il b/src/tests/Loader/classloader/StaticVirtualMethods/NegativeTestCases/AmbiguousImplementationException.il index 1479e47bde1918..bd29f054e4f881 100644 --- a/src/tests/Loader/classloader/StaticVirtualMethods/NegativeTestCases/AmbiguousImplementationException.il +++ b/src/tests/Loader/classloader/StaticVirtualMethods/NegativeTestCases/AmbiguousImplementationException.il @@ -350,7 +350,16 @@ .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [System.Runtime]System.Type, string[]) = {string('https://github.com/dotnet/runtimelab/issues/155: Compatible TypeLoadException for invalid inputs') type([TestLibrary]TestLibrary.Utilities) string[1] ('IsNativeAot') } + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [System.Runtime]System.Type, string[]) = { + string('https://github.com/dotnet/runtimelab/issues/155: Compatible TypeLoadException for invalid inputs') + type([TestLibrary]TestLibrary.Utilities) + string[1] ('IsNativeAot') + } + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [mscorlib]System.Type, string[]) = { + string('https://github.com/dotnet/runtime/issues/124260') + type([TestLibrary]TestLibrary.PlatformDetection) + string[1] ('IsWasm') + } .entrypoint // Code size 452 (0x1c4) .maxstack 2 diff --git a/src/tests/Loader/classloader/StaticVirtualMethods/Reabstraction/Reabstraction.il b/src/tests/Loader/classloader/StaticVirtualMethods/Reabstraction/Reabstraction.il index e985fd23ccb020..4f4dc0770ed376 100644 --- a/src/tests/Loader/classloader/StaticVirtualMethods/Reabstraction/Reabstraction.il +++ b/src/tests/Loader/classloader/StaticVirtualMethods/Reabstraction/Reabstraction.il @@ -346,6 +346,11 @@ type([TestLibrary]TestLibrary.Utilities) string[1] ('IsNativeAot') } + .custom instance void [Microsoft.DotNet.XUnitExtensions]Xunit.ActiveIssueAttribute::.ctor(string, class [mscorlib]System.Type, string[]) = { + string('https://github.com/dotnet/runtime/issues/124260') + type([TestLibrary]TestLibrary.PlatformDetection) + string[1] ('IsWasm') + } .entrypoint // Code size 452 (0x1c4) .maxstack 2 diff --git a/src/tests/baseservices/threading/coverage/OSThreadId/OSThreadId.cs b/src/tests/baseservices/threading/coverage/OSThreadId/OSThreadId.cs index 451cead2d5cd96..c4afabe4ff7e89 100644 --- a/src/tests/baseservices/threading/coverage/OSThreadId/OSThreadId.cs +++ b/src/tests/baseservices/threading/coverage/OSThreadId/OSThreadId.cs @@ -14,8 +14,7 @@ public sealed class OSThreadId private static ManualResetEvent s_resetEvent = new ManualResetEvent(false); private static ulong[] s_threadIds = new ulong[NumThreads]; - [ActiveIssue("https://github.com/dotnet/runtime/issues/41472", typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingNotSupported))] - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] public static void TestEntryPoint() { // The property to be tested is internal. diff --git a/src/tests/run.cmd b/src/tests/run.cmd index 96583bb2c4ca3f..2862c8e364883f 100644 --- a/src/tests/run.cmd +++ b/src/tests/run.cmd @@ -32,6 +32,7 @@ set LogsDirArg= set RunInUnloadableContext= set TieringTest= set RunInterpreter= +set RunWithNodeJS= :Arg_Loop if "%1" == "" goto ArgsDone @@ -75,6 +76,7 @@ if /i "%1" == "runincontext" (set RunInUnloadableCont if /i "%1" == "tieringtest" (set TieringTest=1&shift&goto Arg_Loop) if /i "%1" == "runnativeaottests" (set RunNativeAot=1&shift&goto Arg_Loop) if /i "%1" == "interpreter" (set RunInterpreter=1&shift&goto Arg_Loop) +if /i "%1" == "node" (set RunWithNodeJS=1&shift&goto Arg_Loop) if /i not "%1" == "msbuildargs" goto SkipMsbuildArgs :: All the rest of the args will be collected and passed directly to msbuild. @@ -170,6 +172,10 @@ if defined RunInterpreter ( set __RuntestPyArgs=%__RuntestPyArgs% --interpreter ) +if defined RunWithNodeJS ( + set __RuntestPyArgs=%__RuntestPyArgs% --node +) + REM Find python and set it to the variable PYTHON set _C=-c "import sys; sys.stdout.write(sys.executable)" (py -3 %_C% || py -2 %_C% || python3 %_C% || python2 %_C% || python %_C%) > %TEMP%\pythonlocation.txt 2> NUL @@ -235,6 +241,7 @@ echo logsdir ^ - Specify the logs directory ^(default: artifac echo msbuildargs ^ - Pass all subsequent args directly to msbuild invocations. echo ^ - Path to the runtime to test ^(if specified^). echo interpreter - Runs the tests with the interpreter enabled. +echo node - Runs the tests with NodeJS ^(wasm only^). echo. echo Note that arguments are not case-sensitive. echo. diff --git a/src/tests/run.py b/src/tests/run.py index 9a6a0ada957b58..244e2dd6c8fedb 100755 --- a/src/tests/run.py +++ b/src/tests/run.py @@ -106,6 +106,7 @@ parser.add_argument("--synthesize_pgo", dest="synthesize_pgo", action="store_true", default=False) parser.add_argument("--sequential", dest="sequential", action="store_true", default=False) parser.add_argument("--interpreter", dest="interpreter", action="store_true", default=False) +parser.add_argument("--node", dest="node", action="store_true", default=False) parser.add_argument("--analyze_results_only", dest="analyze_results_only", action="store_true", default=False) parser.add_argument("--verbose", dest="verbose", action="store_true", default=False) @@ -859,6 +860,11 @@ def run_tests(args, print("Setting RunInterpreter=1") os.environ["RunInterpreter"] = "1" + if args.node: + print("Running tests with the NodeJS") + print("Setting RunWithNodeJS=1") + os.environ["RunWithNodeJS"] = "1" + if gc_stress: per_test_timeout *= 8 print("Running GCStress, extending test timeout to cater for slower runtime.") @@ -1018,6 +1024,11 @@ def setup_args(args): lambda arg: True, "Error setting interpreter") + coreclr_setup_args.verify(args, + "node", + lambda arg: True, + "Error setting node") + if coreclr_setup_args.sequential and coreclr_setup_args.parallel: print("Error: don't specify both --sequential and -parallel") sys.exit(1) diff --git a/src/tests/run.sh b/src/tests/run.sh index 20ab2b04a3e014..78f2af6feffab6 100755 --- a/src/tests/run.sh +++ b/src/tests/run.sh @@ -42,6 +42,7 @@ function print_usage { echo ' --tieringtest : Run each test to encourage tier1 rejitting' echo ' --runnativeaottests : Run NativeAOT compiled tests' echo ' --interpreter : Runs the tests with the interpreter enabled' + echo ' --node : Runs the tests with the NodeJS (wasm only)' echo ' --limitedDumpGeneration : ' } @@ -191,6 +192,9 @@ do --interpreter) export RunInterpreter=1 ;; + --node) + export RunWithNodeJS=1 + ;; *) echo "Unknown switch: $i" print_usage @@ -199,6 +203,11 @@ do esac done +# Set default for RunWithNodeJS when using wasm architecture +if [ "$buildArch" = "wasm" ] && [ -z "$RunWithNodeJS" ]; then + export RunWithNodeJS=1 +fi + ################################################################################ # Call run.py to run tests. ################################################################################ @@ -302,6 +311,11 @@ if [[ -n "$RunInterpreter" ]]; then runtestPyArguments+=("--interpreter") fi +if [[ -n "$RunWithNodeJS" ]]; then + echo "Running tests with NodeJS" + runtestPyArguments+=("--node") +fi + # Default to python3 if it is installed __Python=python if command -v python3 &>/dev/null; then