clickhouse-native 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. checksums.yaml +7 -0
  2. data/ext/clickhouse_native/client.cpp +847 -0
  3. data/ext/clickhouse_native/extconf.rb +101 -0
  4. data/ext/clickhouse_native/vendor/clickhouse-cpp/.clang-format +11 -0
  5. data/ext/clickhouse_native/vendor/clickhouse-cpp/.git +1 -0
  6. data/ext/clickhouse_native/vendor/clickhouse-cpp/.gitattributes +63 -0
  7. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/CODEOWNERS +1 -0
  8. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/linux.yml +139 -0
  9. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/macos.yml +87 -0
  10. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/windows_mingw.yml +102 -0
  11. data/ext/clickhouse_native/vendor/clickhouse-cpp/.github/workflows/windows_msvc.yml +74 -0
  12. data/ext/clickhouse_native/vendor/clickhouse-cpp/.gitignore +280 -0
  13. data/ext/clickhouse_native/vendor/clickhouse-cpp/.travis.yml +62 -0
  14. data/ext/clickhouse_native/vendor/clickhouse-cpp/CMakeLists.txt +157 -0
  15. data/ext/clickhouse_native/vendor/clickhouse-cpp/LICENSE +206 -0
  16. data/ext/clickhouse_native/vendor/clickhouse-cpp/README.md +260 -0
  17. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/CMakeLists.txt +246 -0
  18. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/buffer.h +10 -0
  19. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/compressed.cpp +258 -0
  20. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/compressed.h +48 -0
  21. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/endpoints_iterator.cpp +20 -0
  22. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/endpoints_iterator.h +34 -0
  23. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/input.cpp +96 -0
  24. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/input.h +103 -0
  25. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/open_telemetry.h +23 -0
  26. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/output.cpp +119 -0
  27. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/output.h +142 -0
  28. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/platform.cpp +1 -0
  29. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/platform.h +33 -0
  30. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/projected_iterator.h +55 -0
  31. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/singleton.h +11 -0
  32. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/socket.cpp +489 -0
  33. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/socket.h +177 -0
  34. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/sslsocket.cpp +307 -0
  35. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/sslsocket.h +111 -0
  36. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/string_utils.h +28 -0
  37. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/string_view.h +142 -0
  38. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/uuid.h +10 -0
  39. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/wire_format.cpp +177 -0
  40. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/base/wire_format.h +79 -0
  41. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/block.cpp +134 -0
  42. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/block.h +114 -0
  43. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/client.cpp +1269 -0
  44. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/client.h +320 -0
  45. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/array.cpp +175 -0
  46. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/array.h +321 -0
  47. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/column.cpp +24 -0
  48. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/column.h +107 -0
  49. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/date.cpp +365 -0
  50. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/date.h +245 -0
  51. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/decimal.cpp +255 -0
  52. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/decimal.h +50 -0
  53. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/enum.cpp +123 -0
  54. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/enum.h +65 -0
  55. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/factory.cpp +285 -0
  56. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/factory.h +14 -0
  57. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/geo.cpp +108 -0
  58. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/geo.h +79 -0
  59. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip4.cpp +117 -0
  60. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip4.h +71 -0
  61. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip6.cpp +108 -0
  62. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/ip6.h +66 -0
  63. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/itemview.cpp +101 -0
  64. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/itemview.h +86 -0
  65. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/lowcardinality.cpp +527 -0
  66. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/lowcardinality.h +221 -0
  67. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/lowcardinalityadaptor.h +63 -0
  68. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/map.cpp +87 -0
  69. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/map.h +257 -0
  70. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/nothing.h +87 -0
  71. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/nullable.cpp +109 -0
  72. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/nullable.h +153 -0
  73. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/numeric.cpp +126 -0
  74. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/numeric.h +88 -0
  75. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/string.cpp +333 -0
  76. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/string.h +145 -0
  77. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/time.cpp +155 -0
  78. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/time.h +118 -0
  79. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/tuple.cpp +106 -0
  80. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/tuple.h +178 -0
  81. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/utils.h +41 -0
  82. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/uuid.cpp +80 -0
  83. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/columns/uuid.h +58 -0
  84. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/error_codes.h +595 -0
  85. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/exceptions.h +66 -0
  86. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/protocol.h +54 -0
  87. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/query.cpp +25 -0
  88. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/query.h +246 -0
  89. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/server_exception.h +16 -0
  90. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/type_parser.cpp +314 -0
  91. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/type_parser.h +89 -0
  92. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/types.cpp +484 -0
  93. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/types/types.h +397 -0
  94. data/ext/clickhouse_native/vendor/clickhouse-cpp/clickhouse/version.h +14 -0
  95. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/Findcityhash.cmake +26 -0
  96. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/Findlz4.cmake +39 -0
  97. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/Findzstd.cmake +39 -0
  98. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/cpp17.cmake +8 -0
  99. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/openssl.cmake +8 -0
  100. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/subdirs.cmake +5 -0
  101. data/ext/clickhouse_native/vendor/clickhouse-cpp/cmake/version.cmake +87 -0
  102. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/CMakeLists.txt +9 -0
  103. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/attributes.h +682 -0
  104. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/config.h +714 -0
  105. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/internal/bits.h +219 -0
  106. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/macros.h +147 -0
  107. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/optimization.h +241 -0
  108. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/options.h +238 -0
  109. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/policy_checks.h +111 -0
  110. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/base/port.h +26 -0
  111. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128.cc +390 -0
  112. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128.h +1092 -0
  113. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128_have_intrinsic.inc +302 -0
  114. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/absl/absl/numeric/int128_no_intrinsic.inc +308 -0
  115. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/BUCK +13 -0
  116. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/CMakeLists.txt +7 -0
  117. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/COPYING +19 -0
  118. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/city.cc +469 -0
  119. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/city.h +90 -0
  120. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/citycrc.h +43 -0
  121. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/cityhash/cityhash/config.h +118 -0
  122. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/BUCK +14 -0
  123. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/CMakeLists.txt +4 -0
  124. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/LICENSE +28 -0
  125. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/README.md +1 -0
  126. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-death-test.h +346 -0
  127. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-matchers.h +930 -0
  128. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-message.h +219 -0
  129. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-param-test.h +507 -0
  130. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-printers.h +1029 -0
  131. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-spi.h +238 -0
  132. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-test-part.h +184 -0
  133. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest-typed-test.h +329 -0
  134. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest.h +2495 -0
  135. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest_pred_impl.h +359 -0
  136. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/gtest_prod.h +61 -0
  137. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/README.md +56 -0
  138. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/gtest-port.h +37 -0
  139. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/gtest-printers.h +42 -0
  140. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/custom/gtest.h +37 -0
  141. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-death-test-internal.h +304 -0
  142. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-filepath.h +211 -0
  143. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-internal.h +1560 -0
  144. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-param-util.h +947 -0
  145. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-port-arch.h +114 -0
  146. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-port.h +2389 -0
  147. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-string.h +175 -0
  148. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/include/gtest/internal/gtest-type-util.h +183 -0
  149. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-all.cc +48 -0
  150. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-death-test.cc +1644 -0
  151. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-filepath.cc +369 -0
  152. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-internal-inl.h +1221 -0
  153. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-matchers.cc +97 -0
  154. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-port.cc +1433 -0
  155. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-printers.cc +533 -0
  156. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-test-part.cc +108 -0
  157. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest-typed-test.cc +107 -0
  158. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest.cc +6746 -0
  159. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/gtest/src/gtest_main.cc +54 -0
  160. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/BUCK +13 -0
  161. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/CMakeLists.txt +8 -0
  162. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/LICENSE +24 -0
  163. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4.c +2402 -0
  164. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4.h +764 -0
  165. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4hc.c +1554 -0
  166. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/lz4/lz4/lz4hc.h +438 -0
  167. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/BUCK +232 -0
  168. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/CMakeLists.txt +115 -0
  169. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/LICENSE +30 -0
  170. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/allocations.h +55 -0
  171. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/bits.h +200 -0
  172. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/bitstream.h +437 -0
  173. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/compiler.h +358 -0
  174. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/cpu.h +213 -0
  175. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/debug.c +24 -0
  176. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/debug.h +107 -0
  177. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/entropy_common.c +340 -0
  178. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/error_private.c +63 -0
  179. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/error_private.h +159 -0
  180. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/fse.h +639 -0
  181. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/fse_decompress.c +311 -0
  182. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/huf.h +273 -0
  183. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/mem.h +435 -0
  184. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/pool.c +371 -0
  185. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/pool.h +90 -0
  186. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/portability_macros.h +156 -0
  187. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/threading.c +176 -0
  188. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/threading.h +150 -0
  189. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/xxhash.c +24 -0
  190. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/xxhash.h +5686 -0
  191. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_common.c +48 -0
  192. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_deps.h +111 -0
  193. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_internal.h +392 -0
  194. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/common/zstd_trace.h +163 -0
  195. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/clevels.h +134 -0
  196. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/fse_compress.c +624 -0
  197. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/hist.c +181 -0
  198. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/hist.h +75 -0
  199. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/huf_compress.c +1435 -0
  200. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress.c +7032 -0
  201. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_internal.h +1532 -0
  202. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_literals.c +235 -0
  203. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_literals.h +39 -0
  204. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_sequences.c +442 -0
  205. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_sequences.h +54 -0
  206. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_superblock.c +577 -0
  207. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_compress_superblock.h +32 -0
  208. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_cwksp.h +742 -0
  209. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_double_fast.c +758 -0
  210. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_double_fast.h +39 -0
  211. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_fast.c +960 -0
  212. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_fast.h +38 -0
  213. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_lazy.c +2157 -0
  214. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_lazy.h +127 -0
  215. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_ldm.c +724 -0
  216. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_ldm.h +117 -0
  217. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_ldm_geartab.h +106 -0
  218. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_opt.c +1472 -0
  219. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstd_opt.h +56 -0
  220. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstdmt_compress.c +1867 -0
  221. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/compress/zstdmt_compress.h +113 -0
  222. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/huf_decompress.c +1882 -0
  223. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/huf_decompress_amd64.S +576 -0
  224. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_ddict.c +244 -0
  225. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_ddict.h +44 -0
  226. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress.c +2355 -0
  227. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress_block.c +2192 -0
  228. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress_block.h +73 -0
  229. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/decompress/zstd_decompress_internal.h +238 -0
  230. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/cover.c +1257 -0
  231. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/cover.h +158 -0
  232. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/divsufsort.c +1913 -0
  233. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/divsufsort.h +67 -0
  234. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/fastcover.c +766 -0
  235. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/dictBuilder/zdict.c +1127 -0
  236. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_legacy.h +422 -0
  237. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v01.c +2125 -0
  238. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v01.h +94 -0
  239. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v02.c +3477 -0
  240. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v02.h +93 -0
  241. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v03.c +3117 -0
  242. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v03.h +93 -0
  243. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v04.c +3605 -0
  244. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v04.h +142 -0
  245. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v05.c +4004 -0
  246. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v05.h +162 -0
  247. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v06.c +4113 -0
  248. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v06.h +172 -0
  249. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v07.c +4498 -0
  250. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/legacy/zstd_v07.h +187 -0
  251. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zdict.h +474 -0
  252. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zstd.h +3020 -0
  253. data/ext/clickhouse_native/vendor/clickhouse-cpp/contrib/zstd/zstd/zstd_errors.h +114 -0
  254. data/lib/clickhouse_native/clickhouse_native.bundle +0 -0
  255. data/lib/clickhouse_native/client.rb +50 -0
  256. data/lib/clickhouse_native/errors.rb +23 -0
  257. data/lib/clickhouse_native/pool.rb +49 -0
  258. data/lib/clickhouse_native/version.rb +3 -0
  259. data/lib/clickhouse_native.rb +8 -0
  260. metadata +369 -0
