Make it possible to check that an implementation is supported at runtime (#1197)

* Make it possible to check that an implementation is supported at runtime.

* add CI fuzzing on arm 64 bit

This adds fuzzing on drone.io arm64

For some reason, leak detection had to be disabled. If it is enabled, the fuzzer falsely reports a crash at the end of fuzzing.

Closes: #1188

* Guarding the implementation accesses.

* Better doc.

* Updating cxxopts.

* Make it possible to check that an implementation is supported at runtime.

* Guarding the implementation accesses.

* Better doc.

* Updating cxxopts.

* We need to accomodate cxxopts

Co-authored-by: Paul Dreik <github@pauldreik.se>
This commit is contained in:
Daniel Lemire
2020-10-02 11:04:51 -04:00
committed by GitHub
parent e06ddea784
commit 9865bb6904
19 changed files with 159 additions and 25 deletions
+11
View File
@@ -71,6 +71,16 @@ public:
* @return the name of the implementation, e.g. "haswell", "westmere", "arm64"
*/
virtual const std::string &description() const { return _description; }
/**
* The instruction sets this implementation is compiled against
* and the current CPU match. This function may poll the current CPU/system
* and should therefore not be called too often if performance is a concern.
*
*
* @return true if the implementation can be safely used on the current system (determined at runtime)
*/
bool supported_by_runtime_system() const;
/**
* @private For internal implementation use
@@ -180,6 +190,7 @@ public:
*
* const implementation *impl = simdjson::available_implementations["westmere"];
* if (!impl) { exit(1); }
* if (!imp->supported_by_runtime_system()) { exit(1); }
* simdjson::active_implementation = impl;
*
* @param name the implementation to find, e.g. "westmere", "haswell", "arm64"