carray 3.0.7 → 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 (275) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/CHANGELOG.md +7 -1940
  4. data/README.md +38 -32
  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 +6 -9
  11. data/ext/ca_bincmp_dispatch.h +16 -38
  12. data/ext/ca_binop_dispatch.c +27 -0
  13. data/ext/ca_binop_dispatch.h +22 -47
  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 -1506
  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 +90 -163
  28. data/ext/ca_obj_bincmp.c +47 -46
  29. data/ext/ca_obj_binop.c +38 -38
  30. data/ext/ca_obj_bitarray.c +5 -17
  31. data/ext/ca_obj_bitfield.c +15 -30
  32. data/ext/ca_obj_block.c +11 -12
  33. data/ext/ca_obj_byte_swap.c +32 -30
  34. data/ext/ca_obj_const_string.c +57 -62
  35. data/ext/ca_obj_face.c +99 -91
  36. data/ext/ca_obj_face.h +32 -170
  37. data/ext/ca_obj_fake.c +15 -21
  38. data/ext/ca_obj_farray.c +7 -9
  39. data/ext/ca_obj_field.c +17 -13
  40. data/ext/ca_obj_fixlen_string.c +8 -19
  41. data/ext/ca_obj_grid.c +137 -106
  42. data/ext/ca_obj_meld.c +23 -21
  43. data/ext/ca_obj_moncmp.c +10 -21
  44. data/ext/ca_obj_monop.c +24 -35
  45. data/ext/ca_obj_object.c +51 -37
  46. data/ext/ca_obj_record.c +74 -22
  47. data/ext/ca_obj_reduce.c +8 -10
  48. data/ext/ca_obj_refer.c +42 -29
  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 +18 -24
  52. data/ext/ca_obj_select.c +10 -22
  53. data/ext/ca_obj_select_axis.c +27 -36
  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 +28 -24
  57. data/ext/ca_obj_stride.c +53 -54
  58. data/ext/ca_obj_string.c +6 -18
  59. data/ext/ca_obj_tile.c +12 -12
  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 +35 -39
  64. data/ext/ca_obj_window.c +67 -86
  65. data/ext/ca_op_cmplx64.h +4 -0
  66. data/ext/ca_op_ipower.c +34 -12
  67. data/ext/ca_op_powi.h +4 -0
  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 +20 -26
  72. data/ext/ca_sweep_engine.c +2 -3
  73. data/ext/ca_sweep_engine.h +17 -9
  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 +11 -11
  77. data/ext/carray.h +300 -1011
  78. data/ext/carray_access.c +234 -180
  79. data/ext/carray_address_basis.c +33 -38
  80. data/ext/carray_attribute.c +81 -104
  81. data/ext/carray_bincount.c +12 -14
  82. data/ext/carray_broadcast.c +30 -26
  83. data/ext/carray_call_cfunc.c +169 -277
  84. data/ext/carray_call_cfunc.h +36 -28
  85. data/ext/carray_cast.c +912 -346
  86. data/ext/carray_cast_func.rb +31 -3
  87. data/ext/carray_class.c +6 -11
  88. data/ext/carray_conversion.c +43 -38
  89. data/ext/carray_copy.c +28 -26
  90. data/ext/carray_core.c +217 -126
  91. data/ext/carray_count.c +27 -15
  92. data/ext/carray_element.c +40 -25
  93. data/ext/carray_factorize.c +53 -52
  94. data/ext/carray_generate.c +26 -19
  95. data/ext/carray_histogram.c +8 -10
  96. data/ext/carray_hold.c +7 -9
  97. data/ext/carray_index_classifier.c +123 -228
  98. data/ext/carray_index_classifier.h +11 -10
  99. data/ext/carray_integer_total.c +523 -0
  100. data/ext/carray_internal.h +1274 -160
  101. data/ext/carray_key_windows.c +3 -3
  102. data/ext/carray_lazy.c +21 -36
  103. data/ext/carray_loop.c +19 -22
  104. data/ext/carray_mask.c +123 -145
  105. data/ext/carray_math_kernel.h +23 -47
  106. data/ext/carray_mathfunc.c +10 -3
  107. data/ext/carray_median_percentile.c +95 -94
  108. data/ext/carray_memory_view.c +42 -47
  109. data/ext/carray_operator.c +423 -122
  110. data/ext/carray_order.c +121 -85
  111. data/ext/carray_partition.c +13 -15
  112. data/ext/carray_random.c +47 -41
  113. data/ext/carray_round.c +9 -4
  114. data/ext/carray_scatter.c +54 -40
  115. data/ext/carray_segment.c +41 -45
  116. data/ext/carray_slab.c +64 -47
  117. data/ext/carray_slab.h +44 -33
  118. data/ext/carray_sort.c +32 -29
  119. data/ext/carray_sort_kernel.c +12 -10
  120. data/ext/carray_struct.c +38 -43
  121. data/ext/carray_test.c +47 -43
  122. data/ext/carray_time_text.c +24 -31
  123. data/ext/carray_undef.c +50 -7
  124. data/ext/carray_utils.c +258 -94
  125. data/ext/extconf.rb +24 -17
  126. data/ext/mk_call_cfunc.rb +19 -20
  127. data/ext/mk_pow5_table.rb +2 -1
  128. data/ext/mkkernel.rb +782 -461
  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 +264 -180
  135. data/lib/carray/basics.rb +272 -48
  136. data/lib/carray/bincount_nd.rb +33 -16
  137. data/lib/carray/block_iterator.rb +123 -102
  138. data/lib/carray/boolean_reduce.rb +7 -4
  139. data/lib/carray/categorical.rb +63 -51
  140. data/lib/carray/categorical_iterator.rb +89 -67
  141. data/lib/carray/complex.rb +61 -41
  142. data/lib/carray/conditional.rb +49 -22
  143. data/lib/carray/const_string.rb +54 -62
  144. data/lib/carray/core_extensions.rb +1 -1
  145. data/lib/carray/distance_limit.rb +7 -5
  146. data/lib/carray/factories.rb +269 -0
  147. data/lib/carray/fixlen_string.rb +25 -24
  148. data/lib/carray/frame/column_verbs.rb +20 -8
  149. data/lib/carray/frame/concat.rb +3 -3
  150. data/lib/carray/frame/convert.rb +2 -1
  151. data/lib/carray/frame/csv_parser.rb +7 -1
  152. data/lib/carray/frame/frame.rb +35 -25
  153. data/lib/carray/frame/group.rb +183 -150
  154. data/lib/carray/frame/io.rb +26 -7
  155. data/lib/carray/frame/join.rb +37 -12
  156. data/lib/carray/frame/records.rb +1 -1
  157. data/lib/carray/frame/reshape.rb +3 -3
  158. data/lib/carray/frame/sort.rb +10 -8
  159. data/lib/carray/frame/verbs.rb +148 -118
  160. data/lib/carray/frame/windows.rb +232 -21
  161. data/lib/carray/frame.rb +1 -2
  162. data/lib/carray/fuse_source.rb +24 -21
  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 +97 -24
  167. data/lib/carray/key_windows.rb +83 -57
  168. data/lib/carray/lazy.rb +196 -94
  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 +5 -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 +72 -71
  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/gather_nd.rb +106 -106
  183. data/lib/carray/methods/insert_block.rb +2 -2
  184. data/lib/carray/methods/is_between.rb +6 -4
  185. data/lib/carray/methods/is_in.rb +165 -145
  186. data/lib/carray/methods/join.rb +2 -1
  187. data/lib/carray/methods/lag.rb +6 -2
  188. data/lib/carray/methods/locate_addr.rb +150 -138
  189. data/lib/carray/methods/mask_duplicates.rb +1 -1
  190. data/lib/carray/methods/meshgrid.rb +28 -16
  191. data/lib/carray/methods/mode.rb +67 -67
  192. data/lib/carray/methods/nunique.rb +9 -7
  193. data/lib/carray/methods/repeat.rb +12 -12
  194. data/lib/carray/methods/resize.rb +1 -1
  195. data/lib/carray/methods/snap.rb +24 -20
  196. data/lib/carray/methods/string_format.rb +2 -2
  197. data/lib/carray/methods/unique.rb +4 -2
  198. data/lib/carray/methods/value_counts.rb +1 -1
  199. data/lib/carray/mkmf.rb +25 -28
  200. data/lib/carray/percentile_arguments.rb +82 -0
  201. data/lib/carray/record_order.rb +18 -17
  202. data/lib/carray/rng.rb +1 -0
  203. data/lib/carray/runtime.rb +190 -22
  204. data/lib/carray/segment_iterator.rb +251 -129
  205. data/lib/carray/serialize.rb +618 -571
  206. data/lib/carray/slab_iterator.rb +114 -114
  207. data/lib/carray/stack.rb +11 -12
  208. data/lib/carray/string.rb +16 -22
  209. data/lib/carray/string_operation_extension.rb +76 -52
  210. data/lib/carray/struct.rb +122 -164
  211. data/lib/carray/struct_builder.rb +243 -72
  212. data/lib/carray/time.rb +496 -342
  213. data/lib/carray/window_iterator.rb +191 -150
  214. data/lib/carray.rb +6 -11
  215. data/yard-stubs/ca_obj_array.rb +20 -135
  216. data/yard-stubs/ca_obj_bitarray.rb +1 -8
  217. data/yard-stubs/ca_obj_bitfield.rb +4 -3
  218. data/yard-stubs/ca_obj_byte_swap.rb +21 -7
  219. data/yard-stubs/ca_obj_fake.rb +3 -1
  220. data/yard-stubs/ca_obj_farray.rb +1 -1
  221. data/yard-stubs/ca_obj_field.rb +8 -6
  222. data/yard-stubs/ca_obj_refer.rb +7 -5
  223. data/yard-stubs/ca_obj_roll.rb +7 -6
  224. data/yard-stubs/ca_obj_shift.rb +2 -3
  225. data/yard-stubs/ca_obj_stride.rb +5 -7
  226. data/yard-stubs/ca_obj_tile.rb +1 -1
  227. data/yard-stubs/ca_obj_time.rb +43 -0
  228. data/yard-stubs/ca_obj_transpose.rb +1 -1
  229. data/yard-stubs/ca_obj_window.rb +26 -15
  230. data/yard-stubs/carray_access.rb +51 -4
  231. data/yard-stubs/carray_attribute.rb +26 -38
  232. data/yard-stubs/carray_cast.rb +118 -165
  233. data/yard-stubs/carray_class.rb +3 -4
  234. data/yard-stubs/carray_conversion.rb +6 -7
  235. data/yard-stubs/carray_copy.rb +2 -1
  236. data/yard-stubs/carray_count.rb +5 -3
  237. data/yard-stubs/carray_element.rb +4 -3
  238. data/yard-stubs/carray_limits.rb +100 -0
  239. data/yard-stubs/carray_loop.rb +0 -20
  240. data/yard-stubs/carray_mask.rb +59 -41
  241. data/yard-stubs/carray_math.rb +157 -100
  242. data/yard-stubs/carray_mathfunc.rb +415 -3
  243. data/yard-stubs/carray_median_percentile.rb +29 -11
  244. data/yard-stubs/carray_memory_view.rb +2 -2
  245. data/yard-stubs/carray_order.rb +67 -34
  246. data/yard-stubs/carray_random.rb +6 -6
  247. data/yard-stubs/carray_reduce.rb +353 -0
  248. data/yard-stubs/carray_rng.rb +92 -0
  249. data/yard-stubs/carray_scatter.rb +10 -2
  250. data/yard-stubs/carray_slab.rb +7 -4
  251. data/yard-stubs/carray_sort.rb +7 -6
  252. data/yard-stubs/carray_undef.rb +44 -5
  253. data/yard-stubs/ruby_carray.rb +75 -40
  254. metadata +62 -24
  255. data/CHANGELOG.v1.md +0 -126
  256. data/ext/carray_build_flags.h +0 -3
  257. data/ext/carray_config.h +0 -28
  258. data/ext/carray_data_type.c +0 -90
  259. data/ext/carray_kernels_bincmp.c +0 -6457
  260. data/ext/carray_kernels_binop.c +0 -31534
  261. data/ext/carray_kernels_init.c +0 -1734
  262. data/ext/carray_kernels_moncmp.c +0 -2104
  263. data/ext/carray_kernels_monop.c +0 -25337
  264. data/ext/carray_kernels_reduce_aggregate.c +0 -27545
  265. data/ext/carray_kernels_reduce_boolean.c +0 -1924
  266. data/ext/carray_kernels_reduce_cumulative.c +0 -11646
  267. data/ext/carray_kernels_reduce_extreme.c +0 -21631
  268. data/ext/carray_kernels_reduce_variance.c +0 -5981
  269. data/ext/carray_kernels_scan.c +0 -4302
  270. data/ext/carray_kernels_search.c +0 -37776
  271. data/ext/carray_kernels_sort.c +0 -10814
  272. data/ext/carray_kernels_triop.c +0 -1864
  273. data/lib/carray/construct.rb +0 -360
  274. data/lib/carray/data_type_extension.rb +0 -262
  275. data/lib/carray/data_type_limits.rb +0 -91
