summaryrefslogtreecommitdiff
path: root/darray.h
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2021-03-04 15:31:37 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:31 -0400
commit7de8ce4efcfd23515d4e4b6a6f80e142438df758 (patch)
tree843a04a1d2fced3ed7d0bf43b6eb462e1c5f91d1 /darray.h
parentd6d58795a90d338ac8fb308c8a79044172778485 (diff)
downloadruby-7de8ce4efcfd23515d4e4b6a6f80e142438df758.tar.gz
YJIT: Use 2D array to group block versions
For deferred compilation, we sometimes want to care about the order of the block versions. Use an array instead of a linked list to do that.
Diffstat (limited to 'darray.h')
-rw-r--r--darray.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/darray.h b/darray.h
index d3ffc88131..a86132d59a 100644
--- a/darray.h
+++ b/darray.h
@@ -60,6 +60,11 @@
#define rb_darray_foreach(ary, idx_name, elem_ptr_var) \
for (int idx_name = 0; idx_name < rb_darray_size(ary) && ((elem_ptr_var) = rb_darray_ref(ary, idx_name)); ++idx_name)
+// Iterate over valid indicies in the array in a for loop
+//
+#define rb_darray_for(ary, idx_name) \
+ for (int idx_name = 0; idx_name < rb_darray_size(ary); ++idx_name)
+
// Make a dynamic array of a certain size. All bytes backing the elements are set to zero.
// Return 1 on success and 0 on failure.
//