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: 510e9fa1d892
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 71071ca5f88c
Choose a head ref

Commits on May 26, 2016

  1. Copy the full SHA
    7bed12f View commit details
  2. Copy the full SHA
    eb8e2a5 View commit details

Commits on Jun 28, 2016

  1. Copy the full SHA
    0585bd1 View commit details
  2. Copy the full SHA
    142030e View commit details

Commits on Jul 7, 2016

  1. Copy the full SHA
    3d9a318 View commit details
  2. Don't use java_send for JRuby.parse.

    For parsing a small file 10k times, this was 0.04s out of 0.09s.
    headius committed Jul 7, 2016
    Copy the full SHA
    d3bfd4f View commit details
  3. Copy the full SHA
    1034e3b View commit details
  4. Copy the full SHA
    eddd505 View commit details
  5. [Truffle] Fix Kernel#to_s taint spec

    Brandon Fish committed Jul 7, 2016
    6
    Copy the full SHA
    c8b5f03 View commit details

Commits on Jul 8, 2016

  1. Copy the full SHA
    78da47f View commit details
  2. [Truffle] Return StopIteration#result from loop

    Brandon Fish committed Jul 8, 2016
    Copy the full SHA
    db308fe View commit details
  3. Copy the full SHA
    7a7eca1 View commit details
  4. Copy the full SHA
    7f32928 View commit details
  5. Lexical constant searches should not stack targets.

    This logic was flawed. We should only stack up targets when doing
    a hierarchy search, since the LHS of a :: may change over time.
    Invalidation globally should throw the old target away, since it
    will never be executed again.
    headius committed Jul 8, 2016
    Copy the full SHA
    5763968 View commit details

Commits on Jul 9, 2016

  1. Copy the full SHA
    9778b8d View commit details
  2. Copy the full SHA
    1ae29af View commit details
  3. Rework constant caching in indy.

    This fixes #4003. I have rewritten the caching and invalidation to
    work like a call site, with bailout limits on global invalidation
    and type mismatch.
    headius committed Jul 9, 2016
    Copy the full SHA
    d15e35a View commit details
  4. Unify and clean up dispatch paths for Java methods and ctors.

    This work was prompted by running test:jruby:jit with indy turned
    on, which caused many calls to follow the IRubyObject[] path where
    they would have followed the specific-arity paths. Failures showed
    up because the IRubyObject[] paths did not handle error messages
    the same way as the specific paths.
    
    So I started by modifying findCallable to switch on arity, to use
    the same logic for low-arity calls whether they come through
    the appropriate path or not. That caused more bugs because there
    were expectations in the tests that varargs processing would be
    done for all of the IRubyObject[] path and the specific-arity
    findCallable versions did not do varargs.
    
    So I added varargs logic to all paths except for arity = 0,
    thinking it did not need it. That broke a test that expected the
    no-arg constructor to be called rather than the vararg constructor
    when called with no arguments, so I added varargs logic to that
    as well.
    
    All tests appear to pass. I have some minor concern about the
    additional overhead of checking for varargs matches, but not doing
    it before was inconsistent, and we will only look for varargs
    matches when nothing else matches and there's actually varargs
    methods to look at.
    
    Please review my changes, @kares.
    headius committed Jul 9, 2016
    Copy the full SHA
    7718d51 View commit details
  5. Copy the full SHA
    5e01f22 View commit details
  6. Copy the full SHA
    1462657 View commit details
  7. Copy the full SHA
    2039e84 View commit details
  8. Merge pull request #3930 from headius/misc_optz

    Misc optz
    headius authored Jul 9, 2016
    Copy the full SHA
    fa5698e View commit details
  9. Copy the full SHA
    db16171 View commit details
  10. [Truffle] Add keyword arguments to Numeric#step

    Brandon Fish committed Jul 9, 2016
    Copy the full SHA
    982fa88 View commit details
  11. Copy the full SHA
    fe7a657 View commit details
  12. Copy the full SHA
    b033f01 View commit details
  13. 2
    Copy the full SHA
    8dc5f55 View commit details
  14. Copy the full SHA
    b2f8947 View commit details
  15. Copy the full SHA
    90890bd View commit details
  16. Copy the full SHA
    71071ca View commit details
