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

Commits on Nov 15, 2016

  1. Copy the full SHA
    36077f8 View commit details
  2. 1
    Copy the full SHA
    ea29375 View commit details
Original file line number Diff line number Diff line change
@@ -770,6 +770,11 @@ public DynamicObject encodingCompatibilityErrorIncompatible(Encoding a, Encoding
return encodingCompatibilityError(StringUtils.format("incompatible character encodings: %s and %s", a, b), currentNode);
}

@TruffleBoundary
public DynamicObject encodingCompatibilityErrorIncompatibleWithOperation(Encoding encoding, Node currentNode) {
return encodingCompatibilityError(StringUtils.format("incompatible encoding with this operation: %s", encoding), currentNode);
}

@TruffleBoundary
public DynamicObject encodingCompatibilityError(String message, Node currentNode) {
return ExceptionOperations.createRubyException(
Original file line number Diff line number Diff line change
@@ -895,7 +895,6 @@ public Object crypt(DynamicObject string, DynamicObject salt) {
final Rope other = rope(salt);

if (other.byteLength() < 2) {
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new RaiseException(coreExceptions().argumentError("salt too short (need >= 2 bytes)", this));
}

@@ -904,7 +903,6 @@ public Object crypt(DynamicObject string, DynamicObject salt) {
final byte[] saltBytes = Arrays.copyOfRange(other.getBytes(), 0, other.byteLength());

if (saltBytes[0] == 0 || saltBytes[1] == 0) {
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new RaiseException(coreExceptions().argumentError("salt too short (need >= 2 bytes)", this));
}

@@ -913,7 +911,6 @@ public Object crypt(DynamicObject string, DynamicObject salt) {
// We differ from MRI in that we do not process salt to make it work and we will
// return any errors via errno.
if (cryptedString == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new RaiseException(coreExceptions().errnoError(posix.errno(), this));
}

@@ -1038,10 +1035,7 @@ public DynamicObject downcase(DynamicObject string,
final Encoding encoding = rope.getEncoding();

if (encoding.isDummy()) {
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new RaiseException(
coreExceptions().encodingCompatibilityError(
StringUtils.format("incompatible encoding with this operation: %s", encoding), this));
throw new RaiseException(coreExceptions().encodingCompatibilityErrorIncompatibleWithOperation(encoding, this));
}

if (emptyStringProfile.profile(rope.isEmpty())) {
@@ -1670,7 +1664,7 @@ public SwapcaseBangNode(RubyContext context, SourceSection sourceSection) {
makeLeafRopeNode = RopeNodesFactory.MakeLeafRopeNodeGen.create(null, null, null, null);
}

@TruffleBoundary
@TruffleBoundary(throwsControlFlowException = true)
@Specialization
public DynamicObject swapcaseSingleByte(DynamicObject string,
@Cached("createBinaryProfile()") ConditionProfile emptyStringProfile,
@@ -1681,10 +1675,7 @@ public DynamicObject swapcaseSingleByte(DynamicObject string,
final Encoding enc = rope.getEncoding();

if (enc.isDummy()) {
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new RaiseException(
coreExceptions().encodingCompatibilityError(
StringUtils.format("incompatible encoding with this operation: %s", enc), this));
throw new RaiseException(coreExceptions().encodingCompatibilityErrorIncompatibleWithOperation(enc, this));
}

if (emptyStringProfile.profile(rope.isEmpty())) {
@@ -2546,10 +2537,7 @@ public DynamicObject upcase(DynamicObject string) {
final Encoding encoding = rope.getEncoding();

if (encoding.isDummy()) {
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new RaiseException(
coreExceptions().encodingCompatibilityError(
StringUtils.format("incompatible encoding with this operation: %s", encoding), this));
throw new RaiseException(coreExceptions().encodingCompatibilityErrorIncompatibleWithOperation(encoding, this));
}

if (rope.isEmpty()) {
@@ -2614,8 +2602,7 @@ public DynamicObject capitalizeBang(DynamicObject string) {
final Encoding enc = rope.getEncoding();

if (enc.isDummy()) {
throw new RaiseException(coreExceptions().encodingCompatibilityError(
StringUtils.format("incompatible encoding with this operation: %s", enc), this));
throw new RaiseException(coreExceptions().encodingCompatibilityErrorIncompatibleWithOperation(enc, this));
}

if (rope.isEmpty()) {
@@ -4462,7 +4449,6 @@ private SearchResult searchForSingleByteOptimizableDescendant(Rope base, int ind
return new SearchResult(index, repeatingRope);
}
} else {
CompilerDirectives.transferToInterpreterAndInvalidate();
throw new UnsupportedOperationException("Don't know how to traverse rope type: " + base.getClass().getName());
}
}