carray 3.0.6 → 3.1.0

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 (277) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/CHANGELOG.md +7 -1830
  4. data/README.md +62 -35
  5. data/carray.gemspec +16 -4
  6. data/docs/changelogs/CHANGELOG-3.0.md +2464 -0
  7. data/ext/ca_array_pool.c +4 -5
  8. data/ext/ca_axis_descriptor.h +45 -30
  9. data/ext/ca_axis_dispatch.c +7 -4
  10. data/ext/ca_axis_group.c +12 -15
  11. data/ext/ca_bincmp_dispatch.h +16 -38
  12. data/ext/ca_binop_dispatch.c +35 -0
  13. data/ext/ca_binop_dispatch.h +22 -46
  14. data/ext/ca_categorical_iterator.c +36 -34
  15. data/ext/ca_compare.c +0 -1
  16. data/ext/ca_compare.h +8 -1
  17. data/ext/ca_composite_dispatch.h +6 -0
  18. data/ext/ca_for_buffer.h +6 -1
  19. data/ext/ca_group_iter.c +17 -18
  20. data/ext/ca_iter_state_fields.h +196 -0
  21. data/ext/ca_iter_substrate.h +84 -103
  22. data/ext/ca_kernel_iterator.c +125 -89
  23. data/ext/ca_kernel_iterator.h +229 -1504
  24. data/ext/ca_kernel_iterator_internal.h +1167 -0
  25. data/ext/ca_moncmp_dispatch.h +17 -24
  26. data/ext/ca_monop_dispatch.h +25 -74
  27. data/ext/ca_obj_array.c +92 -165
  28. data/ext/ca_obj_bincmp.c +65 -48
  29. data/ext/ca_obj_binop.c +74 -49
  30. data/ext/ca_obj_bitarray.c +7 -21
  31. data/ext/ca_obj_bitfield.c +93 -26
  32. data/ext/ca_obj_block.c +11 -12
  33. data/ext/ca_obj_byte_swap.c +34 -34
  34. data/ext/ca_obj_const_string.c +464 -304
  35. data/ext/ca_obj_face.c +167 -121
  36. data/ext/ca_obj_face.h +32 -170
  37. data/ext/ca_obj_fake.c +127 -34
  38. data/ext/ca_obj_farray.c +13 -9
  39. data/ext/ca_obj_field.c +17 -13
  40. data/ext/ca_obj_fixlen_string.c +57 -34
  41. data/ext/ca_obj_grid.c +149 -113
  42. data/ext/ca_obj_meld.c +28 -26
  43. data/ext/ca_obj_moncmp.c +10 -21
  44. data/ext/ca_obj_monop.c +88 -73
  45. data/ext/ca_obj_object.c +60 -46
  46. data/ext/ca_obj_record.c +74 -22
  47. data/ext/ca_obj_reduce.c +10 -14
  48. data/ext/ca_obj_refer.c +146 -39
  49. data/ext/ca_obj_remap.c +11 -29
  50. data/ext/ca_obj_repeat.c +41 -23
  51. data/ext/ca_obj_roll.c +20 -28
  52. data/ext/ca_obj_select.c +17 -27
  53. data/ext/ca_obj_select_axis.c +35 -42
  54. data/ext/ca_obj_shift.c +22 -42
  55. data/ext/ca_obj_source.c +1 -5
  56. data/ext/ca_obj_stack.c +33 -29
  57. data/ext/ca_obj_stride.c +99 -62
  58. data/ext/ca_obj_string.c +8 -20
  59. data/ext/ca_obj_tile.c +14 -16
  60. data/ext/ca_obj_time.c +12 -23
  61. data/ext/ca_obj_timedelta.c +12 -23
  62. data/ext/ca_obj_transpose.c +8 -10
  63. data/ext/ca_obj_triop.c +48 -49
  64. data/ext/ca_obj_window.c +87 -99
  65. data/ext/ca_op_cmplx64.h +4 -0
  66. data/ext/ca_op_ipower.c +97 -27
  67. data/ext/ca_op_powi.h +9 -28
  68. data/ext/ca_pow5_table.h +2 -1
  69. data/ext/ca_rng_normal.h +4 -0
  70. data/ext/ca_rng_xoshiro256pp.h +3 -0
  71. data/ext/ca_sort_kernels.h +23 -26
  72. data/ext/ca_sweep_engine.c +92 -26
  73. data/ext/ca_sweep_engine.h +22 -15
  74. data/ext/ca_transform_common.c +3 -8
  75. data/ext/ca_triop_dispatch.h +20 -32
  76. data/ext/caframe_csv_reader.c +12 -12
  77. data/ext/carray.h +300 -1009
  78. data/ext/carray_access.c +320 -207
  79. data/ext/carray_address_basis.c +128 -59
  80. data/ext/carray_attribute.c +81 -104
  81. data/ext/carray_bincount.c +12 -14
  82. data/ext/carray_broadcast.c +31 -27
  83. data/ext/carray_call_cfunc.c +174 -285
  84. data/ext/carray_call_cfunc.h +36 -28
  85. data/ext/carray_cast.c +1191 -351
  86. data/ext/carray_cast_func.rb +68 -8
  87. data/ext/carray_class.c +6 -11
  88. data/ext/carray_conversion.c +98 -39
  89. data/ext/carray_copy.c +52 -26
  90. data/ext/carray_core.c +286 -132
  91. data/ext/carray_count.c +53 -22
  92. data/ext/carray_element.c +49 -28
  93. data/ext/carray_factorize.c +64 -63
  94. data/ext/carray_generate.c +26 -19
  95. data/ext/carray_histogram.c +9 -11
  96. data/ext/carray_hold.c +7 -9
  97. data/ext/carray_index_classifier.c +127 -230
  98. data/ext/carray_index_classifier.h +11 -10
  99. data/ext/carray_integer_total.c +523 -0
  100. data/ext/carray_internal.h +1364 -156
  101. data/ext/carray_key_windows.c +3 -3
  102. data/ext/carray_lazy.c +37 -37
  103. data/ext/carray_loop.c +27 -23
  104. data/ext/carray_mask.c +235 -150
  105. data/ext/carray_math_kernel.h +23 -47
  106. data/ext/carray_mathfunc.c +10 -3
  107. data/ext/carray_median_percentile.c +106 -100
  108. data/ext/carray_memory_view.c +83 -69
  109. data/ext/carray_operator.c +490 -128
  110. data/ext/carray_order.c +163 -84
  111. data/ext/carray_partition.c +14 -16
  112. data/ext/carray_random.c +48 -42
  113. data/ext/carray_round.c +33 -5
  114. data/ext/carray_scatter.c +57 -39
  115. data/ext/carray_segment.c +42 -46
  116. data/ext/carray_slab.c +77 -51
  117. data/ext/carray_slab.h +44 -33
  118. data/ext/carray_sort.c +37 -31
  119. data/ext/carray_sort_kernel.c +36 -10
  120. data/ext/carray_struct.c +44 -34
  121. data/ext/carray_test.c +131 -81
  122. data/ext/carray_time_text.c +30 -31
  123. data/ext/carray_undef.c +50 -7
  124. data/ext/carray_utils.c +373 -139
  125. data/ext/extconf.rb +24 -17
  126. data/ext/mk_call_cfunc.rb +25 -31
  127. data/ext/mk_pow5_table.rb +2 -1
  128. data/ext/mkkernel.rb +819 -488
  129. data/ext/ruby_carray.c +47 -42
  130. data/ext/version.h +7 -5
  131. data/lib/carray/attribute.rb +19 -18
  132. data/lib/carray/autoload_carray.rb +20 -15
  133. data/lib/carray/autoload_method_extension.rb +64 -57
  134. data/lib/carray/axis_group.rb +272 -185
  135. data/lib/carray/basics.rb +298 -56
  136. data/lib/carray/bincount_nd.rb +41 -18
  137. data/lib/carray/block_iterator.rb +167 -119
  138. data/lib/carray/boolean_reduce.rb +7 -4
  139. data/lib/carray/categorical.rb +84 -59
  140. data/lib/carray/categorical_iterator.rb +90 -67
  141. data/lib/carray/complex.rb +61 -41
  142. data/lib/carray/conditional.rb +98 -23
  143. data/lib/carray/const_string.rb +112 -46
  144. data/lib/carray/core_extensions.rb +20 -69
  145. data/lib/carray/distance_limit.rb +7 -5
  146. data/lib/carray/factories.rb +269 -0
  147. data/lib/carray/fixlen_string.rb +95 -12
  148. data/lib/carray/frame/column_verbs.rb +76 -9
  149. data/lib/carray/frame/concat.rb +51 -7
  150. data/lib/carray/frame/convert.rb +2 -1
  151. data/lib/carray/frame/csv_parser.rb +20 -5
  152. data/lib/carray/frame/frame.rb +73 -31
  153. data/lib/carray/frame/group.rb +247 -187
  154. data/lib/carray/frame/io.rb +36 -12
  155. data/lib/carray/frame/join.rb +56 -17
  156. data/lib/carray/frame/records.rb +7 -5
  157. data/lib/carray/frame/reshape.rb +27 -7
  158. data/lib/carray/frame/sort.rb +10 -8
  159. data/lib/carray/frame/verbs.rb +217 -134
  160. data/lib/carray/frame/windows.rb +254 -19
  161. data/lib/carray/frame.rb +1 -2
  162. data/lib/carray/fuse_source.rb +28 -23
  163. data/lib/carray/fusion.rb +30 -30
  164. data/lib/carray/histogram.rb +35 -16
  165. data/lib/carray/inspect.rb +7 -7
  166. data/lib/carray/iterator.rb +104 -23
  167. data/lib/carray/key_windows.rb +93 -61
  168. data/lib/carray/lazy.rb +208 -111
  169. data/lib/carray/limits.rb +80 -0
  170. data/lib/carray/mask_gap_fill.rb +21 -16
  171. data/lib/carray/math.rb +87 -50
  172. data/lib/carray/meld_reduce.rb +30 -8
  173. data/lib/carray/methods/align_addr.rb +29 -17
  174. data/lib/carray/methods/bin.rb +8 -1
  175. data/lib/carray/methods/bincount.rb +4 -2
  176. data/lib/carray/methods/bit_string.rb +19 -31
  177. data/lib/carray/methods/broadcast.rb +8 -3
  178. data/lib/carray/methods/choose.rb +5 -5
  179. data/lib/carray/methods/composition.rb +73 -72
  180. data/lib/carray/methods/{index.rb → coordinate.rb} +13 -13
  181. data/lib/carray/methods/discovery_along.rb +3 -3
  182. data/lib/carray/methods/factorize.rb +2 -0
  183. data/lib/carray/methods/gather_nd.rb +106 -103
  184. data/lib/carray/methods/insert_block.rb +2 -2
  185. data/lib/carray/methods/is_between.rb +6 -4
  186. data/lib/carray/methods/is_in.rb +183 -143
  187. data/lib/carray/methods/join.rb +2 -1
  188. data/lib/carray/methods/lag.rb +6 -2
  189. data/lib/carray/methods/locate_addr.rb +157 -94
  190. data/lib/carray/methods/mask_duplicates.rb +1 -1
  191. data/lib/carray/methods/meshgrid.rb +28 -16
  192. data/lib/carray/methods/mode.rb +67 -67
  193. data/lib/carray/methods/nunique.rb +9 -7
  194. data/lib/carray/methods/repeat.rb +23 -13
  195. data/lib/carray/methods/resize.rb +1 -1
  196. data/lib/carray/methods/snap.rb +24 -20
  197. data/lib/carray/methods/string_format.rb +2 -2
  198. data/lib/carray/methods/unique.rb +4 -2
  199. data/lib/carray/methods/value_counts.rb +1 -1
  200. data/lib/carray/mkmf.rb +25 -28
  201. data/lib/carray/percentile_arguments.rb +82 -0
  202. data/lib/carray/record_order.rb +50 -20
  203. data/lib/carray/rng.rb +1 -0
  204. data/lib/carray/runtime.rb +195 -17
  205. data/lib/carray/segment_iterator.rb +262 -137
  206. data/lib/carray/serialize.rb +635 -566
  207. data/lib/carray/slab_iterator.rb +114 -114
  208. data/lib/carray/stack.rb +14 -15
  209. data/lib/carray/string.rb +16 -22
  210. data/lib/carray/string_operation_extension.rb +97 -52
  211. data/lib/carray/struct.rb +122 -164
  212. data/lib/carray/struct_builder.rb +247 -73
  213. data/lib/carray/time.rb +663 -365
  214. data/lib/carray/window_iterator.rb +232 -155
  215. data/lib/carray.rb +6 -11
  216. data/yard-stubs/ca_obj_array.rb +20 -135
  217. data/yard-stubs/ca_obj_bitarray.rb +1 -8
  218. data/yard-stubs/ca_obj_bitfield.rb +6 -2
  219. data/yard-stubs/ca_obj_byte_swap.rb +21 -7
  220. data/yard-stubs/ca_obj_fake.rb +3 -1
  221. data/yard-stubs/ca_obj_farray.rb +1 -1
  222. data/yard-stubs/ca_obj_field.rb +8 -6
  223. data/yard-stubs/ca_obj_refer.rb +10 -5
  224. data/yard-stubs/ca_obj_roll.rb +7 -6
  225. data/yard-stubs/ca_obj_shift.rb +2 -3
  226. data/yard-stubs/ca_obj_stride.rb +5 -7
  227. data/yard-stubs/ca_obj_tile.rb +1 -1
  228. data/yard-stubs/ca_obj_time.rb +43 -0
  229. data/yard-stubs/ca_obj_transpose.rb +1 -1
  230. data/yard-stubs/ca_obj_window.rb +28 -16
  231. data/yard-stubs/carray_access.rb +55 -6
  232. data/yard-stubs/carray_attribute.rb +26 -38
  233. data/yard-stubs/carray_cast.rb +121 -162
  234. data/yard-stubs/carray_class.rb +3 -4
  235. data/yard-stubs/carray_conversion.rb +6 -7
  236. data/yard-stubs/carray_copy.rb +2 -1
  237. data/yard-stubs/carray_count.rb +10 -5
  238. data/yard-stubs/carray_element.rb +4 -3
  239. data/yard-stubs/carray_limits.rb +100 -0
  240. data/yard-stubs/carray_loop.rb +0 -20
  241. data/yard-stubs/carray_mask.rb +59 -41
  242. data/yard-stubs/carray_math.rb +162 -100
  243. data/yard-stubs/carray_mathfunc.rb +415 -3
  244. data/yard-stubs/carray_median_percentile.rb +29 -11
  245. data/yard-stubs/carray_memory_view.rb +2 -2
  246. data/yard-stubs/carray_order.rb +72 -33
  247. data/yard-stubs/carray_random.rb +6 -6
  248. data/yard-stubs/carray_reduce.rb +353 -0
  249. data/yard-stubs/carray_rng.rb +92 -0
  250. data/yard-stubs/carray_scatter.rb +12 -3
  251. data/yard-stubs/carray_slab.rb +7 -4
  252. data/yard-stubs/carray_sort.rb +7 -6
  253. data/yard-stubs/carray_test.rb +18 -5
  254. data/yard-stubs/carray_undef.rb +44 -5
  255. data/yard-stubs/ruby_carray.rb +75 -40
  256. metadata +63 -25
  257. data/CHANGELOG.v1.md +0 -126
  258. data/ext/carray_build_flags.h +0 -3
  259. data/ext/carray_config.h +0 -28
  260. data/ext/carray_data_type.c +0 -90
  261. data/ext/carray_kernels_bincmp.c +0 -6457
  262. data/ext/carray_kernels_binop.c +0 -31534
  263. data/ext/carray_kernels_init.c +0 -1734
  264. data/ext/carray_kernels_moncmp.c +0 -2104
  265. data/ext/carray_kernels_monop.c +0 -25387
  266. data/ext/carray_kernels_reduce_aggregate.c +0 -27545
  267. data/ext/carray_kernels_reduce_boolean.c +0 -1924
  268. data/ext/carray_kernels_reduce_cumulative.c +0 -11646
  269. data/ext/carray_kernels_reduce_extreme.c +0 -21631
  270. data/ext/carray_kernels_reduce_variance.c +0 -5981
  271. data/ext/carray_kernels_scan.c +0 -4302
  272. data/ext/carray_kernels_search.c +0 -37776
  273. data/ext/carray_kernels_sort.c +0 -10814
  274. data/ext/carray_kernels_triop.c +0 -1864
  275. data/lib/carray/construct.rb +0 -360
  276. data/lib/carray/data_type_extension.rb +0 -261
  277. data/lib/carray/data_type_limits.rb +0 -91
