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

Commits on May 25, 2016

  1. Copy the full SHA
    594c7f1 View commit details
  2. Copy the full SHA
    c2fa39a View commit details
16 changes: 1 addition & 15 deletions truffle/src/main/java/org/jruby/truffle/core/rope/LazyRope.java
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@
*/
package org.jruby.truffle.core.rope;

import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import org.jcodings.Encoding;

public abstract class LazyRope extends Rope {
@@ -23,20 +22,7 @@ protected byte getByteSlow(int index) {
return getBytes()[index];
}

public byte[] getBytes() {
if (bytes == null) {
doFulfill();
}

return bytes;
}

@TruffleBoundary
private void doFulfill() {
bytes = fulfill();
}

protected abstract byte[] fulfill();
protected abstract byte[] fulfill();

@Override
public String toString() {
10 changes: 5 additions & 5 deletions truffle/src/main/java/org/jruby/truffle/core/rope/Rope.java
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ public final int byteLength() {
return byteLength;
}

public boolean isEmpty() {
public final boolean isEmpty() {
return byteLength == 0;
}

@@ -54,15 +54,15 @@ public final byte[] getRawBytes() {
return bytes;
}

public byte[] getBytes() {
public final byte[] getBytes() {
if (bytes == null) {
bytes = RopeOperations.flattenBytes(this);
}

return bytes;
}

public byte[] getBytesCopy() {
public final byte[] getBytesCopy() {
return getBytes().clone();
}

@@ -83,7 +83,7 @@ public final int depth() {
}

@Override
public int hashCode() {
public final int hashCode() {
if (hashCode == 0) {
hashCode = RopeOperations.hashForRange(this, 1, 0, byteLength);
}
@@ -92,7 +92,7 @@ public int hashCode() {
}

@Override
public boolean equals(Object o) {
public final boolean equals(Object o) {
if (this == o) {
return true;
}
Original file line number Diff line number Diff line change
@@ -273,7 +273,7 @@ public static byte[] flattenBytes(Rope rope) {

// Force lazy ropes
if (current instanceof LazyRope) {
current.getBytes();
((LazyRope) current).fulfill();
}

if (current.getRawBytes() != null) {