@shd101wyy/yo 0.0.2

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 (339) hide show
  1. package/LICENSE.md +17 -0
  2. package/README.md +80 -0
  3. package/out/cjs/index.cjs +51 -0
  4. package/out/cjs/yo-cli.cjs +2158 -0
  5. package/out/esm/index.mjs +51 -0
  6. package/out/types/src/codegen/async/runtime.d.ts +2 -0
  7. package/out/types/src/codegen/async/state-code-gen.d.ts +10 -0
  8. package/out/types/src/codegen/async/state-machine.d.ts +13 -0
  9. package/out/types/src/codegen/c/collection.d.ts +3 -0
  10. package/out/types/src/codegen/codegen-c.d.ts +12 -0
  11. package/out/types/src/codegen/constants.d.ts +3 -0
  12. package/out/types/src/codegen/expressions/array.d.ts +4 -0
  13. package/out/types/src/codegen/expressions/generation.d.ts +11 -0
  14. package/out/types/src/codegen/expressions/index.d.ts +2 -0
  15. package/out/types/src/codegen/functions/collection.d.ts +5 -0
  16. package/out/types/src/codegen/functions/context.d.ts +57 -0
  17. package/out/types/src/codegen/functions/generation.d.ts +25 -0
  18. package/out/types/src/codegen/functions/index.d.ts +2 -0
  19. package/out/types/src/codegen/index.d.ts +20 -0
  20. package/out/types/src/codegen/parallelism/runtime.d.ts +2 -0
  21. package/out/types/src/codegen/types/collection.d.ts +8 -0
  22. package/out/types/src/codegen/types/generation.d.ts +13 -0
  23. package/out/types/src/codegen/types/index.d.ts +2 -0
  24. package/out/types/src/codegen/utils/fixup.d.ts +2 -0
  25. package/out/types/src/codegen/utils/index.d.ts +77 -0
  26. package/out/types/src/codegen/values/index.d.ts +1 -0
  27. package/out/types/src/emitter.d.ts +11 -0
  28. package/out/types/src/env.d.ts +85 -0
  29. package/out/types/src/error.d.ts +45 -0
  30. package/out/types/src/evaluator/async/await-analysis-types.d.ts +23 -0
  31. package/out/types/src/evaluator/async/await-analysis.d.ts +5 -0
  32. package/out/types/src/evaluator/builtins/alignof.d.ts +8 -0
  33. package/out/types/src/evaluator/builtins/and_or.d.ts +8 -0
  34. package/out/types/src/evaluator/builtins/arc_fns.d.ts +58 -0
  35. package/out/types/src/evaluator/builtins/array_fns.d.ts +0 -0
  36. package/out/types/src/evaluator/builtins/as.d.ts +8 -0
  37. package/out/types/src/evaluator/builtins/async_fns.d.ts +8 -0
  38. package/out/types/src/evaluator/builtins/compt_assert.d.ts +8 -0
  39. package/out/types/src/evaluator/builtins/compt_boolean_fns.d.ts +8 -0
  40. package/out/types/src/evaluator/builtins/compt_expect_error.d.ts +8 -0
  41. package/out/types/src/evaluator/builtins/compt_list_fns.d.ts +33 -0
  42. package/out/types/src/evaluator/builtins/compt_print.d.ts +8 -0
  43. package/out/types/src/evaluator/builtins/compt_string_fns.d.ts +8 -0
  44. package/out/types/src/evaluator/builtins/consume.d.ts +8 -0
  45. package/out/types/src/evaluator/builtins/drop.d.ts +8 -0
  46. package/out/types/src/evaluator/builtins/dup.d.ts +8 -0
  47. package/out/types/src/evaluator/builtins/expr_fns.d.ts +33 -0
  48. package/out/types/src/evaluator/builtins/future_fns.d.ts +8 -0
  49. package/out/types/src/evaluator/builtins/gc.d.ts +8 -0
  50. package/out/types/src/evaluator/builtins/gensym.d.ts +8 -0
  51. package/out/types/src/evaluator/builtins/impl_constraint.d.ts +8 -0
  52. package/out/types/src/evaluator/builtins/macro_expand.d.ts +8 -0
  53. package/out/types/src/evaluator/builtins/numeric_fns.d.ts +8 -0
  54. package/out/types/src/evaluator/builtins/panic.d.ts +8 -0
  55. package/out/types/src/evaluator/builtins/ptr_fns.d.ts +8 -0
  56. package/out/types/src/evaluator/builtins/quote.d.ts +13 -0
  57. package/out/types/src/evaluator/builtins/rc.d.ts +8 -0
  58. package/out/types/src/evaluator/builtins/sizeof.d.ts +8 -0
  59. package/out/types/src/evaluator/builtins/the.d.ts +8 -0
  60. package/out/types/src/evaluator/builtins/type_fns.d.ts +28 -0
  61. package/out/types/src/evaluator/builtins/va_start.d.ts +8 -0
  62. package/out/types/src/evaluator/builtins/var_fns.d.ts +18 -0
  63. package/out/types/src/evaluator/calls/array.d.ts +13 -0
  64. package/out/types/src/evaluator/calls/array_type.d.ts +11 -0
  65. package/out/types/src/evaluator/calls/closure_type.d.ts +11 -0
  66. package/out/types/src/evaluator/calls/compt_function.d.ts +19 -0
  67. package/out/types/src/evaluator/calls/compt_list_type.d.ts +11 -0
  68. package/out/types/src/evaluator/calls/function.d.ts +16 -0
  69. package/out/types/src/evaluator/calls/function_type.d.ts +15 -0
  70. package/out/types/src/evaluator/calls/helper.d.ts +42 -0
  71. package/out/types/src/evaluator/calls/iso.d.ts +15 -0
  72. package/out/types/src/evaluator/calls/module_type.d.ts +11 -0
  73. package/out/types/src/evaluator/calls/numeric_type.d.ts +15 -0
  74. package/out/types/src/evaluator/calls/pointer.d.ts +8 -0
  75. package/out/types/src/evaluator/calls/pointer_type.d.ts +14 -0
  76. package/out/types/src/evaluator/calls/type.d.ts +12 -0
  77. package/out/types/src/evaluator/context.d.ts +169 -0
  78. package/out/types/src/evaluator/exprs/_expr.d.ts +8 -0
  79. package/out/types/src/evaluator/exprs/assignment.d.ts +9 -0
  80. package/out/types/src/evaluator/exprs/begin.d.ts +10 -0
  81. package/out/types/src/evaluator/exprs/binding.d.ts +12 -0
  82. package/out/types/src/evaluator/exprs/c_include.d.ts +8 -0
  83. package/out/types/src/evaluator/exprs/cond.d.ts +8 -0
  84. package/out/types/src/evaluator/exprs/destructuring_assignment.d.ts +33 -0
  85. package/out/types/src/evaluator/exprs/exists.d.ts +0 -0
  86. package/out/types/src/evaluator/exprs/expr.d.ts +9 -0
  87. package/out/types/src/evaluator/exprs/extern.d.ts +8 -0
  88. package/out/types/src/evaluator/exprs/identifer_and_operator.d.ts +9 -0
  89. package/out/types/src/evaluator/exprs/import.d.ts +9 -0
  90. package/out/types/src/evaluator/exprs/initialization_assignment.d.ts +8 -0
  91. package/out/types/src/evaluator/exprs/match.d.ts +8 -0
  92. package/out/types/src/evaluator/exprs/open.d.ts +8 -0
  93. package/out/types/src/evaluator/exprs/property_access.d.ts +8 -0
  94. package/out/types/src/evaluator/exprs/recur.d.ts +8 -0
  95. package/out/types/src/evaluator/exprs/subtype_of.d.ts +21 -0
  96. package/out/types/src/evaluator/exprs/test.d.ts +8 -0
  97. package/out/types/src/evaluator/exprs/typeof.d.ts +8 -0
  98. package/out/types/src/evaluator/exprs/while.d.ts +8 -0
  99. package/out/types/src/evaluator/index.d.ts +26 -0
  100. package/out/types/src/evaluator/types/array.d.ts +8 -0
  101. package/out/types/src/evaluator/types/closure.d.ts +8 -0
  102. package/out/types/src/evaluator/types/compt_list.d.ts +8 -0
  103. package/out/types/src/evaluator/types/concrete_module.d.ts +8 -0
  104. package/out/types/src/evaluator/types/dyn.d.ts +8 -0
  105. package/out/types/src/evaluator/types/enum.d.ts +8 -0
  106. package/out/types/src/evaluator/types/expr_synthesizer.d.ts +14 -0
  107. package/out/types/src/evaluator/types/field.d.ts +14 -0
  108. package/out/types/src/evaluator/types/fn_module.d.ts +8 -0
  109. package/out/types/src/evaluator/types/function.d.ts +58 -0
  110. package/out/types/src/evaluator/types/future_module.d.ts +8 -0
  111. package/out/types/src/evaluator/types/module.d.ts +19 -0
  112. package/out/types/src/evaluator/types/newtype.d.ts +8 -0
  113. package/out/types/src/evaluator/types/object.d.ts +8 -0
  114. package/out/types/src/evaluator/types/proofs.d.ts +0 -0
  115. package/out/types/src/evaluator/types/slice.d.ts +8 -0
  116. package/out/types/src/evaluator/types/struct.d.ts +8 -0
  117. package/out/types/src/evaluator/types/synthesizer.d.ts +16 -0
  118. package/out/types/src/evaluator/types/tuple.d.ts +18 -0
  119. package/out/types/src/evaluator/types/union.d.ts +8 -0
  120. package/out/types/src/evaluator/types/utils.d.ts +71 -0
  121. package/out/types/src/evaluator/types/validation.d.ts +3 -0
  122. package/out/types/src/evaluator/utils/array-utils.d.ts +15 -0
  123. package/out/types/src/evaluator/utils/closure.d.ts +35 -0
  124. package/out/types/src/evaluator/utils.d.ts +4 -0
  125. package/out/types/src/evaluator/values/anonymous_function.d.ts +8 -0
  126. package/out/types/src/evaluator/values/anonymous_module.d.ts +17 -0
  127. package/out/types/src/evaluator/values/anonymous_struct.d.ts +8 -0
  128. package/out/types/src/evaluator/values/array.d.ts +8 -0
  129. package/out/types/src/evaluator/values/boolean.d.ts +3 -0
  130. package/out/types/src/evaluator/values/char.d.ts +3 -0
  131. package/out/types/src/evaluator/values/compt_list.d.ts +8 -0
  132. package/out/types/src/evaluator/values/dyn.d.ts +8 -0
  133. package/out/types/src/evaluator/values/float.d.ts +4 -0
  134. package/out/types/src/evaluator/values/integer.d.ts +4 -0
  135. package/out/types/src/evaluator/values/module.d.ts +58 -0
  136. package/out/types/src/evaluator/values/string.d.ts +3 -0
  137. package/out/types/src/evaluator/values/tuple.d.ts +32 -0
  138. package/out/types/src/expr.d.ts +456 -0
  139. package/out/types/src/function-value.d.ts +42 -0
  140. package/out/types/src/index.d.ts +4 -0
  141. package/out/types/src/lexer.d.ts +2 -0
  142. package/out/types/src/logger.d.ts +1 -0
  143. package/out/types/src/module-manager.d.ts +30 -0
  144. package/out/types/src/naming-checker.d.ts +4 -0
  145. package/out/types/src/parser.d.ts +33 -0
  146. package/out/types/src/test-runner.d.ts +30 -0
  147. package/out/types/src/tests/codegen.test.d.ts +1 -0
  148. package/out/types/src/tests/fixme.test.d.ts +1 -0
  149. package/out/types/src/tests/module-manager.test.d.ts +1 -0
  150. package/out/types/src/tests/parser.test.d.ts +1 -0
  151. package/out/types/src/tests/sample.test.d.ts +0 -0
  152. package/out/types/src/tests/std.test.d.ts +1 -0
  153. package/out/types/src/token.d.ts +40 -0
  154. package/out/types/src/type-value.d.ts +7 -0
  155. package/out/types/src/types/compatibility.d.ts +16 -0
  156. package/out/types/src/types/creators.d.ts +73 -0
  157. package/out/types/src/types/definitions.d.ts +218 -0
  158. package/out/types/src/types/guards.d.ts +70 -0
  159. package/out/types/src/types/hierarchy.d.ts +4 -0
  160. package/out/types/src/types/index.d.ts +7 -0
  161. package/out/types/src/types/module_field.d.ts +2 -0
  162. package/out/types/src/types/tags.d.ts +45 -0
  163. package/out/types/src/types/utils.d.ts +50 -0
  164. package/out/types/src/unit-value.d.ts +7 -0
  165. package/out/types/src/utils.d.ts +6 -0
  166. package/out/types/src/value-tag.d.ts +29 -0
  167. package/out/types/src/value.d.ts +110 -0
  168. package/out/types/src/yo-cli.d.ts +1 -0
  169. package/out/types/tsconfig.tsbuildinfo +1 -0
  170. package/package.json +57 -0
  171. package/scripts/check-liburing.js +76 -0
  172. package/std/alg/hash.yo +50 -0
  173. package/std/allocator.yo +113 -0
  174. package/std/allocators/c_allocator.yo +118 -0
  175. package/std/async.yo +13 -0
  176. package/std/collections/array_list.yo +415 -0
  177. package/std/collections/hash_map.yo +482 -0
  178. package/std/collections/hash_set.yo +706 -0
  179. package/std/collections/index.yo +11 -0
  180. package/std/collections/linked_list.yo +439 -0
  181. package/std/error.yo +0 -0
  182. package/std/gc.yo +10 -0
  183. package/std/index.yo +12 -0
  184. package/std/io/file.yo +191 -0
  185. package/std/io/index.yo +5 -0
  186. package/std/libc/assert.yo +39 -0
  187. package/std/libc/ctype.yo +57 -0
  188. package/std/libc/errno.yo +182 -0
  189. package/std/libc/float.yo +87 -0
  190. package/std/libc/index.yo +29 -0
  191. package/std/libc/limits.yo +65 -0
  192. package/std/libc/math.yo +679 -0
  193. package/std/libc/signal.yo +101 -0
  194. package/std/libc/stdatomic.yo +213 -0
  195. package/std/libc/stdint.yo +214 -0
  196. package/std/libc/stdio.yo +225 -0
  197. package/std/libc/stdlib.yo +204 -0
  198. package/std/libc/string.yo +151 -0
  199. package/std/libc/time.yo +92 -0
  200. package/std/libc/unistd.yo +130 -0
  201. package/std/monad.yo +152 -0
  202. package/std/prelude.yo +3094 -0
  203. package/std/string/index.yo +8 -0
  204. package/std/string/rune.yo +82 -0
  205. package/std/string/string.yo +288 -0
  206. package/std/sync.yo +95 -0
  207. package/std/thread.yo +36 -0
  208. package/std/time.yo +13 -0
  209. package/std/worker.yo +36 -0
  210. package/vendor/mimalloc/.gitattributes +12 -0
  211. package/vendor/mimalloc/CMakeLists.txt +763 -0
  212. package/vendor/mimalloc/LICENSE +21 -0
  213. package/vendor/mimalloc/SECURITY.md +41 -0
  214. package/vendor/mimalloc/azure-pipelines.yml +251 -0
  215. package/vendor/mimalloc/bin/mimalloc-redirect-arm64.dll +0 -0
  216. package/vendor/mimalloc/bin/mimalloc-redirect-arm64.lib +0 -0
  217. package/vendor/mimalloc/bin/mimalloc-redirect-arm64ec.dll +0 -0
  218. package/vendor/mimalloc/bin/mimalloc-redirect-arm64ec.lib +0 -0
  219. package/vendor/mimalloc/bin/mimalloc-redirect.dll +0 -0
  220. package/vendor/mimalloc/bin/mimalloc-redirect.lib +0 -0
  221. package/vendor/mimalloc/bin/mimalloc-redirect32.dll +0 -0
  222. package/vendor/mimalloc/bin/mimalloc-redirect32.lib +0 -0
  223. package/vendor/mimalloc/bin/minject-arm64.exe +0 -0
  224. package/vendor/mimalloc/bin/minject.exe +0 -0
  225. package/vendor/mimalloc/bin/minject32.exe +0 -0
  226. package/vendor/mimalloc/bin/readme.md +118 -0
  227. package/vendor/mimalloc/cmake/JoinPaths.cmake +23 -0
  228. package/vendor/mimalloc/cmake/mimalloc-config-version.cmake +19 -0
  229. package/vendor/mimalloc/cmake/mimalloc-config.cmake +14 -0
  230. package/vendor/mimalloc/contrib/docker/alpine/Dockerfile +23 -0
  231. package/vendor/mimalloc/contrib/docker/alpine-arm32v7/Dockerfile +28 -0
  232. package/vendor/mimalloc/contrib/docker/alpine-x86/Dockerfile +28 -0
  233. package/vendor/mimalloc/contrib/docker/manylinux-x64/Dockerfile +23 -0
  234. package/vendor/mimalloc/contrib/docker/readme.md +10 -0
  235. package/vendor/mimalloc/contrib/vcpkg/portfile.cmake +64 -0
  236. package/vendor/mimalloc/contrib/vcpkg/readme.md +40 -0
  237. package/vendor/mimalloc/contrib/vcpkg/usage +20 -0
  238. package/vendor/mimalloc/contrib/vcpkg/vcpkg-cmake-wrapper.cmake +20 -0
  239. package/vendor/mimalloc/contrib/vcpkg/vcpkg.json +48 -0
  240. package/vendor/mimalloc/doc/bench-2020/bench-c5-18xlarge-2020-01-20-a.svg +887 -0
  241. package/vendor/mimalloc/doc/bench-2020/bench-c5-18xlarge-2020-01-20-b.svg +1185 -0
  242. package/vendor/mimalloc/doc/bench-2020/bench-c5-18xlarge-2020-01-20-rss-a.svg +757 -0
  243. package/vendor/mimalloc/doc/bench-2020/bench-c5-18xlarge-2020-01-20-rss-b.svg +1028 -0
  244. package/vendor/mimalloc/doc/bench-2020/bench-r5a-1.svg +769 -0
  245. package/vendor/mimalloc/doc/bench-2020/bench-r5a-12xlarge-2020-01-16-a.svg +868 -0
  246. package/vendor/mimalloc/doc/bench-2020/bench-r5a-12xlarge-2020-01-16-b.svg +1157 -0
  247. package/vendor/mimalloc/doc/bench-2020/bench-r5a-2.svg +983 -0
  248. package/vendor/mimalloc/doc/bench-2020/bench-r5a-rss-1.svg +683 -0
  249. package/vendor/mimalloc/doc/bench-2020/bench-r5a-rss-2.svg +854 -0
  250. package/vendor/mimalloc/doc/bench-2020/bench-spec-rss.svg +713 -0
  251. package/vendor/mimalloc/doc/bench-2020/bench-spec.svg +713 -0
  252. package/vendor/mimalloc/doc/bench-2020/bench-z4-1.svg +890 -0
  253. package/vendor/mimalloc/doc/bench-2020/bench-z4-2.svg +1146 -0
  254. package/vendor/mimalloc/doc/bench-2020/bench-z4-rss-1.svg +796 -0
  255. package/vendor/mimalloc/doc/bench-2020/bench-z4-rss-2.svg +974 -0
  256. package/vendor/mimalloc/doc/bench-2021/bench-amd5950x-2021-01-30-a.svg +952 -0
  257. package/vendor/mimalloc/doc/bench-2021/bench-amd5950x-2021-01-30-b.svg +1255 -0
  258. package/vendor/mimalloc/doc/bench-2021/bench-c5-18xlarge-2021-01-30-a.svg +955 -0
  259. package/vendor/mimalloc/doc/bench-2021/bench-c5-18xlarge-2021-01-30-b.svg +1269 -0
  260. package/vendor/mimalloc/doc/bench-2021/bench-c5-18xlarge-2021-01-30-rss-a.svg +836 -0
  261. package/vendor/mimalloc/doc/bench-2021/bench-c5-18xlarge-2021-01-30-rss-b.svg +1131 -0
  262. package/vendor/mimalloc/doc/bench-2021/bench-macmini-2021-01-30.svg +766 -0
  263. package/vendor/mimalloc/doc/doxyfile +2895 -0
  264. package/vendor/mimalloc/doc/ds-logo.jpg +0 -0
  265. package/vendor/mimalloc/doc/ds-logo.png +0 -0
  266. package/vendor/mimalloc/doc/mimalloc-doc.h +1452 -0
  267. package/vendor/mimalloc/doc/mimalloc-doxygen.css +60 -0
  268. package/vendor/mimalloc/doc/mimalloc-logo-100.png +0 -0
  269. package/vendor/mimalloc/doc/mimalloc-logo.png +0 -0
  270. package/vendor/mimalloc/doc/mimalloc-logo.svg +161 -0
  271. package/vendor/mimalloc/doc/spades-logo.png +0 -0
  272. package/vendor/mimalloc/doc/unreal-logo.svg +43 -0
  273. package/vendor/mimalloc/ide/vs2022/mimalloc-lib.vcxproj +500 -0
  274. package/vendor/mimalloc/ide/vs2022/mimalloc-lib.vcxproj.filters +108 -0
  275. package/vendor/mimalloc/ide/vs2022/mimalloc-override-dll.vcxproj +508 -0
  276. package/vendor/mimalloc/ide/vs2022/mimalloc-override-dll.vcxproj.filters +111 -0
  277. package/vendor/mimalloc/ide/vs2022/mimalloc-override-test-dep.vcxproj +355 -0
  278. package/vendor/mimalloc/ide/vs2022/mimalloc-override-test.vcxproj +360 -0
  279. package/vendor/mimalloc/ide/vs2022/mimalloc-test-api.vcxproj +295 -0
  280. package/vendor/mimalloc/ide/vs2022/mimalloc-test-stress.vcxproj +292 -0
  281. package/vendor/mimalloc/ide/vs2022/mimalloc-test.vcxproj +289 -0
  282. package/vendor/mimalloc/ide/vs2022/mimalloc.sln +151 -0
  283. package/vendor/mimalloc/include/mimalloc/atomic.h +557 -0
  284. package/vendor/mimalloc/include/mimalloc/internal.h +1153 -0
  285. package/vendor/mimalloc/include/mimalloc/prim.h +421 -0
  286. package/vendor/mimalloc/include/mimalloc/track.h +145 -0
  287. package/vendor/mimalloc/include/mimalloc/types.h +685 -0
  288. package/vendor/mimalloc/include/mimalloc-new-delete.h +66 -0
  289. package/vendor/mimalloc/include/mimalloc-override.h +68 -0
  290. package/vendor/mimalloc/include/mimalloc-stats.h +103 -0
  291. package/vendor/mimalloc/include/mimalloc.h +612 -0
  292. package/vendor/mimalloc/mimalloc.pc.in +11 -0
  293. package/vendor/mimalloc/readme.md +946 -0
  294. package/vendor/mimalloc/src/alloc-aligned.c +360 -0
  295. package/vendor/mimalloc/src/alloc-override.c +316 -0
  296. package/vendor/mimalloc/src/alloc-posix.c +185 -0
  297. package/vendor/mimalloc/src/alloc.c +692 -0
  298. package/vendor/mimalloc/src/arena-abandon.c +346 -0
  299. package/vendor/mimalloc/src/arena.c +1043 -0
  300. package/vendor/mimalloc/src/bitmap.c +441 -0
  301. package/vendor/mimalloc/src/bitmap.h +119 -0
  302. package/vendor/mimalloc/src/free.c +572 -0
  303. package/vendor/mimalloc/src/heap.c +733 -0
  304. package/vendor/mimalloc/src/init.c +714 -0
  305. package/vendor/mimalloc/src/libc.c +334 -0
  306. package/vendor/mimalloc/src/options.c +663 -0
  307. package/vendor/mimalloc/src/os.c +770 -0
  308. package/vendor/mimalloc/src/page-queue.c +390 -0
  309. package/vendor/mimalloc/src/page.c +1049 -0
  310. package/vendor/mimalloc/src/prim/emscripten/prim.c +249 -0
  311. package/vendor/mimalloc/src/prim/osx/alloc-override-zone.c +461 -0
  312. package/vendor/mimalloc/src/prim/osx/prim.c +9 -0
  313. package/vendor/mimalloc/src/prim/prim.c +76 -0
  314. package/vendor/mimalloc/src/prim/readme.md +9 -0
  315. package/vendor/mimalloc/src/prim/unix/prim.c +934 -0
  316. package/vendor/mimalloc/src/prim/wasi/prim.c +284 -0
  317. package/vendor/mimalloc/src/prim/windows/etw-mimalloc.wprp +61 -0
  318. package/vendor/mimalloc/src/prim/windows/etw.h +905 -0
  319. package/vendor/mimalloc/src/prim/windows/etw.man +0 -0
  320. package/vendor/mimalloc/src/prim/windows/prim.c +878 -0
  321. package/vendor/mimalloc/src/prim/windows/readme.md +17 -0
  322. package/vendor/mimalloc/src/random.c +258 -0
  323. package/vendor/mimalloc/src/segment-map.c +142 -0
  324. package/vendor/mimalloc/src/segment.c +1702 -0
  325. package/vendor/mimalloc/src/static.c +41 -0
  326. package/vendor/mimalloc/src/stats.c +635 -0
  327. package/vendor/mimalloc/test/CMakeLists.txt +56 -0
  328. package/vendor/mimalloc/test/main-override-dep.cpp +51 -0
  329. package/vendor/mimalloc/test/main-override-dep.h +11 -0
  330. package/vendor/mimalloc/test/main-override-static.c +539 -0
  331. package/vendor/mimalloc/test/main-override.c +36 -0
  332. package/vendor/mimalloc/test/main-override.cpp +497 -0
  333. package/vendor/mimalloc/test/main.c +46 -0
  334. package/vendor/mimalloc/test/readme.md +16 -0
  335. package/vendor/mimalloc/test/test-api-fill.c +343 -0
  336. package/vendor/mimalloc/test/test-api.c +466 -0
  337. package/vendor/mimalloc/test/test-stress.c +428 -0
  338. package/vendor/mimalloc/test/test-wrong.c +92 -0
  339. package/vendor/mimalloc/test/testhelper.h +49 -0
