Skip to content

Commit

Permalink
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/RubyArray.java
Original file line number Diff line number Diff line change
@@ -1721,15 +1721,15 @@ public IRubyObject each(ThreadContext context, Block block) {
public IRubyObject eachSlice(ThreadContext context, int size, Block block) {
unpack();
Ruby runtime = context.runtime;
RubyClass array = runtime.getArray();

// local copies of everything
int localRealLength = realLength;
IRubyObject[] localValues = values;
int localBegin = begin;

// sliding window, always unpacked since we may manipulate window.begin
RubyArray window = newArrayNoCopy(runtime, localValues, localBegin, size);
makeShared();
// sliding window
RubyArray window = makeShared(localBegin, size, array);

// don't expose shared array to ruby
Signature signature = block.getSignature();
@@ -1740,7 +1740,7 @@ public IRubyObject eachSlice(ThreadContext context, int size, Block block) {
if (specificArity) { // array is never exposed to ruby, just use for yielding
window.begin = localBegin += size;
} else { // array may be exposed to ruby, create new
window = newArrayMayCopy(runtime, localValues, localBegin += size, size);
window = makeShared(localBegin += size, size, array);
}
}

0 comments on commit 5e01f22

Please sign in to comment.