@@ -16,7 +16,7 @@
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
22
  * ca_attach on the operand or its mask (= alias check + xmalloc +
@@ -121,7 +121,7 @@ ca_call_cfunc_1_walk (VALUE arg)
121
121
 
122
122
  VALUE
123
123
  ca_call_cfunc_1 (void (*func)(void *p0), const char *fsync,
124
- VALUE rcx0)
124
+ volatile VALUE rcx0)
125
125
  {
126
126
  CArray *cx[1];
127
127
  char *base[1];
@@ -131,7 +131,7 @@ ca_call_cfunc_1 (void (*func)(void *p0), const char *fsync,
131
131
  ca_sweep_state_t state;
132
132
  ca_call_cfunc_1_ctx_t ctx;
133
133
 
134
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
134
+ GetCArray(rcx0, cx[0]);
135
135
 
136
136
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
137
137
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -191,7 +191,7 @@ ca_call_cfunc_2_walk (VALUE arg)
191
191
 
192
192
  VALUE
193
193
  ca_call_cfunc_2 (void (*func)(void *p0, void *p1), const char *fsync,
194
- VALUE rcx0, VALUE rcx1)
194
+ volatile VALUE rcx0, volatile VALUE rcx1)
195
195
  {
196
196
  CArray *cx[2];
197
197
  char *base[2];
@@ -201,8 +201,8 @@ ca_call_cfunc_2 (void (*func)(void *p0, void *p1), const char *fsync,
201
201
  ca_sweep_state_t state;
202
202
  ca_call_cfunc_2_ctx_t ctx;
203
203
 
204
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
205
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
204
+ GetCArray(rcx0, cx[0]);
205
+ GetCArray(rcx1, cx[1]);
206
206
 
207
207
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
208
208
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -223,8 +223,6 @@ ca_call_cfunc_2 (void (*func)(void *p0, void *p1), const char *fsync,
223
223
  ctx.userdata = NULL;
224
224
  ca_sweep_run(&state, ca_call_cfunc_2_walk, (VALUE) &ctx);
225
225
 
226
- RB_GC_GUARD(rcx1);
227
-
228
226
  return rcx0;
229
227
  }
230
228
 
@@ -264,7 +262,7 @@ ca_call_cfunc_3_walk (VALUE arg)
264
262
 
265
263
  VALUE
266
264
  ca_call_cfunc_3 (void (*func)(void *p0, void *p1, void *p2), const char *fsync,
267
- VALUE rcx0, VALUE rcx1, VALUE rcx2)
265
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2)
268
266
  {
269
267
  CArray *cx[3];
270
268
  char *base[3];
@@ -274,9 +272,9 @@ ca_call_cfunc_3 (void (*func)(void *p0, void *p1, void *p2), const char *fsync,
274
272
  ca_sweep_state_t state;
275
273
  ca_call_cfunc_3_ctx_t ctx;
276
274
 
277
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
278
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
279
- 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]);
280
278
 
281
279
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
282
280
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -297,9 +295,6 @@ ca_call_cfunc_3 (void (*func)(void *p0, void *p1, void *p2), const char *fsync,
297
295
  ctx.userdata = NULL;
298
296
  ca_sweep_run(&state, ca_call_cfunc_3_walk, (VALUE) &ctx);
299
297
 
300
- RB_GC_GUARD(rcx1);
301
- RB_GC_GUARD(rcx2);
302
-
303
298
  return rcx0;
304
299
  }
305
300
 
@@ -339,7 +334,7 @@ ca_call_cfunc_4_walk (VALUE arg)
339
334
 
340
335
  VALUE
341
336
  ca_call_cfunc_4 (void (*func)(void *p0, void *p1, void *p2, void *p3), const char *fsync,
342
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3)
337
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3)
343
338
  {
344
339
  CArray *cx[4];
345
340
  char *base[4];
@@ -349,10 +344,10 @@ ca_call_cfunc_4 (void (*func)(void *p0, void *p1, void *p2, void *p3), const cha
349
344
  ca_sweep_state_t state;
350
345
  ca_call_cfunc_4_ctx_t ctx;
351
346
 
352
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
353
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
354
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
355
- 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]);
356
351
 
357
352
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
358
353
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -373,10 +368,6 @@ ca_call_cfunc_4 (void (*func)(void *p0, void *p1, void *p2, void *p3), const cha
373
368
  ctx.userdata = NULL;
374
369
  ca_sweep_run(&state, ca_call_cfunc_4_walk, (VALUE) &ctx);
375
370
 
376
- RB_GC_GUARD(rcx1);
377
- RB_GC_GUARD(rcx2);
378
- RB_GC_GUARD(rcx3);
379
-
380
371
  return rcx0;
381
372
  }
382
373
 
@@ -416,7 +407,7 @@ ca_call_cfunc_5_walk (VALUE arg)
416
407
 
417
408
  VALUE
418
409
  ca_call_cfunc_5 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4), const char *fsync,
