@@ -222,10 +222,10 @@ def each # :nodoc:
222222 unless defined? ( yield )
223223 return Primitive . cexpr! 'SIZED_ENUMERATOR(self, 0, 0, ary_enum_length)'
224224 end
225- _i = 0
226- value = nil
227- while Primitive . cexpr! ( %q{ ary_fetch_next(self, LOCAL_PTR(_i), LOCAL_PTR(value)) } )
228- yield value
225+ i = 0
226+ until Primitive . rb_jit_ary_at_end ( i )
227+ yield Primitive . rb_jit_ary_at ( i )
228+ i = Primitive . rb_jit_fixnum_inc ( i )
229229 end
230230 self
231231 end
@@ -241,12 +241,12 @@ def map # :nodoc:
241241 return Primitive . cexpr! 'SIZED_ENUMERATOR(self, 0, 0, ary_enum_length)'
242242 end
243243
244- _i = 0
245- value = nil
244+ i = 0
246245 result = Primitive . ary_sized_alloc
247- while Primitive . cexpr! ( %q{ ary_fetch_next(self, LOCAL_PTR(_i), LOCAL_PTR(value)) } )
248- value = yield ( value )
249- Primitive . cexpr! ( %q{ rb_ary_push(result, value) } )
246+ until Primitive . rb_jit_ary_at_end ( i )
247+ _value = yield ( Primitive . rb_jit_ary_at ( i ) )
248+ Primitive . cexpr! ( %q{ rb_ary_push(result, _value) } )
249+ i = Primitive . rb_jit_fixnum_inc ( i )
250250 end
251251 result
252252 end
@@ -267,13 +267,14 @@ def select # :nodoc:
267267 return Primitive . cexpr! 'SIZED_ENUMERATOR(self, 0, 0, ary_enum_length)'
268268 end
269269
270- _i = 0
271- value = nil
270+ i = 0
272271 result = Primitive . ary_sized_alloc
273- while Primitive . cexpr! ( %q{ ary_fetch_next(self, LOCAL_PTR(_i), LOCAL_PTR(value)) } )
272+ until Primitive . rb_jit_ary_at_end ( i )
273+ value = Primitive . rb_jit_ary_at ( i )
274274 if yield value
275275 Primitive . cexpr! ( %q{ rb_ary_push(result, value) } )
276276 end
277+ i = Primitive . rb_jit_fixnum_inc ( i )
277278 end
278279 result
279280 end
@@ -293,10 +294,11 @@ def find(if_none_proc = nil) # :nodoc:
293294 unless defined? ( yield )
294295 return Primitive . cexpr! 'SIZED_ENUMERATOR(self, 0, 0, ary_enum_length)'
295296 end
296- _i = 0
297- value = nil
298- while Primitive . cexpr! ( %q{ ary_fetch_next(self, LOCAL_PTR(_i), LOCAL_PTR(value)) } )
297+ i = 0
298+ until Primitive . rb_jit_ary_at_end ( i )
299+ value = Primitive . rb_jit_ary_at ( i )
299300 return value if yield ( value )
301+ i = Primitive . rb_jit_fixnum_inc ( i )
300302 end
301303 if_none_proc &.call
302304 end
0 commit comments