diff --git a/portability_8h_source.html b/portability_8h_source.html index 11b39531b..8c992d975 100644 --- a/portability_8h_source.html +++ b/portability_8h_source.html @@ -115,169 +115,162 @@ $(document).ready(function(){initNavTree('portability_8h_source.html',''); initR
32 #endif // __clang__
33 #endif // _MSC_VER
34 
-
35 #if SIMDJSON_REGULAR_VISUAL_STUDIO
-
36 // https://en.wikipedia.org/wiki/C_alternative_tokens
-
37 // This header should have no effect, except maybe
-
38 // under Visual Studio.
-
39 #include <iso646.h>
-
40 #endif
-
41 
-
42 #if defined(__x86_64__) || defined(_M_AMD64)
-
43 #define SIMDJSON_IS_X86_64 1
-
44 #elif defined(__aarch64__) || defined(_M_ARM64)
-
45 #define SIMDJSON_IS_ARM64 1
-
46 #elif defined(__PPC64__) || defined(_M_PPC64)
-
47 #if defined(__ALTIVEC__)
-
48 #define SIMDJSON_IS_PPC64_VMX 1
-
49 #endif // defined(__ALTIVEC__)
-
50 #else
-
51 #define SIMDJSON_IS_32BITS 1
-
52 
-
53 // We do not support 32-bit platforms, but it can be
-
54 // handy to identify them.
-
55 #if defined(_M_IX86) || defined(__i386__)
-
56 #define SIMDJSON_IS_X86_32BITS 1
-
57 #elif defined(__arm__) || defined(_M_ARM)
-
58 #define SIMDJSON_IS_ARM_32BITS 1
-
59 #elif defined(__PPC__) || defined(_M_PPC)
-
60 #define SIMDJSON_IS_PPC_32BITS 1
-
61 #endif
-
62 
-
63 #endif // defined(__x86_64__) || defined(_M_AMD64)
-
64 #ifndef SIMDJSON_IS_32BITS
-
65 #define SIMDJSON_IS_32BITS 0
-
66 #endif
-
67 
-
68 #if SIMDJSON_IS_32BITS
-
69 #ifndef SIMDJSON_NO_PORTABILITY_WARNING
-
70 #pragma message("The simdjson library is designed \
-
71 for 64-bit processors and it seems that you are not \
-
72 compiling for a known 64-bit platform. All fast kernels \
-
73 will be disabled and performance may be poor. Please \
-
74 use a 64-bit target such as x64, 64-bit ARM or 64-bit PPC.")
-
75 #endif // SIMDJSON_NO_PORTABILITY_WARNING
-
76 #endif // SIMDJSON_IS_32BITS
-
77 
-
78 // this is almost standard?
-
79 #undef SIMDJSON_STRINGIFY_IMPLEMENTATION_
-
80 #undef SIMDJSON_STRINGIFY
-
81 #define SIMDJSON_STRINGIFY_IMPLEMENTATION_(a) #a
-
82 #define SIMDJSON_STRINGIFY(a) SIMDJSON_STRINGIFY_IMPLEMENTATION_(a)
-
83 
-
84 // Our fast kernels require 64-bit systems.
-
85 //
-
86 // On 32-bit x86, we lack 64-bit popcnt, lzcnt, blsr instructions.
-
87 // Furthermore, the number of SIMD registers is reduced.
-
88 //
-
89 // On 32-bit ARM, we would have smaller registers.
-
90 //
-
91 // The simdjson users should still have the fallback kernel. It is
-
92 // slower, but it should run everywhere.
-
93 
-
94 //
-
95 // Enable valid runtime implementations, and select SIMDJSON_BUILTIN_IMPLEMENTATION
-
96 //
-
97 
-
98 // We are going to use runtime dispatch.
-
99 #if SIMDJSON_IS_X86_64
-
100 #ifdef __clang__
-
101 // clang does not have GCC push pop
-
102 // warning: clang attribute push can't be used within a namespace in clang up
-
103 // til 8.0 so SIMDJSON_TARGET_REGION and SIMDJSON_UNTARGET_REGION must be *outside* of a
-
104 // namespace.
-
105 #define SIMDJSON_TARGET_REGION(T) \
-
106  _Pragma(SIMDJSON_STRINGIFY( \
-
107  clang attribute push(__attribute__((target(T))), apply_to = function)))
-
108 #define SIMDJSON_UNTARGET_REGION _Pragma("clang attribute pop")
-
109 #elif defined(__GNUC__)
-
110 // GCC is easier
-
111 #define SIMDJSON_TARGET_REGION(T) \
-
112  _Pragma("GCC push_options") _Pragma(SIMDJSON_STRINGIFY(GCC target(T)))
-
113 #define SIMDJSON_UNTARGET_REGION _Pragma("GCC pop_options")
-
114 #endif // clang then gcc
-
115 
-
116 #endif // x86
-
117 
-
118 // Default target region macros don't do anything.
-
119 #ifndef SIMDJSON_TARGET_REGION
-
120 #define SIMDJSON_TARGET_REGION(T)
-
121 #define SIMDJSON_UNTARGET_REGION
+
35 #if defined(__x86_64__) || defined(_M_AMD64)
+
36 #define SIMDJSON_IS_X86_64 1
+
37 #elif defined(__aarch64__) || defined(_M_ARM64)
+
38 #define SIMDJSON_IS_ARM64 1
+
39 #elif defined(__PPC64__) || defined(_M_PPC64)
+
40 #if defined(__ALTIVEC__)
+
41 #define SIMDJSON_IS_PPC64_VMX 1
+
42 #endif // defined(__ALTIVEC__)
+
43 #else
+
44 #define SIMDJSON_IS_32BITS 1
+
45 
+
46 // We do not support 32-bit platforms, but it can be
+
47 // handy to identify them.
+
48 #if defined(_M_IX86) || defined(__i386__)
+
49 #define SIMDJSON_IS_X86_32BITS 1
+
50 #elif defined(__arm__) || defined(_M_ARM)
+
51 #define SIMDJSON_IS_ARM_32BITS 1
+
52 #elif defined(__PPC__) || defined(_M_PPC)
+
53 #define SIMDJSON_IS_PPC_32BITS 1
+
54 #endif
+
55 
+
56 #endif // defined(__x86_64__) || defined(_M_AMD64)
+
57 #ifndef SIMDJSON_IS_32BITS
+
58 #define SIMDJSON_IS_32BITS 0
+
59 #endif
+
60 
+
61 #if SIMDJSON_IS_32BITS
+
62 #ifndef SIMDJSON_NO_PORTABILITY_WARNING
+
63 #pragma message("The simdjson library is designed \
+
64 for 64-bit processors and it seems that you are not \
+
65 compiling for a known 64-bit platform. All fast kernels \
+
66 will be disabled and performance may be poor. Please \
+
67 use a 64-bit target such as x64, 64-bit ARM or 64-bit PPC.")
+
68 #endif // SIMDJSON_NO_PORTABILITY_WARNING
+
69 #endif // SIMDJSON_IS_32BITS
+
70 
+
71 // this is almost standard?
+
72 #undef SIMDJSON_STRINGIFY_IMPLEMENTATION_
+
73 #undef SIMDJSON_STRINGIFY
+
74 #define SIMDJSON_STRINGIFY_IMPLEMENTATION_(a) #a
+
75 #define SIMDJSON_STRINGIFY(a) SIMDJSON_STRINGIFY_IMPLEMENTATION_(a)
+
76 
+
77 // Our fast kernels require 64-bit systems.
+
78 //
+
79 // On 32-bit x86, we lack 64-bit popcnt, lzcnt, blsr instructions.
+
80 // Furthermore, the number of SIMD registers is reduced.
+
81 //
+
82 // On 32-bit ARM, we would have smaller registers.
+
83 //
+
84 // The simdjson users should still have the fallback kernel. It is
+
85 // slower, but it should run everywhere.
+
86 
+
87 //
+
88 // Enable valid runtime implementations, and select SIMDJSON_BUILTIN_IMPLEMENTATION
+
89 //
+
90 
+
91 // We are going to use runtime dispatch.
+
92 #if SIMDJSON_IS_X86_64
+
93 #ifdef __clang__
+
94 // clang does not have GCC push pop
+
95 // warning: clang attribute push can't be used within a namespace in clang up
+
96 // til 8.0 so SIMDJSON_TARGET_REGION and SIMDJSON_UNTARGET_REGION must be *outside* of a
+
97 // namespace.
+
98 #define SIMDJSON_TARGET_REGION(T) \
+
99  _Pragma(SIMDJSON_STRINGIFY( \
+
100  clang attribute push(__attribute__((target(T))), apply_to = function)))
+
101 #define SIMDJSON_UNTARGET_REGION _Pragma("clang attribute pop")
+
102 #elif defined(__GNUC__)
+
103 // GCC is easier
+
104 #define SIMDJSON_TARGET_REGION(T) \
+
105  _Pragma("GCC push_options") _Pragma(SIMDJSON_STRINGIFY(GCC target(T)))
+
106 #define SIMDJSON_UNTARGET_REGION _Pragma("GCC pop_options")
+
107 #endif // clang then gcc
+
108 
+
109 #endif // x86
+
110 
+
111 // Default target region macros don't do anything.
+
112 #ifndef SIMDJSON_TARGET_REGION
+
113 #define SIMDJSON_TARGET_REGION(T)
+
114 #define SIMDJSON_UNTARGET_REGION
+
115 #endif
+
116 
+
117 // Is threading enabled?
+
118 #if defined(_REENTRANT) || defined(_MT)
+
119 #ifndef SIMDJSON_THREADS_ENABLED
+
120 #define SIMDJSON_THREADS_ENABLED
+
121 #endif
122 #endif
123 
-
124 // Is threading enabled?
-
125 #if defined(_REENTRANT) || defined(_MT)
-
126 #ifndef SIMDJSON_THREADS_ENABLED
-
127 #define SIMDJSON_THREADS_ENABLED
-
128 #endif
-
129 #endif
-
130 
-
131 // workaround for large stack sizes under -O0.
-
132 // https://github.com/simdjson/simdjson/issues/691
-
133 #ifdef __APPLE__
-
134 #ifndef __OPTIMIZE__
-
135 // Apple systems have small stack sizes in secondary threads.
-
136 // Lack of compiler optimization may generate high stack usage.
-
137 // Users may want to disable threads for safety, but only when
-
138 // in debug mode which we detect by the fact that the __OPTIMIZE__
-
139 // macro is not defined.
-
140 #undef SIMDJSON_THREADS_ENABLED
-
141 #endif
-
142 #endif
-
143 
-
144 
-
145 #if defined(__clang__)
-
146 #define SIMDJSON_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined")))
-
147 #elif defined(__GNUC__)
-
148 #define SIMDJSON_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize_undefined))
-
149 #else
-
150 #define SIMDJSON_NO_SANITIZE_UNDEFINED
-
151 #endif
-
152 
-
153 
-
154 #if defined(__clang__) || defined(__GNUC__)
-
155 #if defined(__has_feature)
-
156 # if __has_feature(memory_sanitizer)
-
157 #define SIMDJSON_NO_SANITIZE_MEMORY __attribute__((no_sanitize("memory")))
-
158 # endif // if __has_feature(memory_sanitizer)
-
159 #endif // defined(__has_feature)
-
160 #endif
-
161 // make sure it is defined as 'nothing' if it is unapplicable.
-
162 #ifndef SIMDJSON_NO_SANITIZE_MEMORY
-
163 #define SIMDJSON_NO_SANITIZE_MEMORY
-
164 #endif
-
165 
-
166 #if SIMDJSON_VISUAL_STUDIO
-
167 // This is one case where we do not distinguish between
-
168 // regular visual studio and clang under visual studio.
-
169 // clang under Windows has _stricmp (like visual studio) but not strcasecmp (as clang normally has)
-
170 #define simdjson_strcasecmp _stricmp
-
171 #define simdjson_strncasecmp _strnicmp
-
172 #else
-
173 // The strcasecmp, strncasecmp, and strcasestr functions do not work with multibyte strings (e.g. UTF-8).
-
174 // So they are only useful for ASCII in our context.
-
175 // https://www.gnu.org/software/libunistring/manual/libunistring.html#char-_002a-strings
-
176 #define simdjson_strcasecmp strcasecmp
-
177 #define simdjson_strncasecmp strncasecmp
-
178 #endif
-
179 
-
180 #ifdef NDEBUG
-
181 
-
182 #if SIMDJSON_VISUAL_STUDIO
-
183 #define SIMDJSON_UNREACHABLE() __assume(0)
-
184 #define SIMDJSON_ASSUME(COND) __assume(COND)
-
185 #else
-
186 #define SIMDJSON_UNREACHABLE() __builtin_unreachable();
-
187 #define SIMDJSON_ASSUME(COND) do { if (!(COND)) __builtin_unreachable(); } while (0)
+
124 // workaround for large stack sizes under -O0.
+
125 // https://github.com/simdjson/simdjson/issues/691
+
126 #ifdef __APPLE__
+
127 #ifndef __OPTIMIZE__
+
128 // Apple systems have small stack sizes in secondary threads.
+
129 // Lack of compiler optimization may generate high stack usage.
+
130 // Users may want to disable threads for safety, but only when
+
131 // in debug mode which we detect by the fact that the __OPTIMIZE__
+
132 // macro is not defined.
+
133 #undef SIMDJSON_THREADS_ENABLED
+
134 #endif
+
135 #endif
+
136 
+
137 
+
138 #if defined(__clang__)
+
139 #define SIMDJSON_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined")))
+
140 #elif defined(__GNUC__)
+
141 #define SIMDJSON_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize_undefined))
+
142 #else
+
143 #define SIMDJSON_NO_SANITIZE_UNDEFINED
+
144 #endif
+
145 
+
146 
+
147 #if defined(__clang__) || defined(__GNUC__)
+
148 #if defined(__has_feature)
+
149 # if __has_feature(memory_sanitizer)
+
150 #define SIMDJSON_NO_SANITIZE_MEMORY __attribute__((no_sanitize("memory")))
+
151 # endif // if __has_feature(memory_sanitizer)
+
152 #endif // defined(__has_feature)
+
153 #endif
+
154 // make sure it is defined as 'nothing' if it is unapplicable.
+
155 #ifndef SIMDJSON_NO_SANITIZE_MEMORY
+
156 #define SIMDJSON_NO_SANITIZE_MEMORY
+
157 #endif
+
158 
+
159 #if SIMDJSON_VISUAL_STUDIO
+
160 // This is one case where we do not distinguish between
+
161 // regular visual studio and clang under visual studio.
+
162 // clang under Windows has _stricmp (like visual studio) but not strcasecmp (as clang normally has)
+
163 #define simdjson_strcasecmp _stricmp
+
164 #define simdjson_strncasecmp _strnicmp
+
165 #else
+
166 // The strcasecmp, strncasecmp, and strcasestr functions do not work with multibyte strings (e.g. UTF-8).
+
167 // So they are only useful for ASCII in our context.
+
168 // https://www.gnu.org/software/libunistring/manual/libunistring.html#char-_002a-strings
+
169 #define simdjson_strcasecmp strcasecmp
+
170 #define simdjson_strncasecmp strncasecmp
+
171 #endif
+
172 
+
173 #ifdef NDEBUG
+
174 
+
175 #if SIMDJSON_VISUAL_STUDIO
+
176 #define SIMDJSON_UNREACHABLE() __assume(0)
+
177 #define SIMDJSON_ASSUME(COND) __assume(COND)
+
178 #else
+
179 #define SIMDJSON_UNREACHABLE() __builtin_unreachable();
+
180 #define SIMDJSON_ASSUME(COND) do { if (!(COND)) __builtin_unreachable(); } while (0)
+
181 #endif
+
182 
+
183 #else // NDEBUG
+
184 
+
185 #define SIMDJSON_UNREACHABLE() assert(0);
+
186 #define SIMDJSON_ASSUME(COND) assert(COND)
+
187 
188 #endif
189 
-
190 #else // NDEBUG
-
191 
-
192 #define SIMDJSON_UNREACHABLE() assert(0);
-
193 #define SIMDJSON_ASSUME(COND) assert(COND)
-
194 
-
195 #endif
-
196 
-
197 #endif // SIMDJSON_PORTABILITY_H
+
190 #endif // SIMDJSON_PORTABILITY_H