419
- 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)
420
411
  {
421
412
  CArray *cx[5];
422
413
  char *base[5];
@@ -426,11 +417,11 @@ ca_call_cfunc_5 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4),
426
417
  ca_sweep_state_t state;
427
418
  ca_call_cfunc_5_ctx_t ctx;
428
419
 
429
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
430
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
431
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
432
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
433
- 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]);
434
425
 
435
426
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
436
427
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -451,11 +442,6 @@ ca_call_cfunc_5 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4),
451
442
  ctx.userdata = NULL;
452
443
  ca_sweep_run(&state, ca_call_cfunc_5_walk, (VALUE) &ctx);
453
444
 
454
- RB_GC_GUARD(rcx1);
455
- RB_GC_GUARD(rcx2);
456
- RB_GC_GUARD(rcx3);
457
- RB_GC_GUARD(rcx4);
458
-
459
445
  return rcx0;
460
446
  }
461
447
 
@@ -495,7 +481,7 @@ ca_call_cfunc_6_walk (VALUE arg)
495
481
 
496
482
  VALUE
497
483
  ca_call_cfunc_6 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4, void *p5), const char *fsync,
498
- 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)
499
485
  {
500
486
  CArray *cx[6];
501
487
  char *base[6];
@@ -505,12 +491,12 @@ ca_call_cfunc_6 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4,
505
491
  ca_sweep_state_t state;
506
492
  ca_call_cfunc_6_ctx_t ctx;
507
493
 
508
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
509
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
510
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
511
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
512
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
513
- 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]);
514
500
 
515
501
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
516
502
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -531,12 +517,6 @@ ca_call_cfunc_6 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4,
531
517
  ctx.userdata = NULL;
532
518
  ca_sweep_run(&state, ca_call_cfunc_6_walk, (VALUE) &ctx);
533
519
 
534
- RB_GC_GUARD(rcx1);
535
- RB_GC_GUARD(rcx2);
536
- RB_GC_GUARD(rcx3);
537
- RB_GC_GUARD(rcx4);
538
- RB_GC_GUARD(rcx5);
539
-
540
520
  return rcx0;
541
521
  }
542
522
 
@@ -576,7 +556,7 @@ ca_call_cfunc_7_walk (VALUE arg)
576
556
 
577
557
  VALUE
578
558
  ca_call_cfunc_7 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4, void *p5, void *p6), const char *fsync,
579
- 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)
580
560
  {
581
561
  CArray *cx[7];
582
562
  char *base[7];
@@ -586,13 +566,13 @@ ca_call_cfunc_7 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4,
586
566
  ca_sweep_state_t state;
587
567
  ca_call_cfunc_7_ctx_t ctx;
588
568
 
589
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
590
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
591
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
592
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
593
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
594
- TypedData_Get_Struct(rcx5, CArray, &carray_data_type, cx[5]);
595
- 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]);
596
576
 
597
577
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
598
578
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -613,13 +593,6 @@ ca_call_cfunc_7 (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4,
613
593
  ctx.userdata = NULL;
614
594
  ca_sweep_run(&state, ca_call_cfunc_7_walk, (VALUE) &ctx);
615
595
 
616
- RB_GC_GUARD(rcx1);
617
- RB_GC_GUARD(rcx2);
618
- RB_GC_GUARD(rcx3);
619
- RB_GC_GUARD(rcx4);
620
- RB_GC_GUARD(rcx5);
621
- RB_GC_GUARD(rcx6);
622
-
623
596
  return rcx0;
624
597
  }
625
598
 
