-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ruby-2.3' into ruby-2.3+socket
Showing
816 changed files
with
7,414 additions
and
5,994 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
#!/usr/bin/env bash | ||
"exec" "`dirname $BASH_SOURCE[0]`/jruby" "$0" "$@" | ||
|
||
require File.join(JRuby.runtime.instance_config.jruby_home, 'lib/ruby/truffle/jruby+truffle/runner') | ||
|
||
JRubyTruffleRunner.new | ||
exec `dirname $BASH_SOURCE[0]`/jruby `dirname $BASH_SOURCE[0]`/../lib/ruby/truffle/jruby+truffle/bin/jruby+truffle "$@" |
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
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
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
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 change: 0 additions & 1 deletion
1
core/src/main/java/org/jruby/ir/passes/AddCallProtocolInstructions.java
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 change: 0 additions & 1 deletion
1
core/src/main/java/org/jruby/ir/passes/AddLocalVarLoadStoreInstructions.java
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 change: 0 additions & 1 deletion
1
core/src/main/java/org/jruby/ir/passes/DeadCodeElimination.java
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
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
155 changes: 155 additions & 0 deletions
155
core/src/main/java/org/jruby/ir/targets/ConstantLookupSite.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
package org.jruby.ir.targets; | ||
|
||
import com.headius.invokebinder.Binder; | ||
import org.jruby.Ruby; | ||
import org.jruby.RubyModule; | ||
import org.jruby.ir.operands.UndefinedValue; | ||
import org.jruby.parser.StaticScope; | ||
import org.jruby.runtime.ThreadContext; | ||
import org.jruby.runtime.builtin.IRubyObject; | ||
import org.jruby.util.cli.Options; | ||
import org.jruby.util.log.Logger; | ||
import org.jruby.util.log.LoggerFactory; | ||
|
||
import java.lang.invoke.MethodHandle; | ||
import java.lang.invoke.MethodType; | ||
import java.lang.invoke.MutableCallSite; | ||
import java.lang.invoke.SwitchPoint; | ||
|
||
import static java.lang.invoke.MethodHandles.guardWithTest; | ||
|
||
/** | ||
* Created by headius on 1/31/16. | ||
*/ | ||
public class ConstantLookupSite extends MutableCallSite { | ||
private static final Logger LOG = LoggerFactory.getLogger("ConstantLookupSite"); | ||
private final String name; | ||
private final boolean publicOnly; | ||
|
||
public ConstantLookupSite(MethodType type, String name, boolean publicOnly) { | ||
super(type); | ||
|
||
this.name = name; | ||
this.publicOnly = publicOnly; | ||
} | ||
|
||
public IRubyObject searchConst(ThreadContext context, StaticScope staticScope) { | ||
// Lexical lookup | ||
Ruby runtime = context.getRuntime(); | ||
RubyModule object = runtime.getObject(); | ||
IRubyObject constant = (staticScope == null) ? object.getConstant(name) : staticScope.getConstantInner(name); | ||
|
||
// Inheritance lookup | ||
RubyModule module = null; | ||
if (constant == null) { | ||
// SSS FIXME: Is this null check case correct? | ||
module = staticScope == null ? object : staticScope.getModule(); | ||
constant = publicOnly ? module.getConstantFromNoConstMissing(name, false) : module.getConstantNoConstMissing(name); | ||
} | ||
|
||
// Call const_missing or cache | ||
if (constant == null) { | ||
return module.callMethod(context, "const_missing", context.runtime.fastNewSymbol(name)); | ||
} | ||
|
||
SwitchPoint switchPoint = (SwitchPoint) runtime.getConstantInvalidator(name).getData(); | ||
|
||
// bind constant until invalidated | ||
MethodHandle target = Binder.from(type()) | ||
.drop(0, 2) | ||
.constant(constant); | ||
MethodHandle fallback = getTarget(); | ||
if (fallback == null) { | ||
fallback = Binder.from(type()) | ||
.insert(0, this) | ||
.invokeVirtualQuiet(Bootstrap.LOOKUP, "searchConst"); | ||
} | ||
|
||
setTarget(switchPoint.guardWithTest(target, fallback)); | ||
|
||
if (Options.INVOKEDYNAMIC_LOG_CONSTANTS.load()) { | ||
LOG.info(name + "\tretrieved and cached from scope " + staticScope.getIRScope());// + " added to PIC" + extractSourceInfo(site)); | ||
} | ||
|
||
return constant; | ||
} | ||
|
||
public IRubyObject inheritanceSearchConst(ThreadContext context, IRubyObject cmVal) { | ||
Ruby runtime = context.runtime; | ||
RubyModule module; | ||
|
||
if (cmVal instanceof RubyModule) { | ||
module = (RubyModule) cmVal; | ||
} else { | ||
throw runtime.newTypeError(cmVal + " is not a type/class"); | ||
} | ||
|
||
IRubyObject constant = publicOnly ? module.getConstantFromNoConstMissing(name, false) : module.getConstantNoConstMissing(name); | ||
|
||
if (constant == null) { | ||
constant = UndefinedValue.UNDEFINED; | ||
} | ||
|
||
SwitchPoint switchPoint = (SwitchPoint) runtime.getConstantInvalidator(name).getData(); | ||
|
||
// bind constant until invalidated | ||
MethodHandle target = Binder.from(type()) | ||
.drop(0, 2) | ||
.constant(constant); | ||
|
||
MethodHandle fallback = getTarget(); | ||
if (fallback == null) { | ||
fallback = Binder.from(type()) | ||
.insert(0, this) | ||
.invokeVirtualQuiet(Bootstrap.LOOKUP, "inheritanceSearchConst"); | ||
} | ||
|
||
// test that module is same as before | ||
MethodHandle test = Binder.from(type().changeReturnType(boolean.class)) | ||
.drop(0, 1) | ||
.insert(1, module.id) | ||
.invokeStaticQuiet(Bootstrap.LOOKUP, Bootstrap.class, "testArg0ModuleMatch"); | ||
|
||
target = guardWithTest(test, target, fallback); | ||
|
||
setTarget(switchPoint.guardWithTest(target, fallback)); | ||
|
||
if (Options.INVOKEDYNAMIC_LOG_CONSTANTS.load()) { | ||
LOG.info(name + "\tretrieved and cached from type " + cmVal.getMetaClass());// + " added to PIC" + extractSourceInfo(site)); | ||
} | ||
|
||
return constant; | ||
} | ||
|
||
public IRubyObject lexicalSearchConst(ThreadContext context, StaticScope scope) { | ||
Ruby runtime = context.runtime; | ||
|
||
IRubyObject constant = scope.getConstantInner(name); | ||
|
||
if (constant == null) { | ||
constant = UndefinedValue.UNDEFINED; | ||
} | ||
|
||
SwitchPoint switchPoint = (SwitchPoint) runtime.getConstantInvalidator(name).getData(); | ||
|
||
// bind constant until invalidated | ||
MethodHandle target = Binder.from(type()) | ||
.drop(0, 2) | ||
.constant(constant); | ||
|
||
MethodHandle fallback = getTarget(); | ||
if (fallback == null) { | ||
fallback = Binder.from(type()) | ||
.insert(0, this) | ||
.invokeVirtualQuiet(Bootstrap.LOOKUP, "lexicalSearchConst"); | ||
} | ||
|
||
setTarget(switchPoint.guardWithTest(target, fallback)); | ||
|
||
if (Options.INVOKEDYNAMIC_LOG_CONSTANTS.load()) { | ||
LOG.info(name + "\tretrieved and cached from scope " + scope.getIRScope());// + " added to PIC" + extractSourceInfo(site)); | ||
} | ||
|
||
return constant; | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require_relative '../lib/runner.rb' | ||
|
||
JRubyTruffleRunner.new |
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
sudo: false | ||
language: ruby | ||
script: | ||
- bundle exec rspec | ||
|
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
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
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
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
Oops, something went wrong.