JFLib

plat/cpu.rs#

Source: lib/plat/cpu.rs

cpu -- CPU feature detection for SIMD dispatch                             [src/core/cpu.s]

  cpu_features() -> CPU_* bits     cached; SSE2 is the baseline and has no bit.
                                   `--simd sse2` on the command line forces 0 (baseline
                                   kernels only, to compare results)
  cpu_brand() -> String            the processor name ("" when unknown)

The detection itself lives in rt::cpu (the simd crate dispatches on it); the process entry
applies `--simd sse2` before the app starts.
  • fn cpu_features() -> u32 CPU_* bits (cached; rt::cpu) [cpu_features]

  • fn cpu_brand() -> String the processor name from CPUID 0x80000002..4 (macOS, iOS: sysctl machdep.cpu.brand_string, "Apple M2", on an Intel Mac Intel's name; under Rosetta 2 the Mac's own chip), blanks trimmed [cpu_brand]

  • fn avx2_probe() -> bool run two 256-bit AVX2 instructions (they fault without OS support); only call it when cpu_features() reports CPU_AVX2 [plattest t_cpu]

  • fn stack_aligned() -> bool the stack pointer is 16-byte aligned where a call could happen (the compiler relies on it: a thread started with a misaligned stack shows here) [plattest th_raw]

  • fn avx2_probe() -> bool The browser does not advertise or execute native AVX2 instructions (nor do ARM64 processors).

  • fn stack_aligned() -> bool WebAssembly's compiler-managed value/call stacks satisfy their platform ABI (Apple Silicon: the system starts every thread; Intel Macs read rsp as Windows and Linux do).

  • fn stack_aligned() -> bool the stack pointer is 16-byte aligned (ARM64 faults on a memory access through a misaligned sp: a thread started with one would show here first) [plattest th_raw]

  • fn cpu_brand() -> String the processor's name from MIDR_EL1 ("ARM Cortex-A720"; "Qualcomm CPU 0x001" for parts not listed), "ARM64" when the kernel does not let user space read it

  • fn cpu_brand() -> String the processor's name from /proc/cpuinfo: x86-64 its "model name" (the emulator: the host's processor), ARM64 "Hardware" where the kernel still writes it, else every kind of core once from "CPU implementer" and "CPU part" ("ARM Cortex-A55 + ARM Cortex-A78" on big.LITTLE); "" when it says nothing

  • fn cpu_brand() -> String the processor's name (HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0, ProcessorNameString, such as "Snapdragon(R) X Elite - X1E78100 - Qualcomm(R) Oryon(TM) CPU"), "ARM64" when it is missing

Source: docs/API.md in the JFLib repository.