@@ -795,7 +768,7 @@ ca_call_cfunc_2_1 (int8_t dty1, int8_t dty2, int8_t dtx1, void (*mathfunc)(void*
795
768
  if ( rb_ca_is_scalar(ry2) ) {
796
769
  ry2 = rb_ca_fetch_addr(ry2, 0);
797
770
  }
798
- return rb_ary_new3(2, ry1, ry2);
771
+ return rb_ary_new_from_args(2, ry1, ry2);
799
772
  }
800
773
 
801
774
  VALUE
@@ -825,7 +798,7 @@ ca_call_cfunc_2_2 (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, void (*ma
825
798
  if ( rb_ca_is_scalar(ry2) ) {
826
799
  ry2 = rb_ca_fetch_addr(ry2, 0);
827
800
  }
828
- return rb_ary_new3(2, ry1, ry2);
801
+ return rb_ary_new_from_args(2, ry1, ry2);
829
802
  }
830
803
 
831
804
  VALUE
@@ -856,7 +829,7 @@ ca_call_cfunc_2_3 (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t dt
856
829
  if ( rb_ca_is_scalar(ry2) ) {
857
830
  ry2 = rb_ca_fetch_addr(ry2, 0);
858
831
  }
859
- return rb_ary_new3(2, ry1, ry2);
832
+ return rb_ary_new_from_args(2, ry1, ry2);
860
833
  }
861
834
 
862
835
  VALUE
@@ -888,7 +861,7 @@ ca_call_cfunc_2_4 (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t dt
888
861
  if ( rb_ca_is_scalar(ry2) ) {
889
862
  ry2 = rb_ca_fetch_addr(ry2, 0);
890
863
  }
891
- return rb_ary_new3(2, ry1, ry2);
864
+ return rb_ary_new_from_args(2, ry1, ry2);
892
865
  }
893
866
 
894
867
  VALUE
@@ -925,7 +898,7 @@ ca_call_cfunc_3_1 (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, void (*ma
925
898
  if ( rb_ca_is_scalar(ry3) ) {
926
899
  ry3 = rb_ca_fetch_addr(ry3, 0);
927
900
  }
928
- return rb_ary_new3(3, ry1, ry2, ry3);
901
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
929
902
  }
930
903
 
931
904
  VALUE
@@ -963,7 +936,7 @@ ca_call_cfunc_3_2 (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t dt
963
936
  if ( rb_ca_is_scalar(ry3) ) {
964
937
  ry3 = rb_ca_fetch_addr(ry3, 0);
965
938
  }
966
- return rb_ary_new3(3, ry1, ry2, ry3);
939
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
967
940
  }
968
941
 
969
942
  VALUE
@@ -1002,7 +975,7 @@ ca_call_cfunc_3_3 (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t dt
1002
975
  if ( rb_ca_is_scalar(ry3) ) {
1003
976
  ry3 = rb_ca_fetch_addr(ry3, 0);
1004
977
  }
1005
- return rb_ary_new3(3, ry1, ry2, ry3);
978
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
1006
979
  }
1007
980
 
1008
981
  /* -------------------------------------------------------------------- */
@@ -1048,7 +1021,7 @@ ca_call_cfunc_1_r_walk (VALUE arg)
1048
1021
 
1049
1022
  VALUE
1050
1023
  ca_call_cfunc_1_r (void (*func)(void *p0, void *userdata), const char *fsync,
1051
- VALUE rcx0,
1024
+ volatile VALUE rcx0,
1052
1025
  void *userdata)
1053
1026
  {
1054
1027
  CArray *cx[1];
@@ -1059,7 +1032,7 @@ ca_call_cfunc_1_r (void (*func)(void *p0, void *userdata), const char *fsync,
1059
1032
  ca_sweep_state_t state;
1060
1033
  ca_call_cfunc_1_r_ctx_t ctx;
1061
1034
 
1062
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1035
+ GetCArray(rcx0, cx[0]);
1063
1036
 
1064
1037
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1065
1038
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1119,7 +1092,7 @@ ca_call_cfunc_2_r_walk (VALUE arg)
1119
1092
 
1120
1093
  VALUE
1121
1094
  ca_call_cfunc_2_r (void (*func)(void *p0, void *p1, void *userdata), const char *fsync,
1122
- VALUE rcx0, VALUE rcx1,
1095
+ volatile VALUE rcx0, volatile VALUE rcx1,
1123
1096
  void *userdata)
1124
1097
  {
1125
1098
  CArray *cx[2];
@@ -1130,8 +1103,8 @@ ca_call_cfunc_2_r (void (*func)(void *p0, void *p1, void *userdata), const char
1130
1103
  ca_sweep_state_t state;
1131
1104
  ca_call_cfunc_2_r_ctx_t ctx;
1132
1105
 
1133
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1134
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1106
+ GetCArray(rcx0, cx[0]);
1107
+ GetCArray(rcx1, cx[1]);
1135
1108
 
1136
1109
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1137
1110
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1152,8 +1125,6 @@ ca_call_cfunc_2_r (void (*func)(void *p0, void *p1, void *userdata), const char
1152
1125
  ctx.userdata = userdata;
1153
1126
  ca_sweep_run(&state, ca_call_cfunc_2_r_walk, (VALUE) &ctx);
1154
1127
 
1155
- RB_GC_GUARD(rcx1);
1156
-
1157
1128
  return rcx0;
1158
1129
  }
1159
1130
 
@@ -1193,7 +1164,7 @@ ca_call_cfunc_3_r_walk (VALUE arg)
1193
1164
 
1194
1165
  VALUE
1195
1166
  ca_call_cfunc_3_r (void (*func)(void *p0, void *p1, void *p2, void *userdata), const char *fsync,
1196
- VALUE rcx0, VALUE rcx1, VALUE rcx2,
1167
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2,
1197
1168
  void *userdata)
1198
1169
  {
1199
1170
  CArray *cx[3];
@@ -1204,9 +1175,9 @@ ca_call_cfunc_3_r (void (*func)(void *p0, void *p1, void *p2, void *userdata), c
1204
1175
  ca_sweep_state_t state;
1205
1176
  ca_call_cfunc_3_r_ctx_t ctx;
1206
1177
 
1207
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1208
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1209
- 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]);
1210
1181
 
1211
1182
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1212
1183
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1227,9 +1198,6 @@ ca_call_cfunc_3_r (void (*func)(void *p0, void *p1, void *p2, void *userdata), c
1227
1198
  ctx.userdata = userdata;
1228
1199
  ca_sweep_run(&state, ca_call_cfunc_3_r_walk, (VALUE) &ctx);
1229
1200
 
1230
- RB_GC_GUARD(rcx1);
1231
- RB_GC_GUARD(rcx2);
1232
-
1233
1201
  return rcx0;
1234
1202
  }
1235
1203
 
@@ -1269,7 +1237,7 @@ ca_call_cfunc_4_r_walk (VALUE arg)
1269
1237
 
1270
1238
  VALUE
1271
1239
  ca_call_cfunc_4_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *userdata), const char *fsync,
1272
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3,
1240
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3,
1273
1241
  void *userdata)
1274
1242
  {
1275
1243
  CArray *cx[4];
@@ -1280,10 +1248,10 @@ ca_call_cfunc_4_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *us
1280
1248
  ca_sweep_state_t state;
1281
1249
  ca_call_cfunc_4_r_ctx_t ctx;
1282
1250
 
1283
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1284
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1285
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
1286
- 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]);
1287
1255
 
1288
1256
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1289
1257
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1304,10 +1272,6 @@ ca_call_cfunc_4_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *us
1304
1272
  ctx.userdata = userdata;
1305
1273
  ca_sweep_run(&state, ca_call_cfunc_4_r_walk, (VALUE) &ctx);
1306
1274
 
1307
- RB_GC_GUARD(rcx1);
1308
- RB_GC_GUARD(rcx2);
1309
- RB_GC_GUARD(rcx3);
1310
-
1311
1275
  return rcx0;
1312
1276
  }
1313
1277
 
@@ -1347,7 +1311,7 @@ ca_call_cfunc_5_r_walk (VALUE arg)
1347
1311
 
1348
1312
  VALUE
1349
1313
  ca_call_cfunc_5_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4, void *userdata), const char *fsync,
1350
- 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,
1351
1315
  void *userdata)
1352
1316
  {
1353
1317
  CArray *cx[5];
@@ -1358,11 +1322,11 @@ ca_call_cfunc_5_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4
1358
1322
  ca_sweep_state_t state;
1359
1323
  ca_call_cfunc_5_r_ctx_t ctx;
1360
1324
 
1361
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1362
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1363
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
1364
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
1365
- 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]);
1366
1330
 
1367
1331
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1368
1332
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1383,11 +1347,6 @@ ca_call_cfunc_5_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4
1383
1347
  ctx.userdata = userdata;
1384
1348
  ca_sweep_run(&state, ca_call_cfunc_5_r_walk, (VALUE) &ctx);
1385
1349
 