@@ -0,0 +1,706 @@
1
+ /**
2
+ * HashSet - A high-performance hash set implementation using SwissTable algorithm
3
+ *
4
+ * This implementation uses the same SwissTable design as HashMap, providing:
5
+ * - SIMD-accelerated lookup using control bytes
6
+ * - Quadratic probing for collision resolution
7
+ * - 7/8 max load factor for optimal performance
8
+ * - Compact memory layout with metadata array
9
+ *
10
+ * Memory layout:
11
+ * - ctrl: Array of control bytes (metadata), one per slot
12
+ * - data: Array of elements
13
+ *
14
+ * Control byte values:
15
+ * - 0xFF (EMPTY): Slot is empty and never used
16
+ * - 0xFE (DELETED): Slot was used but is now deleted
17
+ * - 0x00-0x7F: Lower 7 bits of hash (H2 hash), indicates occupied slot
18
+ *
19
+ * Hash function splits hash into two parts:
20
+ * - H1: Upper bits used to find slot group
21
+ * - H2: Lower 7 bits stored in control byte for fast SIMD comparison
22
+ */
23
+ { GlobalAllocator, AllocError } :: import "../allocator.yo";
24
+ { malloc, calloc, realloc, free } :: GlobalAllocator;
25
+
26
+ /**
27
+ * HashSet error types
28
+ */
29
+ HashSetError :: enum(
30
+ AllocError(error : AllocError),
31
+ ElementNotFound,
32
+ CapacityOverflow
33
+ );
34
+
35
+ /**
36
+ * Control byte constants for SwissTable
37
+ */
38
+ CTRL_EMPTY :: u8(255);
39
+ CTRL_DELETED :: u8(254);
40
+
41
+ /**
42
+ * Default initial capacity (must be power of 2)
43
+ */
44
+ DEFAULT_CAPACITY :: usize(16);
45
+
46
+ /**
47
+ * Maximum load factor: 7/8 = 0.875
48
+ * We resize when: size > capacity * 7 / 8
49
+ */
50
+ MAX_LOAD_FACTOR_NUMERATOR :: usize(7);
51
+ MAX_LOAD_FACTOR_DENOMINATOR :: usize(8);
52
+
53
+ /**
54
+ * Extract H2 hash (lower 7 bits) from full hash
55
+ */
56
+ h2_hash :: (fn(hash: u64) -> u8)
57
+ (u8((hash & u64(127))))
58
+ ;
59
+
60
+ /**
61
+ * Extract H1 hash (upper bits) for slot index
62
+ */
63
+ h1_hash :: (fn(hash: u64, capacity: usize) -> usize)
64
+ ((usize((hash >> u64(7))) % capacity))
65
+ ;
66
+
67
+ /**
68
+ * HashSet type - high-performance set using SwissTable
69
+ *
70
+ * Memory layout:
71
+ * - ctrl: Pointer to control bytes array (length = capacity)
72
+ * - data: Pointer to elements array (length = capacity)
73
+ * - capacity: Total number of slots (always power of 2)
74
+ * - size: Current number of occupied slots
75
+ */
76
+ HashSet :: (fn(
77
+ compt(T): Type,
78
+ where(T <: (Eq(T), Hash))
79
+ ) -> compt(Type))
80
+ object(
81
+ ctrl : ?*(u8),
82
+ data : ?*(T),
83
+ capacity : usize,
84
+ size : usize,
85
+
86
+ /**
87
+ * Allocate memory for HashSet with given capacity
88
+ * Initializes all control bytes to EMPTY
89
+ */
90
+ _alloc_with_capacity :: (fn(capacity: usize) -> Result(Self, HashSetError))(
91
+ {
92
+ element_size :: sizeof(T);
93
+ ctrl_size := capacity;
94
+ data_size := (capacity * element_size);
95
+
96
+ ctrl_result := malloc(ctrl_size);
97
+ match(ctrl_result,
98
+ .None => .Err(.AllocError(error: .OutOfMemory)),
99
+ .Some(ctrl_void_ptr) => {
100
+ ctrl_ptr := *(u8)(ctrl_void_ptr);
101
+
102
+ data_result := malloc(data_size);
103
+ match(data_result,
104
+ .None => {
105
+ free(.Some(*(void)(ctrl_ptr)));
106
+ .Err(.AllocError(error: .OutOfMemory))
107
+ },
108
+ .Some(data_void_ptr) => {
109
+ data_ptr := *(T)(data_void_ptr);
110
+
111
+ i := usize(0);
112
+ while(i < capacity, i = (i + usize(1)), {
113
+ (ctrl_ptr &+ i).* = CTRL_EMPTY;
114
+ });
115
+
116
+ .Ok(Self(
117
+ ctrl: .Some(ctrl_ptr),
118
+ data: .Some(data_ptr),
119
+ capacity: capacity,
120
+ size: usize(0)
121
+ ))
122
+ }
123
+ )
124
+ }
125
+ )
126
+ }
127
+ ),
128
+
129
+ /**
130
+ * Create a new empty HashSet with default capacity
131
+ */
132
+ new :: (fn() -> Self)(
133
+ {
134
+ result := Self._alloc_with_capacity(DEFAULT_CAPACITY);
135
+ match(result,
136
+ .Ok(set) => set,
137
+ .Err(_) => panic("Failed to allocate HashSet")
138
+ )
139
+ }
140
+ ),
141
+
142
+ /**
143
+ * Create a HashSet with a specific initial capacity
144
+ * Capacity will be rounded up to next power of 2
145
+ */
146
+ with_capacity :: (fn(requested_capacity: usize) -> Self)(
147
+ {
148
+ capacity := cond(
149
+ (requested_capacity < DEFAULT_CAPACITY) => DEFAULT_CAPACITY,
150
+ true => {
151
+ c := requested_capacity;
152
+ c = (c - usize(1));
153
+ c = (c | (c >> usize(1)));
154
+ c = (c | (c >> usize(2)));
155
+ c = (c | (c >> usize(4)));
156
+ c = (c | (c >> usize(8)));
157
+ c = (c | (c >> usize(16)));
158
+ (c + usize(1))
159
+ }
160
+ );
161
+
162
+ result := Self._alloc_with_capacity(capacity);
163
+ match(result,
164
+ .Ok(set) => set,
165
+ .Err(_) => panic("Failed to allocate HashSet")
166
+ )
167
+ }
168
+ ),
169
+
170
+ /**
171
+ * Get ctrl pointer (unwrapped for internal use)
172
+ */
173
+ _ctrl_ptr :: (fn(self: Self) -> *(u8))(
174
+ match(self.ctrl,
175
+ .Some(ptr) => ptr,
176
+ .None => panic("HashSet ctrl pointer is null")
177
+ )
178
+ ),
179
+
180
+ /**
181
+ * Get data pointer (unwrapped for internal use)
182
+ */
183
+ _data_ptr :: (fn(self: Self) -> *(T))(
184
+ match(self.data,
185
+ .Some(ptr) => ptr,
186
+ .None => panic("HashSet data pointer is null")
187
+ )
188
+ ),
189
+
190
+ /**
191
+ * Find slot index for a given element using quadratic probing
192
+ * Returns Some(index) if element is found, None otherwise
193
+ */
194
+ _find_slot :: (fn(self: Self, element: T, hash: u64) -> Option(usize))(
195
+ {
196
+ h2 := h2_hash(hash);
197
+ index := h1_hash(hash, self.capacity);
198
+ probe := usize(0);
199
+ ctrl_ptr := self._ctrl_ptr();
200
+ data_ptr := self._data_ptr();
201
+
202
+ while(probe < self.capacity, probe = (probe + usize(1)), {
203
+ probe_index := ((index + probe) % self.capacity);
204
+ ctrl_byte := (ctrl_ptr &+ probe_index).*;
205
+
206
+ cond(
207
+ (ctrl_byte == CTRL_EMPTY) => {
208
+ return .None;
209
+ },
210
+ (ctrl_byte == h2) => {
211
+ stored_element := (data_ptr &+ probe_index).*;
212
+ cond(
213
+ (stored_element == element) => {
214
+ return .Some(probe_index);
215
+ },
216
+ true => ()
217
+ );
218
+ },
219
+ true => ()
220
+ );
221
+ });
222
+
223
+ .None
224
+ }
225
+ ),
226
+
227
+ /**
228
+ * Find first available slot (EMPTY or DELETED) for insertion
229
+ * Returns slot index using quadratic probing
230
+ */
231
+ _find_insert_slot :: (fn(self: Self, hash: u64) -> usize)(
232
+ {
233
+ index := h1_hash(hash, self.capacity);
234
+ probe := usize(0);
235
+ ctrl_ptr := self._ctrl_ptr();
236
+
237
+ while(probe < self.capacity, probe = (probe + usize(1)), {
238
+ probe_index := ((index + probe) % self.capacity);
239
+ ctrl_byte := (ctrl_ptr &+ probe_index).*;
240
+
241
+ cond(
242
+ ((ctrl_byte == CTRL_EMPTY) || (ctrl_byte == CTRL_DELETED)) => {
243
+ return probe_index;
244
+ },
245
+ true => ()
246
+ );
247
+ });
248
+
249
+ panic("HashSet is full - should have resized")
250
+ }
251
+ ),
252
+
253
+ /**
254
+ * Check if HashSet needs resizing based on load factor
255
+ */
256
+ _needs_resize :: (fn(self: Self) -> bool)(
257
+ {
258
+ threshold := ((self.capacity * MAX_LOAD_FACTOR_NUMERATOR) / MAX_LOAD_FACTOR_DENOMINATOR);
259
+ (self.size >= threshold)
260
+ }
261
+ ),
262
+
263
+ /**
264
+ * Resize and rehash the HashSet to a new capacity
265
+ */
266
+ _resize :: (fn(self: Self, new_capacity: usize) -> Result(unit, HashSetError))(
267
+ {
268
+ result := Self._alloc_with_capacity(new_capacity);
269
+ match(result,
270
+ .Err(err) => .Err(err),
271
+ .Ok(new_set) => {
272
+ i := usize(0);
273
+ ctrl_ptr := self._ctrl_ptr();
274
+ data_ptr := self._data_ptr();
275
+ while(i < self.capacity, i = (i + usize(1)), {
276
+ ctrl_byte := (ctrl_ptr &+ i).*;
277
+ cond(
278
+ ((ctrl_byte != CTRL_EMPTY) && (ctrl_byte != CTRL_DELETED)) => {
279
+ element := (data_ptr &+ i).*;
280
+ hash := element.hash();
281
+ h2 := h2_hash(hash);
282
+ new_index := new_set._find_insert_slot(hash);
283
+
284
+ new_ctrl_ptr := new_set._ctrl_ptr();
285
+ new_data_ptr := new_set._data_ptr();
286
+ (new_ctrl_ptr &+ new_index).* = h2;
287
+ (new_data_ptr &+ new_index).* = element;
288
+ new_set.size = (new_set.size + usize(1));
289
+ },
290
+ true => ()
291
+ );
292
+ });
293
+
294
+ match(self.ctrl,
295
+ .Some(ptr) => free(.Some(*(void) ptr)),
296
+ .None => ()
297
+ );
298
+ match(self.data,
299
+ .Some(ptr) => free(.Some(*(void) ptr)),
300
+ .None => ()
301
+ );
302
+
303
+ self.ctrl = new_set.ctrl;
304
+ self.data = new_set.data;
305
+ self.capacity = new_set.capacity;
306
+
307
+ new_set.ctrl = .None;
308
+ new_set.data = .None;
309
+
310
+ .Ok(())
311
+ }
312
+ )
313
+ }
314
+ ),
315
+
316
+ /**
317
+ * Insert an element into the set
318
+ * Returns Ok(true) if element was newly inserted, Ok(false) if already present
319
+ */
320
+ add :: (fn(self: Self, element: T) -> Result(bool, HashSetError))(
321
+ {
322
+ hash := element.hash();
323
+ slot_opt := self._find_slot(element, hash);
324
+
325
+ match(slot_opt,
326
+ .Some(_) => .Ok(false),
327
+ .None => {
328
+ resize_check := cond(
329
+ (self._needs_resize()) => {
330
+ new_capacity := (self.capacity * usize(2));
331
+ self._resize(new_capacity)
332
+ },
333
+ true => (Result(unit, HashSetError).Ok(()))
334
+ );
335
+
336
+ match(resize_check,
337
+ .Err(err) => .Err(err),
338
+ .Ok(_) => {
339
+ h2 := h2_hash(hash);
340
+ index := self._find_insert_slot(hash);
341
+
342
+ ctrl_ptr := self._ctrl_ptr();
343
+ data_ptr := self._data_ptr();
344
+ (ctrl_ptr &+ index).* = h2;
345
+ (data_ptr &+ index).* = element;
346
+ self.size = (self.size + usize(1));
347
+
348
+ .Ok(true)
349
+ }
350
+ )
351
+ }
352
+ )
353
+ }
354
+ ),
355
+
356
+ /**
357
+ * Check if an element exists in the set
358
+ */
359
+ has :: (fn(self: Self, element: T) -> bool)(
360
+ {
361
+ hash := element.hash();
362
+ slot_opt := self._find_slot(element, hash);
363
+ match(slot_opt,
364
+ .Some(_) => true,
365
+ .None => false
366
+ )
367
+ }
368
+ ),
369
+
370
+ /**
371
+ * Remove an element from the set
372
+ * Returns true if the element was present and removed, false otherwise
373
+ */
374
+ remove :: (fn(self: Self, element: T) -> bool)(
375
+ {
376
+ hash := element.hash();
377
+ slot_opt := self._find_slot(element, hash);
378
+ match(slot_opt,
379
+ .Some(index) => {
380
+ ctrl_ptr := self._ctrl_ptr();
381
+ (ctrl_ptr &+ index).* = CTRL_DELETED;
382
+ self.size = (self.size - usize(1));
383
+ true
384
+ },
385
+ .None => false
386
+ )
387
+ }
388
+ ),
389
+
390
+ /**
391
+ * Get the number of elements in the set
392
+ */
393
+ len :: (fn(self: Self) -> usize)(
394
+ self.size
395
+ ),
396
+
397
+ /**
398
+ * Check if the set is empty
399
+ */
400
+ is_empty :: (fn(self: Self) -> bool)(
401
+ (self.size == usize(0))
402
+ ),
403
+
404
+ /**
405
+ * Clear all elements from the set
406
+ * Resets all control bytes to EMPTY
407
+ */
408
+ clear :: (fn(self: Self) -> unit)(
409
+ {
410
+ ctrl_ptr := self._ctrl_ptr();
411
+ i := usize(0);
412
+ while(i < self.capacity, i = (i + usize(1)), {
413
+ (ctrl_ptr &+ i).* = CTRL_EMPTY;
414
+ });
415
+ self.size = usize(0);
416
+ }
417
+ ),
418
+
419
+ /**
420
+ * Check if this set is a subset of another set
421
+ * Returns true if all elements in self are also in other
422
+ */
423
+ is_subset :: (fn(self: Self, other: Self) -> bool)(
424
+ cond(
425
+ (self.size > other.size) => false,
426
+ true => {
427
+ i := usize(0);
428
+ ctrl_ptr := self._ctrl_ptr();
429
+ data_ptr := self._data_ptr();
430
+ is_sub := true;
431
+
432
+ while(i < self.capacity, i = (i + usize(1)), {
433
+ ctrl_byte := (ctrl_ptr &+ i).*;
434
+ cond(
435
+ ((ctrl_byte != CTRL_EMPTY) && (ctrl_byte != CTRL_DELETED)) => {
436
+ element := (data_ptr &+ i).*;
437
+ contains_result := other.has(element);
438
+ cond(
439
+ (contains_result == false) => {
440
+ is_sub = false;
441
+ },
442
+ true => ()
443
+ );
444
+ },
445
+ true => ()
446
+ );
447
+ });
448
+
449
+ is_sub
450
+ }
451
+ )
452
+ ),
453
+
454
+ /**
455
+ * Check if this set is a superset of another set
456
+ * Returns true if all elements in other are also in self
457
+ */
458
+ is_superset :: (fn(self: Self, other: Self) -> bool)(
459
+ other.is_subset(self)
460
+ ),
461
+
462
+ /**
463
+ * Check if this set is disjoint from another set
464
+ * Returns true if the sets have no elements in common
465
+ */
466
+ is_disjoint :: (fn(self: Self, other: Self) -> bool)(
467
+ {
468
+ smaller := cond((self.size <= other.size) => self, true => other);
469
+ larger := cond((self.size <= other.size) => other, true => self);
470
+
471
+ i := usize(0);
472
+ ctrl_ptr := smaller._ctrl_ptr();
473
+ data_ptr := smaller._data_ptr();
474
+ result := true;
475
+
476
+ while(i < smaller.capacity, i = (i + usize(1)), {
477
+ ctrl_byte := (ctrl_ptr &+ i).*;
478
+ cond(
479
+ ((ctrl_byte != CTRL_EMPTY) && (ctrl_byte != CTRL_DELETED)) => {
480
+ element := (data_ptr &+ i).*;
481
+ contains_result := larger.has(element);
482
+ cond(
483
+ (contains_result == true) => {
484
+ result = false;
485
+ },
486
+ true => ()
487
+ );
488
+ },
489
+ true => ()
490
+ );
491
+ });
492
+
493
+ result
494
+ }
495
+ ),
496
+
497
+ /**
498
+ * Create a new set containing the union of two sets
499
+ * Returns a new HashSet containing all elements from both sets
500
+ */
501
+ union :: (fn(self: Self, other: Self) -> Result(Self, HashSetError))(
502
+ {
503
+ new_capacity := cond(
504
+ ((self.size + other.size) > DEFAULT_CAPACITY) => {
505
+ combined := (self.size + other.size);
506
+ c := combined;
507
+ c = (c - usize(1));
508
+ c = (c | (c >> usize(1)));
509
+ c = (c | (c >> usize(2)));
510
+ c = (c | (c >> usize(4)));
511
+ c = (c | (c >> usize(8)));
512
+ c = (c | (c >> usize(16)));
513
+ (c + usize(1))
514
+ },
515
+ true => DEFAULT_CAPACITY
516
+ );
517
+
518
+ result_set_result := Self._alloc_with_capacity(new_capacity);
519
+ match(result_set_result,
520
+ .Err(err) => .Err(err),
521
+ .Ok(result_set) => {
522
+ i := usize(0);
523
+ ctrl_ptr := self._ctrl_ptr();
524
+ data_ptr := self._data_ptr();
525
+ while(i < self.capacity, i = (i + usize(1)), {
526
+ ctrl_byte := (ctrl_ptr &+ i).*;
527
+ cond(
528
+ ((ctrl_byte != CTRL_EMPTY) && (ctrl_byte != CTRL_DELETED)) => {
529
+ element := (data_ptr &+ i).*;
530
+ _ := result_set.add(element);
531
+ },
532
+ true => ()
533
+ );
534
+ });
535
+
536
+ j := usize(0);
537
+ other_ctrl_ptr := other._ctrl_ptr();
538
+ other_data_ptr := other._data_ptr();
539
+ while(j < other.capacity, j = (j + usize(1)), {
540
+ ctrl_byte := (other_ctrl_ptr &+ j).*;
541
+ cond(
542
+ ((ctrl_byte != CTRL_EMPTY) && (ctrl_byte != CTRL_DELETED)) => {
543
+ element := (other_data_ptr &+ j).*;
544
+ _ := result_set.add(element);
545
+ },
546
+ true => ()
547
+ );
548
+ });
549
+
550
+ .Ok(result_set)
551
+ }
552
+ )
553
+ }
554
+ ),
555
+
556
+ /**
557
+ * Create a new set containing the intersection of two sets
558
+ * Returns a new HashSet containing only elements present in both sets
559
+ */
560
+ intersection :: (fn(self: Self, other: Self) -> Result(Self, HashSetError))(
561
+ {
562
+ smaller := cond((self.size <= other.size) => self, true => other);
563
+ larger := cond((self.size <= other.size) => other, true => self);
564
+
565
+ result_set_result := Self._alloc_with_capacity(DEFAULT_CAPACITY);
566
+ match(result_set_result,
567
+ .Err(err) => .Err(err),
568
+ .Ok(result_set) => {
569
+ i := usize(0);
570
+ ctrl_ptr := smaller._ctrl_ptr();
571
+ data_ptr := smaller._data_ptr();
572
+ while(i < smaller.capacity, i = (i + usize(1)), {
573
+ ctrl_byte := (ctrl_ptr &+ i).*;
574
+ cond(
575
+ ((ctrl_byte != CTRL_EMPTY) && (ctrl_byte != CTRL_DELETED)) => {
576
+ element := (data_ptr &+ i).*;
577
+ cond(
578
+ (larger.has(element)) => {
579
+ _ := result_set.add(element);
580
+ },
581
+ true => ()
582
+ );
583
+ },
584
+ true => ()
585
+ );
586
+ });
587
+
588
+ .Ok(result_set)
589
+ }
590
+ )
591
+ }
592
+ ),
593
+
594
+ /**
595
+ * Create a new set containing the difference of two sets
596
+ * Returns a new HashSet containing elements in self but not in other
597
+ */
598
+ difference :: (fn(self: Self, other: Self) -> Result(Self, HashSetError))(
599
+ {
600
+ result_set_result := Self._alloc_with_capacity(DEFAULT_CAPACITY);
601
+ match(result_set_result,
602
+ .Err(err) => .Err(err),
603
+ .Ok(result_set) => {
604
+ i := usize(0);
605
+ ctrl_ptr := self._ctrl_ptr();
606
+ data_ptr := self._data_ptr();
607
+ while(i < self.capacity, i = (i + usize(1)), {
608
+ ctrl_byte := (ctrl_ptr &+ i).*;
609
+ cond(
610
+ ((ctrl_byte != CTRL_EMPTY) && (ctrl_byte != CTRL_DELETED)) => {
611
+ element := (data_ptr &+ i).*;
612
+ contains_result := other.has(element);
613
+ cond(
614
+ (contains_result == false) => {
615
+ _ := result_set.add(element);
616
+ },
617
+ true => ()
618
+ );
619
+ },
620
+ true => ()
621
+ );
622
+ });
623
+
624
+ .Ok(result_set)
625
+ }
626
+ )
627
+ }
628
+ ),
629
+
630
+ /**
631
+ * Create a new set containing the symmetric difference of two sets
632
+ * Returns a new HashSet containing elements in either set but not in both
633
+ */
634
+ symmetric_difference :: (fn(self: Self, other: Self) -> Result(Self, HashSetError))(
635
+ {
636
+ result_set_result := Self._alloc_with_capacity(DEFAULT_CAPACITY);
637
+ match(result_set_result,
638
+ .Err(err) => .Err(err),
639
+ .Ok(result_set) => {
640
+ i := usize(0);
641
+ ctrl_ptr := self._ctrl_ptr();
642
+ data_ptr := self._data_ptr();
643
+ while(i < self.capacity, i = (i + usize(1)), {
644
+ ctrl_byte := (ctrl_ptr &+ i).*;
645
+ cond(
646
+ ((ctrl_byte != CTRL_EMPTY) && (ctrl_byte != CTRL_DELETED)) => {
647
+ element := (data_ptr &+ i).*;
648
+ contains_result := other.has(element);
649
+ cond(
650
+ (contains_result == false) => {
651
+ _ := result_set.add(element);
652
+ },
653
+ true => ()
654
+ );
655
+ },
656
+ true => ()
657
+ );
658
+ });
659
+
660
+ j := usize(0);
661
+ other_ctrl_ptr := other._ctrl_ptr();
662
+ other_data_ptr := other._data_ptr();
663
+ while(j < other.capacity, j = (j + usize(1)), {
664
+ ctrl_byte := (other_ctrl_ptr &+ j).*;
665
+ cond(
666
+ ((ctrl_byte != CTRL_EMPTY) && (ctrl_byte != CTRL_DELETED)) => {
667
+ element := (other_data_ptr &+ j).*;
668
+ contains_result := self.has(element);
669
+ cond(
670
+ (contains_result == false) => {
671
+ _ := result_set.add(element);
672
+ },
673
+ true => ()
674
+ );
675
+ },
676
+ true => ()
677
+ );
678
+ });
679
+
680
+ .Ok(result_set)
681
+ }
682
+ )
683
+ }
684
+ ),
685
+
686
+ /**
687
+ * RAII destructor - automatically called when HashSet goes out of scope
688
+ */
689
+ dispose :: (fn(self: Self) -> unit)(
690
+ {
691
+ match(self.ctrl,
692
+ .Some(ptr) => free(.Some(*(void) ptr)),
693
+ .None => ()
694
+ );
695
+ match(self.data,
696
+ .Some(ptr) => free(.Some(*(void) ptr)),
697
+ .None => ()
698
+ );
699
+ }
700
+ )
701
+ );
702
+
703
+ export
704
+ HashSet,
705
+ HashSetError
706
+ ;
@@ -0,0 +1,11 @@
1
+ _array_list :: import "./array_list.yo";
2
+ _hash_map :: import "./hash_map.yo";
3
+ _hash_set :: import "./hash_set.yo";
4
+ _linked_list :: import "./linked_list.yo";
5
+
6
+ export
7
+ ...(_array_list),
8
+ ...(_hash_map),
9
+ ...(_hash_set),
10
+ ...(_linked_list)
11
+ ;