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

Commits on Jun 21, 2016

  1. Copy the full SHA
    b2070e9 View commit details
  2. Copy the full SHA
    f043666 View commit details
Original file line number Diff line number Diff line change
@@ -2815,26 +2815,6 @@ public Object stringByteSubstring(DynamicObject string, DynamicObject range, Not

}

@Primitive(name = "string_check_null_safe", needsSelf = false)
public static abstract class StringCheckNullSafePrimitiveNode extends PrimitiveArrayArgumentsNode {

@Specialization
public DynamicObject stringCheckNullSafe(DynamicObject string,
@Cached("create()") BranchProfile errorProfile) {
final byte[] bytes = rope(string).getBytes();

for (int i = 0; i < bytes.length; i++) {
if (bytes[i] == 0) {
errorProfile.enter();
throw new RaiseException(coreExceptions().argumentError("string contains NULL byte", this));
}
}

return string;
}

}

@Primitive(name = "string_chr_at", lowerFixnumParameters = 0)
@ImportStatic(StringGuards.class)
public static abstract class StringChrAtPrimitiveNode extends PrimitiveArrayArgumentsNode {
Original file line number Diff line number Diff line change
@@ -37,14 +37,14 @@ public DynamicObject truncateLengthNegative(DynamicObject string, int newByteLen
getContext().getCoreExceptions().argumentError(formatNegativeError(newByteLength), this));
}

@Specialization(guards = { "newByteLength > 0", "isRubyString(string)", "isNewLengthTooLarge(string, newByteLength)" })
@Specialization(guards = { "newByteLength >= 0", "isRubyString(string)", "isNewLengthTooLarge(string, newByteLength)" })
@TruffleBoundary
public DynamicObject truncateLengthTooLong(DynamicObject string, int newByteLength) {
throw new RaiseException(
getContext().getCoreExceptions().argumentError(formatTooLongError(newByteLength, rope(string)), this));
}

@Specialization(guards = { "newByteLength > 0", "isRubyString(string)", "!isNewLengthTooLarge(string, newByteLength)" })
@Specialization(guards = { "newByteLength >= 0", "isRubyString(string)", "!isNewLengthTooLarge(string, newByteLength)" })
public DynamicObject stealStorage(DynamicObject string, int newByteLength,
@Cached("createX()") RopeNodes.MakeSubstringNode makeSubstringNode) {