1386
- RB_GC_GUARD(rcx1);
1387
- RB_GC_GUARD(rcx2);
1388
- RB_GC_GUARD(rcx3);
1389
- RB_GC_GUARD(rcx4);
1390
-
1391
1350
  return rcx0;
1392
1351
  }
1393
1352
 
@@ -1427,7 +1386,7 @@ ca_call_cfunc_6_r_walk (VALUE arg)
1427
1386
 
1428
1387
  VALUE
1429
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,
1430
- 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,
1431
1390
  void *userdata)
1432
1391
  {
1433
1392
  CArray *cx[6];
@@ -1438,12 +1397,12 @@ ca_call_cfunc_6_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4
1438
1397
  ca_sweep_state_t state;
1439
1398
  ca_call_cfunc_6_r_ctx_t ctx;
1440
1399
 
1441
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1442
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1443
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
1444
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
1445
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
1446
- 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]);
1447
1406
 
1448
1407
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1449
1408
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1464,12 +1423,6 @@ ca_call_cfunc_6_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4
1464
1423
  ctx.userdata = userdata;
1465
1424
  ca_sweep_run(&state, ca_call_cfunc_6_r_walk, (VALUE) &ctx);
1466
1425
 
1467
- RB_GC_GUARD(rcx1);
1468
- RB_GC_GUARD(rcx2);
1469
- RB_GC_GUARD(rcx3);
1470
- RB_GC_GUARD(rcx4);
1471
- RB_GC_GUARD(rcx5);
1472
-
1473
1426
  return rcx0;
1474
1427
  }
1475
1428
 
@@ -1509,7 +1462,7 @@ ca_call_cfunc_7_r_walk (VALUE arg)
1509
1462
 
1510
1463
  VALUE
1511
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,
1512
- 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,
1513
1466
  void *userdata)
1514
1467
  {
1515
1468
  CArray *cx[7];
@@ -1520,13 +1473,13 @@ ca_call_cfunc_7_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4
1520
1473
  ca_sweep_state_t state;
1521
1474
  ca_call_cfunc_7_r_ctx_t ctx;
1522
1475
 
1523
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1524
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1525
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
1526
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
1527
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
1528
- TypedData_Get_Struct(rcx5, CArray, &carray_data_type, cx[5]);
1529
- 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]);
1530
1483
 
1531
1484
  /* sweep engine: per-operand acquire (alias / xmalloc + ca_xfer_all),
1532
1485
  operand pairing, mask OR across INPUTs, mask propagate to OUTPUTs.
@@ -1547,13 +1500,6 @@ ca_call_cfunc_7_r (void (*func)(void *p0, void *p1, void *p2, void *p3, void *p4
1547
1500
  ctx.userdata = userdata;
1548
1501
  ca_sweep_run(&state, ca_call_cfunc_7_r_walk, (VALUE) &ctx);
1549
1502
 
1550
- RB_GC_GUARD(rcx1);
1551
- RB_GC_GUARD(rcx2);
1552
- RB_GC_GUARD(rcx3);
1553
- RB_GC_GUARD(rcx4);
1554
- RB_GC_GUARD(rcx5);
1555
- RB_GC_GUARD(rcx6);
1556
-
1557
1503
  return rcx0;
1558
1504
  }
1559
1505
 
@@ -1724,7 +1670,7 @@ ca_call_cfunc_2_1_r (int8_t dty1, int8_t dty2, int8_t dtx1, void (*mathfunc)(voi
1724
1670
  if ( rb_ca_is_scalar(ry2) ) {
1725
1671
  ry2 = rb_ca_fetch_addr(ry2, 0);
1726
1672
  }
1727
- return rb_ary_new3(2, ry1, ry2);
1673
+ return rb_ary_new_from_args(2, ry1, ry2);
1728
1674
  }
1729
1675
 
1730
1676
  VALUE
@@ -1754,7 +1700,7 @@ ca_call_cfunc_2_2_r (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, void (*
1754
1700
  if ( rb_ca_is_scalar(ry2) ) {
1755
1701
  ry2 = rb_ca_fetch_addr(ry2, 0);
1756
1702
  }
1757
- return rb_ary_new3(2, ry1, ry2);
1703
+ return rb_ary_new_from_args(2, ry1, ry2);
1758
1704
  }
1759
1705
 
1760
1706
  VALUE
@@ -1785,7 +1731,7 @@ ca_call_cfunc_2_3_r (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t
1785
1731
  if ( rb_ca_is_scalar(ry2) ) {
1786
1732
  ry2 = rb_ca_fetch_addr(ry2, 0);
1787
1733
  }
1788
- return rb_ary_new3(2, ry1, ry2);
1734
+ return rb_ary_new_from_args(2, ry1, ry2);
1789
1735
  }
1790
1736
 
1791
1737
  VALUE
@@ -1817,7 +1763,7 @@ ca_call_cfunc_2_4_r (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t
1817
1763
  if ( rb_ca_is_scalar(ry2) ) {
1818
1764
  ry2 = rb_ca_fetch_addr(ry2, 0);
1819
1765
  }
1820
- return rb_ary_new3(2, ry1, ry2);
1766
+ return rb_ary_new_from_args(2, ry1, ry2);
1821
1767
  }
1822
1768
 
1823
1769
  VALUE
@@ -1854,7 +1800,7 @@ ca_call_cfunc_3_1_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, void (*
1854
1800
  if ( rb_ca_is_scalar(ry3) ) {
1855
1801
  ry3 = rb_ca_fetch_addr(ry3, 0);
1856
1802
  }
1857
- return rb_ary_new3(3, ry1, ry2, ry3);
1803
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
1858
1804
  }
1859
1805
 
1860
1806
  VALUE
@@ -1892,7 +1838,7 @@ ca_call_cfunc_3_2_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t
1892
1838
  if ( rb_ca_is_scalar(ry3) ) {
1893
1839
  ry3 = rb_ca_fetch_addr(ry3, 0);
1894
1840
  }
1895
- return rb_ary_new3(3, ry1, ry2, ry3);
1841
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
1896
1842
  }
1897
1843
 
1898
1844
  VALUE
@@ -1931,7 +1877,7 @@ ca_call_cfunc_3_3_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t
1931
1877
  if ( rb_ca_is_scalar(ry3) ) {
1932
1878
  ry3 = rb_ca_fetch_addr(ry3, 0);
1933
1879
  }
1934
- return rb_ary_new3(3, ry1, ry2, ry3);
1880
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
1935
1881
  }
1936
1882
 
1937
1883
  /* -------------------------------------------------------------------- */
@@ -1944,7 +1890,7 @@ ca_call_cfunc_3_3_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t
1944
1890
 
1945
1891
  VALUE
