public class IRBuilder
extends java.lang.Object
Constructor and Description |
---|
IRBuilder() |
Modifier and Type | Method and Description |
---|---|
Operand |
build(Node node,
IRScope m) |
Operand |
buildAlias(AliasNode alias,
IRScope s) |
Operand |
buildAnd(AndNode andNode,
IRScope m) |
void |
buildArgs(java.util.List<Operand> argsList,
Node args,
IRScope s) |
Operand |
buildArgsCat(ArgsCatNode argsCatNode,
IRScope s) |
void |
buildArgsCatArguments(java.util.List<Operand> args,
ArgsCatNode argsCatNode,
IRScope s) |
Operand |
buildArgsPush(ArgsPushNode node,
IRScope m) |
void |
buildArgsPushArguments(java.util.List<Operand> args,
ArgsPushNode argsPushNode,
IRScope m) |
void |
buildArguments(java.util.List<Operand> args,
Node node,
IRScope s) |
Operand |
buildArray(Node node,
IRScope m) |
void |
buildArrayArguments(java.util.List<Operand> args,
Node node,
IRScope s) |
void |
buildAssignment(Node node,
IRScope s,
Operand values,
int argIndex,
boolean isSplat) |
static Node |
buildAST(boolean isCommandLineScript,
java.lang.String arg) |
Operand |
buildAttrAssignAssignment(Node node,
IRScope s,
Operand value) |
Operand |
buildBackref(BackRefNode node,
IRScope m) |
Operand |
buildBegin(BeginNode beginNode,
IRScope s) |
Operand |
buildBignum(BignumNode node,
IRScope s) |
Operand |
buildBlock(BlockNode node,
IRScope s) |
void |
buildBlockArgsAssignment(Node node,
IRScope s,
int argIndex,
boolean isSplat) |
Operand |
buildBreak(BreakNode breakNode,
IRExecutionScope s) |
Operand |
buildCall(CallNode callNode,
IRScope s) |
Operand |
buildCase(CaseNode caseNode,
IRScope m) |
Operand |
buildClass(ClassNode classNode,
IRScope s)
Build a new class and add it to the current scope (s).
|
Operand |
buildClassVar(ClassVarNode node,
IRScope s) |
Operand |
buildClassVarAsgn(ClassVarAsgnNode classVarAsgnNode,
IRScope s) |
Operand |
buildClassVarDecl(ClassVarDeclNode classVarDeclNode,
IRScope s) |
Operand |
buildColon2(Colon2Node iVisited,
IRScope s) |
Operand |
buildColon3(Colon3Node node,
IRScope s) |
Operand |
buildConstDecl(ConstDeclNode node,
IRScope s) |
Operand |
buildConstDeclAssignment(ConstDeclNode constDeclNode,
IRScope s,
Operand val) |
Operand |
buildDAsgn(DAsgnNode dasgnNode,
IRScope s) |
Operand |
buildDefined(Node node,
IRScope m) |
Operand |
buildDefn(MethodDefNode node,
IRScope s) |
Operand |
buildDefs(DefsNode node,
IRScope s) |
Operand |
buildDot(DotNode dotNode,
IRScope s) |
Operand |
buildDRegexp(DRegexpNode dregexpNode,
IRScope s) |
Operand |
buildDStr(DStrNode dstrNode,
IRScope s) |
Operand |
buildDSymbol(Node node,
IRScope s) |
Operand |
buildDVar(DVarNode node,
IRScope m) |
Operand |
buildDXStr(DXStrNode dstrNode,
IRScope m) |
Operand |
buildEnsureNode(Node node,
IRScope m) |
Operand |
buildEvStr(EvStrNode node,
IRScope s) |
Operand |
buildFalse(Node node,
IRScope s) |
Operand |
buildFCall(FCallNode fcallNode,
IRScope s) |
Operand |
buildFixnum(FixnumNode node,
IRScope m) |
Operand |
buildFloat(FloatNode node,
IRScope m)
public Operand buildFlip(Node node, IRScope m) {
final FlipNode flipNode = (FlipNode) node;
m.getVariableCompiler().retrieveLocalVariable(flipNode.getIndex(), flipNode.getDepth());
if (flipNode.isExclusive()) {
m.performBooleanBranch(new BranchCallback() {
public void branch(IRScope m) {
build(flipNode.getEndNode(), m,true);
m.performBooleanBranch(new BranchCallback() {
public void branch(IRScope m) {
m.loadFalse();
m.getVariableCompiler().assignLocalVariable(flipNode.getIndex(), flipNode.getDepth(), false);
}
}, new BranchCallback() {
public void branch(IRScope m) {
}
});
m.loadTrue();
}
}, new BranchCallback() {
public void branch(IRScope m) {
build(flipNode.getBeginNode(), m,true);
becomeTrueOrFalse(m);
m.getVariableCompiler().assignLocalVariable(flipNode.getIndex(), flipNode.getDepth(), true);
}
});
} else {
m.performBooleanBranch(new BranchCallback() {
public void branch(IRScope m) {
build(flipNode.getEndNode(), m,true);
m.performBooleanBranch(new BranchCallback() {
public void branch(IRScope m) {
m.loadFalse();
m.getVariableCompiler().assignLocalVariable(flipNode.getIndex(), flipNode.getDepth(), false);
}
}, new BranchCallback() {
public void branch(IRScope m) {
}
});
m.loadTrue();
}
}, new BranchCallback() {
public void branch(IRScope m) {
build(flipNode.getBeginNode(), m,true);
m.performBooleanBranch(new BranchCallback() {
public void branch(IRScope m) {
build(flipNode.getEndNode(), m,true);
flipTrueOrFalse(m);
m.getVariableCompiler().assignLocalVariable(flipNode.getIndex(), flipNode.getDepth(), false);
m.loadTrue();
}
}, new BranchCallback() {
public void branch(IRScope m) {
m.loadFalse();
}
});
}
});
}
// TODO: don't require pop
if (!expr) m.consumeCurrentValue();
}
private void becomeTrueOrFalse(IRScope m) {
m.performBooleanBranch(new BranchCallback() {
public void branch(IRScope m) {
m.loadTrue();
}
}, new BranchCallback() {
public void branch(IRScope m) {
m.loadFalse();
}
});
}
private void flipTrueOrFalse(IRScope m) {
m.performBooleanBranch(new BranchCallback() {
public void branch(IRScope m) {
m.loadFalse();
}
}, new BranchCallback() {
public void branch(IRScope m) {
m.loadTrue();
}
});
}
|
Operand |
buildFor(ForNode forNode,
IRExecutionScope m) |
Operand |
buildForIter(ForNode forNode,
IRExecutionScope s) |
Operand |
buildGetArgumentDefinition(Node node,
IRScope m,
java.lang.String type) |
Operand |
buildGetDefinition(Node node,
IRScope s) |
Operand |
buildGetDefinitionBase(Node node,
IRScope m) |
Operand |
buildGlobalAsgn(GlobalAsgnNode globalAsgnNode,
IRScope m) |
Operand |
buildGlobalVar(GlobalVarNode node,
IRScope m) |
Operand |
buildHash(HashNode hashNode,
IRScope m) |
Operand |
buildIf(IfNode ifNode,
IRScope s) |
Operand |
buildInstAsgn(InstAsgnNode instAsgnNode,
IRScope s) |
Operand |
buildInstVar(InstVarNode node,
IRScope m) |
Operand |
buildIter(IterNode iterNode,
IRExecutionScope s) |
Operand |
buildLiteral(LiteralNode literalNode,
IRScope s) |
Operand |
buildLocalAsgn(LocalAsgnNode localAsgnNode,
IRScope s) |
Operand |
buildLocalVar(LocalVarNode node,
IRScope s) |
Operand |
buildMatch(MatchNode matchNode,
IRScope m) |
Operand |
buildMatch2(Match2Node matchNode,
IRScope m) |
Operand |
buildMatch3(Match3Node matchNode,
IRScope m) |
Operand |
buildModule(ModuleNode moduleNode,
IRScope s) |
Operand |
buildMultipleAsgn(MultipleAsgnNode multipleAsgnNode,
IRScope s) |
void |
buildMultipleAsgnAssignment(MultipleAsgnNode multipleAsgnNode,
IRScope s,
Operand values) |
Operand |
buildNewline(NewlineNode node,
IRScope s) |
Operand |
buildNext(NextNode nextNode,
IRExecutionScope s) |
Operand |
buildNil(Node node,
IRScope m) |
Operand |
buildNot(NotNode node,
IRScope m) |
Operand |
buildNthRef(NthRefNode nthRefNode,
IRScope m) |
Operand |
buildOpAsgn(OpAsgnNode opAsgnNode,
IRScope s) |
Operand |
buildOpAsgnAnd(OpAsgnAndNode andNode,
IRScope s) |
Operand |
buildOpAsgnOr(OpAsgnOrNode orNode,
IRScope s) |
Operand |
buildOpElementAsgn(Node node,
IRScope m) |
Operand |
buildOpElementAsgnWithAnd(Node node,
IRScope s) |
Operand |
buildOpElementAsgnWithMethod(Node node,
IRScope s) |
Operand |
buildOpElementAsgnWithOr(Node node,
IRScope s) |
Operand |
buildOr(OrNode orNode,
IRScope m) |
Operand |
buildRedo(Node node,
IRExecutionScope s)
public Operand buildPostExe(Node node, IRScope m) {
final PostExeNode postExeNode = (PostExeNode) node;
// create the closure class and instantiate it
final CompilerCallback closureBody = new CompilerCallback() {
public void call(IRScope m) {
if (postExeNode.getBodyNode() != null) {
build(postExeNode.getBodyNode(), m, true);
} else {
m.loadNil();
}
}
};
m.createNewEndBlock(closureBody);
}
public Operand buildPreExe(Node node, IRScope m) {
final PreExeNode preExeNode = (PreExeNode) node;
// create the closure class and instantiate it
final CompilerCallback closureBody = new CompilerCallback() {
public void call(IRScope m) {
if (preExeNode.getBodyNode() != null) {
build(preExeNode.getBodyNode(), m,true);
} else {
m.loadNil();
}
}
};
m.runBeginBlock(preExeNode.getScope(), closureBody);
}
|
Operand |
buildRegexp(RegexpNode reNode,
IRScope m) |
Operand |
buildRescue(Node node,
IRScope m) |
Operand |
buildRetry(Node node,
IRScope s) |
Operand |
buildReturn(ReturnNode returnNode,
IRScope m) |
IRScope |
buildRoot(RootNode rootNode) |
Operand |
buildSClass(SClassNode sclassNode,
IRScope s) |
Operand |
buildSelf(Node node,
IRScope s) |
void |
buildSpecificArityArguments(java.util.List<Operand> args,
Node node,
IRScope s) |
Operand |
buildSplat(SplatNode splatNode,
IRScope s) |
void |
buildSplatArguments(java.util.List<Operand> args,
SplatNode node,
IRScope s) |
Operand |
buildStr(StrNode strNode,
IRScope s) |
Operand |
buildSuper(SuperNode superNode,
IRScope s) |
Operand |
buildSValue(SValueNode node,
IRScope s) |
Operand |
buildSymbol(SymbolNode node,
IRScope s) |
Operand |
buildToAry(ToAryNode node,
IRScope s) |
Operand |
buildTrue(Node node,
IRScope m) |
java.lang.String |
buildType(Node typeNode) |
Operand |
buildUndef(Node node,
IRScope m) |
Operand |
buildUntil(UntilNode untilNode,
IRExecutionScope s) |
Operand |
buildVAlias(Node node,
IRScope m) |
void |
buildVariableArityArguments(java.util.List<Operand> args,
Node node,
IRScope s) |
Operand |
buildVCall(VCallNode node,
IRScope s) |
Operand |
buildWhile(WhileNode whileNode,
IRExecutionScope s) |
Operand |
buildXStr(XStrNode node,
IRScope m) |
Operand |
buildYield(YieldNode node,
IRScope s) |
Operand |
buildZArray(Node node,
IRScope m) |
Operand |
buildZSuper(ZSuperNode zsuperNode,
IRScope s) |
Operand |
generateJRubyUtilityCall(IRScope m,
MethAddr meth,
Operand receiver,
Operand[] args) |
static void |
main(java.lang.String[] args) |
void |
receiveArgs(ArgsNode argsNode,
IRScope s) |
java.util.List<Operand> |
setupCallArgs(Node args,
IRScope s) |
Node |
skipOverNewlines(IRScope s,
Node n) |
public static void main(java.lang.String[] args)
public static Node buildAST(boolean isCommandLineScript, java.lang.String arg)
public Operand generateJRubyUtilityCall(IRScope m, MethAddr meth, Operand receiver, Operand[] args)
public void buildVariableArityArguments(java.util.List<Operand> args, Node node, IRScope s)
public void buildSpecificArityArguments(java.util.List<Operand> args, Node node, IRScope s)
public void buildAssignment(Node node, IRScope s, Operand values, int argIndex, boolean isSplat)
public void buildBlockArgsAssignment(Node node, IRScope s, int argIndex, boolean isSplat)
public Operand buildArgsCat(ArgsCatNode argsCatNode, IRScope s)
public Operand buildArgsPush(ArgsPushNode node, IRScope m)
public Operand buildAttrAssignAssignment(Node node, IRScope s, Operand value)
public Operand buildBackref(BackRefNode node, IRScope m)
public Operand buildBignum(BignumNode node, IRScope s)
public Operand buildBreak(BreakNode breakNode, IRExecutionScope s)
public Operand buildClass(ClassNode classNode, IRScope s)
public Operand buildSClass(SClassNode sclassNode, IRScope s)
public Operand buildClassVar(ClassVarNode node, IRScope s)
public Operand buildClassVarAsgn(ClassVarAsgnNode classVarAsgnNode, IRScope s)
public Operand buildClassVarDecl(ClassVarDeclNode classVarDeclNode, IRScope s)
public Operand buildConstDecl(ConstDeclNode node, IRScope s)
public Operand buildConstDeclAssignment(ConstDeclNode constDeclNode, IRScope s, Operand val)
public Operand buildColon2(Colon2Node iVisited, IRScope s)
public Operand buildColon3(Colon3Node node, IRScope s)
public Operand buildGetArgumentDefinition(Node node, IRScope m, java.lang.String type)
public Operand buildDefn(MethodDefNode node, IRScope s)
public java.lang.String buildType(Node typeNode)
public Operand buildDRegexp(DRegexpNode dregexpNode, IRScope s)
public Operand buildFixnum(FixnumNode node, IRScope m)
public Operand buildFloat(FloatNode node, IRScope m)
public Operand buildFor(ForNode forNode, IRExecutionScope m)
public Operand buildForIter(ForNode forNode, IRExecutionScope s)
public Operand buildGlobalAsgn(GlobalAsgnNode globalAsgnNode, IRScope m)
public Operand buildGlobalVar(GlobalVarNode node, IRScope m)
public Operand buildInstAsgn(InstAsgnNode instAsgnNode, IRScope s)
public Operand buildInstVar(InstVarNode node, IRScope m)
public Operand buildIter(IterNode iterNode, IRExecutionScope s)
public Operand buildLiteral(LiteralNode literalNode, IRScope s)
public Operand buildLocalAsgn(LocalAsgnNode localAsgnNode, IRScope s)
public Operand buildLocalVar(LocalVarNode node, IRScope s)
public Operand buildMatch2(Match2Node matchNode, IRScope m)
public Operand buildMatch3(Match3Node matchNode, IRScope m)
public Operand buildModule(ModuleNode moduleNode, IRScope s)
public Operand buildMultipleAsgn(MultipleAsgnNode multipleAsgnNode, IRScope s)
public void buildMultipleAsgnAssignment(MultipleAsgnNode multipleAsgnNode, IRScope s, Operand values)
public Operand buildNewline(NewlineNode node, IRScope s)
public Operand buildNext(NextNode nextNode, IRExecutionScope s)
public Operand buildNthRef(NthRefNode nthRefNode, IRScope m)
public Operand buildOpAsgn(OpAsgnNode opAsgnNode, IRScope s)
public Operand buildOpAsgnAnd(OpAsgnAndNode andNode, IRScope s)
public Operand buildOpAsgnOr(OpAsgnOrNode orNode, IRScope s)
public Operand buildRedo(Node node, IRExecutionScope s)
public Operand buildRegexp(RegexpNode reNode, IRScope m)
public Operand buildReturn(ReturnNode returnNode, IRScope m)
public Operand buildSValue(SValueNode node, IRScope s)
public Operand buildSymbol(SymbolNode node, IRScope s)
public Operand buildUntil(UntilNode untilNode, IRExecutionScope s)
public Operand buildWhile(WhileNode whileNode, IRExecutionScope s)
public Operand buildZSuper(ZSuperNode zsuperNode, IRScope s)
public void buildArgsCatArguments(java.util.List<Operand> args, ArgsCatNode argsCatNode, IRScope s)
public void buildArgsPushArguments(java.util.List<Operand> args, ArgsPushNode argsPushNode, IRScope m)
public void buildArrayArguments(java.util.List<Operand> args, Node node, IRScope s)
Copyright © 2002-2009 JRuby Team. All Rights Reserved.