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: eb9517ef5f39
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fda635e3a3e3
Choose a head ref
  • 4 commits
  • 4 files changed
  • 1 contributor

Commits on Mar 4, 2015

  1. String#lines should use each_line Enumerator to create ary.

    Reduces warnings noise in test:mri runs.
    headius committed Mar 4, 2015
    Copy the full SHA
    a67797e View commit details
  2. Numeric coercion should bail out if !respond_to? coerce.

    Reduces warning noise in test:mri.
    headius committed Mar 4, 2015
    Copy the full SHA
    2d46e1f View commit details
  3. Faster nil access.

    headius committed Mar 4, 2015
    Copy the full SHA
    c8e291f View commit details
  4. Copy the full SHA
    fda635e View commit details
Showing with 24 additions and 6 deletions.
  1. +2 −0 .travis.yml
  2. +18 −2 core/src/main/java/org/jruby/RubyNumeric.java
  3. +2 −2 core/src/main/java/org/jruby/RubyString.java
  4. +2 −2 rakelib/test.rake
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ env:
- PHASE='-Ptest'
- PHASE='-Prake -Dtask=test:jruby'
- PHASE='-Prake -Dtask=test:mri'
- PHASE='-Prake -Dtask=test:mri:jit'
- PHASE='-Prake -Dtask=test:slow_suites'
- PHASE='-Prake -Dtask=test:tracing'
- PHASE='-Prake -Dtask=spec:ji'
@@ -70,6 +71,7 @@ matrix:
- env: PHASE='-Pmain'
- env: PHASE='-Prake -Dtask=spec:jrubyc'
- env: PHASE='-Prake -Dtask=spec:profiler'
- env: PHASE='-Prake -Dtask=test:mri:jit'

branches:
only:
20 changes: 18 additions & 2 deletions core/src/main/java/org/jruby/RubyNumeric.java
Original file line number Diff line number Diff line change
@@ -459,9 +459,17 @@ protected final IRubyObject coerceBody(ThreadContext context, IRubyObject other)
*
*/
protected final RubyArray doCoerce(ThreadContext context, IRubyObject other, boolean err) {
Ruby runtime = context.runtime;
IRubyObject result;

IRubyObject savedError = context.runtime.getGlobalVariables().get("$!"); // Svae $!
IRubyObject savedError = runtime.getGlobalVariables().get("$!"); // Svae $!

if (!other.respondsTo("coerce")) {
if (err) {
coerceRescue(context, other);
}
return null;
}
try {
result = coerceBody(context, other);
} catch (RaiseException e) {
@@ -488,6 +496,14 @@ protected final RubyArray doCoerce(ThreadContext context, IRubyObject other, boo
return (RubyArray) result;
}

/** coerce_rescue
*
*/
protected final IRubyObject coerceRescue(ThreadContext context, IRubyObject other) {
coerceFailed(context, other);
return context.runtime.getNil();
}

/** coerce_failed
*
*/
@@ -528,7 +544,7 @@ protected final IRubyObject coerceBit(ThreadContext context, String method, IRub
protected final IRubyObject coerceCmp(ThreadContext context, String method, IRubyObject other) {
RubyArray ary = doCoerce(context, other, false);
if (ary == null) {
return context.runtime.getNil(); // MRI does it!
return context.nil; // MRI does it!
}
return (ary.eltInternal(0)).callMethod(context, method, ary.eltInternal(1));
}
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -5165,7 +5165,7 @@ public IRubyObject lines20(ThreadContext context, Block block) {
return each_lineCommon19(context, block);
}
// FIXME: Inefficient; build array manually rather than via Enumerator
return enumeratorize(context.runtime, this, "lines").callMethod(context, "to_a");
return enumeratorize(context.runtime, this, "each_line").callMethod(context, "to_a");
}

@JRubyMethod(name = "lines")
@@ -5175,7 +5175,7 @@ public IRubyObject lines20(ThreadContext context, IRubyObject arg, Block block)
return each_lineCommon19(context, arg, block);
}
// FIXME: Inefficient; build array manually rather than via Enumerator
return enumeratorize(context.runtime, this, "lines", arg).callMethod(context, "to_a");
return enumeratorize(context.runtime, this, "each_line", arg).callMethod(context, "to_a");
}

private IRubyObject each_lineCommon19(ThreadContext context, Block block) {
4 changes: 2 additions & 2 deletions rakelib/test.rake
Original file line number Diff line number Diff line change
@@ -58,8 +58,8 @@ namespace :test do
compile_flags = {
:default => :int,
:int => ["-X-C"],
:jit => ["-Xjit.threshold=0", "-J-XX:MaxPermSize=256M"],
:aot => ["-X+C", "-J-XX:MaxPermSize=256M"],
:jit => ["-Xjit.threshold=0", "-J-XX:MaxPermSize=512M"],
:aot => ["-X+C", "-J-XX:MaxPermSize=512M"],
:all => [:int, :jit, :aot]
}