Methods in org.jruby.compiler.ir with parameters of type IR_Scope |
Operand |
IR_Builder.build(Node node,
IR_Scope m)
|
Operand |
IR_Builder.buildAlias(AliasNode alias,
IR_Scope s)
|
Operand |
IR_Builder.buildAnd(AndNode andNode,
IR_Scope m)
|
void |
IR_Builder.buildArgs(java.util.List<Operand> argsList,
Node args,
IR_Scope s)
|
Operand |
IR_Builder.buildArgsCat(ArgsCatNode argsCatNode,
IR_Scope s)
|
void |
IR_Builder.buildArgsCatArguments(java.util.List<Operand> args,
ArgsCatNode argsCatNode,
IR_Scope s)
|
Operand |
IR_Builder.buildArgsPush(ArgsPushNode node,
IR_Scope m)
|
void |
IR_Builder.buildArgsPushArguments(java.util.List<Operand> args,
ArgsPushNode argsPushNode,
IR_Scope m)
|
void |
IR_Builder.buildArguments(java.util.List<Operand> args,
Node node,
IR_Scope s)
|
Operand |
IR_Builder.buildArray(Node node,
IR_Scope m)
|
void |
IR_Builder.buildArrayArguments(java.util.List<Operand> args,
Node node,
IR_Scope s)
|
void |
IR_Builder.buildAssignment(Node node,
IR_Scope s,
Operand values,
int argIndex,
boolean isSplat)
|
Operand |
IR_Builder.buildAttrAssignAssignment(Node node,
IR_Scope s,
Operand value)
|
Operand |
IR_Builder.buildBackref(BackRefNode node,
IR_Scope m)
|
Operand |
IR_Builder.buildBegin(BeginNode beginNode,
IR_Scope s)
|
Operand |
IR_Builder.buildBignum(BignumNode node,
IR_Scope s)
|
Operand |
IR_Builder.buildBlock(BlockNode node,
IR_Scope s)
|
void |
IR_Builder.buildBlockArgsAssignment(Node node,
IR_Scope s,
int argIndex,
boolean isSplat)
|
Operand |
IR_Builder.buildBreak(BreakNode breakNode,
IR_Scope s)
|
Operand |
IR_Builder.buildCall(CallNode callNode,
IR_Scope s)
|
Operand |
IR_Builder.buildCase(CaseNode caseNode,
IR_Scope m)
|
Operand |
IR_Builder.buildClass(ClassNode classNode,
IR_Scope s)
|
Operand |
IR_Builder.buildClassVar(ClassVarNode node,
IR_Scope s)
public Operand buildSClass(Node node, IR_Scope m) {
final SClassNode sclassNode = (SClassNode) node;
CompilerCallback receiverCallback = new CompilerCallback() {
public void call(IR_Scope m) {
build(sclassNode.getReceiverNode(), m, true);
}
};
CompilerCallback bodyCallback = new CompilerCallback() {
public void call(IR_Scope m) {
if (sclassNode.getBodyNode() != null) {
build(sclassNode.getBodyNode(), m, true);
} else {
m.loadNil();
}
}
};
m.defineClass("SCLASS", sclassNode.getScope(), null, null, bodyCallback, receiverCallback, inspector);
} |
Operand |
IR_Builder.buildClassVarAsgn(ClassVarAsgnNode classVarAsgnNode,
IR_Scope s)
|
Operand |
IR_Builder.buildClassVarDecl(ClassVarDeclNode classVarDeclNode,
IR_Scope s)
|
Operand |
IR_Builder.buildColon2(Colon2Node iVisited,
IR_Scope s)
|
Operand |
IR_Builder.buildColon3(Colon3Node node,
IR_Scope s)
|
Operand |
IR_Builder.buildConst(ConstNode node,
IR_Scope s)
|
Operand |
IR_Builder.buildConstDecl(ConstDeclNode node,
IR_Scope s)
|
Operand |
IR_Builder.buildConstDeclAssignment(ConstDeclNode constDeclNode,
IR_Scope s,
Operand val)
|
Operand |
IR_Builder.buildDAsgn(DAsgnNode dasgnNode,
IR_Scope s)
public Operand buildGetDefinitionBase(final Node node, IR_Scope m) {
switch (node.getNodeType()) {
case CLASSVARASGNNODE:
case CLASSVARDECLNODE:
case CONSTDECLNODE:
case DASGNNODE:
case GLOBALASGNNODE:
case LOCALASGNNODE:
case MULTIPLEASGNNODE:
case OPASGNNODE:
case OPELEMENTASGNNODE:
case DVARNODE:
case FALSENODE:
case TRUENODE:
case LOCALVARNODE:
case INSTVARNODE:
case BACKREFNODE:
case SELFNODE:
case VCALLNODE:
case YIELDNODE:
case GLOBALVARNODE:
case CONSTNODE:
case FCALLNODE:
case CLASSVARNODE:
// these are all simple cases that don't require the heavier defined logic
buildGetDefinition(node, m);
break;
default:
BranchCallback reg = new BranchCallback() {
public void branch(IR_Scope m) {
m.inDefined();
buildGetDefinition(node, m);
}
};
BranchCallback out = new BranchCallback() {
public void branch(IR_Scope m) {
m.outDefined();
}
};
m.protect(reg, out, String.class);
}
}
public Operand buildDefined(final Node node, IR_Scope m) {
buildGetDefinitionBase(((DefinedNode) node).getExpressionNode(), m);
m.stringOrNil();
}
public Operand buildGetArgumentDefinition(final Node node, IR_Scope m, String type) {
if (node == null) {
return new StringLiteral(type);
} else if (node instanceof ArrayNode) {
Object endToken = m.getNewEnding();
for (int i = 0; i < ((ArrayNode) node).size(); i++) {
Node iterNode = ((ArrayNode) node).get(i);
buildGetDefinition(iterNode, m);
m.ifNull(endToken);
}
Operand sl = new StringLiteral(type);
Object realToken = m.getNewEnding();
m.go(realToken);
m.setEnding(endToken);
m.pushNull();
m.setEnding(realToken);
} else {
buildGetDefinition(node, m);
Object endToken = m.getNewEnding();
m.ifNull(endToken);
Operand sl = new StringLiteral(type);
Object realToken = m.getNewEnding();
m.go(realToken);
m.setEnding(endToken);
m.pushNull();
m.setEnding(realToken);
}
}
public Operand buildGetDefinition(final Node node, IR_Scope m) {
switch (node.getNodeType()) {
case CLASSVARASGNNODE:
case CLASSVARDECLNODE:
case CONSTDECLNODE:
case DASGNNODE:
case GLOBALASGNNODE:
case LOCALASGNNODE:
case MULTIPLEASGNNODE:
case OPASGNNODE:
case OPELEMENTASGNNODE:
return new StringLiteral("assignment");
case BACKREFNODE:
// SSS FIXME!
Operand x = m.backref();
return x instanceof RubyMatchData.class ? new StringLiteral("$" + ((BackRefNode) node).getType()) : Nil.NIL;
case DVARNODE:
return new StringLiteral("local-variable(in-block)");
case FALSENODE:
return new StringLiteral("false");
case TRUENODE:
return new StringLiteral("true");
case LOCALVARNODE:
return new StringLiteral("local-variable");
case MATCH2NODE:
case MATCH3NODE:
return new StringLiteral("method");
case NILNODE:
return new StringLiteral("nil");
case NTHREFNODE:
m.isCaptured(((NthRefNode) node).getMatchNumber(),
new BranchCallback() {
public void branch(IR_Scope m) {
return new StringLiteral("$" + ((NthRefNode) node).getMatchNumber());
}
},
new BranchCallback() {
public void branch(IR_Scope m) {
return Nil.NIL;
}
});
break;
case SELFNODE:
return new StringLiteral("self");
case VCALLNODE:
m.loadSelf();
m.isMethodBound(((VCallNode) node).getName(),
new BranchCallback() {
public void branch(IR_Scope m) {
return new StringLiteral("method");
}
},
new BranchCallback() {
public void branch(IR_Scope m) {
return Nil.NIL;
}
});
break;
case YIELDNODE:
m.hasBlock(new BranchCallback() {
public void branch(IR_Scope m) {
return new StringLiteral("yield");
}
},
new BranchCallback() {
public void branch(IR_Scope m) {
return Nil.NIL;
}
});
break;
case GLOBALVARNODE:
m.isGlobalDefined(((GlobalVarNode) node).getName(),
new BranchCallback() {
public void branch(IR_Scope m) {
return new StringLiteral("global-variable");
}
},
new BranchCallback() {
public void branch(IR_Scope m) {
return Nil.NIL;
}
});
break;
case INSTVARNODE:
m.isInstanceVariableDefined(((InstVarNode) node).getName(),
new BranchCallback() {
public void branch(IR_Scope m) {
return new StringLiteral("instance-variable");
}
},
new BranchCallback() {
public void branch(IR_Scope m) {
return Nil.NIL;
}
});
break;
case CONSTNODE:
m.isConstantDefined(((ConstNode) node).getName(),
new BranchCallback() {
public void branch(IR_Scope m) {
return new StringLiteral("constant");
}
},
new BranchCallback() {
public void branch(IR_Scope m) {
return Nil.NIL;
}
});
break;
case FCALLNODE:
m.loadSelf();
m.isMethodBound(((FCallNode) node).getName(),
new BranchCallback() {
public void branch(IR_Scope m) {
buildGetArgumentDefinition(((FCallNode) node).getArgsNode(), m, "method");
}
},
new BranchCallback() {
public void branch(IR_Scope m) {
return Nil.NIL;
}
});
break;
case COLON3NODE:
case COLON2NODE:
{
final Colon3Node iVisited = (Colon3Node) node;
final String name = iVisited.getName();
BranchCallback setup = new BranchCallback() {
public void branch(IR_Scope m) {
if (iVisited instanceof Colon2Node) {
final Node leftNode = ((Colon2Node) iVisited).getLeftNode();
build(leftNode, m,true);
} else {
m.loadObject();
}
}
};
BranchCallback isConstant = new BranchCallback() {
public void branch(IR_Scope m) {
return new StringLiteral("constant");
}
};
BranchCallback isMethod = new BranchCallback() {
public void branch(IR_Scope m) {
return new StringLiteral("method");
}
};
BranchCallback none = new BranchCallback() {
public void branch(IR_Scope m) {
return Nil.NIL;
}
};
m.isConstantBranch(setup, isConstant, isMethod, none, name);
break;
}
case CALLNODE:
{
final CallNode iVisited = (CallNode) node;
Object isnull = m.getNewEnding();
Object ending = m.getNewEnding();
buildGetDefinition(iVisited.getReceiverNode(), m);
m.ifNull(isnull);
m.rescue(new BranchCallback() {
public void branch(IR_Scope m) {
build(iVisited.getReceiverNode(), m,true); //[IRubyObject]
m.duplicateCurrentValue(); //[IRubyObject, IRubyObject]
m.metaclass(); //[IRubyObject, RubyClass]
m.duplicateCurrentValue(); //[IRubyObject, RubyClass, RubyClass]
m.getVisibilityFor(iVisited.getName()); //[IRubyObject, RubyClass, Visibility]
m.duplicateCurrentValue(); //[IRubyObject, RubyClass, Visibility, Visibility]
final Object isfalse = m.getNewEnding();
Object isreal = m.getNewEnding();
Object ending = m.getNewEnding();
m.isPrivate(isfalse, 3); //[IRubyObject, RubyClass, Visibility]
m.isNotProtected(isreal, 1); //[IRubyObject, RubyClass]
m.selfIsKindOf(isreal); //[IRubyObject]
m.consumeCurrentValue();
m.go(isfalse);
m.setEnding(isreal); //[]
m.isMethodBound(iVisited.getName(), new BranchCallback() {
public void branch(IR_Scope m) {
buildGetArgumentDefinition(iVisited.getArgsNode(), m, "method");
}
},
new BranchCallback() {
public void branch(IR_Scope m) {
m.go(isfalse);
}
});
m.go(ending);
m.setEnding(isfalse);
m.pushNull();
m.setEnding(ending);
}
}, JumpException.class,
new BranchCallback() {
public void branch(IR_Scope m) {
m.pushNull();
}
}, String.class);
// m.swapValues();
//m.consumeCurrentValue();
m.go(ending);
m.setEnding(isnull);
m.pushNull();
m.setEnding(ending);
break;
}
case CLASSVARNODE:
{
ClassVarNode iVisited = (ClassVarNode) node;
final Object ending = m.getNewEnding();
final Object failure = m.getNewEnding();
final Object singleton = m.getNewEnding();
Object second = m.getNewEnding();
Object third = m.getNewEnding();
m.loadCurrentModule(); //[RubyClass]
m.duplicateCurrentValue(); //[RubyClass, RubyClass]
m.ifNotNull(second); //[RubyClass]
m.consumeCurrentValue(); //[]
m.loadSelf(); //[self]
m.metaclass(); //[RubyClass]
m.duplicateCurrentValue(); //[RubyClass, RubyClass]
m.isClassVarDefined(iVisited.getName(),
new BranchCallback() {
public void branch(IR_Scope m) {
m.consumeCurrentValue();
Operand sl = new StringLiteral("class variable");
m.go(ending);
}
},
new BranchCallback() {
public void branch(IR_Scope m) {
}
});
m.setEnding(second); //[RubyClass]
m.duplicateCurrentValue();
m.isClassVarDefined(iVisited.getName(),
new BranchCallback() {
public void branch(IR_Scope m) {
m.consumeCurrentValue();
Operand sl = new StringLiteral("class variable");
m.go(ending);
}
},
new BranchCallback() {
public void branch(IR_Scope m) {
}
});
m.setEnding(third); //[RubyClass]
m.duplicateCurrentValue(); //[RubyClass, RubyClass]
m.ifSingleton(singleton); //[RubyClass]
m.consumeCurrentValue();//[]
m.go(failure);
m.setEnding(singleton);
m.attached();//[RubyClass]
m.notIsModuleAndClassVarDefined(iVisited.getName(), failure); //[]
Operand sl = new StringLiteral("class variable");
m.go(ending);
m.setEnding(failure);
m.pushNull();
m.setEnding(ending);
}
break;
case ZSUPERNODE:
{
Object fail = m.getNewEnding();
Object fail2 = m.getNewEnding();
Object fail_easy = m.getNewEnding();
Object ending = m.getNewEnding();
m.getFrameName(); //[String]
m.duplicateCurrentValue(); //[String, String]
m.ifNull(fail); //[String]
m.getFrameKlazz(); //[String, RubyClass]
m.duplicateCurrentValue(); //[String, RubyClass, RubyClass]
m.ifNull(fail2); //[String, RubyClass]
m.superClass();
m.ifNotSuperMethodBound(fail_easy);
Operand sl = new StringLiteral("super");
m.go(ending);
m.setEnding(fail2);
m.consumeCurrentValue();
m.setEnding(fail);
m.consumeCurrentValue();
m.setEnding(fail_easy);
m.pushNull();
m.setEnding(ending);
}
break;
case SUPERNODE:
{
Object fail = m.getNewEnding();
Object fail2 = m.getNewEnding();
Object fail_easy = m.getNewEnding();
Object ending = m.getNewEnding();
m.getFrameName(); //[String]
m.duplicateCurrentValue(); //[String, String]
m.ifNull(fail); //[String]
m.getFrameKlazz(); //[String, RubyClass]
m.duplicateCurrentValue(); //[String, RubyClass, RubyClass]
m.ifNull(fail2); //[String, RubyClass]
m.superClass();
m.ifNotSuperMethodBound(fail_easy);
buildGetArgumentDefinition(((SuperNode) node).getArgsNode(), m, "super");
m.go(ending);
m.setEnding(fail2);
m.consumeCurrentValue();
m.setEnding(fail);
m.consumeCurrentValue();
m.setEnding(fail_easy);
m.pushNull();
m.setEnding(ending);
break;
}
case ATTRASSIGNNODE:
{
final AttrAssignNode iVisited = (AttrAssignNode) node;
Object isnull = m.getNewEnding();
Object ending = m.getNewEnding();
buildGetDefinition(iVisited.getReceiverNode(), m);
m.ifNull(isnull);
m.rescue(new BranchCallback() {
public void branch(IR_Scope m) {
build(iVisited.getReceiverNode(), m,true); //[IRubyObject]
m.duplicateCurrentValue(); //[IRubyObject, IRubyObject]
m.metaclass(); //[IRubyObject, RubyClass]
m.duplicateCurrentValue(); //[IRubyObject, RubyClass, RubyClass]
m.getVisibilityFor(iVisited.getName()); //[IRubyObject, RubyClass, Visibility]
m.duplicateCurrentValue(); //[IRubyObject, RubyClass, Visibility, Visibility]
final Object isfalse = m.getNewEnding();
Object isreal = m.getNewEnding();
Object ending = m.getNewEnding();
m.isPrivate(isfalse, 3); //[IRubyObject, RubyClass, Visibility]
m.isNotProtected(isreal, 1); //[IRubyObject, RubyClass]
m.selfIsKindOf(isreal); //[IRubyObject]
m.consumeCurrentValue();
m.go(isfalse);
m.setEnding(isreal); //[]
m.isMethodBound(iVisited.getName(), new BranchCallback() {
public void branch(IR_Scope m) {
buildGetArgumentDefinition(iVisited.getArgsNode(), m, "assignment");
}
},
new BranchCallback() {
public void branch(IR_Scope m) {
m.go(isfalse);
}
});
m.go(ending);
m.setEnding(isfalse);
m.pushNull();
m.setEnding(ending);
}
}, JumpException.class,
new BranchCallback() {
public void branch(IR_Scope m) {
m.pushNull();
}
}, String.class);
m.go(ending);
m.setEnding(isnull);
m.pushNull();
m.setEnding(ending);
break;
}
default:
m.rescue(new BranchCallback() {
public void branch(IR_Scope m) {
build(node, m,true);
m.consumeCurrentValue();
m.pushNull();
}
}, JumpException.class,
new BranchCallback() {
public void branch(IR_Scope m) {
m.pushNull();
}
}, String.class);
m.consumeCurrentValue();
//MPS_FIXME: new StringLiteral("expression");
}
} |
Operand |
IR_Builder.buildDefn(MethodDefNode node,
IR_Scope s)
|
Operand |
IR_Builder.buildDefs(MethodDefNode node,
IR_Scope s)
|
Operand |
IR_Builder.buildDot(DotNode dotNode,
IR_Scope s)
|
Operand |
IR_Builder.buildDRegexp(DRegexpNode dregexpNode,
IR_Scope s)
|
Operand |
IR_Builder.buildDStr(DStrNode dstrNode,
IR_Scope s)
|
Operand |
IR_Builder.buildDSymbol(Node node,
IR_Scope s)
|
Operand |
IR_Builder.buildDVar(DVarNode node,
IR_Scope m)
|
Operand |
IR_Builder.buildDXStr(DXStrNode dstrNode,
IR_Scope m)
|
Operand |
IR_Builder.buildEvStr(EvStrNode node,
IR_Scope s)
public Operand buildEnsureNode(Node node, IR_Scope m) {
final EnsureNode ensureNode = (EnsureNode) node;
if (ensureNode.getEnsureNode() != null) {
m.performEnsure(new BranchCallback() {
public void branch(IR_Scope m) {
if (ensureNode.getBodyNode() != null) {
build(ensureNode.getBodyNode(), m, true);
} else {
m.loadNil();
}
}
},
new BranchCallback() {
public void branch(IR_Scope m) {
build(ensureNode.getEnsureNode(), m, false);
}
});
} else {
if (ensureNode.getBodyNode() != null) {
build(ensureNode.getBodyNode(), m,true);
} else {
m.loadNil();
}
}
// TODO: don't require pop
if (!expr) m.consumeCurrentValue();
} |
Operand |
IR_Builder.buildFalse(Node node,
IR_Scope s)
|
Operand |
IR_Builder.buildFCall(FCallNode fcallNode,
IR_Scope s)
|
Operand |
IR_Builder.buildFixnum(FixnumNode node,
IR_Scope m)
|
Operand |
IR_Builder.buildFloat(FloatNode node,
IR_Scope m)
public Operand buildFlip(Node node, IR_Scope m) {
final FlipNode flipNode = (FlipNode) node;
m.getVariableCompiler().retrieveLocalVariable(flipNode.getIndex(), flipNode.getDepth());
if (flipNode.isExclusive()) {
m.performBooleanBranch(new BranchCallback() {
public void branch(IR_Scope m) {
build(flipNode.getEndNode(), m,true);
m.performBooleanBranch(new BranchCallback() {
public void branch(IR_Scope m) {
m.loadFalse();
m.getVariableCompiler().assignLocalVariable(flipNode.getIndex(), flipNode.getDepth(), false);
}
}, new BranchCallback() {
public void branch(IR_Scope m) {
}
});
m.loadTrue();
}
}, new BranchCallback() {
public void branch(IR_Scope m) {
build(flipNode.getBeginNode(), m,true);
becomeTrueOrFalse(m);
m.getVariableCompiler().assignLocalVariable(flipNode.getIndex(), flipNode.getDepth(), true);
}
});
} else {
m.performBooleanBranch(new BranchCallback() {
public void branch(IR_Scope m) {
build(flipNode.getEndNode(), m,true);
m.performBooleanBranch(new BranchCallback() {
public void branch(IR_Scope m) {
m.loadFalse();
m.getVariableCompiler().assignLocalVariable(flipNode.getIndex(), flipNode.getDepth(), false);
}
}, new BranchCallback() {
public void branch(IR_Scope m) {
}
});
m.loadTrue();
}
}, new BranchCallback() {
public void branch(IR_Scope m) {
build(flipNode.getBeginNode(), m,true);
m.performBooleanBranch(new BranchCallback() {
public void branch(IR_Scope m) {
build(flipNode.getEndNode(), m,true);
flipTrueOrFalse(m);
m.getVariableCompiler().assignLocalVariable(flipNode.getIndex(), flipNode.getDepth(), false);
m.loadTrue();
}
}, new BranchCallback() {
public void branch(IR_Scope m) {
m.loadFalse();
}
});
}
});
}
// TODO: don't require pop
if (!expr) m.consumeCurrentValue();
}
private void becomeTrueOrFalse(IR_Scope m) {
m.performBooleanBranch(new BranchCallback() {
public void branch(IR_Scope m) {
m.loadTrue();
}
}, new BranchCallback() {
public void branch(IR_Scope m) {
m.loadFalse();
}
});
}
private void flipTrueOrFalse(IR_Scope m) {
m.performBooleanBranch(new BranchCallback() {
public void branch(IR_Scope m) {
m.loadFalse();
}
}, new BranchCallback() {
public void branch(IR_Scope m) {
m.loadTrue();
}
});
} |
Operand |
IR_Builder.buildFor(ForNode forNode,
IR_Scope m)
|
Operand |
IR_Builder.buildForIter(ForNode forNode,
IR_Scope s)
|
Operand |
IR_Builder.buildGlobalAsgn(GlobalAsgnNode globalAsgnNode,
IR_Scope m)
|
Operand |
IR_Builder.buildGlobalVar(GlobalVarNode node,
IR_Scope m)
|
Operand |
IR_Builder.buildHash(HashNode hashNode,
IR_Scope m)
|
Operand |
IR_Builder.buildIf(IfNode ifNode,
IR_Scope s)
|
Operand |
IR_Builder.buildInstAsgn(InstAsgnNode instAsgnNode,
IR_Scope s)
|
Operand |
IR_Builder.buildInstVar(InstVarNode node,
IR_Scope m)
|
Operand |
IR_Builder.buildIter(IterNode iterNode,
IR_Scope s)
|
Operand |
IR_Builder.buildLocalAsgn(LocalAsgnNode localAsgnNode,
IR_Scope s)
|
Operand |
IR_Builder.buildLocalVar(LocalVarNode node,
IR_Scope s)
|
Operand |
IR_Builder.buildMatch(MatchNode matchNode,
IR_Scope m)
|
Operand |
IR_Builder.buildMatch2(Match2Node matchNode,
IR_Scope m)
|
Operand |
IR_Builder.buildMatch3(Match3Node matchNode,
IR_Scope m)
|
Operand |
IR_Builder.buildModule(ModuleNode moduleNode,
IR_Scope s)
|
Operand |
IR_Builder.buildMultipleAsgn(MultipleAsgnNode multipleAsgnNode,
IR_Scope s)
|
void |
IR_Builder.buildMultipleAsgnAssignment(MultipleAsgnNode multipleAsgnNode,
IR_Scope s,
Operand values)
|
Operand |
IR_Builder.buildNewline(NewlineNode node,
IR_Scope s)
|
Operand |
IR_Builder.buildNext(NextNode nextNode,
IR_Scope s)
|
Operand |
IR_Builder.buildNil(Node node,
IR_Scope m)
|
Operand |
IR_Builder.buildNot(NotNode node,
IR_Scope m)
|
Operand |
IR_Builder.buildNthRef(NthRefNode nthRefNode,
IR_Scope m)
|
Operand |
IR_Builder.buildOpAsgn(OpAsgnNode opAsgnNode,
IR_Scope s)
|
Operand |
IR_Builder.buildOpAsgnAnd(OpAsgnAndNode andNode,
IR_Scope s)
|
Operand |
IR_Builder.buildOpAsgnOr(OpAsgnOrNode orNode,
IR_Scope s)
|
Operand |
IR_Builder.buildOr(OrNode orNode,
IR_Scope m)
private class OpElementAsgnArgumentsCallback implements ArgumentsCallback {
private Node node;
public OpElementAsgnArgumentsCallback(Node node) {
this.node = node;
}
public int getArity() {
switch (node.getNodeType()) {
case ARGSCATNODE:
case ARGSPUSHNODE:
case SPLATNODE:
return -1;
case ARRAYNODE:
ArrayNode arrayNode = (ArrayNode)node;
if (arrayNode.size() == 0) {
return 0;
} else if (arrayNode.size() > 3) {
return -1;
} else {
return ((ArrayNode)node).size();
}
default:
return 1;
}
}
public void call(IR_Scope m) {
if (getArity() == 1) {
// if arity 1, just build the one element to save us the array cost
build(((ArrayNode)node).get(0), m,true);
} else {
// build into array
buildArguments(node, m);
}
}
};
public Operand buildOpElementAsgnWithOr(Node node, IR_Scope m) {
final OpElementAsgnNode opElementAsgnNode = (OpElementAsgnNode) node;
CompilerCallback receiverCallback = new CompilerCallback() {
public void call(IR_Scope m) {
build(opElementAsgnNode.getReceiverNode(), m);
}
};
ArgumentsCallback argsCallback = new OpElementAsgnArgumentsCallback(opElementAsgnNode.getArgsNode());
CompilerCallback valueCallback = new CompilerCallback() {
public void call(IR_Scope m) {
build(opElementAsgnNode.getValueNode(), m, true);
}
};
m.getInvocationCompiler().opElementAsgnWithOr(receiverCallback, argsCallback, valueCallback);
// TODO: don't require pop
if (!expr) m.consumeCurrentValue();
}
public Operand buildOpElementAsgnWithAnd(Node node, IR_Scope m) {
final OpElementAsgnNode opElementAsgnNode = (OpElementAsgnNode) node;
CompilerCallback receiverCallback = new CompilerCallback() {
public void call(IR_Scope m) {
build(opElementAsgnNode.getReceiverNode(), m);
}
};
ArgumentsCallback argsCallback = new OpElementAsgnArgumentsCallback(opElementAsgnNode.getArgsNode());
CompilerCallback valueCallback = new CompilerCallback() {
public void call(IR_Scope m) {
build(opElementAsgnNode.getValueNode(), m);
}
};
m.getInvocationCompiler().opElementAsgnWithAnd(receiverCallback, argsCallback, valueCallback);
}
public Operand buildOpElementAsgnWithMethod(Node node, IR_Scope m) {
final OpElementAsgnNode opElementAsgnNode = (OpElementAsgnNode) node;
CompilerCallback receiverCallback = new CompilerCallback() {
public void call(IR_Scope m) {
build(opElementAsgnNode.getReceiverNode(), m);
}
};
ArgumentsCallback argsCallback = setupCallArgs(opElementAsgnNode.getArgsNode());
CompilerCallback valueCallback = new CompilerCallback() {
public void call(IR_Scope m) {
build(opElementAsgnNode.getValueNode(), m);
}
};
m.getInvocationCompiler().opElementAsgnWithMethod(receiverCallback, argsCallback, valueCallback, opElementAsgnNode.getOperatorName());
} |
Operand |
IR_Builder.buildRedo(Node node,
IR_Scope s)
public Operand buildPostExe(Node node, IR_Scope m) {
final PostExeNode postExeNode = (PostExeNode) node;
// create the closure class and instantiate it
final CompilerCallback closureBody = new CompilerCallback() {
public void call(IR_Scope m) {
if (postExeNode.getBodyNode() != null) {
build(postExeNode.getBodyNode(), m, true);
} else {
m.loadNil();
}
}
};
m.createNewEndBlock(closureBody);
}
public Operand buildPreExe(Node node, IR_Scope m) {
final PreExeNode preExeNode = (PreExeNode) node;
// create the closure class and instantiate it
final CompilerCallback closureBody = new CompilerCallback() {
public void call(IR_Scope m) {
if (preExeNode.getBodyNode() != null) {
build(preExeNode.getBodyNode(), m,true);
} else {
m.loadNil();
}
}
};
m.runBeginBlock(preExeNode.getScope(), closureBody);
} |
Operand |
IR_Builder.buildRegexp(RegexpNode reNode,
IR_Scope m)
|
Operand |
IR_Builder.buildReturn(ReturnNode returnNode,
IR_Scope m)
public Operand buildRetry(Node node, IR_Scope s) {
// JRuby only supports retry when present in rescue blocks!
// 1.9 doesn't support retry anywhere else. |
Operand |
IR_Builder.buildSelf(Node node,
IR_Scope s)
|
void |
IR_Builder.buildSpecificArityArguments(java.util.List<Operand> args,
Node node,
IR_Scope s)
|
Operand |
IR_Builder.buildSplat(SplatNode splatNode,
IR_Scope s)
|
void |
IR_Builder.buildSplatArguments(java.util.List<Operand> args,
SplatNode node,
IR_Scope s)
|
Operand |
IR_Builder.buildStr(StrNode strNode,
IR_Scope s)
|
Operand |
IR_Builder.buildSuper(SuperNode superNode,
IR_Scope s)
|
Operand |
IR_Builder.buildSValue(SValueNode node,
IR_Scope s)
|
Operand |
IR_Builder.buildSymbol(SymbolNode node,
IR_Scope s)
|
Operand |
IR_Builder.buildToAry(ToAryNode node,
IR_Scope s)
|
Operand |
IR_Builder.buildTrue(Node node,
IR_Scope m)
|
Operand |
IR_Builder.buildUntil(UntilNode untilNode,
IR_Scope s)
|
void |
IR_Builder.buildVariableArityArguments(java.util.List<Operand> args,
Node node,
IR_Scope s)
|
Operand |
IR_Builder.buildVCall(VCallNode node,
IR_Scope s)
public Operand buildVAlias(Node node, IR_Scope m) {
VAliasNode valiasNode = (VAliasNode) node;
m.aliasGlobal(valiasNode.getNewName(), valiasNode.getOldName());
} |
Operand |
IR_Builder.buildWhile(WhileNode whileNode,
IR_Scope s)
|
Operand |
IR_Builder.buildXStr(XStrNode node,
IR_Scope m)
|
Operand |
IR_Builder.buildYield(YieldNode node,
IR_Scope s)
|
Operand |
IR_Builder.buildZArray(Node node,
IR_Scope m)
|
Operand |
IR_Builder.buildZSuper(ZSuperNode zsuperNode,
IR_Scope s)
|
void |
CompilerTarget.codegen(IR_Scope scope)
|
Operand |
IR_Builder.receiveArgs(ArgsNode argsNode,
IR_Scope s)
|
java.util.List<Operand> |
IR_Builder.setupCallArgs(Node args,
IR_Scope s)
|
java.util.List<Operand> |
IR_Builder.setupCallArgs(Node receiver,
Node args,
IR_Scope s)
|