@@ -0,0 +1,219 @@
1
+ // Copyright 2018 The Abseil Authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // https://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ #ifndef ABSL_BASE_INTERNAL_BITS_H_
16
+ #define ABSL_BASE_INTERNAL_BITS_H_
17
+
18
+ // This file contains bitwise ops which are implementation details of various
19
+ // absl libraries.
20
+
21
+ #include <cstdint>
22
+
23
+ #include "absl/base/config.h"
24
+
25
+ // Clang on Windows has __builtin_clzll; otherwise we need to use the
26
+ // windows intrinsic functions.
27
+ #if defined(_MSC_VER) && !defined(__clang__)
28
+ #include <intrin.h>
29
+ #if defined(_M_X64)
30
+ #pragma intrinsic(_BitScanReverse64)
31
+ #pragma intrinsic(_BitScanForward64)
32
+ #endif
33
+ #pragma intrinsic(_BitScanReverse)
34
+ #pragma intrinsic(_BitScanForward)
35
+ #endif
36
+
37
+ #include "absl/base/attributes.h"
38
+
39
+ #if defined(_MSC_VER) && !defined(__clang__)
40
+ // We can achieve something similar to attribute((always_inline)) with MSVC by
41
+ // using the __forceinline keyword, however this is not perfect. MSVC is
42
+ // much less aggressive about inlining, and even with the __forceinline keyword.
43
+ #define ABSL_BASE_INTERNAL_FORCEINLINE __forceinline
44
+ #else
45
+ // Use default attribute inline.
46
+ #define ABSL_BASE_INTERNAL_FORCEINLINE inline ABSL_ATTRIBUTE_ALWAYS_INLINE
47
+ #endif
48
+
49
+
50
+ namespace absl {
51
+ ABSL_NAMESPACE_BEGIN
52
+ namespace base_internal {
53
+
54
+ ABSL_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros64Slow(uint64_t n) {
55
+ int zeroes = 60;
56
+ if (n >> 32) {
57
+ zeroes -= 32;
58
+ n >>= 32;
59
+ }
60
+ if (n >> 16) {
61
+ zeroes -= 16;
62
+ n >>= 16;
63
+ }
64
+ if (n >> 8) {
65
+ zeroes -= 8;
66
+ n >>= 8;
67
+ }
68
+ if (n >> 4) {
69
+ zeroes -= 4;
70
+ n >>= 4;
71
+ }
72
+ return "\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[n] + zeroes;
73
+ }
74
+
75
+ ABSL_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros64(uint64_t n) {
76
+ #if defined(_MSC_VER) && !defined(__clang__) && defined(_M_X64)
77
+ // MSVC does not have __buitin_clzll. Use _BitScanReverse64.
78
+ unsigned long result = 0; // NOLINT(runtime/int)
79
+ if (_BitScanReverse64(&result, n)) {
80
+ return 63 - result;
81
+ }
82
+ return 64;
83
+ #elif defined(_MSC_VER) && !defined(__clang__)
84
+ // MSVC does not have __buitin_clzll. Compose two calls to _BitScanReverse
85
+ unsigned long result = 0; // NOLINT(runtime/int)
86
+ if ((n >> 32) &&
87
+ _BitScanReverse(&result, static_cast<unsigned long>(n >> 32))) {
88
+ return 31 - result;
89
+ }
90
+ if (_BitScanReverse(&result, static_cast<unsigned long>(n))) {
91
+ return 63 - result;
92
+ }
93
+ return 64;
94
+ #elif defined(__GNUC__) || defined(__clang__)
95
+ // Use __builtin_clzll, which uses the following instructions:
96
+ // x86: bsr
97
+ // ARM64: clz
98
+ // PPC: cntlzd
99
+ static_assert(sizeof(unsigned long long) == sizeof(n), // NOLINT(runtime/int)
100
+ "__builtin_clzll does not take 64-bit arg");
101
+
102
+ // Handle 0 as a special case because __builtin_clzll(0) is undefined.
103
+ if (n == 0) {
104
+ return 64;
105
+ }
106
+ return __builtin_clzll(n);
107
+ #else
108
+ return CountLeadingZeros64Slow(n);
109
+ #endif
110
+ }
111
+
112
+ ABSL_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros32Slow(uint64_t n) {
113
+ int zeroes = 28;
114
+ if (n >> 16) {
115
+ zeroes -= 16;
116
+ n >>= 16;
117
+ }
118
+ if (n >> 8) {
119
+ zeroes -= 8;
120
+ n >>= 8;
121
+ }
122
+ if (n >> 4) {
123
+ zeroes -= 4;
124
+ n >>= 4;
125
+ }
126
+ return "\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[n] + zeroes;
127
+ }
128
+
129
+ ABSL_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros32(uint32_t n) {
130
+ #if defined(_MSC_VER) && !defined(__clang__)
131
+ unsigned long result = 0; // NOLINT(runtime/int)
132
+ if (_BitScanReverse(&result, n)) {
133
+ return 31 - result;
134
+ }
135
+ return 32;
136
+ #elif defined(__GNUC__) || defined(__clang__)
137
+ // Use __builtin_clz, which uses the following instructions:
138
+ // x86: bsr
139
+ // ARM64: clz
140
+ // PPC: cntlzd
141
+ static_assert(sizeof(int) == sizeof(n),
142
+ "__builtin_clz does not take 32-bit arg");
143
+
144
+ // Handle 0 as a special case because __builtin_clz(0) is undefined.
145
+ if (n == 0) {
146
+ return 32;
147
+ }
148
+ return __builtin_clz(n);
149
+ #else
150
+ return CountLeadingZeros32Slow(n);
151
+ #endif
152
+ }
153
+
154
+ ABSL_BASE_INTERNAL_FORCEINLINE int CountTrailingZerosNonZero64Slow(uint64_t n) {
155
+ int c = 63;
156
+ n &= ~n + 1;
157
+ if (n & 0x00000000FFFFFFFF) c -= 32;
158
+ if (n & 0x0000FFFF0000FFFF) c -= 16;
159
+ if (n & 0x00FF00FF00FF00FF) c -= 8;
160
+ if (n & 0x0F0F0F0F0F0F0F0F) c -= 4;
161
+ if (n & 0x3333333333333333) c -= 2;
162
+ if (n & 0x5555555555555555) c -= 1;
163
+ return c;
164
+ }
165
+
166
+ ABSL_BASE_INTERNAL_FORCEINLINE int CountTrailingZerosNonZero64(uint64_t n) {
167
+ #if defined(_MSC_VER) && !defined(__clang__) && defined(_M_X64)
168
+ unsigned long result = 0; // NOLINT(runtime/int)
169
+ _BitScanForward64(&result, n);
170
+ return result;
171
+ #elif defined(_MSC_VER) && !defined(__clang__)
172
+ unsigned long result = 0; // NOLINT(runtime/int)
173
+ if (static_cast<uint32_t>(n) == 0) {
174
+ _BitScanForward(&result, static_cast<unsigned long>(n >> 32));
175
+ return result + 32;
176
+ }
177
+ _BitScanForward(&result, static_cast<unsigned long>(n));
178
+ return result;
179
+ #elif defined(__GNUC__) || defined(__clang__)
180
+ static_assert(sizeof(unsigned long long) == sizeof(n), // NOLINT(runtime/int)
181
+ "__builtin_ctzll does not take 64-bit arg");
182
+ return __builtin_ctzll(n);
183
+ #else
184
+ return CountTrailingZerosNonZero64Slow(n);
185
+ #endif
186
+ }
187
+
188
+ ABSL_BASE_INTERNAL_FORCEINLINE int CountTrailingZerosNonZero32Slow(uint32_t n) {
189
+ int c = 31;
190
+ n &= ~n + 1;
191
+ if (n & 0x0000FFFF) c -= 16;
192
+ if (n & 0x00FF00FF) c -= 8;
193
+ if (n & 0x0F0F0F0F) c -= 4;
194
+ if (n & 0x33333333) c -= 2;
195
+ if (n & 0x55555555) c -= 1;
196
+ return c;
197
+ }
198
+
199
+ ABSL_BASE_INTERNAL_FORCEINLINE int CountTrailingZerosNonZero32(uint32_t n) {
200
+ #if defined(_MSC_VER) && !defined(__clang__)
201
+ unsigned long result = 0; // NOLINT(runtime/int)
202
+ _BitScanForward(&result, n);
203
+ return result;
204
+ #elif defined(__GNUC__) || defined(__clang__)
205
+ static_assert(sizeof(int) == sizeof(n),
206
+ "__builtin_ctz does not take 32-bit arg");
207
+ return __builtin_ctz(n);
208
+ #else
209
+ return CountTrailingZerosNonZero32Slow(n);
210
+ #endif
211
+ }
212
+
213
+ #undef ABSL_BASE_INTERNAL_FORCEINLINE
214
+
215
+ } // namespace base_internal
216
+ ABSL_NAMESPACE_END
217
+ } // namespace absl
218
+
219
+ #endif // ABSL_BASE_INTERNAL_BITS_H_
@@ -0,0 +1,147 @@
1
+ //
2
+ // Copyright 2017 The Abseil Authors.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+ // -----------------------------------------------------------------------------
17
+ // File: macros.h
18
+ // -----------------------------------------------------------------------------
19
+ //
20
+ // This header file defines the set of language macros used within Abseil code.
21
+ // For the set of macros used to determine supported compilers and platforms,
22
+ // see absl/base/config.h instead.
23
+ //
24
+ // This code is compiled directly on many platforms, including client
25
+ // platforms like Windows, Mac, and embedded systems. Before making
26
+ // any changes here, make sure that you're not breaking any platforms.
27
+
28
+ #ifndef ABSL_BASE_MACROS_H_
29
+ #define ABSL_BASE_MACROS_H_
30
+
31
+ #include <cassert>
32
+ #include <cstddef>
33
+
34
+ #include "absl/base/attributes.h"
35
+ #include "absl/base/config.h"
36
+ #include "absl/base/optimization.h"
37
+ #include "absl/base/port.h"
38
+
39
+ // ABSL_ARRAYSIZE()
40
+ //
41
+ // Returns the number of elements in an array as a compile-time constant, which
42
+ // can be used in defining new arrays. If you use this macro on a pointer by
43
+ // mistake, you will get a compile-time error.
44
+ #define ABSL_ARRAYSIZE(array) \
45
+ (sizeof(::absl::macros_internal::ArraySizeHelper(array)))
46
+
47
+ namespace absl {
48
+ ABSL_NAMESPACE_BEGIN
49
+ namespace macros_internal {
50
+ // Note: this internal template function declaration is used by ABSL_ARRAYSIZE.
51
+ // The function doesn't need a definition, as we only use its type.
52
+ template <typename T, size_t N>
53
+ auto ArraySizeHelper(const T (&array)[N]) -> char (&)[N];
54
+ } // namespace macros_internal
55
+ ABSL_NAMESPACE_END
56
+ } // namespace absl
57
+
58
+ // ABSL_BAD_CALL_IF()
59
+ //
60
+ // Used on a function overload to trap bad calls: any call that matches the
61
+ // overload will cause a compile-time error. This macro uses a clang-specific
62
+ // "enable_if" attribute, as described at
63
+ // https://clang.llvm.org/docs/AttributeReference.html#enable-if
64
+ //
65
+ // Overloads which use this macro should be bracketed by
66
+ // `#ifdef ABSL_BAD_CALL_IF`.
67
+ //
68
+ // Example:
69
+ //
70
+ // int isdigit(int c);
71
+ // #ifdef ABSL_BAD_CALL_IF
72
+ // int isdigit(int c)
73
+ // ABSL_BAD_CALL_IF(c <= -1 || c > 255,
74
+ // "'c' must have the value of an unsigned char or EOF");
75
+ // #endif // ABSL_BAD_CALL_IF
76
+ #if ABSL_HAVE_ATTRIBUTE(enable_if)
77
+ #define ABSL_BAD_CALL_IF(expr, msg) \
78
+ __attribute__((enable_if(expr, "Bad call trap"), unavailable(msg)))
79
+ #endif
80
+
81
+ // ABSL_ASSERT()
82
+ //
83
+ // In C++11, `assert` can't be used portably within constexpr functions.
84
+ // ABSL_ASSERT functions as a runtime assert but works in C++11 constexpr
85
+ // functions. Example:
86
+ //
87
+ // constexpr double Divide(double a, double b) {
88
+ // return ABSL_ASSERT(b != 0), a / b;
89
+ // }
90
+ //
91
+ // This macro is inspired by
92
+ // https://akrzemi1.wordpress.com/2017/05/18/asserts-in-constexpr-functions/
93
+ #if defined(NDEBUG)
94
+ #define ABSL_ASSERT(expr) \
95
+ (false ? static_cast<void>(expr) : static_cast<void>(0))
96
+ #else
97
+ #define ABSL_ASSERT(expr) \
98
+ (ABSL_PREDICT_TRUE((expr)) ? static_cast<void>(0) \
99
+ : [] { assert(false && #expr); }()) // NOLINT
100
+ #endif
101
+
102
+ // `ABSL_INTERNAL_HARDENING_ABORT()` controls how `ABSL_HARDENING_ASSERT()`
103
+ // aborts the program in release mode (when NDEBUG is defined). The
104
+ // implementation should abort the program as quickly as possible and ideally it
105
+ // should not be possible to ignore the abort request.
106
+ #if (ABSL_HAVE_BUILTIN(__builtin_trap) && \
107
+ ABSL_HAVE_BUILTIN(__builtin_unreachable)) || \
108
+ (defined(__GNUC__) && !defined(__clang__))
109
+ #define ABSL_INTERNAL_HARDENING_ABORT() \
110
+ do { \
111
+ __builtin_trap(); \
112
+ __builtin_unreachable(); \
113
+ } while (false)
114
+ #else
115
+ #define ABSL_INTERNAL_HARDENING_ABORT() abort()
116
+ #endif
117
+
118
+ // ABSL_HARDENING_ASSERT()
119
+ //
120
+ // `ABSL_HARDENING_ASSERT()` is like `ABSL_ASSERT()`, but used to implement
121
+ // runtime assertions that should be enabled in hardened builds even when
122
+ // `NDEBUG` is defined.
123
+ //
124
+ // When `NDEBUG` is not defined, `ABSL_HARDENING_ASSERT()` is identical to
125
+ // `ABSL_ASSERT()`.
126
+ //
127
+ // See `ABSL_OPTION_HARDENED` in `absl/base/options.h` for more information on
128
+ // hardened mode.
129
+ #if ABSL_OPTION_HARDENED == 1 && defined(NDEBUG)
130
+ #define ABSL_HARDENING_ASSERT(expr) \
131
+ (ABSL_PREDICT_TRUE((expr)) ? static_cast<void>(0) \
132
+ : [] { ABSL_INTERNAL_HARDENING_ABORT(); }())
133
+ #else
134
+ #define ABSL_HARDENING_ASSERT(expr) ABSL_ASSERT(expr)
135
+ #endif
136
+
137
+ #ifdef ABSL_HAVE_EXCEPTIONS
138
+ #define ABSL_INTERNAL_TRY try
139
+ #define ABSL_INTERNAL_CATCH_ANY catch (...)
140
+ #define ABSL_INTERNAL_RETHROW do { throw; } while (false)
141
+ #else // ABSL_HAVE_EXCEPTIONS
142
+ #define ABSL_INTERNAL_TRY if (true)
143
+ #define ABSL_INTERNAL_CATCH_ANY else if (false)
144
+ #define ABSL_INTERNAL_RETHROW do {} while (false)
145
+ #endif // ABSL_HAVE_EXCEPTIONS
146
+
147
+ #endif // ABSL_BASE_MACROS_H_
@@ -0,0 +1,241 @@
1
+ //
2
+ // Copyright 2017 The Abseil Authors.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+ // -----------------------------------------------------------------------------
17
+ // File: optimization.h
18
+ // -----------------------------------------------------------------------------
19
+ //
20
+ // This header file defines portable macros for performance optimization.
21
+
22
+ #ifndef ABSL_BASE_OPTIMIZATION_H_
23
+ #define ABSL_BASE_OPTIMIZATION_H_
24
+
25
+ #include "absl/base/config.h"
26
+
27
+ // ABSL_BLOCK_TAIL_CALL_OPTIMIZATION
28
+ //
29
+ // Instructs the compiler to avoid optimizing tail-call recursion. Use of this
30
+ // macro is useful when you wish to preserve the existing function order within
31
+ // a stack trace for logging, debugging, or profiling purposes.
32
+ //
33
+ // Example:
34
+ //
35
+ // int f() {
36
+ // int result = g();
37
+ // ABSL_BLOCK_TAIL_CALL_OPTIMIZATION();
38
+ // return result;
39
+ // }
40
+ #if defined(__pnacl__)
41
+ #define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() if (volatile int x = 0) { (void)x; }
42
+ #elif defined(__clang__)
43
+ // Clang will not tail call given inline volatile assembly.
44
+ #define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__("")
45
+ #elif defined(__GNUC__)
46
+ // GCC will not tail call given inline volatile assembly.
47
+ #define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__("")
48
+ #elif defined(_MSC_VER)
49
+ #include <intrin.h>
50
+ // The __nop() intrinsic blocks the optimisation.
51
+ #define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() __nop()
52
+ #else
53
+ #define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() if (volatile int x = 0) { (void)x; }
54
+ #endif
55
+
56
+ // ABSL_CACHELINE_SIZE
57
+ //
58
+ // Explicitly defines the size of the L1 cache for purposes of alignment.
59
+ // Setting the cacheline size allows you to specify that certain objects be
60
+ // aligned on a cacheline boundary with `ABSL_CACHELINE_ALIGNED` declarations.
61
+ // (See below.)
62
+ //
63
+ // NOTE: this macro should be replaced with the following C++17 features, when
64
+ // those are generally available:
65
+ //
66
+ // * `std::hardware_constructive_interference_size`
67
+ // * `std::hardware_destructive_interference_size`
68
+ //
69
+ // See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0154r1.html
70
+ // for more information.
71
+ #if defined(__GNUC__)
72
+ // Cache line alignment
73
+ #if defined(__i386__) || defined(__x86_64__)
74
+ #define ABSL_CACHELINE_SIZE 64
75
+ #elif defined(__powerpc64__)
76
+ #define ABSL_CACHELINE_SIZE 128
77
+ #elif defined(__aarch64__)
78
+ // We would need to read special register ctr_el0 to find out L1 dcache size.
79
+ // This value is a good estimate based on a real aarch64 machine.
80
+ #define ABSL_CACHELINE_SIZE 64
81
+ #elif defined(__arm__)
82
+ // Cache line sizes for ARM: These values are not strictly correct since
83
+ // cache line sizes depend on implementations, not architectures. There
84
+ // are even implementations with cache line sizes configurable at boot
85
+ // time.
86
+ #if defined(__ARM_ARCH_5T__)
87
+ #define ABSL_CACHELINE_SIZE 32
88
+ #elif defined(__ARM_ARCH_7A__)
89
+ #define ABSL_CACHELINE_SIZE 64
90
+ #endif
91
+ #endif
92
+
93
+ #ifndef ABSL_CACHELINE_SIZE
94
+ // A reasonable default guess. Note that overestimates tend to waste more
95
+ // space, while underestimates tend to waste more time.
96
+ #define ABSL_CACHELINE_SIZE 64
97
+ #endif
98
+
99
+ // ABSL_CACHELINE_ALIGNED
100
+ //
101
+ // Indicates that the declared object be cache aligned using
102
+ // `ABSL_CACHELINE_SIZE` (see above). Cacheline aligning objects allows you to
103
+ // load a set of related objects in the L1 cache for performance improvements.
104
+ // Cacheline aligning objects properly allows constructive memory sharing and
105
+ // prevents destructive (or "false") memory sharing.
106
+ //
107
+ // NOTE: this macro should be replaced with usage of `alignas()` using
108
+ // `std::hardware_constructive_interference_size` and/or
109
+ // `std::hardware_destructive_interference_size` when available within C++17.
110
+ //
111
+ // See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0154r1.html
112
+ // for more information.
113
+ //
114
+ // On some compilers, `ABSL_CACHELINE_ALIGNED` expands to an `__attribute__`
115
+ // or `__declspec` attribute. For compilers where this is not known to work,
116
+ // the macro expands to nothing.
117
+ //
118
+ // No further guarantees are made here. The result of applying the macro
119
+ // to variables and types is always implementation-defined.
120
+ //
121
+ // WARNING: It is easy to use this attribute incorrectly, even to the point
122
+ // of causing bugs that are difficult to diagnose, crash, etc. It does not
123
+ // of itself guarantee that objects are aligned to a cache line.
124
+ //
125
+ // NOTE: Some compilers are picky about the locations of annotations such as
126
+ // this attribute, so prefer to put it at the beginning of your declaration.
127
+ // For example,
128
+ //
129
+ // ABSL_CACHELINE_ALIGNED static Foo* foo = ...
130
+ //
131
+ // class ABSL_CACHELINE_ALIGNED Bar { ...
132
+ //
133
+ // Recommendations:
134
+ //
135
+ // 1) Consult compiler documentation; this comment is not kept in sync as
136
+ // toolchains evolve.
137
+ // 2) Verify your use has the intended effect. This often requires inspecting
138
+ // the generated machine code.
139
+ // 3) Prefer applying this attribute to individual variables. Avoid
140
+ // applying it to types. This tends to localize the effect.
141
+ #define ABSL_CACHELINE_ALIGNED __attribute__((aligned(ABSL_CACHELINE_SIZE)))
142
+ #elif defined(_MSC_VER)
143
+ #define ABSL_CACHELINE_SIZE 64
144
+ #define ABSL_CACHELINE_ALIGNED __declspec(align(ABSL_CACHELINE_SIZE))
145
+ #else
146
+ #define ABSL_CACHELINE_SIZE 64
147
+ #define ABSL_CACHELINE_ALIGNED
148
+ #endif
149
+
150
+ // ABSL_PREDICT_TRUE, ABSL_PREDICT_FALSE
151
+ //
152
+ // Enables the compiler to prioritize compilation using static analysis for
153
+ // likely paths within a boolean branch.
154
+ //
155
+ // Example:
156
+ //
157
+ // if (ABSL_PREDICT_TRUE(expression)) {
158
+ // return result; // Faster if more likely
159
+ // } else {
160
+ // return 0;
161
+ // }
162
+ //
163
+ // Compilers can use the information that a certain branch is not likely to be
164
+ // taken (for instance, a CHECK failure) to optimize for the common case in
165
+ // the absence of better information (ie. compiling gcc with `-fprofile-arcs`).
166
+ //
167
+ // Recommendation: Modern CPUs dynamically predict branch execution paths,
168
+ // typically with accuracy greater than 97%. As a result, annotating every
169
+ // branch in a codebase is likely counterproductive; however, annotating
170
+ // specific branches that are both hot and consistently mispredicted is likely
171
+ // to yield performance improvements.
172
+ #if ABSL_HAVE_BUILTIN(__builtin_expect) || \
173
+ (defined(__GNUC__) && !defined(__clang__))
174
+ #define ABSL_PREDICT_FALSE(x) (__builtin_expect(false || (x), false))
175
+ #define ABSL_PREDICT_TRUE(x) (__builtin_expect(false || (x), true))
176
+ #else
177
+ #define ABSL_PREDICT_FALSE(x) (x)
178
+ #define ABSL_PREDICT_TRUE(x) (x)
179
+ #endif
180
+
181
+ // ABSL_INTERNAL_ASSUME(cond)
182
+ // Informs the compiler than a condition is always true and that it can assume
183
+ // it to be true for optimization purposes. The call has undefined behavior if
184
+ // the condition is false.
185
+ // In !NDEBUG mode, the condition is checked with an assert().
186
+ // NOTE: The expression must not have side effects, as it will only be evaluated
187
+ // in some compilation modes and not others.
188
+ //
189
+ // Example:
190
+ //
191
+ // int x = ...;
192
+ // ABSL_INTERNAL_ASSUME(x >= 0);
193
+ // // The compiler can optimize the division to a simple right shift using the
194
+ // // assumption specified above.
195
+ // int y = x / 16;
196
+ //
197
+ #if !defined(NDEBUG)
198
+ #define ABSL_INTERNAL_ASSUME(cond) assert(cond)
199
+ #elif ABSL_HAVE_BUILTIN(__builtin_assume)
200
+ #define ABSL_INTERNAL_ASSUME(cond) __builtin_assume(cond)
201
+ #elif defined(__GNUC__) || ABSL_HAVE_BUILTIN(__builtin_unreachable)
202
+ #define ABSL_INTERNAL_ASSUME(cond) \
203
+ do { \
204
+ if (!(cond)) __builtin_unreachable(); \
205
+ } while (0)
206
+ #elif defined(_MSC_VER)
207
+ #define ABSL_INTERNAL_ASSUME(cond) __assume(cond)
208
+ #else
209
+ #define ABSL_INTERNAL_ASSUME(cond) \
210
+ do { \
211
+ static_cast<void>(false && (cond)); \
212
+ } while (0)
213
+ #endif
214
+
215
+ // ABSL_INTERNAL_UNIQUE_SMALL_NAME(cond)
216
+ // This macro forces small unique name on a static file level symbols like
217
+ // static local variables or static functions. This is intended to be used in
218
+ // macro definitions to optimize the cost of generated code. Do NOT use it on
219
+ // symbols exported from translation unit since it may casue a link time
220
+ // conflict.
221
+ //
222
+ // Example:
223
+ //
224
+ // #define MY_MACRO(txt)
225
+ // namespace {
226
+ // char VeryVeryLongVarName[] ABSL_INTERNAL_UNIQUE_SMALL_NAME() = txt;
227
+ // const char* VeryVeryLongFuncName() ABSL_INTERNAL_UNIQUE_SMALL_NAME();
228
+ // const char* VeryVeryLongFuncName() { return txt; }
229
+ // }
230
+ //
231
+
232
+ #if defined(__GNUC__)
233
+ #define ABSL_INTERNAL_UNIQUE_SMALL_NAME2(x) #x
234
+ #define ABSL_INTERNAL_UNIQUE_SMALL_NAME1(x) ABSL_INTERNAL_UNIQUE_SMALL_NAME2(x)
235
+ #define ABSL_INTERNAL_UNIQUE_SMALL_NAME() \
236
+ asm(ABSL_INTERNAL_UNIQUE_SMALL_NAME1(.absl.__COUNTER__))
237
+ #else
238
+ #define ABSL_INTERNAL_UNIQUE_SMALL_NAME()
239
+ #endif
240
+
241
+ #endif // ABSL_BASE_OPTIMIZATION_H_