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

Commits on Mar 16, 2015

  1. Copy the full SHA
    8af011a View commit details
  2. Copy the full SHA
    ac05656 View commit details
  3. More decoding supported

    enebo committed Mar 16, 2015
    Copy the full SHA
    5b78deb View commit details
  4. Copy the full SHA
    c9b9e5a View commit details
  5. Copy the full SHA
    0d38675 View commit details
  6. Some more debugging output and remove mismatched and no longer used a…

    …rgument type field for closures
    enebo committed Mar 16, 2015
    Copy the full SHA
    1e81860 View commit details
  7. Copy the full SHA
    113649e View commit details
  8. Copy the full SHA
    601417a View commit details
  9. Copy the full SHA
    a1f330a View commit details
  10. Copy the full SHA
    15aabf3 View commit details
  11. More encode/decode fixes

    enebo committed Mar 16, 2015
    Copy the full SHA
    352d792 View commit details
  12. Copy the full SHA
    45445fb View commit details
  13. More cleanup of encode/decode

    enebo committed Mar 16, 2015
    Copy the full SHA
    983635e View commit details
  14. More decoding cleanup

    enebo committed Mar 16, 2015
    Copy the full SHA
    bde6e1b View commit details
Showing with 588 additions and 520 deletions.
  1. +11 −11 core/src/main/java/org/jruby/ir/IRBuilder.java
  2. +0 −2 core/src/main/java/org/jruby/ir/Operation.java
  3. +5 −5 core/src/main/java/org/jruby/ir/dataflow/analyses/StoreLocalVarPlacementNode.java
  4. +1 −1 core/src/main/java/org/jruby/ir/dataflow/analyses/StoreLocalVarPlacementProblem.java
  5. +5 −2 core/src/main/java/org/jruby/ir/instructions/AliasInstr.java
  6. +5 −0 core/src/main/java/org/jruby/ir/instructions/ArgScopeDepthInstr.java
  7. +15 −0 core/src/main/java/org/jruby/ir/instructions/AttrAssignInstr.java
  8. +2 −2 core/src/main/java/org/jruby/ir/instructions/BEQInstr.java
  9. +3 −3 core/src/main/java/org/jruby/ir/instructions/BNEInstr.java
  10. +5 −0 core/src/main/java/org/jruby/ir/instructions/BacktickInstr.java
  11. +5 −0 core/src/main/java/org/jruby/ir/instructions/BlockGivenInstr.java
  12. +5 −0 core/src/main/java/org/jruby/ir/instructions/BreakInstr.java
  13. +5 −0 core/src/main/java/org/jruby/ir/instructions/BuildCompoundArrayInstr.java
  14. +6 −1 core/src/main/java/org/jruby/ir/instructions/BuildCompoundStringInstr.java
  15. +6 −0 core/src/main/java/org/jruby/ir/instructions/BuildDynRegExpInstr.java
  16. +7 −0 core/src/main/java/org/jruby/ir/instructions/BuildLambdaInstr.java
  17. +5 −0 core/src/main/java/org/jruby/ir/instructions/BuildRangeInstr.java
  18. +5 −0 core/src/main/java/org/jruby/ir/instructions/BuildSplatInstr.java
  19. +3 −3 core/src/main/java/org/jruby/ir/instructions/CallBase.java
  20. +5 −0 core/src/main/java/org/jruby/ir/instructions/CheckArgsArrayArityInstr.java
  21. +5 −0 core/src/main/java/org/jruby/ir/instructions/CheckForLJEInstr.java
  22. +9 −1 core/src/main/java/org/jruby/ir/instructions/ConstMissingInstr.java
  23. +5 −0 core/src/main/java/org/jruby/ir/instructions/CopyInstr.java
  24. +5 −0 core/src/main/java/org/jruby/ir/instructions/GetClassVarContainerModuleInstr.java
  25. +5 −0 core/src/main/java/org/jruby/ir/instructions/GetGlobalVariableInstr.java
  26. +1 −0 core/src/main/java/org/jruby/ir/instructions/JumpInstr.java
  27. +5 −0 core/src/main/java/org/jruby/ir/instructions/LabelInstr.java
  28. +5 −0 core/src/main/java/org/jruby/ir/instructions/LineNumberInstr.java
  29. +5 −0 core/src/main/java/org/jruby/ir/instructions/LoadLocalVarInstr.java
  30. +6 −0 core/src/main/java/org/jruby/ir/instructions/Match2Instr.java
  31. +0 −8 core/src/main/java/org/jruby/ir/instructions/NoResultCallInstr.java
  32. +5 −0 core/src/main/java/org/jruby/ir/instructions/ProcessModuleBodyInstr.java
  33. +5 −0 core/src/main/java/org/jruby/ir/instructions/PushFrameInstr.java
  34. +10 −1 core/src/main/java/org/jruby/ir/instructions/PutGlobalVarInstr.java
  35. +5 −0 core/src/main/java/org/jruby/ir/instructions/RaiseRequiredKeywordArgumentError.java
  36. +5 −0 core/src/main/java/org/jruby/ir/instructions/ReceiveJRubyExceptionInstr.java
  37. +5 −0 core/src/main/java/org/jruby/ir/instructions/ReceiveRestArgInstr.java
  38. +5 −0 core/src/main/java/org/jruby/ir/instructions/ReceiveRubyExceptionInstr.java
  39. +5 −1 core/src/main/java/org/jruby/ir/instructions/ReifyClosureInstr.java
  40. +10 −1 core/src/main/java/org/jruby/ir/instructions/RuntimeHelperCall.java
  41. +5 −0 core/src/main/java/org/jruby/ir/instructions/SearchConstInstr.java
  42. +5 −0 core/src/main/java/org/jruby/ir/instructions/SetCapturedVarInstr.java
  43. +8 −3 core/src/main/java/org/jruby/ir/instructions/StoreLocalVarInstr.java
  44. +2 −2 core/src/main/java/org/jruby/ir/instructions/TwoOperandBranchInstr.java
  45. +30 −0 core/src/main/java/org/jruby/ir/instructions/ZSuperInstr.java
  46. +5 −0 core/src/main/java/org/jruby/ir/instructions/defined/GetErrorInfoInstr.java
  47. +5 −0 core/src/main/java/org/jruby/ir/operands/Array.java
  48. +5 −0 core/src/main/java/org/jruby/ir/operands/AsString.java
  49. +6 −1 core/src/main/java/org/jruby/ir/operands/Backref.java
  50. +5 −0 core/src/main/java/org/jruby/ir/operands/Bignum.java
  51. +6 −0 core/src/main/java/org/jruby/ir/operands/Boolean.java
  52. +2 −1 core/src/main/java/org/jruby/ir/operands/ClosureLocalVariable.java
  53. +5 −0 core/src/main/java/org/jruby/ir/operands/CurrentScope.java
  54. +5 −0 core/src/main/java/org/jruby/ir/operands/DynamicSymbol.java
  55. +5 −0 core/src/main/java/org/jruby/ir/operands/Fixnum.java
  56. +5 −0 core/src/main/java/org/jruby/ir/operands/Float.java
  57. +5 −0 core/src/main/java/org/jruby/ir/operands/GlobalVariable.java
  58. +19 −6 core/src/main/java/org/jruby/ir/operands/Hash.java
  59. +4 −0 core/src/main/java/org/jruby/ir/operands/IRException.java
  60. +24 −0 core/src/main/java/org/jruby/ir/operands/Label.java
  61. +6 −0 core/src/main/java/org/jruby/ir/operands/LocalVariable.java
  62. +7 −1 core/src/main/java/org/jruby/ir/operands/NthRef.java
  63. +5 −0 core/src/main/java/org/jruby/ir/operands/NullBlock.java
  64. +5 −0 core/src/main/java/org/jruby/ir/operands/Regexp.java
  65. +5 −0 core/src/main/java/org/jruby/ir/operands/SValue.java
  66. +5 −0 core/src/main/java/org/jruby/ir/operands/ScopeModule.java
  67. +5 −0 core/src/main/java/org/jruby/ir/operands/Splat.java
  68. +6 −2 core/src/main/java/org/jruby/ir/operands/Symbol.java
  69. +3 −1 core/src/main/java/org/jruby/ir/operands/TemporaryClosureVariable.java
  70. +12 −0 core/src/main/java/org/jruby/ir/operands/UnboxedBoolean.java
  71. +5 −0 core/src/main/java/org/jruby/ir/operands/WrappedIRClosure.java
  72. +4 −5 core/src/main/java/org/jruby/ir/persistence/IRReader.java
  73. +85 −11 core/src/main/java/org/jruby/ir/persistence/IRReaderStream.java
  74. +4 −0 core/src/main/java/org/jruby/ir/persistence/IRWriter.java
  75. +65 −139 core/src/main/java/org/jruby/ir/persistence/InstrDecoderMap.java
  76. +0 −117 core/src/main/java/org/jruby/ir/persistence/OperandDecoderMap.java
  77. +0 −189 core/src/main/java/org/jruby/ir/persistence/read/parser/NonIRObjectFactory.java
22 changes: 11 additions & 11 deletions core/src/main/java/org/jruby/ir/IRBuilder.java
Original file line number Diff line number Diff line change
@@ -1265,7 +1265,7 @@ public Operand buildConstDeclAssignment(ConstDeclNode constDeclNode, Operand val

private void genInheritanceSearchInstrs(Operand startingModule, Variable constVal, Label foundLabel, boolean noPrivateConstants, String name) {
addInstr(new InheritanceSearchConstInstr(constVal, startingModule, name, noPrivateConstants));
addInstr(BNEInstr.create(constVal, UndefinedValue.UNDEFINED, foundLabel));
addInstr(BNEInstr.create(foundLabel, constVal, UndefinedValue.UNDEFINED));
addInstr(new ConstMissingInstr(constVal, startingModule, name));
addInstr(new LabelInstr(foundLabel));
}
@@ -1417,7 +1417,7 @@ public Operand run() {
Operand v = protectCodeWithRescue(protectedCode, rescueBlock);
Label doneLabel = getNewLabel();
Variable tmpVar = getValueInTemporaryVariable(v);
addInstr(BNEInstr.create(tmpVar, manager.getNil(), doneLabel));
addInstr(BNEInstr.create(doneLabel, tmpVar, manager.getNil()));
addInstr(new CopyInstr(tmpVar, new FrozenString("expression")));
addInstr(new LabelInstr(doneLabel));

@@ -1480,9 +1480,9 @@ public Operand run() {
Variable tmpVar = createTemporaryVariable();
String constName = ((ConstNode) node).getName();
addInstr(new LexicalSearchConstInstr(tmpVar, startingSearchScope(), constName));
addInstr(BNEInstr.create(tmpVar, UndefinedValue.UNDEFINED, defLabel));
addInstr(BNEInstr.create(defLabel, tmpVar, UndefinedValue.UNDEFINED));
addInstr(new InheritanceSearchConstInstr(tmpVar, findContainerModule(), constName, false)); // SSS FIXME: should this be the current-module var or something else?
addInstr(BNEInstr.create(tmpVar, UndefinedValue.UNDEFINED, defLabel));
addInstr(BNEInstr.create(defLabel, tmpVar, UndefinedValue.UNDEFINED));
addInstr(new CopyInstr(tmpVar, manager.getNil()));
addInstr(new JumpInstr(doneLabel));
addInstr(new LabelInstr(defLabel));
@@ -1855,7 +1855,7 @@ protected void receiveNonBlockArgs(final ArgsNode argsNode) {
if (scope instanceof IRMethod) addArgumentDescription(IRMethodArgs.ArgType.opt, argName);
// You need at least required+j+1 incoming args for this opt arg to get an arg at all
addInstr(new ReceiveOptArgInstr(av, required, numPreReqd, j));
addInstr(BNEInstr.create(av, UndefinedValue.UNDEFINED, l)); // if 'av' is not undefined, go to default
addInstr(BNEInstr.create(l, av, UndefinedValue.UNDEFINED)); // if 'av' is not undefined, go to default
build(n.getValue());
addInstr(new LabelInstr(l));
}
@@ -1942,7 +1942,7 @@ public void receiveArgs(final ArgsNode argsNode) {
Label l = getNewLabel();
if (scope instanceof IRMethod) addKeyArgDesc(kasgn, argName);
addInstr(new ReceiveKeywordArgInstr(av, argName, required));
addInstr(BNEInstr.create(av, UndefinedValue.UNDEFINED, l)); // if 'av' is not undefined, we are done
addInstr(BNEInstr.create(l, av, UndefinedValue.UNDEFINED)); // if 'av' is not undefined, we are done

// Required kwargs have no value and check_arity will throw if they are not provided.
if (!isRequiredKeywordArgumentValue(kasgn)) {
@@ -2385,11 +2385,11 @@ public Operand buildFlip(FlipNode flipNode) {
addInstr(new CopyInstr(returnVal, manager.getFalse()));

// Are we in state 1?
addInstr(BNEInstr.create(flipState, s1, s2Label));
addInstr(BNEInstr.create(s2Label, flipState, s1));

// ----- Code for when we are in state 1 -----
Operand s1Val = build(flipNode.getBeginNode());
addInstr(BNEInstr.create(s1Val, manager.getTrue(), s2Label));
addInstr(BNEInstr.create(s2Label, s1Val, manager.getTrue()));

// s1 condition is true => set returnVal to true & move to state 2
addInstr(new CopyInstr(returnVal, manager.getTrue()));
@@ -2402,12 +2402,12 @@ public Operand buildFlip(FlipNode flipNode) {
if (flipNode.isExclusive()) addInstr(BEQInstr.create(returnVal, manager.getTrue(), doneLabel));

// Are we in state 2?
addInstr(BNEInstr.create(flipState, s2, doneLabel));
addInstr(BNEInstr.create(doneLabel, flipState, s2));

// ----- Code for when we are in state 2 -----
Operand s2Val = build(flipNode.getEndNode());
addInstr(new CopyInstr(returnVal, manager.getTrue()));
addInstr(BNEInstr.create(s2Val, manager.getTrue(), doneLabel));
addInstr(BNEInstr.create(doneLabel, s2Val, manager.getTrue()));

// s2 condition is true => move to state 1
addInstr(new CopyInstr(flipState, s1));
@@ -3452,7 +3452,7 @@ public Operand run() {
// Generate the next set of instructions
if (next != null) addInstr(new LabelInstr(next));
next = getNewLabel();
addInstr(BNEInstr.create(new Fixnum(depthFromSuper), scopeDepth, next));
addInstr(BNEInstr.create(next, new Fixnum(depthFromSuper), scopeDepth));
Operand[] args = adjustVariableDepth(getCallArgs(superScope, superBuilder), depthFromSuper);
addInstr(new ZSuperInstr(zsuperResult, buildSelf(), args, block));
addInstr(new JumpInstr(allDoneLabel));
2 changes: 0 additions & 2 deletions core/src/main/java/org/jruby/ir/Operation.java
Original file line number Diff line number Diff line change
@@ -172,9 +172,7 @@ public enum Operation {

/* Instructions to support defined? */
BLOCK_GIVEN(0),
DEFINED_CONSTANT_OR_METHOD(OpFlags.f_can_raise_exception),
GET_ERROR_INFO(0),
METHOD_DEFINED(OpFlags.f_can_raise_exception),
RESTORE_ERROR_INFO(OpFlags.f_has_side_effect),

/* Boxing/Unboxing between Ruby <--> Java types */
Original file line number Diff line number Diff line change
@@ -189,7 +189,7 @@ public boolean addStores(Map<Operand, Operand> varRenameMap, Set<LocalVariable>
// we'll be in trouble in that scenario!
if (spillAllVars || cl.usesLocalVariable(v) || cl.definesLocalVariable(v)) {
addedStores = true;
instrs.add(new StoreLocalVarInstr(problem.getLocalVarReplacement(v, varRenameMap), scope, v));
instrs.add(new StoreLocalVarInstr(scope, problem.getLocalVarReplacement(v, varRenameMap), v));
newDirtyVars.remove(v);
}
}
@@ -200,7 +200,7 @@ public boolean addStores(Map<Operand, Operand> varRenameMap, Set<LocalVariable>
instrs.previous();
for (LocalVariable v : dirtyVars) {
addedStores = true;
instrs.add(new StoreLocalVarInstr(problem.getLocalVarReplacement(v, varRenameMap), scope, v));
instrs.add(new StoreLocalVarInstr(scope, problem.getLocalVarReplacement(v, varRenameMap), v));
}
instrs.next();
dirtyVars.clear();
@@ -221,7 +221,7 @@ public boolean addStores(Map<Operand, Operand> varRenameMap, Set<LocalVariable>
|| (!(v instanceof ClosureLocalVariable) && scope.getScopeType().isClosureType()))
{
addedStores = true;
instrs.add(new StoreLocalVarInstr(problem.getLocalVarReplacement(v, varRenameMap), scope, v));
instrs.add(new StoreLocalVarInstr(scope, problem.getLocalVarReplacement(v, varRenameMap), v));
newDirtyVars.remove(v);
}
}
@@ -270,7 +270,7 @@ public boolean addStores(Map<Operand, Operand> varRenameMap, Set<LocalVariable>
instrs.previous();
for (LocalVariable v : dirtyVars) {
addedStores = true;
instrs.add(new StoreLocalVarInstr(problem.getLocalVarReplacement(v, varRenameMap), scope, v));
instrs.add(new StoreLocalVarInstr(scope, problem.getLocalVarReplacement(v, varRenameMap), v));
}
instrs.next();
dirtyVars.clear();
@@ -283,7 +283,7 @@ public boolean addStores(Map<Operand, Operand> varRenameMap, Set<LocalVariable>
instrs.previous();
for (LocalVariable v : dirtyVars) {
addedStores = true;
instrs.add(new StoreLocalVarInstr(problem.getLocalVarReplacement(v, varRenameMap), scope, v));
instrs.add(new StoreLocalVarInstr(scope, problem.getLocalVarReplacement(v, varRenameMap), v));
}
instrs.next();
dirtyVars.clear();
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ boolean addClosureExitStoreLocalVars(ListIterator<Instr> instrs, Set<LocalVariab
for (LocalVariable v : dirtyVars) {
if (isEvalScript || !(v instanceof ClosureLocalVariable) || !((ClosureLocalVariable)v).isDefinedLocally()) {
addedStores = true;
instrs.add(new StoreLocalVarInstr(getLocalVarReplacement(v, varRenameMap), scope, v));
instrs.add(new StoreLocalVarInstr(scope, getLocalVarReplacement(v, varRenameMap), v));
}
}
return addedStores;
7 changes: 5 additions & 2 deletions core/src/main/java/org/jruby/ir/instructions/AliasInstr.java
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
import org.jruby.ir.IRVisitor;
import org.jruby.ir.Operation;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.persistence.IRWriterEncoder;
import org.jruby.ir.runtime.IRRuntimeHelpers;
import org.jruby.ir.transformations.inlining.CloneInfo;
@@ -13,8 +14,6 @@
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

import java.util.Map;

public class AliasInstr extends Instr implements FixedArityInstr {
// SSS FIXME: Implicit self arg -- make explicit to not get screwed by inlining!
public AliasInstr(Operand newName, Operand oldName) {
@@ -35,6 +34,10 @@ public void encode(IRWriterEncoder e) {
e.encode(getOldName());
}

public static AliasInstr decode(IRReaderDecoder d) {
return new AliasInstr(d.decodeOperand(), d.decodeOperand());
}

@Override
public Instr clone(CloneInfo ii) {
return new AliasInstr(getNewName().cloneForInlining(ii), getOldName().cloneForInlining(ii));
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
import org.jruby.ir.Operation;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.parser.StaticScope;
import org.jruby.runtime.DynamicScope;
@@ -34,4 +35,8 @@ public Object interpret(ThreadContext context, StaticScope currScope, DynamicSco
}
return context.runtime.newFixnum(i);
}

public static ArgScopeDepthInstr decode(IRReaderDecoder d) {
return new ArgScopeDepthInstr(d.decodeVariable());
}
}
15 changes: 15 additions & 0 deletions core/src/main/java/org/jruby/ir/instructions/AttrAssignInstr.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package org.jruby.ir.instructions;

import org.jruby.RubyInstanceConfig;
import org.jruby.ir.IRScope;
import org.jruby.ir.IRVisitor;
import org.jruby.ir.Operation;
import org.jruby.ir.instructions.specialized.OneArgOperandAttrAssignInstr;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.persistence.IRWriterEncoder;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.parser.StaticScope;
@@ -44,6 +46,19 @@ public Instr clone(CloneInfo ii) {
return new AttrAssignInstr(getReceiver().cloneForInlining(ii), getName(), cloneCallArgs(ii));
}

@Override
public void encode(IRWriterEncoder e) {
if (RubyInstanceConfig.IR_WRITING_DEBUG) System.out.println("Instr(" + getOperation() + "): " + this);
e.encode(getOperation());
e.encode(getReceiver());
e.encode(getName());
e.encode(getCallArgs());
}

public static AttrAssignInstr decode(IRReaderDecoder d) {
return create(d.decodeOperand(), d.decodeString(), d.decodeOperandArray());
}

@Override
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope dynamicScope, IRubyObject self, Object[] temp) {
IRubyObject object = (IRubyObject) getReceiver().retrieve(context, self, currScope, dynamicScope, temp);
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/ir/instructions/BEQInstr.java
Original file line number Diff line number Diff line change
@@ -22,8 +22,8 @@ public static BranchInstr create(Operand v1, Operand v2, Label jmpTarget) {
return new BEQInstr(jmpTarget, v1, v2);
}

protected BEQInstr(Label jmpTarget, Operand v1, Operand v2) {
super(Operation.BEQ, v1, v2, jmpTarget);
protected BEQInstr(Label jumpTarget, Operand v1, Operand v2) {
super(Operation.BEQ, jumpTarget, v1, v2);
}

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

public class BNEInstr extends TwoOperandBranchInstr implements FixedArityInstr {
public static BranchInstr create(Operand v1, Operand v2, Label jmpTarget) {
public static BranchInstr create(Label jmpTarget, Operand v1, Operand v2) {
if (v2 instanceof Boolean) {
return ((Boolean) v2).isFalse() ? new BTrueInstr(jmpTarget, v1) : new BFalseInstr(jmpTarget, v1);
}
return new BNEInstr(jmpTarget, v1, v2);
}

public BNEInstr(Label jmpTarget, Operand v1, Operand v2) {
super(Operation.BNE, v1, v2, jmpTarget);
public BNEInstr(Label jumpTarget, Operand v1, Operand v2) {
super(Operation.BNE, jumpTarget, v1, v2);
}

@Override
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
import org.jruby.ir.Operation;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.persistence.IRWriterEncoder;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.parser.StaticScope;
@@ -38,6 +39,10 @@ public void encode(IRWriterEncoder e) {
e.encode(getPieces());
}

public static BacktickInstr decode(IRReaderDecoder d) {
return new BacktickInstr(d.decodeVariable(), d.decodeOperandArray());
}

@Override
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) {
RubyString newString = context.runtime.newString();
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
import org.jruby.ir.Operation;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.persistence.IRWriterEncoder;
import org.jruby.ir.runtime.IRRuntimeHelpers;
import org.jruby.ir.transformations.inlining.CloneInfo;
@@ -36,6 +37,10 @@ public void encode(IRWriterEncoder e) {
e.encode(getBlockArg());
}

public static BlockGivenInstr decode(IRReaderDecoder d) {
return new BlockGivenInstr(d.decodeVariable(), d.decodeOperand());
}

@Override
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) {
Object blk = getBlockArg().retrieve(context, self, currScope, currDynScope, temp);
5 changes: 5 additions & 0 deletions core/src/main/java/org/jruby/ir/instructions/BreakInstr.java
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.StringLiteral;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.persistence.IRWriterEncoder;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.ir.transformations.inlining.InlineCloneInfo;
@@ -103,6 +104,10 @@ public void encode(IRWriterEncoder e) {
e.encode(getScopeName());
}

public static BreakInstr decode(IRReaderDecoder d) {
return new BreakInstr(d.decodeOperand(), d.decodeString());
}

@Override
public void visit(IRVisitor visitor) {
visitor.BreakInstr(this);
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
import org.jruby.ir.Operation;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.persistence.IRWriterEncoder;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.parser.StaticScope;
@@ -51,6 +52,10 @@ public void encode(IRWriterEncoder e) {
e.encode(isArgsPush());
}

public static BuildCompoundArrayInstr decode(IRReaderDecoder d) {
return new BuildCompoundArrayInstr(d.decodeVariable(), d.decodeOperand(), d.decodeOperand(), d.decodeBoolean());
}

@Override
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) {
IRubyObject v1 = (IRubyObject)getAppendingArg().retrieve(context, self, currScope, currDynScope, temp);
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.StringLiteral;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.persistence.IRWriterEncoder;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.parser.StaticScope;
@@ -48,8 +49,12 @@ public boolean isSameEncodingAndCodeRange(RubyString str, StringLiteral newStr)
@Override
public void encode(IRWriterEncoder e) {
super.encode(e);
e.encode(encoding == null ? "" : encoding.toString());
e.encode(getPieces());
e.encode(encoding);
}

public static BuildCompoundStringInstr decode(IRReaderDecoder d) {
return new BuildCompoundStringInstr(d.decodeVariable(), d.decodeOperandArray(), d.decodeEncoding());
}

@Override
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
import org.jruby.ir.Operation;
import org.jruby.ir.operands.Operand;
import org.jruby.ir.operands.Variable;
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.persistence.IRWriterEncoder;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.parser.StaticScope;
@@ -66,6 +67,11 @@ public void encode(IRWriterEncoder e) {
e.encode(getOptions().toEmbeddedOptions());
}

public static BuildDynRegExpInstr decode(IRReaderDecoder d) {
return new BuildDynRegExpInstr(d.decodeVariable(),
d.decodeOperandArray(),RegexpOptions.fromEmbeddedOptions(d.decodeInt()));
}

@Override
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) {
// FIXME (from RegexpNode.java): 1.9 should care about internal or external encoding and not kcode.
Original file line number Diff line number Diff line change
@@ -5,9 +5,11 @@
import org.jruby.ir.IRVisitor;
import org.jruby.ir.Operation;
import org.jruby.ir.operands.*;
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.persistence.IRWriterEncoder;
import org.jruby.ir.transformations.inlining.CloneInfo;
import org.jruby.lexer.yacc.ISourcePosition;
import org.jruby.lexer.yacc.SimpleSourcePosition;
import org.jruby.parser.StaticScope;
import org.jruby.runtime.Block;
import org.jruby.runtime.DynamicScope;
@@ -62,6 +64,11 @@ public void encode(IRWriterEncoder e) {
e.encode(getPosition().getLine());
}

public static BuildLambdaInstr decode(IRReaderDecoder d) {
return new BuildLambdaInstr(d.decodeVariable(), d.decodeOperand(),
new SimpleSourcePosition(d.decodeString(), d.decodeInt()));
}

@Override
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) {
// SSS FIXME: Copied this from ast/LambdaNode ... Is this required here as well?
Loading