Showing with 736 additions and 384 deletions.
  1. +4 −4 core/src/main/java/org/jruby/RubyArray.java
  2. +8 −0 core/src/main/java/org/jruby/RubyBasicObject.java
  3. +18 −0 core/src/main/java/org/jruby/RubyModule.java
  4. +9 −0 core/src/main/java/org/jruby/RubyNumeric.java
  5. +2 −2 core/src/main/java/org/jruby/compiler/JITCompiler.java
  6. +2 −2 core/src/main/java/org/jruby/compiler/JITCompilerMBean.java
  7. +0 −2 core/src/main/java/org/jruby/ir/instructions/ArrayDerefInstr.java
  8. +4 −1 core/src/main/java/org/jruby/ir/instructions/AttrAssignInstr.java
  9. +1 −0 core/src/main/java/org/jruby/ir/instructions/LoadFrameClosureInstr.java
  10. +0 −1 core/src/main/java/org/jruby/ir/instructions/UnresolvedSuperInstr.java
  11. +5 −5 core/src/main/java/org/jruby/ir/targets/ArrayDerefInvokeSite.java
  12. +1 −1 core/src/main/java/org/jruby/ir/targets/Bootstrap.java
  13. +2 −2 core/src/main/java/org/jruby/ir/targets/ClassSuperInvokeSite.java
  14. +157 −61 core/src/main/java/org/jruby/ir/targets/ConstantLookupSite.java
  15. +3 −3 core/src/main/java/org/jruby/ir/targets/IRBytecodeAdapter.java
  16. +1 −1 core/src/main/java/org/jruby/ir/targets/IRBytecodeAdapter6.java
  17. +18 −19 core/src/main/java/org/jruby/ir/targets/IRBytecodeAdapter7.java
  18. +2 −2 core/src/main/java/org/jruby/ir/targets/InstanceSuperInvokeSite.java
  19. +23 −29 core/src/main/java/org/jruby/ir/targets/InvokeSite.java
  20. +1 −3 core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
  21. +5 −5 core/src/main/java/org/jruby/ir/targets/NormalInvokeSite.java
  22. +5 −7 core/src/main/java/org/jruby/ir/targets/ResolvedSuperInvokeSite.java
  23. +5 −5 core/src/main/java/org/jruby/ir/targets/SelfInvokeSite.java
  24. +33 −0 core/src/main/java/org/jruby/ir/targets/SiteTracker.java
  25. +8 −8 core/src/main/java/org/jruby/ir/targets/SuperInvokeSite.java
  26. +2 −2 core/src/main/java/org/jruby/ir/targets/UnresolvedSuperInvokeSite.java
  27. +2 −2 core/src/main/java/org/jruby/ir/targets/ZSuperInvokeSite.java
  28. +10 −0 core/src/main/java/org/jruby/java/dispatch/CallableSelector.java
  29. +152 −53 core/src/main/java/org/jruby/java/invokers/RubyToJavaInvoker.java
  30. +13 −3 core/src/main/java/org/jruby/util/ClasspathLauncher.java
  31. +4 −2 core/src/main/ruby/jruby/jruby.rb
  32. +2 −1 core/src/main/ruby/jruby/kernel.rb
  33. +6 −0 core/src/main/ruby/jruby/kernel/basicobject.rb
  34. +0 −1 spec/truffle/tags/core/kernel/loop_tags.txt
  35. +0 −2 spec/truffle/tags/core/kernel/to_s_tags.txt
  36. +0 −106 spec/truffle/tags/core/numeric/step_tags.txt
  37. +5 −0 tool/jt.rb
  38. +19 −1 tool/truffle/callgraph2html.rb
  39. +7 −1 truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
  40. +1 −1 truffle/src/main/java/org/jruby/truffle/core/cast/TaintResultNode.java
  41. +2 −3 truffle/src/main/java/org/jruby/truffle/core/fiber/FiberNodes.java
  42. +6 −1 truffle/src/main/java/org/jruby/truffle/core/kernel/KernelNodes.java
  43. +11 −8 truffle/src/main/java/org/jruby/truffle/core/thread/ThreadManager.java
  44. +45 −3 truffle/src/main/java/org/jruby/truffle/core/thread/ThreadNodes.java
  45. +43 −0 truffle/src/main/java/org/jruby/truffle/language/locals/InstrumentedWriteLocalVariableNode.java
  46. +1 −1 truffle/src/main/java/org/jruby/truffle/language/locals/ReadLocalVariableNode.java
  47. +11 −2 truffle/src/main/java/org/jruby/truffle/language/locals/WriteLocalVariableNode.java
  48. +4 −0 truffle/src/main/java/org/jruby/truffle/language/objects/AllocateObjectNode.java
  49. +1 −2 truffle/src/main/java/org/jruby/truffle/language/parser/jruby/BodyTranslator.java
  50. +7 −7 truffle/src/main/java/org/jruby/truffle/language/parser/jruby/LoadArgumentsTranslator.java
  51. +1 −1 truffle/src/main/java/org/jruby/truffle/language/parser/jruby/MethodTranslator.java
  52. +1 −1 truffle/src/main/java/org/jruby/truffle/language/parser/jruby/TranslatorDriver.java
  53. +27 −3 truffle/src/main/java/org/jruby/truffle/tools/callgraph/CallGraph.java
  54. +11 −5 truffle/src/main/java/org/jruby/truffle/tools/callgraph/SimpleWriter.java
  55. +4 −1 truffle/src/main/ruby/core/kernel.rb
  56. +21 −1 truffle/src/main/ruby/core/numeric.rb
  57. +0 −7 truffle/src/test/java/org/jruby/truffle/tck/RubyTckTest.java
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/RubyArray.java
Original file line number Diff line number Diff line change
@@ -1721,15 +1721,15 @@ public IRubyObject each(ThreadContext context, Block block) {
public IRubyObject eachSlice(ThreadContext context, int size, Block block) {
unpack();
Ruby runtime = context.runtime;
RubyClass array = runtime.getArray();

// local copies of everything
int localRealLength = realLength;
IRubyObject[] localValues = values;
int localBegin = begin;

// sliding window, always unpacked since we may manipulate window.begin
RubyArray window = newArrayNoCopy(runtime, localValues, localBegin, size);
makeShared();
// sliding window
RubyArray window = makeShared(localBegin, size, array);

// don't expose shared array to ruby
Signature signature = block.getSignature();
@@ -1740,7 +1740,7 @@ public IRubyObject eachSlice(ThreadContext context, int size, Block block) {
if (specificArity) { // array is never exposed to ruby, just use for yielding
window.begin = localBegin += size;
} else { // array may be exposed to ruby, create new
window = newArrayMayCopy(runtime, localValues, localBegin += size, size);
window = makeShared(localBegin += size, size, array);
}
}

8 changes: 8 additions & 0 deletions core/src/main/java/org/jruby/RubyBasicObject.java
Original file line number Diff line number Diff line change
@@ -1119,6 +1119,14 @@ public IRubyObject op_not(ThreadContext context) {
return context.runtime.newBoolean(!this.isTrue());
}

/**
* The != method implemented for BasicObject. Note that this version is currently
* replaced by a Ruby version in basicobject.rb for better caching characteristics.
*
* @param context thread context
* @param other other object
* @return false if this == other, true otherwise
*/
@JRubyMethod(name = "!=", required = 1)
public IRubyObject op_not_equal(ThreadContext context, IRubyObject other) {
return context.runtime.newBoolean(!invokedynamic(context, this, OP_EQUAL, other).isTrue());
18 changes: 18 additions & 0 deletions core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
@@ -37,8 +37,11 @@
***** END LICENSE BLOCK *****/
package org.jruby;

import com.headius.invokebinder.Binder;
import org.jcodings.Encoding;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -83,6 +86,7 @@
import org.jruby.ir.IRClosure;
import org.jruby.ir.IRMethod;
import org.jruby.ir.runtime.IRRuntimeHelpers;
import org.jruby.ir.targets.Bootstrap;
import org.jruby.javasupport.binding.Initializer;
import org.jruby.parser.StaticScope;
import org.jruby.runtime.Block;
@@ -300,7 +304,13 @@ public void addIncludingHierarchy(IncludedModule hierarchy) {
*/
protected RubyModule(Ruby runtime, RubyClass metaClass, boolean objectSpace) {
super(runtime, metaClass, objectSpace);

id = runtime.allocModuleId();

idTest = Binder.from(boolean.class, ThreadContext.class, IRubyObject.class)
.insert(2,id)
.invokeStaticQuiet(LOOKUP, Bootstrap.class, "testModuleMatch");

runtime.addModule(this);
// if (parent == null) parent = runtime.getObject();
setFlag(NEEDSIMPL_F, !isClass());
@@ -4474,6 +4484,12 @@ public IRubyObject initialize(Block block) {

public final int id;

/**
* Pre-built test that takes ThreadContext, IRubyObject and checks that the object is a module with the
* same ID as this one.
*/
public final MethodHandle idTest;

/**
* The class/module within whose namespace this class/module resides.
*/
@@ -4755,4 +4771,6 @@ public void setRefinements(Map<RubyClass, RubyModule> refinements) {

/** Whether this class proxies a normal Java class */
private boolean javaProxy = false;

private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
}
9 changes: 9 additions & 0 deletions core/src/main/java/org/jruby/RubyNumeric.java
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@
import org.jruby.ast.util.ArgsUtil;
import org.jruby.common.RubyWarnings;
import org.jruby.exceptions.RaiseException;
import org.jruby.ext.bigdecimal.RubyBigDecimal;
import org.jruby.javasupport.JavaUtil;
import org.jruby.runtime.Block;
import org.jruby.runtime.ClassIndex;
@@ -275,6 +276,14 @@ private static IRubyObject numericToFloat(Ruby runtime, IRubyObject num) {
throw runtime.newTypeError("can't convert " + num.getType() + " into Float");
}

if (num instanceof RubyFloat) {
return num;
}

if (num instanceof RubyFixnum && !runtime.isFixnumReopened()) {
return ((RubyFixnum) num).to_f();
}

return TypeConverter.convertToType(num, runtime.getFloat(), "to_f");
}

4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/compiler/JITCompiler.java
Original file line number Diff line number Diff line change
@@ -143,13 +143,13 @@ public long getLargestCodeSize() {
return counts.largestCodeSize.get();
}

public String[] frameAwareMethods() {
public String[] getFrameAwareMethods() {
String[] frameAwareMethods = MethodIndex.FRAME_AWARE_METHODS.toArray(new String[0]);
Arrays.sort(frameAwareMethods);
return frameAwareMethods;
}

public String[] scopeAwareMethods() {
public String[] getScopeAwareMethods() {
String[] scopeAwareMethods = MethodIndex.SCOPE_AWARE_METHODS.toArray(new String[0]);
Arrays.sort(scopeAwareMethods);
return scopeAwareMethods;
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/compiler/JITCompilerMBean.java
Original file line number Diff line number Diff line change
@@ -10,6 +10,6 @@ public interface JITCompilerMBean {
public long getAverageCodeSize();
public long getAverageCompileTime();
public long getLargestCodeSize();
public String[] frameAwareMethods();
public String[] scopeAwareMethods();
public String[] getFrameAwareMethods();
public String[] getScopeAwareMethods();
}
Original file line number Diff line number Diff line change
@@ -19,8 +19,6 @@
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

import static org.jruby.ir.IRFlags.REQUIRES_FRAME;

/**
* Instruction representing Ruby code of the form: "a['str']"
* which is equivalent to: a.[]('str'). Because a Hash receiver
Original file line number Diff line number Diff line change
@@ -37,7 +37,10 @@ public boolean computeScopeFlags(IRScope scope) {
// by passing in the frame self explicitly to Helpers.invoke(..)
// rather than try to get it off context.getFrameSelf()
super.computeScopeFlags(scope);
scope.getFlags().add(REQUIRES_FRAME);
if (targetRequiresCallersFrame()) {
// This can be narrowed further by filtering out cases with literals other than String and Regexp
scope.getFlags().add(REQUIRES_FRAME);
}
return true;
}

Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ public static LoadFrameClosureInstr decode(IRReaderDecoder d) {

@Override
public boolean computeScopeFlags(IRScope scope) {
super.computeScopeFlags(scope);
scope.getFlags().add(REQUIRES_FRAME);
return true;
}
Original file line number Diff line number Diff line change
@@ -35,7 +35,6 @@ public UnresolvedSuperInstr(Variable result, Operand receiver, Operand[] args, O
public boolean computeScopeFlags(IRScope scope) {
super.computeScopeFlags(scope);
scope.getFlags().add(IRFlags.REQUIRES_FRAME); // for current class and method name
scope.getFlags().add(IRFlags.REQUIRES_DYNSCOPE); // for current class and method name
return true;
}

Original file line number Diff line number Diff line change
@@ -30,14 +30,14 @@
* Created by headius on 10/23/14.
*/
public class ArrayDerefInvokeSite extends NormalInvokeSite {
public ArrayDerefInvokeSite(MethodType type) {
super(type, "[]");
public ArrayDerefInvokeSite(MethodType type, String file, int line) {
super(type, "[]", file, line);
}

public static final Handle BOOTSTRAP = new Handle(Opcodes.H_INVOKESTATIC, p(ArrayDerefInvokeSite.class), "bootstrap", sig(CallSite.class, MethodHandles.Lookup.class, String.class, MethodType.class));
public static final Handle BOOTSTRAP = new Handle(Opcodes.H_INVOKESTATIC, p(ArrayDerefInvokeSite.class), "bootstrap", sig(CallSite.class, MethodHandles.Lookup.class, String.class, MethodType.class, String.class, int.class));

public static CallSite bootstrap(MethodHandles.Lookup lookup, String name, MethodType type) {
InvokeSite site = new ArrayDerefInvokeSite(type);
public static CallSite bootstrap(MethodHandles.Lookup lookup, String name, MethodType type, String file, int line) {
InvokeSite site = new ArrayDerefInvokeSite(type, file, line);

return InvokeSite.bootstrap(site, lookup);
}
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ir/targets/Bootstrap.java
Original file line number Diff line number Diff line change
@@ -816,7 +816,7 @@ public static IRubyObject instVarNullToNil(IRubyObject value, IRubyObject nil, S
return value;
}

public static boolean testArg0ModuleMatch(IRubyObject arg0, int id) {
public static boolean testModuleMatch(ThreadContext context, IRubyObject arg0, int id) {
return arg0 instanceof RubyModule && ((RubyModule)arg0).id == id;
}

Original file line number Diff line number Diff line change
@@ -21,8 +21,8 @@
* Created by headius on 10/23/14.
*/
public class ClassSuperInvokeSite extends ResolvedSuperInvokeSite {
public ClassSuperInvokeSite(MethodType type, String name, String splatmapString) {
super(type, name, splatmapString);
public ClassSuperInvokeSite(MethodType type, String name, String splatmapString, String file, int line) {
super(type, name, splatmapString, file, line);
}

@Override
Loading