Class NativeVariant.Cpu

java.lang.Object
electrostatic4j.snaploader.platform.util.NativeVariant.Cpu
Enclosing class:
NativeVariant

public static final class NativeVariant.Cpu extends Object
A namespace class exposing the CPU propositions.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    hasExtensions(String... requiredNames)
    Tests whether the named ISA extensions are all present.
    static boolean
    Tests whether the current system architecture is a 64-bit chipset (NOT APPLICABLE TO ALL CPUs).
    static boolean
    Tests whether the current CPU vendor is an AMD vendor (e.g., x86_64 Intel Chipset).
    static boolean
    Tests whether the current CPU vendor is an ARM vendor (e.g., Broadcom Chipset).
    static boolean
    Tests whether the current runtime environment is operating on a PowerPc CPU, typically Ppc only means 32-bit.
    static boolean
    Tests whether the current runtime environment is operating on a PowerPc CPU, typically the 64-bit version with the little endian byte-order (i.e., le architecture).
    static boolean
    Tests whether the current environment is running on a RISC-V (reduced instruction-set) CPU, typically plain RISC-V means 32-bit, and with the added predicate is64() adds the 64-bit predicate.
    static boolean
    Tests whether the current runtime environment is operating on an IBM System/390 CPU, typically plain s390 means the 32-bit version.
    static boolean
    Tests whether the current runtime environment is operating on an IBM System/390 CPU, typically the 64-bit version.
    static boolean
    Tests whether the current runtime environment is operating on a Sparc CPU, typically plain Sparc means 32-bit.
    static boolean
    Tests whether the current runtime environment is operating on a SparcV9 CPU, the typical 64-bit version of the Sparc CPU.
    static boolean
    Tests whether the current system architecture is of an x86 chipset, typically 32-bit intel chipsets.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isRiscV

      public static boolean isRiscV()
      Tests whether the current environment is running on a RISC-V (reduced instruction-set) CPU, typically plain RISC-V means 32-bit, and with the added predicate is64() adds the 64-bit predicate.
      Returns:
      true if the current runtime is operating on a RISC-V
    • isSparc

      public static boolean isSparc()
      Tests whether the current runtime environment is operating on a Sparc CPU, typically plain Sparc means 32-bit.
      Returns:
      true if the current runtime is operating on a Sparc.
      See Also:
    • isSparcV9

      public static boolean isSparcV9()
      Tests whether the current runtime environment is operating on a SparcV9 CPU, the typical 64-bit version of the Sparc CPU.
      Returns:
      true if the current runtime environment is running on a SparcV9.
      See Also:
    • isPpc

      public static boolean isPpc()
      Tests whether the current runtime environment is operating on a PowerPc CPU, typically Ppc only means 32-bit.
      Returns:
      true if the current runtime environment is operating on a PPC.
      See Also:
    • isPpc64le

      public static boolean isPpc64le()
      Tests whether the current runtime environment is operating on a PowerPc CPU, typically the 64-bit version with the little endian byte-order (i.e., le architecture).
      Returns:
      true if the current runtime environment is operating on a PPC-64-bit-le.
      See Also:
    • isS390

      public static boolean isS390()
      Tests whether the current runtime environment is operating on an IBM System/390 CPU, typically plain s390 means the 32-bit version.
      Returns:
      true if the current runtime environment is operating on an IBM System/390.
      See Also:
    • isS390x

      public static boolean isS390x()
      Tests whether the current runtime environment is operating on an IBM System/390 CPU, typically the 64-bit version.
      Returns:
      true if the current runtime environment is operating on an IBM System/390-64-bit.
      See Also:
    • is64

      public static boolean is64()
      Tests whether the current system architecture is a 64-bit chipset (NOT APPLICABLE TO ALL CPUs).
      Returns:
      true if the current OS architecture is a 64-bit chipset, false otherwise.
    • isX86

      public static boolean isX86()
      Tests whether the current system architecture is of an x86 chipset, typically 32-bit intel chipsets.
      Returns:
      true if the current OS architecture is of an x86 chipset, false otherwise.
    • isAMD

      public static boolean isAMD()
      Tests whether the current CPU vendor is an AMD vendor (e.g., x86_64 Intel Chipset).
      Returns:
      true if the current CPU vendor is an AMD vendor.
    • isARM

      public static boolean isARM()
      Tests whether the current CPU vendor is an ARM vendor (e.g., Broadcom Chipset).
      Returns:
      true if the current CPU vendor is an ARM vendor.
    • hasExtensions

      public static boolean hasExtensions(String... requiredNames)
      Tests whether the named ISA extensions are all present.

      Extension names are case-insensitive and might be reported differently by different operating systems or even by different versions of the same operating system.

      Examples of extension names:

      • "3dnow" for AMD 3D-Now
      • "avx" for x86 AVX
      • "avx2" for x86 AVX2
      • "avx512f" for x86 AVX512F
      • "bmi1" for x86 bit-manipulation instruction set 1
      • "f16c" for x86 half-precision floating-point
      • "fma" for x86 fused multiply-add
      • "fmac" for Arm floating-point multiply-accumulate
      • "mmx" for x86 MMX
      • "neon" for Arm NEON
      • "sse3" for x86 SSE3
      • "sse4_1" for x86 SSE4.1
      • "sse4_2" for x86 SSE4.2
      • "ssse3" for x86 SSSE3
      • "v8" for Arm V8
      • "v8_crc32" for Arm V8 extra CRC32
      • "v8_crypto" for Arm V8 extra cryptographic
      • "v81_atomic" for Arm V8.1 atomic
      • "v82_dp" for Arm V8.2 DP
      • "v83_jscvt" for Arm v8.3 JSCVT
      • "v83_lrcpc" for Arm v8.3 LRCPC

      Wikipedia provides informal descriptions of many ISA extensions. https://en.wikipedia.org/wiki/Template:Multimedia_extensions offers a good starting point.

      Parameters:
      requiredNames - the names of the extensions to test for
      Returns:
      true if the current platform supports all of the specified extensions, otherwise false