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

Commits on Apr 11, 2018

  1. Final move to push RubySymbol a bit further through to IR. This is a

    reasonable move since RubySymbol contains both the ByteList we need for proper
    display (for errors whatnot) and it also has the raw interned ID String we
    use for table access of variables and identifiers.
    
    The second reasonable reason for this move is when we execute IR we have already
    bootstrapped the runtime so it is safe to have symbols here.  By pushing them
    this far forward we can also just return them for instrs where we need to
    return a symbol.  Like in the case of a 'def foo;end'.
    
    This only did put instrs.  Get next.
    enebo committed Apr 11, 2018
    Copy the full SHA
    c7cebeb View commit details
  2. A lot more switching of IR to RubySymbol from ByteList. Only two weird

    outcomes:
    
    1. Temporary variables still use String instead of Symbol (they did not use
    ByteList before either).  They will call getId() and not getName() but this
    is ok.
    2. to not pin RubySymbol to a static field I Symbol.KW_REST_ARG_DUMMY is
    initialized with a null RubySymbol instance.  This is a little wonky this
    field may end up in IRManager eventually but it really has no visible contents
    so this is probably ok for now.
    enebo committed Apr 11, 2018
    Copy the full SHA
    6c642aa View commit details
Showing with 325 additions and 289 deletions.
  1. +2 −2 core/src/main/java/org/jruby/ast/ArgsNode.java
  2. +6 −0 core/src/main/java/org/jruby/ast/RestArgNode.java
  3. +2 −2 core/src/main/java/org/jruby/internal/runtime/AbstractIRMethod.java
  4. +74 −70 core/src/main/java/org/jruby/ir/IRBuilder.java
  5. +4 −3 core/src/main/java/org/jruby/ir/IRClosure.java
  6. +4 −2 core/src/main/java/org/jruby/ir/IREvalScript.java
  7. +4 −0 core/src/main/java/org/jruby/ir/IRManager.java
  8. +3 −2 core/src/main/java/org/jruby/ir/IRMethod.java
  9. +12 −11 core/src/main/java/org/jruby/ir/IRScope.java
  10. +6 −5 core/src/main/java/org/jruby/ir/instructions/ConstMissingInstr.java
  11. +6 −6 core/src/main/java/org/jruby/ir/instructions/GetClassVariableInstr.java
  12. +6 −7 core/src/main/java/org/jruby/ir/instructions/GetFieldInstr.java
  13. +10 −10 core/src/main/java/org/jruby/ir/instructions/GetInstr.java
  14. +6 −6 core/src/main/java/org/jruby/ir/instructions/PutClassVariableInstr.java
  15. +6 −6 core/src/main/java/org/jruby/ir/instructions/PutConstInstr.java
  16. +5 −5 core/src/main/java/org/jruby/ir/instructions/PutFieldInstr.java
  17. +10 −10 core/src/main/java/org/jruby/ir/instructions/PutInstr.java
  18. +8 −8 core/src/main/java/org/jruby/ir/instructions/RaiseRequiredKeywordArgumentError.java
  19. +15 −12 core/src/main/java/org/jruby/ir/instructions/ReceiveKeywordArgInstr.java
  20. +13 −13 core/src/main/java/org/jruby/ir/instructions/SearchConstInstr.java
  21. +16 −16 core/src/main/java/org/jruby/ir/instructions/SearchModuleForConstInstr.java
  22. +13 −13 core/src/main/java/org/jruby/ir/instructions/SetCapturedVarInstr.java
  23. +1 −1 core/src/main/java/org/jruby/ir/interpreter/StartupInterpreterEngine.java
  24. +2 −3 core/src/main/java/org/jruby/ir/operands/ClosureLocalVariable.java
  25. +8 −8 core/src/main/java/org/jruby/ir/operands/LocalVariable.java
  26. +1 −2 core/src/main/java/org/jruby/ir/operands/Self.java
  27. +15 −10 core/src/main/java/org/jruby/ir/operands/Symbol.java
  28. +1 −2 core/src/main/java/org/jruby/ir/operands/TemporaryCurrentModuleVariable.java
  29. +1 −1 core/src/main/java/org/jruby/ir/operands/TemporaryCurrentScopeVariable.java
  30. +1 −0 core/src/main/java/org/jruby/ir/operands/TemporaryLocalReplacementVariable.java
  31. +1 −2 core/src/main/java/org/jruby/ir/operands/TemporaryLocalVariable.java
  32. +4 −7 core/src/main/java/org/jruby/ir/operands/TemporaryVariable.java
  33. +2 −1 core/src/main/java/org/jruby/ir/operands/Variable.java
  34. +7 −6 core/src/main/java/org/jruby/ir/persistence/IRDumper.java
  35. +4 −3 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. +3 −2 core/src/main/java/org/jruby/ir/persistence/IRWriter.java
  39. +4 −1 core/src/main/java/org/jruby/ir/persistence/IRWriterAnalyzer.java
  40. +2 −1 core/src/main/java/org/jruby/ir/persistence/IRWriterEncoder.java
  41. +5 −0 core/src/main/java/org/jruby/ir/persistence/IRWriterStream.java
  42. +12 −18 core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
  43. +10 −10 core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
  44. +1 −1 core/src/main/java/org/jruby/ir/targets/MethodData.java
  45. +1 −1 core/src/main/java/org/jruby/ir/transformations/inlining/InlineCloneInfo.java
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/ast/ArgsNode.java
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ public class ArgsNode extends Node {
private short postIndex;
private short keywordsIndex;

protected final ArgumentNode restArgNode;
protected final RestArgNode restArgNode;
private final KeywordRestArgNode keyRest;
private final BlockArgNode blockArgNode;

@@ -192,7 +192,7 @@ public ListNode getOptArgs() {
* Gets the restArgNode.
* @return Returns an ArgumentNode
*/
public ArgumentNode getRestArgNode() {
public RestArgNode getRestArgNode() {
return restArgNode;
}

6 changes: 6 additions & 0 deletions core/src/main/java/org/jruby/ast/RestArgNode.java
Original file line number Diff line number Diff line change
@@ -46,6 +46,12 @@ public RestArgNode(ArgumentNode argNode) {
this(argNode.getPosition(), argNode.getSymbolName(), argNode.getIndex());
}

public boolean isAnonymous() {
RubySymbol argName = getSymbolName();

return argName == null || argName.getBytes().realSize() == 0;
}

@Override
public NodeType getNodeType() {
return NodeType.RESTARG;
Original file line number Diff line number Diff line change
@@ -112,10 +112,10 @@ public MethodData getMethodData() {
for (Instr i : context.getInstructions()) {
switch (i.getOperation()) {
case GET_FIELD:
ivarNames.add(((GetFieldInstr) i).getRef());
ivarNames.add(((GetFieldInstr) i).getId());
break;
case PUT_FIELD:
ivarNames.add(((PutFieldInstr) i).getRef());
ivarNames.add(((PutFieldInstr) i).getId());
break;
}
}
Loading