@@ -16,14 +16,12 @@
16
16
  * per-cell callback invocation as its last argument. Use when the
17
17
  * callback needs to share state with the caller (accumulators,
18
18
  * configuration flags, library plan handles, ...) without resorting to
19
- * file-static / global plumbing.
19
+ * file-static / global variables.
20
20
  *
21
21
  * Attach-safe: INPUT-only operands (= fsync[k] == '0') never call
22
- * ca_attach on the operand or its mask (= alias check + ALLOCV +
22
+ * ca_attach on the operand or its mask (= alias check + xmalloc +
23
23
  * ca_xfer_all for non-alias). OUTPUT operands (= fsync[k] == '1')
24
- * use ca_attach + ca_sync (= legitimate per the refined input-only-
25
- * operand invariant established in PROPOSAL_EAGER_ELEMENTWISE_NO_ATTACH
26
- * and extended in PROPOSAL_EAGER_SLOWPATH_CHUNKING_ARENA).
24
+ * use ca_attach + ca_sync.
27
25
  *
28
26
  * Slab variants `ca_call_cslab_N` / `ca_call_cslab_N_r` take the chunked
29
27
  * path instead (ca_sweep_acquire_chunked / ca_sweep_next_chunk /
@@ -37,10 +35,9 @@
37
35
  * function to wrap); use cslab when the operand is large, virtual, or the
38
36
  * body is worth vectorising.
39
37
  *
40
- * L0.1 (PROPOSAL_L0_AUTHOR_SURFACE, 2026-06-11): the per-operand acquire
41
- * + broadcast check + mask OR + release lifecycle is now factored out
42
- * into ext/ca_sweep_engine.{c,h} (ca_sweep_acquire / ca_sweep_release). This
43
- * file keeps the arity-dependent inner loop only. ABI unchanged.
38
+ * The per-operand acquire + broadcast check + mask OR + release lifecycle
39
+ * lives in ext/ca_sweep_engine.{c,h} (ca_sweep_acquire / ca_sweep_release).
40
+ * This file keeps the arity-dependent inner loop only.
44
41
  *
45
42
  * --------------------------------------------------------------------------- */
46
43
 
@@ -124,7 +121,7 @@ ca_call_cfunc_1_walk (VALUE arg)
124
121
 
125
122
  VALUE
126
123
  ca_call_cfunc_1 (void (*func)(void *p0), const char *fsync,
127
- VALUE rcx0)
124
+ volatile VALUE rcx0)
128
125
  {
129
126
  CArray *cx[1];
130
127
  char *base[1];
@@ -134,7 +131,7 @@ ca_call_cfunc_1 (void (*func)(void *p0), const char *fsync,
134
131
  ca_sweep_state_t state;
135
132
  ca_call_cfunc_1_ctx_t ctx;
136
133
 
137
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
134
+ GetCArray(rcx0, cx[0]);
138
135
 
139
136
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
140
137
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -194,7 +191,7 @@ ca_call_cfunc_2_walk (VALUE arg)
194
191
 
195
192
  VALUE
196
193
  ca_call_cfunc_2 (void (*func)(void *p0, void *p1), const char *fsync,
197
- VALUE rcx0, VALUE rcx1)
194
+ volatile VALUE rcx0, volatile VALUE rcx1)
198
195
  {
199
196
  CArray *cx[2];
200
197
  char *base[2];
@@ -204,8 +201,8 @@ ca_call_cfunc_2 (void (*func)(void *p0, void *p1), const char *fsync,
204
201
  ca_sweep_state_t state;
205
202
  ca_call_cfunc_2_ctx_t ctx;
206
203
 
207
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
208
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
204
+ GetCArray(rcx0, cx[0]);
205
+ GetCArray(rcx1, cx[1]);
209
206
 
210
207
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
211
208
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -226,8 +223,6 @@ ca_call_cfunc_2 (void (*func)(void *p0, void *p1), const char *fsync,
226
223
  ctx.userdata = NULL;
227
224
  ca_sweep_run(&state, ca_call_cfunc_2_walk, (VALUE) &ctx);
228
225
 
229
- RB_GC_GUARD(rcx1);
230
-
231
226
  return rcx0;
232
227
  }
233
228
 
@@ -267,7 +262,7 @@ ca_call_cfunc_3_walk (VALUE arg)
267
262
 
268
263
  VALUE
269
264
  ca_call_cfunc_3 (void (*func)(void *p0, void *p1, void *p2), const char *fsync,
270
- VALUE rcx0, VALUE rcx1, VALUE rcx2)
265
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2)
271
266
  {
272
267
  CArray *cx[3];
273
268
  char *base[3];
@@ -277,9 +272,9 @@ ca_call_cfunc_3 (void (*func)(void *p0, void *p1, void *p2), const char *fsync,
277
272
  ca_sweep_state_t state;
278
273
  ca_call_cfunc_3_ctx_t ctx;
279
274
 
280
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
281
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
282
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
275
+ GetCArray(rcx0, cx[0]);
276
+ GetCArray(rcx1, cx[1]);
277
+ GetCArray(rcx2, cx[2]);
283
278
 
284
279
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
285
280
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -300,9 +295,6 @@ ca_call_cfunc_3 (void (*func)(void *p0, void *p1, void *p2), const char *fsync,
300
295
  ctx.userdata = NULL;
301
296
  ca_sweep_run(&state, ca_call_cfunc_3_walk, (VALUE) &ctx);
302
297
 
303
- RB_GC_GUARD(rcx1);
304
- RB_GC_GUARD(rcx2);
305
-
306
298
  return rcx0;
307
299
  }
308
300
 
@@ -342,7 +334,7 @@ ca_call_cfunc_4_walk (VALUE arg)
342
334
 
343
335
  VALUE
344
336
  ca_call_cfunc_4 (void (*func)(void *p0, void *p1, void *p2, void *p3), const char *fsync,
345
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3)
337
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3)
346
338
  {
347
339
  CArray *cx[4];
348
340
  char *base[4];
@@ -352,10 +344,10 @@ ca_call_cfunc_4 (void (*func)(void *p0, void *p1, void *p2, void *p3), const cha
352
344
  ca_sweep_state_t state;
353
345
  ca_call_cfunc_4_ctx_t ctx;
354
346
 
355
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
356
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
357
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
358
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
347
+ GetCArray(rcx0, cx[0]);
348
+ GetCArray(rcx1, cx[1]);
349
+ GetCArray(rcx2, cx[2]);
350
+ GetCArray(rcx3, cx[3]);
359
351
 
360
352
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
361
353
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -376,10 +368,6 @@ ca_call_cfunc_4 (void (*func)(void *p0, void *p1, void *p2, void *p3), const cha
376
368
  ctx.userdata = NULL;
377
369
  ca_sweep_run(&state, ca_call_cfunc_4_walk, (VALUE) &ctx);
378
370
 
379
- RB_GC_GUARD(rcx1);
380
- RB_GC_GUARD(rcx2);
381
- RB_GC_GUARD(rcx3);
382
-
383
371
  return rcx0;
384
372
  }
385
373
 
@@ -419,7 +407,7 @@ ca_call_cfunc_5_walk (VALUE arg)
419
407
 
420
408
  VALUE
421
409
  ca_call_cfunc_5 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4), const char *fsync,
422
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3, VALUE rcx4)
410
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3, volatile VALUE rcx4)
423
411
  {
424
412
  CArray *cx[5];
425
413
  char *base[5];
@@ -429,11 +417,11 @@ ca_call_cfunc_5 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4),
429
417
  ca_sweep_state_t state;
430
418
  ca_call_cfunc_5_ctx_t ctx;
431
419
 
432
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
433
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
434
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
435
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
436
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
420
+ GetCArray(rcx0, cx[0]);
421
+ GetCArray(rcx1, cx[1]);
422
+ GetCArray(rcx2, cx[2]);
423
+ GetCArray(rcx3, cx[3]);
424
+ GetCArray(rcx4, cx[4]);
437
425
 
438
426
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
439
427
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -454,11 +442,6 @@ ca_call_cfunc_5 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4),
454
442
  ctx.userdata = NULL;
455
443
  ca_sweep_run(&state, ca_call_cfunc_5_walk, (VALUE) &ctx);
456
444
 
457
- RB_GC_GUARD(rcx1);
458
- RB_GC_GUARD(rcx2);
459
- RB_GC_GUARD(rcx3);
460
- RB_GC_GUARD(rcx4);
461
-
462
445
  return rcx0;
463
446
  }
