Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[Truffle] Make $_ thread local and use it in implicit matches.
- Loading branch information
Showing
with
78 additions
and 6 deletions.
- +32 −0 core/src/main/java/org/jruby/truffle/nodes/ThreadLocalObjectNode.java
- +10 −0 core/src/main/java/org/jruby/truffle/runtime/core/RubyThread.java
- +35 −5 core/src/main/java/org/jruby/truffle/translator/BodyTranslator.java
- +1 −0 spec/truffle/tags/language/predefined_tags.txt
- +0 −1 spec/truffle/tags/language/regexp_tags.txt
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. This | ||
* code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
* redistribute it and/or modify it under the terms of the: | ||
* | ||
* Eclipse Public License version 1.0 | ||
* GNU General Public License version 2 | ||
* GNU Lesser General Public License version 2.1 | ||
*/ | ||
package org.jruby.truffle.nodes; | ||
|
||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import com.oracle.truffle.api.source.SourceSection; | ||
import org.jruby.truffle.runtime.RubyContext; | ||
import org.jruby.truffle.runtime.core.RubyBasicObject; | ||
|
||
public class ThreadLocalObjectNode extends RubyNode { | ||
|
||
public ThreadLocalObjectNode(RubyContext context, SourceSection sourceSection) { | ||
super(context, sourceSection); | ||
} | ||
|
||
@Override | ||
public RubyBasicObject executeRubyBasicObject(VirtualFrame frame) { | ||
return getContext().getThreadManager().getCurrentThread().getThreadLocals(); | ||
} | ||
|
||
@Override | ||
public Object execute(VirtualFrame frame) { | ||
return executeRubyBasicObject(frame); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1,2 +1 @@ | ||
fails:Literal Regexps allows unescaped / to be used with %r |