Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c07398de11ad
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c43426679905
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Feb 20, 2016

  1. Updates for String#reverse.

    Fixes MRI TestM17N#test_reverse.
    headius committed Feb 20, 2016
    Copy the full SHA
    70bfb4c View commit details
  2. Copy the full SHA
    93f7fbd View commit details
  3. define_singleton_method needs to read visibility.

    Fixes MRI TestMethod#test_bound_method_entry.
    headius committed Feb 20, 2016
    Copy the full SHA
    c434266 View commit details
Showing with 26 additions and 14 deletions.
  1. +1 −1 core/src/main/java/org/jruby/RubyKernel.java
  2. +21 −13 core/src/main/java/org/jruby/RubyString.java
  3. +4 −0 core/src/main/java/org/jruby/ext/stringio/StringIO.java
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyKernel.java
Original file line number Diff line number Diff line change
@@ -1233,7 +1233,7 @@ public static IRubyObject untrace_var(ThreadContext context, IRubyObject recv, I
return context.runtime.getNil();
}

@JRubyMethod(required = 1, optional = 1)
@JRubyMethod(required = 1, optional = 1, reads = VISIBILITY)
public static IRubyObject define_singleton_method(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
if (args.length == 0) {
throw context.runtime.newArgumentError(0, 1);
34 changes: 21 additions & 13 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -1456,6 +1456,9 @@ public RubyString reverse_bang19(ThreadContext context) {
byte[]bytes = value.getUnsafeBytes();
int p = value.getBegin();
int len = value.getRealSize();
int end = p + len;
int op = len;
int cr = getCodeRange();

Encoding enc = value.getEncoding();
// this really needs to be inlined here
@@ -1465,25 +1468,30 @@ public RubyString reverse_bang19(ThreadContext context) {
bytes[p + i] = bytes[p + len - i - 1];
bytes[p + len - i - 1] = b;
}
} else if (cr == CR_VALID) {
byte[] obytes = new byte[len];
while (p < end) {
int cl = StringSupport.length(enc, bytes, p, end);

op -= cl;
System.arraycopy(bytes, p, obytes, op, cl);
p += cl;
}
} else {
int end = p + len;
int op = len;
byte[]obytes = new byte[len];
boolean single = true;
byte[] obytes = new byte[len];
cr = enc.isAsciiCompatible() ? CR_7BIT : CR_VALID;
while (p < end) {
int cl = StringSupport.length(enc, bytes, p, end);
if (cl > 1 || (bytes[p] & 0x80) != 0) {
single = false;
op -= cl;
System.arraycopy(bytes, p, obytes, op, cl);
p += cl;
} else {
obytes[--op] = bytes[p++];
}

if (cl > 1 || (bytes[p] & 0x80) != 0) cr = CR_UNKNOWN;
op -= cl;
System.arraycopy(bytes, p, obytes, op, cl);
p += cl;
}
value.setUnsafeBytes(obytes);
if (getCodeRange() == CR_UNKNOWN) setCodeRange(single ? CR_7BIT : CR_VALID);
}

setCodeRange(cr);
}
return this;
}
4 changes: 4 additions & 0 deletions core/src/main/java/org/jruby/ext/stringio/StringIO.java
Original file line number Diff line number Diff line change
@@ -1244,6 +1244,10 @@ public static IRubyObject syswrite_nonblock(ThreadContext context, IRubyObject s
}
}

public IRubyObject puts(ThreadContext context, IRubyObject[] args) {
return GenericWritable.puts(context, this, args);
}

/* rb: check_modifiable */
public void checkFrozen() {
super.checkFrozen();