464
447
 
@@ -498,7 +481,7 @@ ca_call_cfunc_6_walk (VALUE arg)
498
481
 
499
482
  VALUE
500
483
  ca_call_cfunc_6 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4, void *p5), const char *fsync,
501
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3, VALUE rcx4, VALUE rcx5)
484
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3, volatile VALUE rcx4, volatile VALUE rcx5)
502
485
  {
503
486
  CArray *cx[6];
504
487
  char *base[6];
@@ -508,12 +491,12 @@ ca_call_cfunc_6 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4,
508
491
  ca_sweep_state_t state;
509
492
  ca_call_cfunc_6_ctx_t ctx;
510
493
 
511
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
512
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
513
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
514
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
515
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
516
- TypedData_Get_Struct(rcx5, CArray, &carray_data_type, cx[5]);
494
+ GetCArray(rcx0, cx[0]);
495
+ GetCArray(rcx1, cx[1]);
496
+ GetCArray(rcx2, cx[2]);
497
+ GetCArray(rcx3, cx[3]);
498
+ GetCArray(rcx4, cx[4]);
499
+ GetCArray(rcx5, cx[5]);
517
500
 
518
501
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
519
502
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -534,12 +517,6 @@ ca_call_cfunc_6 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4,
534
517
  ctx.userdata = NULL;
535
518
  ca_sweep_run(&state, ca_call_cfunc_6_walk, (VALUE) &ctx);
536
519
 
537
- RB_GC_GUARD(rcx1);
538
- RB_GC_GUARD(rcx2);
539
- RB_GC_GUARD(rcx3);
540
- RB_GC_GUARD(rcx4);
541
- RB_GC_GUARD(rcx5);
542
-
543
520
  return rcx0;
544
521
  }
545
522
 
@@ -579,7 +556,7 @@ ca_call_cfunc_7_walk (VALUE arg)
579
556
 
580
557
  VALUE
581
558
  ca_call_cfunc_7 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4, void *p5, void *p6), const char *fsync,