1946
1892
  ca_call_cslab_1 (ca_cslab_t func, const char *fsync,
1947
- VALUE rcx0)
1893
+ volatile VALUE rcx0)
1948
1894
  {
1949
1895
  CArray *cx[1];
1950
1896
  char *base[1];
@@ -1955,7 +1901,7 @@ ca_call_cslab_1 (ca_cslab_t func, const char *fsync,
1955
1901
  ca_sweep_state_t state;
1956
1902
  ca_cslab_ctx_t ctx;
1957
1903
 
1958
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
1904
+ GetCArray(rcx0, cx[0]);
1959
1905
 
1960
1906
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
1961
1907
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -1986,7 +1932,7 @@ ca_call_cslab_1 (ca_cslab_t func, const char *fsync,
1986
1932
 
1987
1933
  VALUE
1988
1934
  ca_call_cslab_2 (ca_cslab_t func, const char *fsync,
1989
- VALUE rcx0, VALUE rcx1)
1935
+ volatile VALUE rcx0, volatile VALUE rcx1)
1990
1936
  {
1991
1937
  CArray *cx[2];
1992
1938
  char *base[2];
@@ -1997,8 +1943,8 @@ ca_call_cslab_2 (ca_cslab_t func, const char *fsync,
1997
1943
  ca_sweep_state_t state;
1998
1944
  ca_cslab_ctx_t ctx;
1999
1945
 
2000
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2001
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
1946
+ GetCArray(rcx0, cx[0]);
1947
+ GetCArray(rcx1, cx[1]);
2002
1948
 
2003
1949
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2004
1950
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2024,14 +1970,12 @@ ca_call_cslab_2 (ca_cslab_t func, const char *fsync,
2024
1970
  ctx.userdata = NULL;
2025
1971
  ca_sweep_run_chunked(&state, ca_cslab_walk, (VALUE) &ctx);
2026
1972
 
2027
- RB_GC_GUARD(rcx1);
2028
-
2029
1973
  return rcx0;
2030
1974
  }
2031
1975
 
2032
1976
  VALUE
2033
1977
  ca_call_cslab_3 (ca_cslab_t func, const char *fsync,
2034
- VALUE rcx0, VALUE rcx1, VALUE rcx2)
1978
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2)
2035
1979
  {
2036
1980
  CArray *cx[3];
2037
1981
  char *base[3];
@@ -2042,9 +1986,9 @@ ca_call_cslab_3 (ca_cslab_t func, const char *fsync,
2042
1986
  ca_sweep_state_t state;
2043
1987
  ca_cslab_ctx_t ctx;
2044
1988
 
2045
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2046
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2047
- 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]);
2048
1992
 
2049
1993
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2050
1994
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2070,15 +2014,12 @@ ca_call_cslab_3 (ca_cslab_t func, const char *fsync,
2070
2014
  ctx.userdata = NULL;
2071
2015
  ca_sweep_run_chunked(&state, ca_cslab_walk, (VALUE) &ctx);
2072
2016
 
2073
- RB_GC_GUARD(rcx1);
2074
- RB_GC_GUARD(rcx2);
2075
-
2076
2017
  return rcx0;
2077
2018
  }
2078
2019
 
2079
2020
  VALUE
2080
2021
  ca_call_cslab_4 (ca_cslab_t func, const char *fsync,
2081
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3)
2022
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3)
2082
2023
  {
2083
2024
  CArray *cx[4];
2084
2025
  char *base[4];
@@ -2089,10 +2030,10 @@ ca_call_cslab_4 (ca_cslab_t func, const char *fsync,
2089
2030
  ca_sweep_state_t state;
2090
2031
  ca_cslab_ctx_t ctx;
2091
2032
 
2092
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2093
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2094
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2095
- 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]);
2096
2037
 
2097
2038
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2098
2039
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2118,16 +2059,12 @@ ca_call_cslab_4 (ca_cslab_t func, const char *fsync,
2118
2059
  ctx.userdata = NULL;
2119
2060
  ca_sweep_run_chunked(&state, ca_cslab_walk, (VALUE) &ctx);
2120
2061
 
2121
- RB_GC_GUARD(rcx1);
2122
- RB_GC_GUARD(rcx2);
2123
- RB_GC_GUARD(rcx3);
2124
-
2125
2062
  return rcx0;
2126
2063
  }
2127
2064
 
2128
2065
  VALUE
2129
2066
  ca_call_cslab_5 (ca_cslab_t func, const char *fsync,
2130
- 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)
2131
2068
  {
2132
2069
  CArray *cx[5];
2133
2070
  char *base[5];
@@ -2138,11 +2075,11 @@ ca_call_cslab_5 (ca_cslab_t func, const char *fsync,
2138
2075
  ca_sweep_state_t state;
2139
2076
  ca_cslab_ctx_t ctx;
2140
2077
 
2141
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2142
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2143
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2144
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2145
- 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]);
2146
2083
 
2147
2084
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2148
2085
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2168,17 +2105,12 @@ ca_call_cslab_5 (ca_cslab_t func, const char *fsync,
2168
2105
  ctx.userdata = NULL;
2169
2106
  ca_sweep_run_chunked(&state, ca_cslab_walk, (VALUE) &ctx);
2170
2107
 
2171
- RB_GC_GUARD(rcx1);
2172
- RB_GC_GUARD(rcx2);
2173
- RB_GC_GUARD(rcx3);
2174
- RB_GC_GUARD(rcx4);
2175
-
2176
2108
  return rcx0;
2177
2109
  }
2178
2110
 
2179
2111
  VALUE
2180
2112
  ca_call_cslab_6 (ca_cslab_t func, const char *fsync,
2181
- 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)
2182
2114
  {
2183
2115
  CArray *cx[6];
2184
2116
  char *base[6];
@@ -2189,12 +2121,12 @@ ca_call_cslab_6 (ca_cslab_t func, const char *fsync,
2189
2121
  ca_sweep_state_t state;
2190
2122
  ca_cslab_ctx_t ctx;
2191
2123
 
2192
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2193
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2194
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2195
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2196
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
2197
- 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]);
2198
2130
 
2199
2131
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2200
2132
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2220,18 +2152,12 @@ ca_call_cslab_6 (ca_cslab_t func, const char *fsync,
2220
2152
  ctx.userdata = NULL;
2221
2153
  ca_sweep_run_chunked(&state, ca_cslab_walk, (VALUE) &ctx);
2222
2154
 
2223
- RB_GC_GUARD(rcx1);
2224
- RB_GC_GUARD(rcx2);
2225
- RB_GC_GUARD(rcx3);
2226
- RB_GC_GUARD(rcx4);
2227
- RB_GC_GUARD(rcx5);
2228
-
2229
2155
  return rcx0;
2230
2156
  }
2231
2157
 
2232
2158
  VALUE
2233
2159
  ca_call_cslab_7 (ca_cslab_t func, const char *fsync,
2234
- 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)
2235
2161
  {
2236
2162
  CArray *cx[7];
2237
2163
  char *base[7];
@@ -2242,13 +2168,13 @@ ca_call_cslab_7 (ca_cslab_t func, const char *fsync,
2242
2168
  ca_sweep_state_t state;
2243
2169
  ca_cslab_ctx_t ctx;
2244
2170
 
2245
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2246
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2247
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2248
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2249
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
2250
- TypedData_Get_Struct(rcx5, CArray, &carray_data_type, cx[5]);
2251
- 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]);
2252
2178
 
2253
2179
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2254
2180
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2274,19 +2200,12 @@ ca_call_cslab_7 (ca_cslab_t func, const char *fsync,
2274
2200
  ctx.userdata = NULL;
2275
2201
  ca_sweep_run_chunked(&state, ca_cslab_walk, (VALUE) &ctx);
2276
2202
 
2277
- RB_GC_GUARD(rcx1);
2278
- RB_GC_GUARD(rcx2);
2279
- RB_GC_GUARD(rcx3);
2280
- RB_GC_GUARD(rcx4);
2281
- RB_GC_GUARD(rcx5);
2282
- RB_GC_GUARD(rcx6);
2283
-
2284
2203
  return rcx0;
2285
2204
  }
2286
2205
 
2287
2206
  VALUE
2288
2207
  ca_call_cslab_1_r (ca_cslab_r_t func, const char *fsync,
2289
- VALUE rcx0,
2208
+ volatile VALUE rcx0,
2290
2209
  void *userdata)
2291
2210
  {
2292
2211
  CArray *cx[1];
@@ -2298,7 +2217,7 @@ ca_call_cslab_1_r (ca_cslab_r_t func, const char *fsync,
2298
2217
  ca_sweep_state_t state;
2299
2218
  ca_cslab_ctx_t ctx;
2300
2219
 
2301
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2220
+ GetCArray(rcx0, cx[0]);
2302
2221
 
2303
2222
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2304
2223
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2329,7 +2248,7 @@ ca_call_cslab_1_r (ca_cslab_r_t func, const char *fsync,
2329
2248
 
2330
2249
  VALUE
2331
2250
  ca_call_cslab_2_r (ca_cslab_r_t func, const char *fsync,
2332
- VALUE rcx0, VALUE rcx1,
2251
+ volatile VALUE rcx0, volatile VALUE rcx1,
2333
2252
  void *userdata)
2334
2253
  {
2335
2254
  CArray *cx[2];
@@ -2341,8 +2260,8 @@ ca_call_cslab_2_r (ca_cslab_r_t func, const char *fsync,
2341
2260
  ca_sweep_state_t state;
2342
2261
  ca_cslab_ctx_t ctx;
2343
2262
 
2344
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2345
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2263
+ GetCArray(rcx0, cx[0]);
2264
+ GetCArray(rcx1, cx[1]);
2346
2265
 
2347
2266
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2348
2267
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2368,14 +2287,12 @@ ca_call_cslab_2_r (ca_cslab_r_t func, const char *fsync,
2368
2287
  ctx.userdata = userdata;
2369
2288
  ca_sweep_run_chunked(&state, ca_cslab_r_walk, (VALUE) &ctx);
2370
2289
 
2371
- RB_GC_GUARD(rcx1);
2372
-
2373
2290
  return rcx0;
2374
2291
  }
2375
2292
 
2376
2293
  VALUE
2377
2294
  ca_call_cslab_3_r (ca_cslab_r_t func, const char *fsync,
2378
- VALUE rcx0, VALUE rcx1, VALUE rcx2,
2295
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2,
2379
2296
  void *userdata)
2380
2297
  {
2381
2298
  CArray *cx[3];
@@ -2387,9 +2304,9 @@ ca_call_cslab_3_r (ca_cslab_r_t func, const char *fsync,
2387
2304
  ca_sweep_state_t state;
2388
2305
  ca_cslab_ctx_t ctx;
2389
2306
 
2390
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2391
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2392
- 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]);
2393
2310
 
2394
2311
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2395
2312
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2415,15 +2332,12 @@ ca_call_cslab_3_r (ca_cslab_r_t func, const char *fsync,
2415
2332
  ctx.userdata = userdata;
2416
2333
  ca_sweep_run_chunked(&state, ca_cslab_r_walk, (VALUE) &ctx);
2417
2334
 
2418
- RB_GC_GUARD(rcx1);
2419
- RB_GC_GUARD(rcx2);
2420
-
2421
2335
  return rcx0;
2422
2336
  }
2423
2337
 
2424
2338
  VALUE
2425
2339
  ca_call_cslab_4_r (ca_cslab_r_t func, const char *fsync,
2426
- VALUE rcx0, VALUE rcx1, VALUE rcx2, VALUE rcx3,
2340
+ volatile VALUE rcx0, volatile VALUE rcx1, volatile VALUE rcx2, volatile VALUE rcx3,
2427
2341
  void *userdata)
2428
2342
  {
2429
2343
  CArray *cx[4];
@@ -2435,10 +2349,10 @@ ca_call_cslab_4_r (ca_cslab_r_t func, const char *fsync,
2435
2349
  ca_sweep_state_t state;
2436
2350
  ca_cslab_ctx_t ctx;
2437
2351
 
2438
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2439
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2440
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2441
- 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]);
2442
2356
 
2443
2357
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2444
2358
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2464,16 +2378,12 @@ ca_call_cslab_4_r (ca_cslab_r_t func, const char *fsync,
2464
2378
  ctx.userdata = userdata;
2465
2379
  ca_sweep_run_chunked(&state, ca_cslab_r_walk, (VALUE) &ctx);
2466
2380
 
2467
- RB_GC_GUARD(rcx1);
2468
- RB_GC_GUARD(rcx2);
2469
- RB_GC_GUARD(rcx3);
2470
-
2471
2381
  return rcx0;
2472
2382
  }
2473
2383
 
2474
2384
  VALUE
2475
2385
  ca_call_cslab_5_r (ca_cslab_r_t func, const char *fsync,
2476
- 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,
2477
2387
  void *userdata)
2478
2388
  {
2479
2389
  CArray *cx[5];
@@ -2485,11 +2395,11 @@ ca_call_cslab_5_r (ca_cslab_r_t func, const char *fsync,
2485
2395
  ca_sweep_state_t state;
2486
2396
  ca_cslab_ctx_t ctx;
2487
2397
 
2488
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2489
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2490
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2491
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2492
- 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]);
2493
2403
 
2494
2404
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2495
2405
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2515,17 +2425,12 @@ ca_call_cslab_5_r (ca_cslab_r_t func, const char *fsync,
2515
2425
  ctx.userdata = userdata;
2516
2426
  ca_sweep_run_chunked(&state, ca_cslab_r_walk, (VALUE) &ctx);
2517
2427
 
2518
- RB_GC_GUARD(rcx1);
2519
- RB_GC_GUARD(rcx2);
2520
- RB_GC_GUARD(rcx3);
2521
- RB_GC_GUARD(rcx4);
2522
-
2523
2428
  return rcx0;
2524
2429
  }
2525
2430
 
2526
2431
  VALUE
2527
2432
  ca_call_cslab_6_r (ca_cslab_r_t func, const char *fsync,
2528
- 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,
2529
2434
  void *userdata)
2530
2435
  {
2531
2436
  CArray *cx[6];
@@ -2537,12 +2442,12 @@ ca_call_cslab_6_r (ca_cslab_r_t func, const char *fsync,
2537
2442
  ca_sweep_state_t state;
2538
2443
  ca_cslab_ctx_t ctx;
2539
2444
 
2540
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2541
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2542
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2543
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2544
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
2545
- 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]);
2546
2451
 
2547
2452
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2548
2453
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2568,18 +2473,12 @@ ca_call_cslab_6_r (ca_cslab_r_t func, const char *fsync,
2568
2473
  ctx.userdata = userdata;
2569
2474
  ca_sweep_run_chunked(&state, ca_cslab_r_walk, (VALUE) &ctx);
2570
2475
 
2571
- RB_GC_GUARD(rcx1);
2572
- RB_GC_GUARD(rcx2);
2573
- RB_GC_GUARD(rcx3);
2574
- RB_GC_GUARD(rcx4);
2575
- RB_GC_GUARD(rcx5);
2576
-
2577
2476
  return rcx0;
2578
2477
  }
2579
2478
 
2580
2479
  VALUE
2581
2480
  ca_call_cslab_7_r (ca_cslab_r_t func, const char *fsync,
2582
- 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,
2583
2482
  void *userdata)
2584
2483
  {
2585
2484
  CArray *cx[7];
@@ -2591,13 +2490,13 @@ ca_call_cslab_7_r (ca_cslab_r_t func, const char *fsync,
2591
2490
  ca_sweep_state_t state;
2592
2491
  ca_cslab_ctx_t ctx;
2593
2492
 
2594
- TypedData_Get_Struct(rcx0, CArray, &carray_data_type, cx[0]);
2595
- TypedData_Get_Struct(rcx1, CArray, &carray_data_type, cx[1]);
2596
- TypedData_Get_Struct(rcx2, CArray, &carray_data_type, cx[2]);
2597
- TypedData_Get_Struct(rcx3, CArray, &carray_data_type, cx[3]);
2598
- TypedData_Get_Struct(rcx4, CArray, &carray_data_type, cx[4]);
2599
- TypedData_Get_Struct(rcx5, CArray, &carray_data_type, cx[5]);
2600
- 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]);
2601
2500
 
2602
2501
  /* sweep engine, chunked path: per-operand acquire (attach for OUTPUT
2603
2502
  and alias INPUT, arena chunk scratch for non-alias INPUT), broadcast
@@ -2623,13 +2522,6 @@ ca_call_cslab_7_r (ca_cslab_r_t func, const char *fsync,
2623
2522
  ctx.userdata = userdata;
2624
2523
  ca_sweep_run_chunked(&state, ca_cslab_r_walk, (VALUE) &ctx);
2625
2524
 
2626
- RB_GC_GUARD(rcx1);
2627
- RB_GC_GUARD(rcx2);
2628
- RB_GC_GUARD(rcx3);
2629
- RB_GC_GUARD(rcx4);
2630
- RB_GC_GUARD(rcx5);
2631
- RB_GC_GUARD(rcx6);
2632
-
2633
2525
  return rcx0;
2634
2526
  }
2635
2527
 
@@ -2800,7 +2692,7 @@ ca_call_cslab_2_1 (int8_t dty1, int8_t dty2, int8_t dtx1, ca_cslab_t slabfunc, v
2800
2692
  if ( rb_ca_is_scalar(ry2) ) {
2801
2693
  ry2 = rb_ca_fetch_addr(ry2, 0);
2802
2694
  }
2803
- return rb_ary_new3(2, ry1, ry2);
2695
+ return rb_ary_new_from_args(2, ry1, ry2);
2804
2696
  }
2805
2697
 
2806
2698
  VALUE
@@ -2830,7 +2722,7 @@ ca_call_cslab_2_2 (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, ca_cslab_
2830
2722
  if ( rb_ca_is_scalar(ry2) ) {
2831
2723
  ry2 = rb_ca_fetch_addr(ry2, 0);
2832
2724
  }
2833
- return rb_ary_new3(2, ry1, ry2);
2725
+ return rb_ary_new_from_args(2, ry1, ry2);
2834
2726
  }
2835
2727
 
2836
2728
  VALUE
@@ -2861,7 +2753,7 @@ ca_call_cslab_2_3 (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t dt
2861
2753
  if ( rb_ca_is_scalar(ry2) ) {
2862
2754
  ry2 = rb_ca_fetch_addr(ry2, 0);
2863
2755
  }
2864
- return rb_ary_new3(2, ry1, ry2);
2756
+ return rb_ary_new_from_args(2, ry1, ry2);
2865
2757
  }
2866
2758
 
2867
2759
  VALUE
@@ -2893,7 +2785,7 @@ ca_call_cslab_2_4 (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t dt
2893
2785
  if ( rb_ca_is_scalar(ry2) ) {
2894
2786
  ry2 = rb_ca_fetch_addr(ry2, 0);
2895
2787
  }
2896
- return rb_ary_new3(2, ry1, ry2);
2788
+ return rb_ary_new_from_args(2, ry1, ry2);
2897
2789
  }
2898
2790
 
2899
2791
  VALUE
@@ -2930,7 +2822,7 @@ ca_call_cslab_3_1 (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, ca_cslab_
2930
2822
  if ( rb_ca_is_scalar(ry3) ) {
2931
2823
  ry3 = rb_ca_fetch_addr(ry3, 0);
2932
2824
  }
2933
- return rb_ary_new3(3, ry1, ry2, ry3);
2825
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
2934
2826
  }
2935
2827
 
2936
2828
  VALUE
@@ -2968,7 +2860,7 @@ ca_call_cslab_3_2 (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t dt
2968
2860
  if ( rb_ca_is_scalar(ry3) ) {
2969
2861
  ry3 = rb_ca_fetch_addr(ry3, 0);
2970
2862
  }
2971
- return rb_ary_new3(3, ry1, ry2, ry3);
2863
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
2972
2864
  }
2973
2865
 
2974
2866
  VALUE
@@ -3007,7 +2899,7 @@ ca_call_cslab_3_3 (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t dt
3007
2899
  if ( rb_ca_is_scalar(ry3) ) {
3008
2900
  ry3 = rb_ca_fetch_addr(ry3, 0);
3009
2901
  }
3010
- return rb_ary_new3(3, ry1, ry2, ry3);
2902
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
3011
2903
  }
3012
2904
 
3013
2905
  VALUE
@@ -3177,7 +3069,7 @@ ca_call_cslab_2_1_r (int8_t dty1, int8_t dty2, int8_t dtx1, ca_cslab_r_t slabfun
3177
3069
  if ( rb_ca_is_scalar(ry2) ) {
3178
3070
  ry2 = rb_ca_fetch_addr(ry2, 0);
3179
3071
  }
3180
- return rb_ary_new3(2, ry1, ry2);
3072
+ return rb_ary_new_from_args(2, ry1, ry2);
3181
3073
  }
3182
3074
 
3183
3075
  VALUE
@@ -3207,7 +3099,7 @@ ca_call_cslab_2_2_r (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, ca_csla
3207
3099
  if ( rb_ca_is_scalar(ry2) ) {
3208
3100
  ry2 = rb_ca_fetch_addr(ry2, 0);
3209
3101
  }
3210
- return rb_ary_new3(2, ry1, ry2);
3102
+ return rb_ary_new_from_args(2, ry1, ry2);
3211
3103
  }
3212
3104
 
3213
3105
  VALUE
@@ -3238,7 +3130,7 @@ ca_call_cslab_2_3_r (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t
3238
3130
  if ( rb_ca_is_scalar(ry2) ) {
3239
3131
  ry2 = rb_ca_fetch_addr(ry2, 0);
3240
3132
  }
3241
- return rb_ary_new3(2, ry1, ry2);
3133
+ return rb_ary_new_from_args(2, ry1, ry2);
3242
3134
  }
3243
3135
 
3244
3136
  VALUE
@@ -3270,7 +3162,7 @@ ca_call_cslab_2_4_r (int8_t dty1, int8_t dty2, int8_t dtx1, int8_t dtx2, int8_t
3270
3162
  if ( rb_ca_is_scalar(ry2) ) {
3271
3163
  ry2 = rb_ca_fetch_addr(ry2, 0);
3272
3164
  }
3273
- return rb_ary_new3(2, ry1, ry2);
3165
+ return rb_ary_new_from_args(2, ry1, ry2);
3274
3166
  }
3275
3167
 
3276
3168
  VALUE
@@ -3307,7 +3199,7 @@ ca_call_cslab_3_1_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, ca_csla
3307
3199
  if ( rb_ca_is_scalar(ry3) ) {
3308
3200
  ry3 = rb_ca_fetch_addr(ry3, 0);
3309
3201
  }
3310
- return rb_ary_new3(3, ry1, ry2, ry3);
3202
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
3311
3203
  }
3312
3204
 
3313
3205
  VALUE
@@ -3345,7 +3237,7 @@ ca_call_cslab_3_2_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t
3345
3237
  if ( rb_ca_is_scalar(ry3) ) {
3346
3238
  ry3 = rb_ca_fetch_addr(ry3, 0);
3347
3239
  }
3348
- return rb_ary_new3(3, ry1, ry2, ry3);
3240
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
3349
3241
  }
3350
3242
 
3351
3243
  VALUE
@@ -3384,6 +3276,6 @@ ca_call_cslab_3_3_r (int8_t dty1, int8_t dty2, int8_t dty3, int8_t dtx1, int8_t
3384
3276
  if ( rb_ca_is_scalar(ry3) ) {
3385
3277
  ry3 = rb_ca_fetch_addr(ry3, 0);
3386
3278
  }
3387
- return rb_ary_new3(3, ry1, ry2, ry3);
3279
+ return rb_ary_new_from_args(3, ry1, ry2, ry3);
3388
3280
  }
3389
3281