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

Commits on Feb 27, 2015

  1. Copy the full SHA
    3fd7fe1 View commit details
  2. Copy the full SHA
    766e5e4 View commit details
Showing with 25 additions and 2 deletions.
  1. +0 −1 spec/truffle/tags/core/string/slice_tags.txt
  2. +25 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
1 change: 0 additions & 1 deletion spec/truffle/tags/core/string/slice_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
fails:String#slice with index, length always taints resulting strings when self is tainted
fails:String#slice with index, length calls to_int on the given index and the given length
fails:String#slice with index, length returns subclass instances
fails:String#slice with Range returns an empty string if range.begin is inside self and > real end
fails:String#slice with Range always taints resulting strings when self is tainted
Original file line number Diff line number Diff line change
@@ -320,7 +320,7 @@ public Object getIndex(RubyString string, int index, UndefinedPlaceholder undefi
}
}

@Specialization(guards = "!isRubyRange(arguments[1])")
@Specialization(guards = { "!isRubyRange(arguments[1])", "!isRubyRegexp(arguments[1])" })
public Object getIndex(VirtualFrame frame, RubyString string, Object index, UndefinedPlaceholder undefined) {
notDesignedForCompilation();

@@ -369,6 +369,30 @@ public Object slice(RubyString string, int start, int length) {
}
}

@Specialization(guards = "!isUndefinedPlaceholder(arguments[2])")
public Object slice(VirtualFrame frame, RubyString string, int start, Object length) {
notDesignedForCompilation();

if (toIntNode == null) {
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}

return slice(string, start, toIntNode.executeIntegerFixnum(frame, length));
}

@Specialization(guards = { "!isRubyRange(arguments[1])", "!isRubyRegexp(arguments[1])", "!isUndefinedPlaceholder(arguments[2])" })
public Object slice(VirtualFrame frame, RubyString string, Object start, Object length) {
notDesignedForCompilation();

if (toIntNode == null) {
CompilerDirectives.transferToInterpreter();
toIntNode = insert(ToIntNodeFactory.create(getContext(), getSourceSection(), null));
}

return slice(string, toIntNode.executeIntegerFixnum(frame, start), toIntNode.executeIntegerFixnum(frame, length));
}

@Specialization
public Object slice(RubyString string, RubyRegexp regexp, UndefinedPlaceholder capture) {
notDesignedForCompilation();