Skip to content

[wasm] WasmBase.IsSupported no longer returns true #88494

@vargaz

Description

@vargaz

Description

Testcase:

using System;
using System.Numerics;

public class Test
{
    public static int Main () {
        int sum = 0;
        for (int i = 0; i < 100000000; ++i) {
            sum += BitOperations.Log2 ((ulong)i);
        }
        return sum;
    }
}

JIT debug output:

converting (in B14: stack: 0) IL_000f: call      0x0600137b
cmethod = bool System.Runtime.Intrinsics.Wasm.WasmBase:get_IsSupported ()
	->  false

What seems to be happening is that the JIT first calls
arch_emit_simd_intrinsics (), which calls

	if (!strcmp (class_ns, "System.Runtime.Intrinsics.Wasm")) {
		return emit_hardware_intrinsics (cfg, cmethod, fsig, args,
			supported_wasm_intrinsics, sizeof (supported_wasm_intrinsics),
			emit_wasm_supported_intrinsics);
	}

Which doesn't handle WasmBase, but it still returns a MonoInst for WasmBase:get_IsSupported (), so
arch_emit_common_intrinsics () is never called.

Reproduction Steps

.

Expected behavior

.

Actual behavior

.

Regression?

Yes

Known Workarounds

No response

Configuration

dotnet/runtime master

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-wasmWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions