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

Commits on Jul 30, 2015

  1. Copy the full SHA
    140eeef View commit details
  2. Copy the full SHA
    2648553 View commit details
  3. Copy the full SHA
    ad448be View commit details
Showing with 353 additions and 154 deletions.
  1. +2 −2 core/src/main/java/org/jruby/ir/instructions/ArgScopeDepthInstr.java
  2. +1 −1 core/src/main/java/org/jruby/ir/instructions/BFalseInstr.java
  3. +1 −1 core/src/main/java/org/jruby/ir/instructions/BNilInstr.java
  4. +1 −1 core/src/main/java/org/jruby/ir/instructions/BTrueInstr.java
  5. +1 −1 core/src/main/java/org/jruby/ir/instructions/BUndefInstr.java
  6. +2 −2 core/src/main/java/org/jruby/ir/instructions/BacktickInstr.java
  7. +3 −3 core/src/main/java/org/jruby/ir/instructions/BlockGivenInstr.java
  8. +4 −6 core/src/main/java/org/jruby/ir/instructions/BranchInstr.java
  9. +4 −6 core/src/main/java/org/jruby/ir/instructions/BuildCompoundArrayInstr.java
  10. +2 −2 core/src/main/java/org/jruby/ir/instructions/BuildCompoundStringInstr.java
  11. +3 −2 core/src/main/java/org/jruby/ir/instructions/BuildDynRegExpInstr.java
  12. +4 −4 core/src/main/java/org/jruby/ir/instructions/BuildLambdaInstr.java
  13. +4 −4 core/src/main/java/org/jruby/ir/instructions/BuildRangeInstr.java
  14. +3 −3 core/src/main/java/org/jruby/ir/instructions/BuildSplatInstr.java
  15. +2 −2 core/src/main/java/org/jruby/ir/instructions/CheckArityInstr.java
  16. +3 −3 core/src/main/java/org/jruby/ir/instructions/CopyInstr.java
  17. +4 −4 core/src/main/java/org/jruby/ir/instructions/DefineClassInstr.java
  18. +3 −3 core/src/main/java/org/jruby/ir/instructions/DefineMetaClassInstr.java
  19. +3 −3 core/src/main/java/org/jruby/ir/instructions/DefineModuleInstr.java
  20. +4 −4 core/src/main/java/org/jruby/ir/instructions/EQQInstr.java
  21. +3 −2 core/src/main/java/org/jruby/ir/instructions/GetClassVarContainerModuleInstr.java
  22. +2 −4 core/src/main/java/org/jruby/ir/instructions/GetEncodingInstr.java
  23. +3 −3 core/src/main/java/org/jruby/ir/instructions/GetGlobalVariableInstr.java
  24. +3 −3 core/src/main/java/org/jruby/ir/instructions/GetInstr.java
  25. +3 −3 core/src/main/java/org/jruby/ir/instructions/InheritanceSearchConstInstr.java
  26. +3 −3 core/src/main/java/org/jruby/ir/instructions/LexicalSearchConstInstr.java
  27. +2 −2 core/src/main/java/org/jruby/ir/instructions/LoadFrameClosureInstr.java
  28. +2 −2 core/src/main/java/org/jruby/ir/instructions/LoadImplicitClosureInstr.java
  29. +4 −4 core/src/main/java/org/jruby/ir/instructions/LoadLocalVarInstr.java
  30. +3 −3 core/src/main/java/org/jruby/ir/instructions/MultipleAsgnBase.java
  31. +30 −0 core/src/main/java/org/jruby/ir/instructions/NOperandResultBaseInstr.java
  32. +22 −0 core/src/main/java/org/jruby/ir/instructions/NoOperandResultBaseInstr.java
  33. +30 −4 core/src/main/java/org/jruby/ir/instructions/OneOperandBranchInstr.java
  34. +40 −0 core/src/main/java/org/jruby/ir/instructions/OneOperandResultBaseInstr.java
  35. +4 −4 core/src/main/java/org/jruby/ir/instructions/ProcessModuleBodyInstr.java
  36. +4 −4 core/src/main/java/org/jruby/ir/instructions/PutGlobalVarInstr.java
  37. +2 −2 core/src/main/java/org/jruby/ir/instructions/ReceiveArgBase.java
  38. +2 −2 core/src/main/java/org/jruby/ir/instructions/ReceiveExceptionBase.java
  39. +2 −2 core/src/main/java/org/jruby/ir/instructions/ReceiveSelfInstr.java
  40. +3 −3 core/src/main/java/org/jruby/ir/instructions/ReifyClosureInstr.java
  41. +4 −4 core/src/main/java/org/jruby/ir/instructions/RescueEQQInstr.java
  42. +3 −3 core/src/main/java/org/jruby/ir/instructions/ResultBaseInstr.java
  43. +3 −2 core/src/main/java/org/jruby/ir/instructions/RuntimeHelperCall.java
  44. +3 −5 core/src/main/java/org/jruby/ir/instructions/SearchConstInstr.java
  45. +3 −3 core/src/main/java/org/jruby/ir/instructions/SetCapturedVarInstr.java
  46. +3 −3 core/src/main/java/org/jruby/ir/instructions/ToAryInstr.java
  47. +41 −8 core/src/main/java/org/jruby/ir/instructions/TwoOperandBranchInstr.java
  48. +53 −0 core/src/main/java/org/jruby/ir/instructions/TwoOperandResultBaseInstr.java
  49. +3 −3 core/src/main/java/org/jruby/ir/instructions/UndefMethodInstr.java
  50. +4 −4 core/src/main/java/org/jruby/ir/instructions/YieldInstr.java
  51. +4 −4 core/src/main/java/org/jruby/ir/instructions/boxing/AluInstr.java
  52. +3 −3 core/src/main/java/org/jruby/ir/instructions/boxing/BoxInstr.java
  53. +3 −3 core/src/main/java/org/jruby/ir/instructions/boxing/UnboxInstr.java
  54. +2 −2 core/src/main/java/org/jruby/ir/instructions/defined/GetErrorInfoInstr.java
Original file line number Diff line number Diff line change
@@ -11,9 +11,9 @@
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

public class ArgScopeDepthInstr extends ResultBaseInstr implements FixedArityInstr {
public class ArgScopeDepthInstr extends NoOperandResultBaseInstr implements FixedArityInstr {
public ArgScopeDepthInstr(Variable result) {
super(Operation.ARG_SCOPE_DEPTH, result, EMPTY_OPERANDS);
super(Operation.ARG_SCOPE_DEPTH, result);
}

@Override
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@

public class BFalseInstr extends OneOperandBranchInstr implements FixedArityInstr {
public BFalseInstr(Label jmpTarget, Operand v) {
super(Operation.B_FALSE, new Operand[] {jmpTarget, v});
super(Operation.B_FALSE, jmpTarget, v);
}

@Override
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@

public class BNilInstr extends OneOperandBranchInstr implements FixedArityInstr {
public BNilInstr(Label jmpTarget, Operand v) {
super(Operation.B_NIL, new Operand[] {jmpTarget, v});
super(Operation.B_NIL, jmpTarget, v);
}

@Override
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@

public class BTrueInstr extends OneOperandBranchInstr implements FixedArityInstr {
public BTrueInstr(Label jmpTarget, Operand v) {
super(Operation.B_TRUE, new Operand[] { jmpTarget, v });
super(Operation.B_TRUE, jmpTarget, v);
}

@Override
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

public class BUndefInstr extends OneOperandBranchInstr implements FixedArityInstr {
public BUndefInstr(Label jmpTarget, Operand v) {
super(Operation.B_UNDEF, new Operand[] {jmpTarget, v});
super(Operation.B_UNDEF, jmpTarget, v);
}

@Override
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
//
// NOTE: This operand is only used in the initial stages of optimization.
// Further down the line, this string operand could get converted to calls
public class BacktickInstr extends ResultBaseInstr {
public class BacktickInstr extends NOperandResultBaseInstr {
public BacktickInstr(Variable result, Operand[] pieces) {
super(Operation.BACKTICK_STRING, result, pieces);
}
@@ -47,7 +47,7 @@ public static BacktickInstr decode(IRReaderDecoder d) {
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) {
RubyString newString = context.runtime.newString();

for (Operand p: operands) {
for (Operand p: getOperands()) {
RubyBasicObject piece = (RubyBasicObject) p.retrieve(context, self, currScope, currDynScope, temp);
newString.append19((piece instanceof RubyString) ? (RubyString) piece : piece.to_s());
}
Original file line number Diff line number Diff line change
@@ -15,15 +15,15 @@

import java.util.Map;

public class BlockGivenInstr extends ResultBaseInstr implements FixedArityInstr {
public class BlockGivenInstr extends OneOperandResultBaseInstr implements FixedArityInstr {
public BlockGivenInstr(Variable result, Operand block) {
super(Operation.BLOCK_GIVEN, result, new Operand[] {block});
super(Operation.BLOCK_GIVEN, result, block);

assert result != null: "BlockGivenInstr result is null";
}

public Operand getBlockArg() {
return operands[0];
return getOperand1();
}

@Override
10 changes: 4 additions & 6 deletions core/src/main/java/org/jruby/ir/instructions/BranchInstr.java
Original file line number Diff line number Diff line change
@@ -4,12 +4,10 @@
import org.jruby.ir.operands.Label;
import org.jruby.ir.operands.Operand;

public abstract class BranchInstr extends NOperandInstr {
public BranchInstr(Operation op, Operand[] operands) {
super(op, operands);
public abstract class BranchInstr extends Instr {
public BranchInstr(Operation op) {
super(op);
}

public Label getJumpTarget() {
return (Label) operands[0];
}
public abstract Label getJumpTarget();
}
Original file line number Diff line number Diff line change
@@ -14,26 +14,24 @@
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

import java.util.Map;

// This represents an array that is used solely during arguments construction
// * Array + Splat ([1,2,3], *[5,6,7])
// This used to be an operand, but since to_a can be called as part of
// building the args-cat/push value, this is not really side-effect free.
public class BuildCompoundArrayInstr extends ResultBaseInstr {
public class BuildCompoundArrayInstr extends TwoOperandResultBaseInstr {
private boolean isArgsPush;

public BuildCompoundArrayInstr(Variable result, Operand a1, Operand a2, boolean isArgsPush) {
super(Operation.BUILD_COMPOUND_ARRAY, result, new Operand[] { a1, a2 });
super(Operation.BUILD_COMPOUND_ARRAY, result, a1, a2);
this.isArgsPush = isArgsPush;
}

public Operand getAppendingArg() {
return operands[0];
return getOperand1();
}

public Operand getAppendedArg() {
return operands[1];
return getOperand2();
}

public boolean isArgsPush() { return isArgsPush; }
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
// This represents a compound string in Ruby
// Ex: - "Hi " + "there"
// - "Hi #{name}"
public class BuildCompoundStringInstr extends ResultBaseInstr {
public class BuildCompoundStringInstr extends NOperandResultBaseInstr {
final private Encoding encoding;

public BuildCompoundStringInstr(Variable result, Operand[] pieces, Encoding encoding) {
@@ -62,7 +62,7 @@ public Object interpret(ThreadContext context, StaticScope currScope, DynamicSco
ByteList bytes = new ByteList();
bytes.setEncoding(encoding);
RubyString str = RubyString.newStringShared(context.runtime, bytes, StringSupport.CR_7BIT);
for (Operand p : operands) {
for (Operand p : getOperands()) {
if ((p instanceof StringLiteral) && (isSameEncodingAndCodeRange(str, (StringLiteral)p))) {
str.getByteList().append(((StringLiteral)p).bytelist);
str.setCodeRange(((StringLiteral)p).getCodeRange());
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@

// Represents a dynamic regexp in Ruby
// Ex: /#{a}#{b}/
public class BuildDynRegExpInstr extends ResultBaseInstr {
public class BuildDynRegExpInstr extends NOperandResultBaseInstr {
final private RegexpOptions options;

// Cached regexp
@@ -35,7 +35,7 @@ public BuildDynRegExpInstr(Variable result, Operand[] pieces, RegexpOptions opti
}

public Operand[] getPieces() {
return operands;
return getOperands();
}

public RegexpOptions getOptions() {
@@ -57,6 +57,7 @@ public Instr clone(CloneInfo ii) {
}

private RubyString[] retrievePieces(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) {
Operand[] operands = getOperands();
int length = operands.length;
RubyString[] strings = new RubyString[length];
for (int i = 0; i < length; i++) {
Original file line number Diff line number Diff line change
@@ -16,13 +16,13 @@

import org.jruby.ir.IRFlags;

public class BuildLambdaInstr extends ResultBaseInstr implements FixedArityInstr, ClosureAcceptingInstr {
public class BuildLambdaInstr extends OneOperandResultBaseInstr implements FixedArityInstr, ClosureAcceptingInstr {
/** The position for the block */
private final String file;
private final int line;

public BuildLambdaInstr(Variable result, Operand lambdaBody, String file, int line) {
super(Operation.LAMBDA, result, new Operand[] { lambdaBody });
super(Operation.LAMBDA, result, lambdaBody);

this.file = file;
this.line = line;
@@ -49,11 +49,11 @@ public Instr clone(CloneInfo ii) {
}

public Operand getLambdaBody() {
return operands[0];
return getOperand1();
}

public Operand getClosureArg() {
return operands[0];
return getOperand1();
}

@Override
Original file line number Diff line number Diff line change
@@ -18,21 +18,21 @@
// NOTE: This operand is only used in the initial stages of optimization
// Further down the line, this range operand could get converted to calls
// that actually build the BuildRangeInstr object
public class BuildRangeInstr extends ResultBaseInstr {
public class BuildRangeInstr extends TwoOperandResultBaseInstr {
private boolean exclusive;

public BuildRangeInstr(Variable result, Operand begin, Operand end, boolean exclusive) {
super(Operation.BUILD_RANGE, result, new Operand[] { begin, end });
super(Operation.BUILD_RANGE, result, begin, end);

this.exclusive = exclusive;
}

public Operand getBegin() {
return operands[0];
return getOperand1();
}

public Operand getEnd() {
return operands[1];
return getOperand2();
}

public boolean isExclusive() {
Original file line number Diff line number Diff line change
@@ -14,13 +14,13 @@
import org.jruby.runtime.builtin.IRubyObject;

// Represents a splat value in Ruby code: *array
public class BuildSplatInstr extends ResultBaseInstr {
public class BuildSplatInstr extends OneOperandResultBaseInstr {
public BuildSplatInstr(Variable result, Operand array) {
super(Operation.BUILD_SPLAT, result, new Operand[] { array });
super(Operation.BUILD_SPLAT, result, array);
}

public Operand getArray() {
return operands[0];
return getOperand1();
}

@Override
Original file line number Diff line number Diff line change
@@ -11,15 +11,15 @@
import org.jruby.runtime.Block;
import org.jruby.runtime.ThreadContext;

public class CheckArityInstr extends NOperandInstr implements FixedArityInstr {
public class CheckArityInstr extends NoOperandInstr implements FixedArityInstr {
public final int required;
public final int opt;
public final boolean rest;
public final boolean receivesKeywords;
public final int restKey;

public CheckArityInstr(int required, int opt, boolean rest, boolean receivesKeywords, int restKey) {
super(Operation.CHECK_ARITY, EMPTY_OPERANDS);
super(Operation.CHECK_ARITY);

this.required = required;
this.opt = opt;
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/ir/instructions/CopyInstr.java
Original file line number Diff line number Diff line change
@@ -14,17 +14,17 @@
import org.jruby.ir.persistence.IRWriterEncoder;
import org.jruby.ir.transformations.inlining.CloneInfo;

public class CopyInstr extends ResultBaseInstr implements FixedArityInstr {
public class CopyInstr extends OneOperandResultBaseInstr implements FixedArityInstr {
public CopyInstr(Operation op, Variable result, Operand source) {
super(op, result, new Operand[] { source });
super(op, result, source);
}

public CopyInstr(Variable result, Operand source) {
this(Operation.COPY, result, source);
}

public Operand getSource() {
return operands[0];
return getOperand1();
}

@Override
Original file line number Diff line number Diff line change
@@ -15,11 +15,11 @@
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

public class DefineClassInstr extends ResultBaseInstr implements FixedArityInstr {
public class DefineClassInstr extends TwoOperandResultBaseInstr implements FixedArityInstr {
private final IRClassBody newIRClassBody;

public DefineClassInstr(Variable result, IRClassBody newIRClassBody, Operand container, Operand superClass) {
super(Operation.DEF_CLASS, result, new Operand[] { container, superClass == null ? UndefinedValue.UNDEFINED : superClass });
super(Operation.DEF_CLASS, result, container, superClass == null ? UndefinedValue.UNDEFINED : superClass);

assert result != null: "DefineClassInstr result is null";

@@ -31,11 +31,11 @@ public IRClassBody getNewIRClassBody() {
}

public Operand getContainer() {
return operands[0];
return getOperand1();
}

public Operand getSuperClass() {
return operands[1];
return getOperand2();
}

@Override
Original file line number Diff line number Diff line change
@@ -13,11 +13,11 @@
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

public class DefineMetaClassInstr extends ResultBaseInstr implements FixedArityInstr {
public class DefineMetaClassInstr extends OneOperandResultBaseInstr implements FixedArityInstr {
private final IRModuleBody metaClassBody;

public DefineMetaClassInstr(Variable result, Operand object, IRModuleBody metaClassBody) {
super(Operation.DEF_META_CLASS, result, new Operand[] {object });
super(Operation.DEF_META_CLASS, result, object);

assert result != null: "DefineMetaClassInstr result is null";

@@ -29,7 +29,7 @@ public IRModuleBody getMetaClassBody() {
}

public Operand getObject() {
return operands[0];
return getOperand1();
}

@Override
Original file line number Diff line number Diff line change
@@ -14,11 +14,11 @@
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

public class DefineModuleInstr extends ResultBaseInstr implements FixedArityInstr {
public class DefineModuleInstr extends OneOperandResultBaseInstr implements FixedArityInstr {
private final IRModuleBody newIRModuleBody;

public DefineModuleInstr(Variable result, IRModuleBody newIRModuleBody, Operand container) {
super(Operation.DEF_MODULE, result, new Operand[] { container });
super(Operation.DEF_MODULE, result, container);

assert result != null : "DefineModuleInstr result is null";

@@ -31,7 +31,7 @@ public IRModuleBody getNewIRModuleBody() {
}

public Operand getContainer() {
return operands[0];
return getOperand1();
}

@Override
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/ir/instructions/EQQInstr.java
Original file line number Diff line number Diff line change
@@ -14,19 +14,19 @@
import org.jruby.runtime.builtin.IRubyObject;

// If v2 is an array, compare v1 with every element of v2 and stop on first match!
public class EQQInstr extends ResultBaseInstr implements FixedArityInstr {
public class EQQInstr extends TwoOperandResultBaseInstr implements FixedArityInstr {
public EQQInstr(Variable result, Operand v1, Operand v2) {
super(Operation.EQQ, result, new Operand[] {v1, v2});
super(Operation.EQQ, result, v1, v2);

assert result != null: "EQQInstr result is null";
}

public Operand getArg1() {
return operands[0];
return getOperand1();
}

public Operand getArg2() {
return operands[1];
return getOperand2();
}

@Override
Loading