diff --git a/eng/pipelines/common/templates/wasm-aot-runtime-test-131537.yml b/eng/pipelines/common/templates/wasm-aot-runtime-test-131537.yml new file mode 100644 index 00000000000000..f559f532c8be21 --- /dev/null +++ b/eng/pipelines/common/templates/wasm-aot-runtime-test-131537.yml @@ -0,0 +1,56 @@ +# TEMP (wasm-aot-131537-validation): validate that the src/tests regression test +# Loader/classloader/generics/regressions/131537 actually runs under the Mono +# wasm-AOT configuration that reproduces #131537 (AOT'd corelib + force-interpreted +# test assembly). Scoped to just that one test via `-tree`, AOT'd locally, run on +# Chrome. Delete this file (and its reference in runtime-extra-platforms-wasm.yml) +# before merging anything real. + +parameters: + alwaysRun: false + isExtraPlatformsBuild: false + isWasmOnlyBuild: false + platforms: [] + extraBuildArgs: '' + useHelixMonitor: false + +jobs: + +- template: /eng/pipelines/common/platform-matrix.yml + parameters: + jobTemplate: /eng/pipelines/common/global-build-job.yml + helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml + buildConfig: Release + runtimeFlavor: mono + platforms: ${{ parameters.platforms }} + variables: + - name: alwaysRunVar + value: ${{ parameters.alwaysRun }} + - name: timeoutPerTestInMinutes + value: 20 + - name: timeoutPerTestCollectionInMinutes + value: 200 + jobParameters: + testGroup: innerloop + isExtraPlatforms: ${{ parameters.isExtraPlatformsBuild }} + nameSuffix: AllSubsets_Mono_RuntimeTests_AOT_131537 + # No runtimeVariant (i.e. not monointerpreter): we want corelib AOT'd, and + # the test csproj force-interprets only test131537.dll via + # _AOT_InternalForceInterpretAssemblies — reproducing the failing config. + buildArgs: -s mono+libs -c $(_BuildConfig) /p:MonoEnableAssertMessages=true /p:InstallV8ForTests=false ${{ parameters.extraBuildArgs }} + timeoutInMinutes: 180 + condition: eq(variables['alwaysRunVar'], true) + postBuildSteps: + - template: /eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml + parameters: + creator: dotnet-bot + testRunNamePrefixSuffix: Mono_$(_BuildConfig)_AOT_131537 + # Scope the runtime-test build to just this one test, and AOT it locally + # (RunAOTCompilation=true) so corelib is AOT'd in the produced wasm app. + # _BuildAllTestGroupsForBrowser: this test is in group 3 (Pri0), and browser CI + # otherwise builds only group 1 (#114123); safe here since only one test is scoped. + testBuildArgs: tree Loader/classloader/generics/regressions/131537 /p:RunAOTCompilation=true /p:InstallV8ForTests=false /p:_BuildAllTestGroupsForBrowser=true + scenarios: + - WasmTestOnChrome + useHelixMonitor: ${{ parameters.useHelixMonitor }} + extraVariablesTemplates: + - template: /eng/pipelines/common/templates/runtimes/test-variables.yml diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml index 4ba21df5c78571..cff515ae762719 100644 --- a/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml +++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml @@ -249,6 +249,18 @@ jobs: isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }} useHelixMonitor: ${{ variables.enableHelixJobMonitor }} + # TEMP (wasm-aot-131537-validation): Mono AOT + Chrome runtime-test lane scoped to + # Loader/classloader/generics/regressions/131537 only. Remove before merging. + - template: /eng/pipelines/common/templates/wasm-aot-runtime-test-131537.yml + parameters: + platforms: + - browser_wasm + extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) + isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }} + isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }} + alwaysRun: ${{ parameters.isWasmOnlyBuild }} + useHelixMonitor: ${{ variables.enableHelixJobMonitor }} + - ${{ if and(ne(parameters.isRollingBuild, true), ne(parameters.excludeOptional, true)) }}: - template: /eng/pipelines/common/templates/wasm-library-tests.yml parameters: diff --git a/src/mono/mono/metadata/jit-icall-reg.h b/src/mono/mono/metadata/jit-icall-reg.h index 1d159485bc63af..c58a320f89ab5b 100644 --- a/src/mono/mono/metadata/jit-icall-reg.h +++ b/src/mono/mono/metadata/jit-icall-reg.h @@ -203,7 +203,6 @@ MONO_JIT_ICALL (mono_get_native_calli_wrapper) \ MONO_JIT_ICALL (mono_get_special_static_data) \ MONO_JIT_ICALL (mono_gsharedvt_constrained_call) \ MONO_JIT_ICALL (mono_gsharedvt_value_copy) \ -MONO_JIT_ICALL (mono_helper_box_nullable) \ MONO_JIT_ICALL (mono_helper_compile_generic_method) \ MONO_JIT_ICALL (mono_helper_ldstr) \ MONO_JIT_ICALL (mono_helper_ldstr_mscorlib) \ diff --git a/src/mono/mono/mini/jit-icalls.c b/src/mono/mono/mini/jit-icalls.c index 4d9a95b8181227..fba533310bd2c7 100644 --- a/src/mono/mono/mini/jit-icalls.c +++ b/src/mono/mono/mini/jit-icalls.c @@ -1169,15 +1169,6 @@ mono_helper_newobj_mscorlib (guint32 idx) return obj; } -MonoObject* -mono_helper_box_nullable (gpointer vbuf, MonoClass *klass) -{ - ERROR_DECL (error); - MonoObject *result = mono_nullable_box (vbuf, klass, error); - mono_error_set_pending_exception (error); - return result; -} - /* * On some architectures, gdb doesn't like encountering the cpu breakpoint instructions * in generated code. So instead we emit a call to this function and place a gdb diff --git a/src/mono/mono/mini/jit-icalls.h b/src/mono/mono/mini/jit-icalls.h index 42b394b06b28a7..6e9ea58124e1e3 100644 --- a/src/mono/mono/mini/jit-icalls.h +++ b/src/mono/mono/mini/jit-icalls.h @@ -116,8 +116,6 @@ ICALL_EXPORT MonoString *mono_helper_ldstr_mscorlib (guint32 idx); ICALL_EXPORT MonoObject *mono_helper_newobj_mscorlib (guint32 idx); -ICALL_EXPORT MonoObject *mono_helper_box_nullable (gpointer vbuf, MonoClass *klass); - ICALL_EXPORT double mono_fsub (double a, double b); ICALL_EXPORT double mono_fadd (double a, double b); diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c index b7faaa15cf79cc..4545e6e0a21168 100644 --- a/src/mono/mono/mini/method-to-ir.c +++ b/src/mono/mono/mini/method-to-ir.c @@ -3403,26 +3403,6 @@ handle_alloc (MonoCompile *cfg, MonoClass *klass, gboolean for_box, int context_ return mono_emit_jit_icall_id (cfg, alloc_ftn, iargs); } -/* - * Box a gsharedvt Nullable via a non-generic runtime helper, passing the value by - * address and the concrete class from the rgctx. This avoids a per-T box wrapper that - * cannot be emitted at AOT time when the consuming assembly runs interpreted. - */ -static MonoInst* -mini_emit_nullable_box_helper (MonoCompile *cfg, MonoInst *val, MonoClass *klass, int context_used) -{ - MonoInst *iargs [2], *addr, *var; - - var = get_vreg_to_inst (cfg, val->dreg); - if (!var) - var = mono_compile_create_var_for_vreg (cfg, m_class_get_byval_arg (klass), OP_LOCAL, val->dreg); - EMIT_NEW_VARLOADA (cfg, addr, var, var->inst_vtype); - - iargs [0] = addr; - iargs [1] = mini_emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_KLASS); - return mono_emit_jit_icall (cfg, mono_helper_box_nullable, iargs); -} - /* * Returns NULL and set the cfg exception on error. */ @@ -3445,9 +3425,11 @@ mini_emit_box (MonoCompile *cfg, MonoInst *val, MonoClass *klass, int context_us MonoInst *addr; MonoMethodSignature *sig = mono_method_signature_internal (method); if (mini_is_gsharedvt_klass (klass)) - return mini_emit_nullable_box_helper (cfg, val, klass, context_used); - addr = emit_get_rgctx_method (cfg, context_used, method, - MONO_RGCTX_INFO_METHOD_FTNDESC); + addr = mini_emit_get_gsharedvt_info_klass (cfg, klass, + MONO_RGCTX_INFO_NULLABLE_CLASS_BOX); + else + addr = emit_get_rgctx_method (cfg, context_used, method, + MONO_RGCTX_INFO_METHOD_FTNDESC); cfg->interp_in_signatures = g_slist_prepend_mempool (cfg->mempool, cfg->interp_in_signatures, sig); return mini_emit_llvmonly_calli (cfg, sig, &val, addr); } else { @@ -3513,14 +3495,9 @@ mini_emit_box (MonoCompile *cfg, MonoInst *val, MonoClass *klass, int context_us /* Nullable case */ MONO_START_BB (cfg, is_nullable_bb); - if (cfg->llvm_only) { - MonoInst *box_call = mini_emit_nullable_box_helper (cfg, val, klass, context_used); - EMIT_NEW_UNALU (cfg, res, OP_MOVE, dreg, box_call->dreg); - res->type = STACK_OBJ; - res->klass = klass; - } else { + { MonoInst *box_addr = mini_emit_get_gsharedvt_info_klass (cfg, klass, - MONO_RGCTX_INFO_NULLABLE_CLASS_BOX); + MONO_RGCTX_INFO_NULLABLE_CLASS_BOX); MonoInst *box_call; MonoMethodSignature *box_sig; @@ -3533,7 +3510,10 @@ mini_emit_box (MonoCompile *cfg, MonoInst *val, MonoClass *klass, int context_us box_sig->param_count = 1; box_sig->params [0] = m_class_get_byval_arg (klass); - box_call = mini_emit_calli (cfg, box_sig, &val, box_addr, NULL, NULL); + if (cfg->llvm_only) + box_call = mini_emit_llvmonly_calli (cfg, box_sig, &val, box_addr); + else + box_call = mini_emit_calli (cfg, box_sig, &val, box_addr, NULL, NULL); EMIT_NEW_UNALU (cfg, res, OP_MOVE, dreg, box_call->dreg); res->type = STACK_OBJ; res->klass = klass; diff --git a/src/mono/mono/mini/mini-runtime.c b/src/mono/mono/mini/mini-runtime.c index 6a2099535cbddd..46e28a680b3cc7 100644 --- a/src/mono/mono/mini/mini-runtime.c +++ b/src/mono/mono/mini/mini-runtime.c @@ -5114,7 +5114,6 @@ register_icalls (void) register_icall (mono_helper_ldstr, mono_icall_sig_object_ptr_int, FALSE); register_icall (mono_helper_ldstr_mscorlib, mono_icall_sig_object_int, FALSE); register_icall (mono_helper_newobj_mscorlib, mono_icall_sig_object_int, FALSE); - register_icall (mono_helper_box_nullable, mono_icall_sig_object_ptr_ptr, FALSE); register_icall (mono_value_copy_internal, mono_icall_sig_void_ptr_ptr_ptr, FALSE); register_icall (mono_object_castclass_unbox, mono_icall_sig_object_object_ptr, FALSE); register_icall (mono_break, mono_icall_sig_void, TRUE); diff --git a/src/tests/Loader/classloader/generics/regressions/131537/test131537.csproj b/src/tests/Loader/classloader/generics/regressions/131537/test131537.csproj index 06c63a526492bb..b3be7d10e0db8e 100644 --- a/src/tests/Loader/classloader/generics/regressions/131537/test131537.csproj +++ b/src/tests/Loader/classloader/generics/regressions/131537/test131537.csproj @@ -1,13 +1,14 @@ - 1 + + 0 + + true - - - <_AOT_InternalForceInterpretAssemblies Include="test131537.dll" /> + + diff --git a/src/tests/build.proj b/src/tests/build.proj index 884ccfcddb0f79..21960e2433cb3a 100644 --- a/src/tests/build.proj +++ b/src/tests/build.proj @@ -205,9 +205,10 @@