582
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3, VALUE rcx4, VALUE rcx5, VALUE rcx6)
559
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3, volatile VALUE rcx4, volatile VALUE rcx5, volatile VALUE rcx6)
583
560
  {
584
561
  CArray *cx[7];
585
562
  char *base[7];
@@ -589,13 +566,13 @@ ca_call_cfunc_7 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4,
589
566
  ca_sweep_state_t state;
590
567
  ca_call_cfunc_7_ctx_t ctx;
591
568
 
592
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
593
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
594
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
595
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
596
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
597
- TypedData_Get_Struct(rcx5, CArray, &carray_data_type, cx[5]);
598
- TypedData_Get_Struct(rcx6, CArray, &carray_data_type, cx[6]);
569
+ GetCArray(rcx0, cx[0]);
570
+ GetCArray(rcx1, cx[1]);
571
+ GetCArray(rcx2, cx[2]);
572
+ GetCArray(rcx3, cx[3]);
573
+ GetCArray(rcx4, cx[4]);
574
+ GetCArray(rcx5, cx[5]);
575
+ GetCArray(rcx6, cx[6]);
599
576
 
600
577
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
601
578
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -616,13 +593,6 @@ ca_call_cfunc_7 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4,
616
593
  ctx.userdata = NULL;
617
594
  ca_sweep_run(&state, ca_call_cfunc_7_walk, (VALUE) &ctx);
618
595
 
619
- RB_GC_GUARD(rcx1);
620
- RB_GC_GUARD(rcx2);
621
- RB_GC_GUARD(rcx3);
622
- RB_GC_GUARD(rcx4);
623
- RB_GC_GUARD(rcx5);
624
- RB_GC_GUARD(rcx6);
625
-
626
596
  return rcx0;
627
597
  }
628
598
 
