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

Commits on Apr 17, 2015

  1. StaticScope now has Signature instead of three individual fields. All…

    … other
    
    changes were made to support this.  We encode/decode scopes with a full
    Signature.  Blocks are all rooted in providing a Signature.  All IR*Method
    will provide a Signature.  Unfortunately, I stopped at IR level for method
    types.  Over time those should get converted.
    
    This corrects all arity issues involving methods and blocks in interp.  JIT
    is still somewhere passing in the wrong values but I will correct that in
    a followup (this is not a regression).
    
    spec:fast:ruby and test:mri both pass so do JIT variants of those tests
    but I strong suspect we are shelling out in some way and running some of
    these tests in interp mode.
    
    On other note of distinction is that for builtin functions we only construct
    a subset of information that Signature wants because Arity is only a subset
    of the info Signature needs.  Since there are no exotic signatures in builtins
    there is a Signature.from(Arity) which will convert to a reasonable analogue
    or throw if it is special in some way.
    
    I tried to leave all deprecated versions of methods and constructors but
    I might have spaced out a few.
    enebo committed Apr 17, 2015
    Copy the full SHA
    512b0a5 View commit details
  2. 1. staticScope.setSignature now only happens when ArgsNode is created…

    … and nowhere else (well some dead code which needs to be removed yet). For AOT, IR persistence still needs to be corrected so that we can popular signature when we reify the StaticScope (to be done in a followup commit).
    
    2. CompiledIRMethod now implements IRMethodArgs so this fixed all JIT methods arity errors.
    enebo committed Apr 17, 2015
    Copy the full SHA
    bff01dd View commit details
  3. Unbreak StaticScope persistence from previous commits. This also indi…

    …rectly fixes proper
    
    Arity for AOT compiled code.
    enebo committed Apr 17, 2015
    Copy the full SHA
    3f09737 View commit details
  4. Copy the full SHA
    b856bd9 View commit details
  5. Copy the full SHA
    2be2987 View commit details
  6. No more requireArgument optionalArguments individual count methods on…

    … StaticScope. getSignature
    
    replaces it.
    
    Remove Arity usage from JIT.  All information of a JIT'd method can come from signature on
    StaticScope now.
    
    What is remaining is pushing more Arity out of *Method types, but pre2 is dragging on and this
    last push will be to use new Signature info to properly implement kwargs.
    enebo committed Apr 17, 2015
    Copy the full SHA
    d06fd82 View commit details
