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

Commits on Aug 27, 2016

  1. 2
    Copy the full SHA
    ee54b4a View commit details
  2. Copy the full SHA
    31e7622 View commit details
Original file line number Diff line number Diff line change
@@ -84,6 +84,8 @@
import org.jruby.truffle.core.rope.RopeNodes;
import org.jruby.truffle.core.rope.RopeNodesFactory;
import org.jruby.truffle.core.rope.RopeOperations;
import org.jruby.truffle.core.rubinius.RegexpPrimitiveNodes;
import org.jruby.truffle.core.rubinius.RegexpPrimitiveNodesFactory;
import org.jruby.truffle.core.string.StringCachingGuards;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.core.symbol.SymbolTable;
@@ -273,15 +275,30 @@ public DynamicObject equal(Object other) {
public abstract static class NotMatchNode extends CoreMethodArrayArgumentsNode {

@Child private CallDispatchHeadNode matchNode;
@Child private RegexpPrimitiveNodes.RegexpSetLastMatchPrimitiveNode setLastMatchNode;

public NotMatchNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
matchNode = DispatchHeadNodeFactory.createMethodCall(context);
setLastMatchNode = RegexpPrimitiveNodesFactory.RegexpSetLastMatchPrimitiveNodeFactory.create(null);
}

@Specialization
public boolean notMatch(VirtualFrame frame, Object self, Object other) {
return !matchNode.callBoolean(frame, self, "=~", null, other);
final boolean ret = !matchNode.callBoolean(frame, self, "=~", null, other);

final FrameSlot matchDataSlot = frame.getFrameDescriptor().findFrameSlot("$~");
final Object matchData = frame.getValue(matchDataSlot);

if (matchData instanceof ThreadLocalObject) {
final ThreadLocalObject threadLocalObject = (ThreadLocalObject) matchData;

setLastMatchNode.executeSetLastMatch(threadLocalObject.get());
} else {
setLastMatchNode.executeSetLastMatch(nil());
}

return ret;
}

}
Original file line number Diff line number Diff line change
@@ -1684,10 +1684,13 @@ public RubyNode visitGlobalVarNode(org.jruby.ast.GlobalVarNode node) {
if (FRAME_LOCAL_GLOBAL_VARIABLES.contains(name)) {
// Assignment is implicit for many of these, so we need to declare when we use

environment.declareVarWhereAllowed(name);

RubyNode readNode = environment.findLocalVarNode(name, source, sourceSection);

if (readNode == null) {
environment.declareVarWhereAllowed(name);
readNode = environment.findLocalVarNode(name, source, sourceSection);
}

if (name.equals("$_")) {
if (getSourcePath(sourceSection).equals(buildCorePath("regexp.rb"))) {
readNode = new RubiniusLastStringReadNode(context, fullSourceSection);