@@ -798,7 +768,7 @@ ca_call_cfunc_2_1 (int8_t dty1, int8_t dty2, int8_t dtx1, void (*mathfunc)(void*
798
768
  if ( rb_ca_is_scalar(ry2) ) {
799
769
  ry2 = rb_ca_fetch_addr(ry2, 0);
800
770
  }
801
- return rb_ary_new3(2, ry1, ry2);
771
+ return rb_ary_new_from_args(2, ry1, ry2);
802
772
  }
803
773
 
804
774
  VALUE
@@ -828,7 +798,7 @@ ca_call_cfunc_2_2 (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, void (*ma
828
798
  if ( rb_ca_is_scalar(ry2) ) {
829
799
  ry2 = rb_ca_fetch_addr(ry2, 0);
830
800
  }
831
- return rb_ary_new3(2, ry1, ry2);
801
+ return rb_ary_new_from_args(2, ry1, ry2);
832
802
  }
833
803
 
834
804
  VALUE
@@ -859,7 +829,7 @@ ca_call_cfunc_2_3 (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t dt
859
829
  if ( rb_ca_is_scalar(ry2) ) {
860
830
  ry2 = rb_ca_fetch_addr(ry2, 0);
861
831
  }
862
- return rb_ary_new3(2, ry1, ry2);
832
+ return rb_ary_new_from_args(2, ry1, ry2);
863
833
  }
864
834
 
865
835
  VALUE
@@ -891,7 +861,7 @@ ca_call_cfunc_2_4 (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t dt
891
861
  if ( rb_ca_is_scalar(ry2) ) {
892
862
  ry2 = rb_ca_fetch_addr(ry2, 0);
893
863
  }
894
- return rb_ary_new3(2, ry1, ry2);
864
+ return rb_ary_new_from_args(2, ry1, ry2);
895
865
  }
896
866
 
897
867
  VALUE
@@ -928,7 +898,7 @@ ca_call_cfunc_3_1 (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, void (*ma
928
898
  if ( rb_ca_is_scalar(ry3) ) {
929
899
  ry3 = rb_ca_fetch_addr(ry3, 0);
930
900
  }
931
- return rb_ary_new3(3, ry1, ry2, ry3);
901
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
932
902
  }
933
903
 
934
904
  VALUE
@@ -966,7 +936,7 @@ ca_call_cfunc_3_2 (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t dt
966
936
  if ( rb_ca_is_scalar(ry3) ) {
967
937
  ry3 = rb_ca_fetch_addr(ry3, 0);
968
938
  }
969
- return rb_ary_new3(3, ry1, ry2, ry3);
939
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
970
940
  }
971
941
 
972
942
  VALUE
@@ -1005,7 +975,7 @@ ca_call_cfunc_3_3 (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t dt
1005
975
  if ( rb_ca_is_scalar(ry3) ) {
1006
976
  ry3 = rb_ca_fetch_addr(ry3, 0);
1007
977
  }
1008
- return rb_ary_new3(3, ry1, ry2, ry3);
978
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
1009
979
  }
1010
980
 
1011
981
  /* -------------------------------------------------------------------- */
@@ -1051,7 +1021,7 @@ ca_call_cfunc_1_r_walk (VALUE arg)
1051
1021
 
1052
1022
  VALUE
1053
1023
  ca_call_cfunc_1_r (void (*func)(void *p0, void *userdata), const char *fsync,
1054
- VALUE rcx0,
1024
+ volatile VALUE rcx0,
1055
1025
  void *userdata)
1056
1026
  {
1057
1027
  CArray *cx[1];
@@ -1062,7 +1032,7 @@ ca_call_cfunc_1_r (void (*func)(void *p0, void *userdata), const char *fsync,
1062
1032
  ca_sweep_state_t state;
1063
1033
  ca_call_cfunc_1_r_ctx_t ctx;
1064
1034
 
1065
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1035
+ GetCArray(rcx0, cx[0]);
1066
1036
 
1067
1037
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1068
1038
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1122,7 +1092,7 @@ ca_call_cfunc_2_r_walk (VALUE arg)
1122
1092
 
1123
1093
  VALUE
1124
1094
  ca_call_cfunc_2_r (void (*func)(void *p0, void *p1, void *userdata), const char *fsync,
1125
- VALUE rcx0, VALUE rcx1,
1095
+ volatile VALUE rcx0, volatile VALUE rcx1,
1126
1096
  void *userdata)
1127
1097
  {
1128
1098
  CArray *cx[2];
@@ -1133,8 +1103,8 @@ ca_call_cfunc_2_r (void (*func)(void *p0, void *p1, void *userdata), const char
1133
1103
  ca_sweep_state_t state;
1134
1104
  ca_call_cfunc_2_r_ctx_t ctx;
1135
1105
 
1136
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1137
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1106
+ GetCArray(rcx0, cx[0]);
1107
+ GetCArray(rcx1, cx[1]);
1138
1108
 
1139
1109
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1140
1110
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1155,8 +1125,6 @@ ca_call_cfunc_2_r (void (*func)(void *p0, void *p1, void *userdata), const char
1155
1125
  ctx.userdata = userdata;
1156
1126
  ca_sweep_run(&state, ca_call_cfunc_2_r_walk, (VALUE) &ctx);
1157
1127
 
1158
- RB_GC_GUARD(rcx1);
1159
-
1160
1128
  return rcx0;
1161
1129
  }
1162
1130
 
@@ -1196,7 +1164,7 @@ ca_call_cfunc_3_r_walk (VALUE arg)
1196
1164
 
1197
1165
  VALUE
1198
1166
  ca_call_cfunc_3_r (void (*func)(void *p0, void *p1, void *p2, void *userdata), const char *fsync,
1199
- VALUE rcx0, VALUE rcx1, VALUE rcx2,
1167
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2,
1200
1168
  void *userdata)
1201
1169
  {
1202
1170
  CArray *cx[3];
@@ -1207,9 +1175,9 @@ ca_call_cfunc_3_r (void (*func)(void *p0, void *p1, void *p2, void *userdata), c
1207
1175
  ca_sweep_state_t state;
1208
1176
  ca_call_cfunc_3_r_ctx_t ctx;
1209
1177
 
1210
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1211
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1212
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
1178
+ GetCArray(rcx0, cx[0]);
1179
+ GetCArray(rcx1, cx[1]);
1180
+ GetCArray(rcx2, cx[2]);
1213
1181
 
1214
1182
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1215
1183
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1230,9 +1198,6 @@ ca_call_cfunc_3_r (void (*func)(void *p0, void *p1, void *p2, void *userdata), c
1230
1198
  ctx.userdata = userdata;
1231
1199
  ca_sweep_run(&state, ca_call_cfunc_3_r_walk, (VALUE) &ctx);
1232
1200
 
1233
- RB_GC_GUARD(rcx1);
1234
- RB_GC_GUARD(rcx2);
1235
-
1236
1201
  return rcx0;
1237
1202
  }
1238
1203
 
@@ -1272,7 +1237,7 @@ ca_call_cfunc_4_r_walk (VALUE arg)
1272
1237
 
1273
1238
  VALUE
1274
1239
  ca_call_cfunc_4_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *userdata), const char *fsync,
1275
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3,
1240
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3,
1276
1241
  void *userdata)
1277
1242
  {
1278
1243
  CArray *cx[4];
@@ -1283,10 +1248,10 @@ ca_call_cfunc_4_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *us
1283
1248
  ca_sweep_state_t state;
1284
1249
  ca_call_cfunc_4_r_ctx_t ctx;
1285
1250
 
1286
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1287
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1288
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
1289
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
1251
+ GetCArray(rcx0, cx[0]);
1252
+ GetCArray(rcx1, cx[1]);
1253
+ GetCArray(rcx2, cx[2]);
1254
+ GetCArray(rcx3, cx[3]);
1290
1255
 
1291
1256
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1292
1257
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1307,10 +1272,6 @@ ca_call_cfunc_4_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *us
1307
1272
  ctx.userdata = userdata;
1308
1273
  ca_sweep_run(&state, ca_call_cfunc_4_r_walk, (VALUE) &ctx);
1309
1274
 
1310
- RB_GC_GUARD(rcx1);
1311
- RB_GC_GUARD(rcx2);
1312
- RB_GC_GUARD(rcx3);
1313
-
1314
1275
  return rcx0;
1315
1276
  }
1316
1277
 
@@ -1350,7 +1311,7 @@ ca_call_cfunc_5_r_walk (VALUE arg)
1350
1311
 
1351
1312
  VALUE
1352
1313
  ca_call_cfunc_5_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4, void *userdata), const char *fsync,
1353
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3, VALUE rcx4,
1314
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3, volatile VALUE rcx4,
1354
1315
  void *userdata)
1355
1316
  {
1356
1317
  CArray *cx[5];
@@ -1361,11 +1322,11 @@ ca_call_cfunc_5_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4
1361
1322
  ca_sweep_state_t state;
1362
1323
  ca_call_cfunc_5_r_ctx_t ctx;
1363
1324
 
1364
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1365
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1366
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
1367
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
1368
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
1325
+ GetCArray(rcx0, cx[0]);
1326
+ GetCArray(rcx1, cx[1]);
1327
+ GetCArray(rcx2, cx[2]);
1328
+ GetCArray(rcx3, cx[3]);
1329
+ GetCArray(rcx4, cx[4]);
1369
1330
 
1370
1331
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1371
1332
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1386,11 +1347,6 @@ ca_call_cfunc_5_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4
1386
1347
  ctx.userdata = userdata;
1387
1348
  ca_sweep_run(&state, ca_call_cfunc_5_r_walk, (VALUE) &ctx);
1388
1349
 
1389
- RB_GC_GUARD(rcx1);
1390
- RB_GC_GUARD(rcx2);
1391
- RB_GC_GUARD(rcx3);
1392
- RB_GC_GUARD(rcx4);
1393
-
1394
1350
  return rcx0;
1395
1351
  }
1396
1352
 
@@ -1430,7 +1386,7 @@ ca_call_cfunc_6_r_walk (VALUE arg)
1430
1386
 
1431
1387
  VALUE
1432
1388
  ca_call_cfunc_6_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4, void *p5, void *userdata), const char *fsync,
1433
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3, VALUE rcx4, VALUE rcx5,
1389
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3, volatile VALUE rcx4, volatile VALUE rcx5,
1434
1390
  void *userdata)
1435
1391
  {
1436
1392
  CArray *cx[6];
@@ -1441,12 +1397,12 @@ ca_call_cfunc_6_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4
1441
1397
  ca_sweep_state_t state;
1442
1398
  ca_call_cfunc_6_r_ctx_t ctx;
1443
1399
 
1444
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1445
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1446
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
1447
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
1448
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
1449
- TypedData_Get_Struct(rcx5, CArray, &carray_data_type, cx[5]);
1400
+ GetCArray(rcx0, cx[0]);
1401
+ GetCArray(rcx1, cx[1]);
1402
+ GetCArray(rcx2, cx[2]);
1403
+ GetCArray(rcx3, cx[3]);
1404
+ GetCArray(rcx4, cx[4]);
1405
+ GetCArray(rcx5, cx[5]);
1450
1406
 
1451
1407
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1452
1408
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1467,12 +1423,6 @@ ca_call_cfunc_6_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4
1467
1423
  ctx.userdata = userdata;
1468
1424
  ca_sweep_run(&state, ca_call_cfunc_6_r_walk, (VALUE) &ctx);
1469
1425
 
1470
- RB_GC_GUARD(rcx1);
1471
- RB_GC_GUARD(rcx2);
1472
- RB_GC_GUARD(rcx3);
1473
- RB_GC_GUARD(rcx4);
1474
- RB_GC_GUARD(rcx5);
1475
-
1476
1426
  return rcx0;
1477
1427
  }
1478
1428
 
@@ -1512,7 +1462,7 @@ ca_call_cfunc_7_r_walk (VALUE arg)
1512
1462
 
1513
1463
  VALUE
1514
1464
  ca_call_cfunc_7_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4, void *p5, void *p6, void *userdata), const char *fsync,
1515
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3, VALUE rcx4, VALUE rcx5, VALUE rcx6,
1465
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3, volatile VALUE rcx4, volatile VALUE rcx5, volatile VALUE rcx6,
1516
1466
  void *userdata)
1517
1467
  {
1518
1468
  CArray *cx[7];
@@ -1523,13 +1473,13 @@ ca_call_cfunc_7_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4
1523
1473
  ca_sweep_state_t state;
1524
1474
  ca_call_cfunc_7_r_ctx_t ctx;
1525
1475
 
1526
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1527
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1528
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
1529
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
1530
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
1531
- TypedData_Get_Struct(rcx5, CArray, &carray_data_type, cx[5]);
1532
- TypedData_Get_Struct(rcx6, CArray, &carray_data_type, cx[6]);
1476
+ GetCArray(rcx0, cx[0]);
1477
+ GetCArray(rcx1, cx[1]);
1478
+ GetCArray(rcx2, cx[2]);
1479
+ GetCArray(rcx3, cx[3]);
1480
+ GetCArray(rcx4, cx[4]);
1481
+ GetCArray(rcx5, cx[5]);
1482
+ GetCArray(rcx6, cx[6]);
1533
1483
 
1534
1484
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1535
1485
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1550,13 +1500,6 @@ ca_call_cfunc_7_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4
1550
1500
  ctx.userdata = userdata;
1551
1501
  ca_sweep_run(&state, ca_call_cfunc_7_r_walk, (VALUE) &ctx);
1552
1502
 
1553
- RB_GC_GUARD(rcx1);
1554
- RB_GC_GUARD(rcx2);
1555
- RB_GC_GUARD(rcx3);
1556
- RB_GC_GUARD(rcx4);
1557
- RB_GC_GUARD(rcx5);
1558
- RB_GC_GUARD(rcx6);
1559
-
1560
1503
  return rcx0;
1561
1504
  }
1562
1505
 
@@ -1727,7 +1670,7 @@ ca_call_cfunc_2_1_r (int8_t dty1, int8_t dty2, int8_t dtx1, void (*mathfunc)(voi
1727
1670
  if ( rb_ca_is_scalar(ry2) ) {
1728
1671
  ry2 = rb_ca_fetch_addr(ry2, 0);
1729
1672
  }
1730
- return rb_ary_new3(2, ry1, ry2);
1673
+ return rb_ary_new_from_args(2, ry1, ry2);
1731
1674
  }
1732
1675
 
1733
1676
  VALUE
@@ -1757,7 +1700,7 @@ ca_call_cfunc_2_2_r (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, void (*
1757
1700
  if ( rb_ca_is_scalar(ry2) ) {
1758
1701
  ry2 = rb_ca_fetch_addr(ry2, 0);
1759
1702
  }
1760
- return rb_ary_new3(2, ry1, ry2);
1703
+ return rb_ary_new_from_args(2, ry1, ry2);
1761
1704
  }
1762
1705
 
1763
1706
  VALUE
@@ -1788,7 +1731,7 @@ ca_call_cfunc_2_3_r (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t
1788
1731
  if ( rb_ca_is_scalar(ry2) ) {
1789
1732
  ry2 = rb_ca_fetch_addr(ry2, 0);
1790
1733
  }
1791
- return rb_ary_new3(2, ry1, ry2);
1734
+ return rb_ary_new_from_args(2, ry1, ry2);
1792
1735
  }
1793
1736
 
1794
1737
  VALUE
@@ -1820,7 +1763,7 @@ ca_call_cfunc_2_4_r (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t
1820
1763
  if ( rb_ca_is_scalar(ry2) ) {
1821
1764
  ry2 = rb_ca_fetch_addr(ry2, 0);
1822
1765
  }
1823
- return rb_ary_new3(2, ry1, ry2);
1766
+ return rb_ary_new_from_args(2, ry1, ry2);
1824
1767
  }
1825
1768
 
1826
1769
  VALUE
@@ -1857,7 +1800,7 @@ ca_call_cfunc_3_1_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, void (*
1857
1800
  if ( rb_ca_is_scalar(ry3) ) {
1858
1801
  ry3 = rb_ca_fetch_addr(ry3, 0);
1859
1802
  }
1860
- return rb_ary_new3(3, ry1, ry2, ry3);
1803
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
1861
1804
  }
1862
1805
 
1863
1806
  VALUE
@@ -1895,7 +1838,7 @@ ca_call_cfunc_3_2_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t
1895
1838
  if ( rb_ca_is_scalar(ry3) ) {
1896
1839
  ry3 = rb_ca_fetch_addr(ry3, 0);
1897
1840
  }
1898
- return rb_ary_new3(3, ry1, ry2, ry3);
1841
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
1899
1842
  }
1900
1843
 
1901
1844
  VALUE
@@ -1934,7 +1877,7 @@ ca_call_cfunc_3_3_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t
1934
1877
  if ( rb_ca_is_scalar(ry3) ) {
1935
1878
  ry3 = rb_ca_fetch_addr(ry3, 0);
1936
1879
  }
1937
- return rb_ary_new3(3, ry1, ry2, ry3);
1880
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
1938
1881
  }
1939
1882
 
1940
1883
  /* -------------------------------------------------------------------- */
@@ -1947,7 +1890,7 @@ ca_call_cfunc_3_3_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t
1947
1890
 
1948
1891
  VALUE
1949
1892
  ca_call_cslab_1 (ca_cslab_t func, const char *fsync,
1950
- VALUE rcx0)
1893
+ volatile VALUE rcx0)
1951
1894
  {
1952
1895
  CArray *cx[1];
1953
1896
  char *base[1];
@@ -1958,7 +1901,7 @@ ca_call_cslab_1 (ca_cslab_t func, const char *fsync,
1958
1901
  ca_sweep_state_t state;
1959
1902
  ca_cslab_ctx_t ctx;
1960
1903
 
1961
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1904
+ GetCArray(rcx0, cx[0]);
1962
1905
 
1963
1906
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
1964
1907
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -1989,7 +1932,7 @@ ca_call_cslab_1 (ca_cslab_t func, const char *fsync,
1989
1932
 
1990
1933
  VALUE
1991
1934
  ca_call_cslab_2 (ca_cslab_t func, const char *fsync,
1992
- VALUE rcx0, VALUE rcx1)
1935
+ volatile VALUE rcx0, volatile VALUE rcx1)
1993
1936
  {
1994
1937
  CArray *cx[2];
1995
1938
  char *base[2];
@@ -2000,8 +1943,8 @@ ca_call_cslab_2 (ca_cslab_t func, const char *fsync,
2000
1943
  ca_sweep_state_t state;
2001
1944
  ca_cslab_ctx_t ctx;
2002
1945
 
2003
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2004
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1946
+ GetCArray(rcx0, cx[0]);
1947
+ GetCArray(rcx1, cx[1]);
2005
1948
 
2006
1949
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2007
1950
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2027,14 +1970,12 @@ ca_call_cslab_2 (ca_cslab_t func, const char *fsync,
2027
1970
  ctx.userdata = NULL;
2028
1971
  ca_sweep_run_chunked(&state, ca_cslab_walk, (VALUE) &ctx);
2029
1972
 
2030
- RB_GC_GUARD(rcx1);
2031
-
2032
1973
  return rcx0;
2033
1974
  }
2034
1975
 
2035
1976
  VALUE
2036
1977
  ca_call_cslab_3 (ca_cslab_t func, const char *fsync,
2037
- VALUE rcx0, VALUE rcx1, VALUE rcx2)
1978
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2)
2038
1979
  {
2039
1980
  CArray *cx[3];
2040
1981
  char *base[3];
@@ -2045,9 +1986,9 @@ ca_call_cslab_3 (ca_cslab_t func, const char *fsync,
2045
1986
  ca_sweep_state_t state;
2046
1987
  ca_cslab_ctx_t ctx;
2047
1988
 
2048
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2049
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2050
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
1989
+ GetCArray(rcx0, cx[0]);
1990
+ GetCArray(rcx1, cx[1]);
1991
+ GetCArray(rcx2, cx[2]);
2051
1992
 
2052
1993
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2053
1994
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2073,15 +2014,12 @@ ca_call_cslab_3 (ca_cslab_t func, const char *fsync,
2073
2014
  ctx.userdata = NULL;
2074
2015
  ca_sweep_run_chunked(&state, ca_cslab_walk, (VALUE) &ctx);
2075
2016
 
2076
- RB_GC_GUARD(rcx1);
2077
- RB_GC_GUARD(rcx2);
2078
-
2079
2017
  return rcx0;
2080
2018
  }
2081
2019
 
2082
2020
  VALUE
2083
2021
  ca_call_cslab_4 (ca_cslab_t func, const char *fsync,
2084
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3)
2022
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3)
2085
2023
  {
2086
2024
  CArray *cx[4];
2087
2025
  char *base[4];
@@ -2092,10 +2030,10 @@ ca_call_cslab_4 (ca_cslab_t func, const char *fsync,
2092
2030
  ca_sweep_state_t state;
2093
2031
  ca_cslab_ctx_t ctx;
2094
2032
 
2095
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2096
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2097
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2098
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2033
+ GetCArray(rcx0, cx[0]);
2034
+ GetCArray(rcx1, cx[1]);
2035
+ GetCArray(rcx2, cx[2]);
2036
+ GetCArray(rcx3, cx[3]);
2099
2037
 
2100
2038
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2101
2039
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2121,16 +2059,12 @@ ca_call_cslab_4 (ca_cslab_t func, const char *fsync,
2121
2059
  ctx.userdata = NULL;
2122
2060
  ca_sweep_run_chunked(&state, ca_cslab_walk, (VALUE) &ctx);
2123
2061
 
2124
- RB_GC_GUARD(rcx1);
2125
- RB_GC_GUARD(rcx2);
2126
- RB_GC_GUARD(rcx3);
2127
-
2128
2062
  return rcx0;
2129
2063
  }
2130
2064
 
2131
2065
  VALUE
2132
2066
  ca_call_cslab_5 (ca_cslab_t func, const char *fsync,
2133
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3, VALUE rcx4)
2067
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3, volatile VALUE rcx4)
2134
2068
  {
2135
2069
  CArray *cx[5];
2136
2070
  char *base[5];
@@ -2141,11 +2075,11 @@ ca_call_cslab_5 (ca_cslab_t func, const char *fsync,
2141
2075
  ca_sweep_state_t state;
2142
2076
  ca_cslab_ctx_t ctx;
2143
2077
 
2144
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2145
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2146
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2147
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2148
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
2078
+ GetCArray(rcx0, cx[0]);
2079
+ GetCArray(rcx1, cx[1]);
2080
+ GetCArray(rcx2, cx[2]);
2081
+ GetCArray(rcx3, cx[3]);
2082
+ GetCArray(rcx4, cx[4]);
2149
2083
 
2150
2084
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2151
2085
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2171,17 +2105,12 @@ ca_call_cslab_5 (ca_cslab_t func, const char *fsync,
2171
2105
  ctx.userdata = NULL;
2172
2106
  ca_sweep_run_chunked(&state, ca_cslab_walk, (VALUE) &ctx);
2173
2107
 
2174
- RB_GC_GUARD(rcx1);
2175
- RB_GC_GUARD(rcx2);
2176
- RB_GC_GUARD(rcx3);
2177
- RB_GC_GUARD(rcx4);
2178
-
2179
2108
  return rcx0;
2180
2109
  }
2181
2110
 
2182
2111
  VALUE
2183
2112
  ca_call_cslab_6 (ca_cslab_t func, const char *fsync,
2184
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3, VALUE rcx4, VALUE rcx5)
2113
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3, volatile VALUE rcx4, volatile VALUE rcx5)
2185
2114
  {
2186
2115
  CArray *cx[6];
2187
2116
  char *base[6];
@@ -2192,12 +2121,12 @@ ca_call_cslab_6 (ca_cslab_t func, const char *fsync,
2192
2121
  ca_sweep_state_t state;
2193
2122
  ca_cslab_ctx_t ctx;
2194
2123
 
2195
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2196
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2197
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2198
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2199
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
2200
- TypedData_Get_Struct(rcx5, CArray, &carray_data_type, cx[5]);
2124
+ GetCArray(rcx0, cx[0]);
2125
+ GetCArray(rcx1, cx[1]);
2126
+ GetCArray(rcx2, cx[2]);
2127
+ GetCArray(rcx3, cx[3]);
2128
+ GetCArray(rcx4, cx[4]);
2129
+ GetCArray(rcx5, cx[5]);
2201
2130
 
2202
2131
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2203
2132
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2223,18 +2152,12 @@ ca_call_cslab_6 (ca_cslab_t func, const char *fsync,
2223
2152
  ctx.userdata = NULL;
2224
2153
  ca_sweep_run_chunked(&state, ca_cslab_walk, (VALUE) &ctx);
2225
2154
 
2226
- RB_GC_GUARD(rcx1);
2227
- RB_GC_GUARD(rcx2);
2228
- RB_GC_GUARD(rcx3);
2229
- RB_GC_GUARD(rcx4);
2230
- RB_GC_GUARD(rcx5);
2231
-
2232
2155
  return rcx0;
2233
2156
  }
2234
2157
 
2235
2158
  VALUE
2236
2159
  ca_call_cslab_7 (ca_cslab_t func, const char *fsync,
2237
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3, VALUE rcx4, VALUE rcx5, VALUE rcx6)
2160
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3, volatile VALUE rcx4, volatile VALUE rcx5, volatile VALUE rcx6)
2238
2161
  {
2239
2162
  CArray *cx[7];
2240
2163
  char *base[7];
@@ -2245,13 +2168,13 @@ ca_call_cslab_7 (ca_cslab_t func, const char *fsync,
2245
2168
  ca_sweep_state_t state;
2246
2169
  ca_cslab_ctx_t ctx;
2247
2170
 
2248
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2249
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2250
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2251
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2252
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
2253
- TypedData_Get_Struct(rcx5, CArray, &carray_data_type, cx[5]);
2254
- TypedData_Get_Struct(rcx6, CArray, &carray_data_type, cx[6]);
2171
+ GetCArray(rcx0, cx[0]);
2172
+ GetCArray(rcx1, cx[1]);
2173
+ GetCArray(rcx2, cx[2]);
2174
+ GetCArray(rcx3, cx[3]);
2175
+ GetCArray(rcx4, cx[4]);
2176
+ GetCArray(rcx5, cx[5]);
2177
+ GetCArray(rcx6, cx[6]);
2255
2178
 
2256
2179
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2257
2180
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2277,19 +2200,12 @@ ca_call_cslab_7 (ca_cslab_t func, const char *fsync,
2277
2200
  ctx.userdata = NULL;
2278
2201
  ca_sweep_run_chunked(&state, ca_cslab_walk, (VALUE) &ctx);
2279
2202
 
2280
- RB_GC_GUARD(rcx1);
2281
- RB_GC_GUARD(rcx2);
2282
- RB_GC_GUARD(rcx3);
2283
- RB_GC_GUARD(rcx4);
2284
- RB_GC_GUARD(rcx5);
2285
- RB_GC_GUARD(rcx6);
2286
-
2287
2203
  return rcx0;
2288
2204
  }
2289
2205
 
2290
2206
  VALUE
2291
2207
  ca_call_cslab_1_r (ca_cslab_r_t func, const char *fsync,
2292
- VALUE rcx0,
2208
+ volatile VALUE rcx0,
2293
2209
  void *userdata)
2294
2210
  {
2295
2211
  CArray *cx[1];
@@ -2301,7 +2217,7 @@ ca_call_cslab_1_r (ca_cslab_r_t func, const char *fsync,
2301
2217
  ca_sweep_state_t state;
2302
2218
  ca_cslab_ctx_t ctx;
2303
2219
 
2304
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2220
+ GetCArray(rcx0, cx[0]);
2305
2221
 
2306
2222
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2307
2223
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2332,7 +2248,7 @@ ca_call_cslab_1_r (ca_cslab_r_t func, const char *fsync,
2332
2248
 
2333
2249
  VALUE
2334
2250
  ca_call_cslab_2_r (ca_cslab_r_t func, const char *fsync,
2335
- VALUE rcx0, VALUE rcx1,
2251
+ volatile VALUE rcx0, volatile VALUE rcx1,
2336
2252
  void *userdata)
2337
2253
  {
2338
2254
  CArray *cx[2];
@@ -2344,8 +2260,8 @@ ca_call_cslab_2_r (ca_cslab_r_t func, const char *fsync,
2344
2260
  ca_sweep_state_t state;
2345
2261
  ca_cslab_ctx_t ctx;
2346
2262
 
2347
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2348
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2263
+ GetCArray(rcx0, cx[0]);
2264
+ GetCArray(rcx1, cx[1]);
2349
2265
 
2350
2266
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2351
2267
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2371,14 +2287,12 @@ ca_call_cslab_2_r (ca_cslab_r_t func, const char *fsync,
2371
2287
  ctx.userdata = userdata;
2372
2288
  ca_sweep_run_chunked(&state, ca_cslab_r_walk, (VALUE) &ctx);
2373
2289
 
2374
- RB_GC_GUARD(rcx1);
2375
-
2376
2290
  return rcx0;
2377
2291
  }
2378
2292
 
2379
2293
  VALUE
2380
2294
  ca_call_cslab_3_r (ca_cslab_r_t func, const char *fsync,
2381
- VALUE rcx0, VALUE rcx1, VALUE rcx2,
2295
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2,
2382
2296
  void *userdata)
2383
2297
  {
2384
2298
  CArray *cx[3];
@@ -2390,9 +2304,9 @@ ca_call_cslab_3_r (ca_cslab_r_t func, const char *fsync,
2390
2304
  ca_sweep_state_t state;
2391
2305
  ca_cslab_ctx_t ctx;
2392
2306
 
2393
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2394
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2395
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2307
+ GetCArray(rcx0, cx[0]);
2308
+ GetCArray(rcx1, cx[1]);
2309
+ GetCArray(rcx2, cx[2]);
2396
2310
 
2397
2311
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2398
2312
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2418,15 +2332,12 @@ ca_call_cslab_3_r (ca_cslab_r_t func, const char *fsync,
2418
2332
  ctx.userdata = userdata;
2419
2333
  ca_sweep_run_chunked(&state, ca_cslab_r_walk, (VALUE) &ctx);
2420
2334
 
2421
- RB_GC_GUARD(rcx1);
2422
- RB_GC_GUARD(rcx2);
2423
-
2424
2335
  return rcx0;
2425
2336
  }
2426
2337
 
2427
2338
  VALUE
2428
2339
  ca_call_cslab_4_r (ca_cslab_r_t func, const char *fsync,
2429
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3,
2340
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3,
2430
2341
  void *userdata)
2431
2342
  {
2432
2343
  CArray *cx[4];
@@ -2438,10 +2349,10 @@ ca_call_cslab_4_r (ca_cslab_r_t func, const char *fsync,
2438
2349
  ca_sweep_state_t state;
2439
2350
  ca_cslab_ctx_t ctx;
2440
2351
 
2441
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2442
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2443
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2444
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2352
+ GetCArray(rcx0, cx[0]);
2353
+ GetCArray(rcx1, cx[1]);
2354
+ GetCArray(rcx2, cx[2]);
2355
+ GetCArray(rcx3, cx[3]);
2445
2356
 
2446
2357
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2447
2358
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2467,16 +2378,12 @@ ca_call_cslab_4_r (ca_cslab_r_t func, const char *fsync,
2467
2378
  ctx.userdata = userdata;
2468
2379
  ca_sweep_run_chunked(&state, ca_cslab_r_walk, (VALUE) &ctx);
2469
2380
 
2470
- RB_GC_GUARD(rcx1);
2471
- RB_GC_GUARD(rcx2);
2472
- RB_GC_GUARD(rcx3);
2473
-
2474
2381
  return rcx0;
2475
2382
  }
2476
2383
 
2477
2384
  VALUE
2478
2385
  ca_call_cslab_5_r (ca_cslab_r_t func, const char *fsync,
2479
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3, VALUE rcx4,
2386
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3, volatile VALUE rcx4,
2480
2387
  void *userdata)
2481
2388
  {
2482
2389
  CArray *cx[5];
@@ -2488,11 +2395,11 @@ ca_call_cslab_5_r (ca_cslab_r_t func, const char *fsync,
2488
2395
  ca_sweep_state_t state;
2489
2396
  ca_cslab_ctx_t ctx;
2490
2397
 
2491
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2492
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2493
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2494
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2495
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
2398
+ GetCArray(rcx0, cx[0]);
2399
+ GetCArray(rcx1, cx[1]);
2400
+ GetCArray(rcx2, cx[2]);
2401
+ GetCArray(rcx3, cx[3]);
2402
+ GetCArray(rcx4, cx[4]);
2496
2403
 
2497
2404
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2498
2405
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2518,17 +2425,12 @@ ca_call_cslab_5_r (ca_cslab_r_t func, const char *fsync,
2518
2425
  ctx.userdata = userdata;
2519
2426
  ca_sweep_run_chunked(&state, ca_cslab_r_walk, (VALUE) &ctx);
2520
2427
 
2521
- RB_GC_GUARD(rcx1);
2522
- RB_GC_GUARD(rcx2);
2523
- RB_GC_GUARD(rcx3);
2524
- RB_GC_GUARD(rcx4);
2525
-
2526
2428
  return rcx0;
2527
2429
  }
2528
2430
 
2529
2431
  VALUE
2530
2432
  ca_call_cslab_6_r (ca_cslab_r_t func, const char *fsync,
2531
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3, VALUE rcx4, VALUE rcx5,
2433
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3, volatile VALUE rcx4, volatile VALUE rcx5,
2532
2434
  void *userdata)
2533
2435
  {
2534
2436
  CArray *cx[6];
@@ -2540,12 +2442,12 @@ ca_call_cslab_6_r (ca_cslab_r_t func, const char *fsync,
2540
2442
  ca_sweep_state_t state;
2541
2443
  ca_cslab_ctx_t ctx;
2542
2444
 
2543
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2544
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2545
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2546
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2547
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
2548
- TypedData_Get_Struct(rcx5, CArray, &carray_data_type, cx[5]);
2445
+ GetCArray(rcx0, cx[0]);
2446
+ GetCArray(rcx1, cx[1]);
2447
+ GetCArray(rcx2, cx[2]);
2448
+ GetCArray(rcx3, cx[3]);
2449
+ GetCArray(rcx4, cx[4]);
2450
+ GetCArray(rcx5, cx[5]);
2549
2451
 
2550
2452
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2551
2453
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2571,18 +2473,12 @@ ca_call_cslab_6_r (ca_cslab_r_t func, const char *fsync,
2571
2473
  ctx.userdata = userdata;
2572
2474
  ca_sweep_run_chunked(&state, ca_cslab_r_walk, (VALUE) &ctx);
2573
2475
 
2574
- RB_GC_GUARD(rcx1);
2575
- RB_GC_GUARD(rcx2);
2576
- RB_GC_GUARD(rcx3);
2577
- RB_GC_GUARD(rcx4);
2578
- RB_GC_GUARD(rcx5);
2579
-
2580
2476
  return rcx0;
2581
2477
  }
2582
2478
 
2583
2479
  VALUE
2584
2480
  ca_call_cslab_7_r (ca_cslab_r_t func, const char *fsync,
2585
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3, VALUE rcx4, VALUE rcx5, VALUE rcx6,
2481
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3, volatile VALUE rcx4, volatile VALUE rcx5, volatile VALUE rcx6,
2586
2482
  void *userdata)
2587
2483
  {
2588
2484
  CArray *cx[7];
@@ -2594,13 +2490,13 @@ ca_call_cslab_7_r (ca_cslab_r_t func, const char *fsync,
2594
2490
  ca_sweep_state_t state;
2595
2491
  ca_cslab_ctx_t ctx;
2596
2492
 
2597
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2598
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2599
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2600
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2601
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
2602
- TypedData_Get_Struct(rcx5, CArray, &carray_data_type, cx[5]);
2603
- TypedData_Get_Struct(rcx6, CArray, &carray_data_type, cx[6]);
2493
+ GetCArray(rcx0, cx[0]);
2494
+ GetCArray(rcx1, cx[1]);
2495
+ GetCArray(rcx2, cx[2]);
2496
+ GetCArray(rcx3, cx[3]);
2497
+ GetCArray(rcx4, cx[4]);
2498
+ GetCArray(rcx5, cx[5]);
2499
+ GetCArray(rcx6, cx[6]);
2604
2500
 
2605
2501
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2606
2502
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2626,13 +2522,6 @@ ca_call_cslab_7_r (ca_cslab_r_t func, const char *fsync,
2626
2522
  ctx.userdata = userdata;
2627
2523
  ca_sweep_run_chunked(&state, ca_cslab_r_walk, (VALUE) &ctx);
2628
2524
 
2629
- RB_GC_GUARD(rcx1);
2630
- RB_GC_GUARD(rcx2);
2631
- RB_GC_GUARD(rcx3);
2632
- RB_GC_GUARD(rcx4);
2633
- RB_GC_GUARD(rcx5);
2634
- RB_GC_GUARD(rcx6);
2635
-
2636
2525
  return rcx0;
2637
2526
  }
2638
2527
 
@@ -2803,7 +2692,7 @@ ca_call_cslab_2_1 (int8_t dty1, int8_t dty2, int8_t dtx1, ca_cslab_t slabfunc, v
2803
2692
  if ( rb_ca_is_scalar(ry2) ) {
2804
2693
  ry2 = rb_ca_fetch_addr(ry2, 0);
2805
2694
  }
2806
- return rb_ary_new3(2, ry1, ry2);
2695
+ return rb_ary_new_from_args(2, ry1, ry2);
2807
2696
  }
2808
2697
 
2809
2698
  VALUE
@@ -2833,7 +2722,7 @@ ca_call_cslab_2_2 (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, ca_cslab_
2833
2722
  if ( rb_ca_is_scalar(ry2) ) {
2834
2723
  ry2 = rb_ca_fetch_addr(ry2, 0);
2835
2724
  }
2836
- return rb_ary_new3(2, ry1, ry2);
2725
+ return rb_ary_new_from_args(2, ry1, ry2);
2837
2726
  }
2838
2727
 
2839
2728
  VALUE
@@ -2864,7 +2753,7 @@ ca_call_cslab_2_3 (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t dt
2864
2753
  if ( rb_ca_is_scalar(ry2) ) {
2865
2754
  ry2 = rb_ca_fetch_addr(ry2, 0);
2866
2755
  }
2867
- return rb_ary_new3(2, ry1, ry2);
2756
+ return rb_ary_new_from_args(2, ry1, ry2);
2868
2757
  }
2869
2758
 
2870
2759
  VALUE
@@ -2896,7 +2785,7 @@ ca_call_cslab_2_4 (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t dt
2896
2785
  if ( rb_ca_is_scalar(ry2) ) {
2897
2786
  ry2 = rb_ca_fetch_addr(ry2, 0);
2898
2787
  }
2899
- return rb_ary_new3(2, ry1, ry2);
2788
+ return rb_ary_new_from_args(2, ry1, ry2);
2900
2789
  }
2901
2790
 
2902
2791
  VALUE
@@ -2933,7 +2822,7 @@ ca_call_cslab_3_1 (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, ca_cslab_
2933
2822
  if ( rb_ca_is_scalar(ry3) ) {
2934
2823
  ry3 = rb_ca_fetch_addr(ry3, 0);
2935
2824
  }
2936
- return rb_ary_new3(3, ry1, ry2, ry3);
2825
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
2937
2826
  }
2938
2827
 
2939
2828
  VALUE
@@ -2971,7 +2860,7 @@ ca_call_cslab_3_2 (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t dt
2971
2860
  if ( rb_ca_is_scalar(ry3) ) {
2972
2861
  ry3 = rb_ca_fetch_addr(ry3, 0);
2973
2862
  }
2974
- return rb_ary_new3(3, ry1, ry2, ry3);
2863
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
2975
2864
  }
2976
2865
 
2977
2866
  VALUE
@@ -3010,7 +2899,7 @@ ca_call_cslab_3_3 (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t dt
3010
2899
  if ( rb_ca_is_scalar(ry3) ) {
3011
2900
  ry3 = rb_ca_fetch_addr(ry3, 0);
3012
2901
  }
3013
- return rb_ary_new3(3, ry1, ry2, ry3);
2902
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
3014
2903
  }
3015
2904
 
3016
2905
  VALUE
@@ -3180,7 +3069,7 @@ ca_call_cslab_2_1_r (int8_t dty1, int8_t dty2, int8_t dtx1, ca_cslab_r_t slabfun
3180
3069
  if ( rb_ca_is_scalar(ry2) ) {
3181
3070
  ry2 = rb_ca_fetch_addr(ry2, 0);
3182
3071
  }
3183
- return rb_ary_new3(2, ry1, ry2);
3072
+ return rb_ary_new_from_args(2, ry1, ry2);
3184
3073
  }
3185
3074
 
3186
3075
  VALUE
@@ -3210,7 +3099,7 @@ ca_call_cslab_2_2_r (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, ca_csla
3210
3099
  if ( rb_ca_is_scalar(ry2) ) {
3211
3100
  ry2 = rb_ca_fetch_addr(ry2, 0);
3212
3101
  }
3213
- return rb_ary_new3(2, ry1, ry2);
3102
+ return rb_ary_new_from_args(2, ry1, ry2);
3214
3103
  }
3215
3104
 
3216
3105
  VALUE
@@ -3241,7 +3130,7 @@ ca_call_cslab_2_3_r (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t
3241
3130
  if ( rb_ca_is_scalar(ry2) ) {
3242
3131
  ry2 = rb_ca_fetch_addr(ry2, 0);
3243
3132
  }
3244
- return rb_ary_new3(2, ry1, ry2);
3133
+ return rb_ary_new_from_args(2, ry1, ry2);
3245
3134
  }
3246
3135
 
3247
3136
  VALUE
@@ -3273,7 +3162,7 @@ ca_call_cslab_2_4_r (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t
3273
3162
  if ( rb_ca_is_scalar(ry2) ) {
3274
3163
  ry2 = rb_ca_fetch_addr(ry2, 0);
3275
3164
  }
3276
- return rb_ary_new3(2, ry1, ry2);
3165
+ return rb_ary_new_from_args(2, ry1, ry2);
3277
3166
  }
3278
3167
 
3279
3168
  VALUE
@@ -3310,7 +3199,7 @@ ca_call_cslab_3_1_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, ca_csla
3310
3199
  if ( rb_ca_is_scalar(ry3) ) {
3311
3200
  ry3 = rb_ca_fetch_addr(ry3, 0);
3312
3201
  }
3313
- return rb_ary_new3(3, ry1, ry2, ry3);
3202
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
3314
3203
  }
3315
3204
 
3316
3205
  VALUE
@@ -3348,7 +3237,7 @@ ca_call_cslab_3_2_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t
3348
3237
  if ( rb_ca_is_scalar(ry3) ) {
3349
3238
  ry3 = rb_ca_fetch_addr(ry3, 0);
3350
3239
  }
3351
- return rb_ary_new3(3, ry1, ry2, ry3);
3240
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
3352
3241
  }
3353
3242
 
3354
3243
  VALUE
@@ -3387,6 +3276,6 @@ ca_call_cslab_3_3_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t
3387
3276
  if ( rb_ca_is_scalar(ry3) ) {
3388
3277
  ry3 = rb_ca_fetch_addr(ry3, 0);
3389
3278
  }
3390
- return rb_ary_new3(3, ry1, ry2, ry3);
3279
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
3391
3280
  }
3392
3281