Showing with 650 additions and 630 deletions.
  1. +9 −1 core/src/main/java/org/jruby/AbstractRubyMethod.java
  2. +2 −1 core/src/main/java/org/jruby/RubyArray.java
  3. +207 −66 core/src/main/java/org/jruby/RubyEnumerable.java
  4. +2 −1 core/src/main/java/org/jruby/RubyEnumerator.java
  5. +29 −12 core/src/main/java/org/jruby/RubyMethod.java
  6. +6 −11 core/src/main/java/org/jruby/RubyModule.java
  7. +5 −12 core/src/main/java/org/jruby/RubyProc.java
  8. +2 −1 core/src/main/java/org/jruby/RubyProcess.java
  9. +3 −2 core/src/main/java/org/jruby/RubyRange.java
  10. +2 −1 core/src/main/java/org/jruby/RubySymbol.java
  11. +10 −9 core/src/main/java/org/jruby/ast/ArgsNode.java
  12. +7 −9 core/src/main/java/org/jruby/ast/MethodDefNode.java
  13. +12 −15 core/src/main/java/org/jruby/internal/runtime/methods/CompiledIRMethod.java
  14. +2 −6 core/src/main/java/org/jruby/internal/runtime/methods/CompiledMethod.java
  15. +3 −4 core/src/main/java/org/jruby/internal/runtime/methods/DynamicMethod.java
  16. +3 −1 core/src/main/java/org/jruby/internal/runtime/methods/IRMethodArgs.java
  17. +0 −2 core/src/main/java/org/jruby/internal/runtime/methods/InterpretedIRBodyMethod.java
  18. +6 −9 core/src/main/java/org/jruby/internal/runtime/methods/InterpretedIRMethod.java
  19. +27 −23 core/src/main/java/org/jruby/internal/runtime/methods/InvocationMethodFactory.java
  20. +6 −8 core/src/main/java/org/jruby/internal/runtime/methods/InvokeDynamicMethodFactory.java
  21. +0 −3 core/src/main/java/org/jruby/internal/runtime/methods/JavaMethod.java
  22. +7 −9 core/src/main/java/org/jruby/internal/runtime/methods/MixedModeIRMethod.java
  23. +2 −3 core/src/main/java/org/jruby/internal/runtime/methods/ReflectedCompiledMethod.java
  24. +2 −0 core/src/main/java/org/jruby/internal/runtime/methods/ReflectedJavaMethod.java
  25. +7 −9 core/src/main/java/org/jruby/internal/runtime/methods/ReflectionMethodFactory.java
  26. +10 −14 core/src/main/java/org/jruby/ir/IRBuilder.java
  27. +1 −2 core/src/main/java/org/jruby/ir/instructions/AttrAssignInstr.java
  28. +1 −2 core/src/main/java/org/jruby/ir/instructions/ClassSuperInstr.java
  29. +1 −1 core/src/main/java/org/jruby/ir/instructions/ConstMissingInstr.java
  30. +1 −2 core/src/main/java/org/jruby/ir/instructions/InstanceSuperInstr.java
  31. +1 −2 core/src/main/java/org/jruby/ir/instructions/NoResultCallInstr.java
  32. +1 −2 core/src/main/java/org/jruby/ir/instructions/UnresolvedSuperInstr.java
  33. +1 −2 core/src/main/java/org/jruby/ir/instructions/ZSuperInstr.java
  34. +1 −1 core/src/main/java/org/jruby/ir/interpreter/InterpreterContext.java
  35. +1 −1 core/src/main/java/org/jruby/ir/persistence/IRReader.java
  36. +2 −0 core/src/main/java/org/jruby/ir/persistence/IRReaderDecoder.java
  37. +6 −0 core/src/main/java/org/jruby/ir/persistence/IRReaderStream.java
  38. +2 −2 core/src/main/java/org/jruby/ir/persistence/IRWriter.java
  39. +5 −0 core/src/main/java/org/jruby/ir/persistence/IRWriterAnalzer.java
  40. +2 −0 core/src/main/java/org/jruby/ir/persistence/IRWriterEncoder.java
  41. +8 −0 core/src/main/java/org/jruby/ir/persistence/IRWriterStream.java
  42. +1 −1 core/src/main/java/org/jruby/ir/targets/ClassData6.java
  43. +1 −1 core/src/main/java/org/jruby/ir/targets/ClassData7.java
  44. +4 −5 core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
  45. +11 −3 core/src/main/java/org/jruby/parser/ParserSupport.java
  46. +15 −45 core/src/main/java/org/jruby/parser/StaticScope.java
  47. +4 −0 core/src/main/java/org/jruby/runtime/Block.java
  48. +3 −0 core/src/main/java/org/jruby/runtime/BlockBody.java
  49. +19 −7 core/src/main/java/org/jruby/runtime/CallBlock.java
  50. +20 −6 core/src/main/java/org/jruby/runtime/CallBlock19.java
  51. +18 −5 core/src/main/java/org/jruby/runtime/CompiledBlock.java
  52. +10 −4 core/src/main/java/org/jruby/runtime/CompiledBlock19.java
  53. +10 −1 core/src/main/java/org/jruby/runtime/CompiledBlockLight19.java
  54. +1 −1 core/src/main/java/org/jruby/runtime/CompiledIRBlockBody.java
  55. +13 −5 core/src/main/java/org/jruby/runtime/ContextAwareBlockBody.java
  56. +14 −138 core/src/main/java/org/jruby/runtime/Helpers.java
  57. +4 −10 core/src/main/java/org/jruby/runtime/IRBlockBody.java
  58. +11 −9 core/src/main/java/org/jruby/runtime/JavaInternalBlockBody.java
  59. +5 −8 core/src/main/java/org/jruby/runtime/MethodFactory.java
  60. +4 −0 core/src/main/java/org/jruby/runtime/NullBlockBody.java
  61. +74 −112 core/src/main/java/org/jruby/runtime/Signature.java
  62. +2 −1 core/src/main/java/org/jruby/util/SunSignalFacade.java
  63. +1 −1 rakelib/test.rake
  64. +0 −2 spec/tags/ruby/core/method/arity_tags.txt
  65. +0 −14 spec/tags/ruby/core/proc/arity_tags.txt
  66. +0 −2 spec/tags/ruby/core/unboundmethod/arity_tags.txt
10 changes: 9 additions & 1 deletion core/src/main/java/org/jruby/AbstractRubyMethod.java
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@
import org.jruby.anno.JRubyMethod;
import org.jruby.ext.jruby.JRubyLibrary;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.internal.runtime.methods.IRMethodArgs;
import org.jruby.internal.runtime.methods.ProcMethod;
import org.jruby.internal.runtime.methods.UndefinedMethod;
import org.jruby.runtime.Block;
@@ -81,7 +82,14 @@ public DynamicMethod getMethod() {
*/
@JRubyMethod(name = "arity")
public RubyFixnum arity() {
return getRuntime().newFixnum(method.getArity().getValue());
int value;
if (method instanceof IRMethodArgs) {
value = ((IRMethodArgs) method).getSignature().arityValue();
} else {
value = method.getArity().getValue();
}

return getRuntime().newFixnum(value);
}

@JRubyMethod(name = "eql?", required = 1)
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/RubyArray.java
Original file line number Diff line number Diff line change
@@ -51,6 +51,7 @@
import org.jruby.runtime.ClassIndex;
import org.jruby.runtime.Helpers;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.Signature;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.encoding.EncodingCapable;
@@ -4026,7 +4027,7 @@ public IRubyObject find(ThreadContext context, IRubyObject ifnone, Block block)
}

public IRubyObject find_index(ThreadContext context, Block block) {
if (!isBuiltin("each")) return RubyEnumerable.find_indexCommon(context, this, block, Arity.OPTIONAL);
if (!isBuiltin("each")) return RubyEnumerable.find_indexCommon(context, this, block, Signature.OPTIONAL);

for (int i = 0; i < realLength; i++) {
if (block.yield(context, eltOk(i)).isTrue()) return context.runtime.newFixnum(i);
Loading