< prev index next >

src/hotspot/cpu/aarch64/vm_version_aarch64.hpp

Print this page
*** 28,10 ***
--- 28,14 ---
  
  #include "spin_wait_aarch64.hpp"
  #include "runtime/abstract_vm_version.hpp"
  #include "utilities/sizes.hpp"
  
+ class stringStream;
+ 
+ #define BIT_MASK(flag) (1ULL<<(flag))
+ 
  class VM_Version : public Abstract_VM_Version {
    friend class VMStructs;
    friend class JVMCIVMStructs;
  
  protected:

*** 59,10 ***
--- 63,12 ---
    // If the len is larger than the system largest supported SVE vector length,
    // the function sets the largest supported value.
    static int set_and_get_current_sve_vector_length(int len);
    static int get_current_sve_vector_length();
  
+   static void insert_features_names(uint64_t features, stringStream& ss);
+ 
  public:
    // Initialization
    static void initialize();
    static void check_virtualizations();
  

*** 136,21 ***
      decl(SVEBITPERM,    svebitperm,    27)    \
      decl(SVE2,          sve2,          28)    \
      decl(A53MAC,        a53mac,        31)
  
    enum Feature_Flag {
! #define DECLARE_CPU_FEATURE_FLAG(id, name, bit) CPU_##id = (1 << bit),
      CPU_FEATURE_FLAGS(DECLARE_CPU_FEATURE_FLAG)
  #undef DECLARE_CPU_FEATURE_FLAG
    };
  
    // Feature identification
  #define CPU_FEATURE_DETECTION(id, name, bit) \
!   static bool supports_##name() { return (_features & CPU_##id) != 0; };
    CPU_FEATURE_FLAGS(CPU_FEATURE_DETECTION)
  #undef CPU_FEATURE_DETECTION
  
    static int cpu_family()                     { return _cpu; }
    static int cpu_model()                      { return _model; }
    static int cpu_model2()                     { return _model2; }
    static int cpu_variant()                    { return _variant; }
    static int cpu_revision()                   { return _revision; }
--- 142,39 ---
      decl(SVEBITPERM,    svebitperm,    27)    \
      decl(SVE2,          sve2,          28)    \
      decl(A53MAC,        a53mac,        31)
  
    enum Feature_Flag {
! #define DECLARE_CPU_FEATURE_FLAG(id, name, bit) CPU_##id = bit,
      CPU_FEATURE_FLAGS(DECLARE_CPU_FEATURE_FLAG)
  #undef DECLARE_CPU_FEATURE_FLAG
+     MAX_CPU_FEATURES
    };
  
+   STATIC_ASSERT(sizeof(_features) * BitsPerByte >= MAX_CPU_FEATURES);
+ 
+   static const char* _features_names[MAX_CPU_FEATURES];
+ 
    // Feature identification
  #define CPU_FEATURE_DETECTION(id, name, bit) \
!   static bool supports_##name() { return supports_feature(CPU_##id); }
    CPU_FEATURE_FLAGS(CPU_FEATURE_DETECTION)
  #undef CPU_FEATURE_DETECTION
  
+   static void set_feature(Feature_Flag flag) {
+     _features |= BIT_MASK(flag);
+   }
+   static void clear_feature(Feature_Flag flag) {
+     _features &= (~BIT_MASK(flag));
+   }
+   static bool supports_feature(Feature_Flag flag) {
+     return (_features & BIT_MASK(flag)) != 0;
+   }
+   static bool supports_feature(uint64_t features, Feature_Flag flag) {
+     return (features & BIT_MASK(flag)) != 0;
+   }
+ 
    static int cpu_family()                     { return _cpu; }
    static int cpu_model()                      { return _model; }
    static int cpu_model2()                     { return _model2; }
    static int cpu_variant()                    { return _variant; }
    static int cpu_revision()                   { return _revision; }

*** 197,8 ***
--- 221,20 ---
    // For common 64/128-bit unpredicated vector operations, we may prefer
    // emitting NEON instructions rather than the corresponding SVE instructions.
    static bool use_neon_for_vector(int vector_length_in_bytes) {
      return vector_length_in_bytes <= 16;
    }
+ 
+   static void get_cpu_features_name(void* features_buffer, stringStream& ss);
+   static void get_missing_features_name(void* features_buffer, stringStream& ss);
+ 
+   // Returns number of bytes required to store cpu features representation
+   static int cpu_features_size();
+ 
+   // Stores cpu features representation in the provided buffer. This representation is arch dependent.
+   // Size of the buffer must be same as returned by cpu_features_size()
+   static void store_cpu_features(void* buf);
+ 
+   static bool supports_features(void* features_to_test);
  };
  
  #endif // CPU_AARCH64_VM_VERSION_AARCH64_HPP
< prev index next >