Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat all fills as unpackable operations because I'm lazy.
Browse files Browse the repository at this point in the history
headius committed Jun 11, 2016
1 parent 758a1cb commit b2e2611
Showing 1 changed file with 4 additions and 32 deletions.
36 changes: 4 additions & 32 deletions core/src/main/java/org/jruby/specialized/RubyArrayTwoObject.java
Original file line number Diff line number Diff line change
@@ -146,44 +146,16 @@ public IRubyObject each(ThreadContext context, Block block) {
protected IRubyObject fillCommon(ThreadContext context, int beg, long len, Block block) {
if (!packed()) return super.fillCommon(context, beg, len, block);

modifyCheck();

// See [ruby-core:17483]
if (len <= 0) return this;

if (len > Integer.MAX_VALUE - beg) throw context.runtime.newArgumentError("argument too big");

if (len > 2) {
unpack();
return super.fillCommon(context, beg, len, block);
}

car = block.yield(context, RubyFixnum.zero(context.runtime));
if (len > 1) cdr = block.yield(context, RubyFixnum.one(context.runtime));

return this;
unpack();
return super.fillCommon(context, beg, len, block);
}

@Override
protected IRubyObject fillCommon(ThreadContext context, int beg, long len, IRubyObject item) {
if (!packed()) return super.fillCommon(context, beg, len, item);

modifyCheck();

// See [ruby-core:17483]
if (len <= 0) return this;

if (len > Integer.MAX_VALUE - beg) throw context.runtime.newArgumentError("argument too big");

if (len > 2) {
unpack();
return super.fillCommon(context, beg, len, item);
}

car = item;
if (len > 1) cdr = item;

return this;
unpack();
return super.fillCommon(context, beg, len, item);
}

@Override

0 comments on commit b2e2611

Please sign in to comment.