Java Code Examples for com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: Mode.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void compileTemplateCalls(ClassGenerator classGen,
                                  MethodGenerator methodGen,
                                  InstructionHandle next, int min, int max){
    for (Template template : _neededTemplates.keySet()) {
        final int prec = template.getImportPrecedence();
        if ((prec >= min) && (prec < max)) {
            if (template.hasContents()) {
                InstructionList til = template.compile(classGen, methodGen);
                til.append(new GOTO_W(next));
                _templateILs.put(template, til);
                _templateIHs.put(template, til.getStart());
            }
            else {
                // empty template
                _templateIHs.put(template, next);
            }
        }
    }
}
 
Example #2
Source Project: openjdk-8   Author: bpupadhyaya   File: Text.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generates code that loads the array that will contain the character
 * data represented by this Text node, followed by the offset of the
 * data from the start of the array, and then the length of the data.
 *
 * The pre-condition to calling this method is that
 * canLoadAsArrayOffsetLength() returns true.
 * @see #canLoadArrayOffsetLength()
 */
public void loadAsArrayOffsetLength(ClassGenerator classGen,
                                    MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    final XSLTC xsltc = classGen.getParser().getXSLTC();

    // The XSLTC object keeps track of character data
    // that is to be stored in char arrays.
    final int offset = xsltc.addCharacterData(_text);
    final int length = _text.length();
    String charDataFieldName =
        STATIC_CHAR_DATA_FIELD + (xsltc.getCharacterDataCount()-1);

    il.append(new GETSTATIC(cpg.addFieldref(xsltc.getClassName(),
                                   charDataFieldName,
                                   STATIC_CHAR_DATA_FIELD_SIG)));
    il.append(new PUSH(cpg, offset));
    il.append(new PUSH(cpg, _text.length()));
}
 
Example #3
Source Project: TencentKona-8   Author: Tencent   File: PositionCall.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final InstructionList il = methodGen.getInstructionList();

    if (methodGen instanceof CompareGenerator) {
        il.append(((CompareGenerator)methodGen).loadCurrentNode());
    }
    else if (methodGen instanceof TestGenerator) {
        il.append(new ILOAD(POSITION_INDEX));
    }
    else {
        final ConstantPoolGen cpg = classGen.getConstantPool();
        final int index = cpg.addInterfaceMethodref(NODE_ITERATOR,
                                                   "getPosition",
                                                   "()I");

        il.append(methodGen.loadIterator());
        il.append(new INVOKEINTERFACE(index,1));
    }
}
 
Example #4
Source Project: openjdk-8   Author: bpupadhyaya   File: SyntaxTreeNode.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Call translate() on all child syntax tree nodes.
 * @param classGen BCEL Java class generator
 * @param methodGen BCEL Java method generator
 */
protected void translateContents(ClassGenerator classGen,
                                 MethodGenerator methodGen) {
    // Call translate() on all child nodes
    final int n = elementCount();

    for (int i = 0; i < n; i++) {
        methodGen.markChunkStart();
        final SyntaxTreeNode item = (SyntaxTreeNode)_contents.elementAt(i);
        item.translate(classGen, methodGen);
        methodGen.markChunkEnd();
    }

    // After translation, unmap any registers for any variables/parameters
    // that were declared in this scope. Performing this unmapping in the
    // same AST scope as the declaration deals with the problems of
    // references falling out-of-scope inside the for-each element.
    // (the cause of which being 'lazy' register allocation for references)
    for (int i = 0; i < n; i++) {
        if( _contents.elementAt(i) instanceof VariableBase) {
            final VariableBase var = (VariableBase)_contents.elementAt(i);
            var.unmapRegister(methodGen);
        }
    }
}
 
Example #5
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: FunctionCall.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Compile the function call and treat as an expression
 * Update true/false-lists.
 */
@Override
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen)
{
    Type type = Type.Boolean;
    if (_chosenMethodType != null)
        type = _chosenMethodType.resultType();

    final InstructionList il = methodGen.getInstructionList();
    translate(classGen, methodGen);

    if ((type instanceof BooleanType) || (type instanceof IntType)) {
        _falseList.add(il.append(new IFEQ(null)));
    }
}
 
Example #6
Source Project: Bytecoder   Author: mirkosertic   File: Predicate.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Translate a predicate expression. If non of the optimizations apply
 * then this translation pushes two references on the stack: a reference
 * to a newly created filter object and a reference to the predicate's
 * closure. See class <code>Step</code> for further details.
 */
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {

    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (_nthPositionFilter || _nthDescendant) {
        _exp.translate(classGen, methodGen);
    }
    else if (isNodeValueTest() && (getParent() instanceof Step)) {
        _value.translate(classGen, methodGen);
        il.append(new CHECKCAST(cpg.addClass(STRING_CLASS)));
        il.append(new PUSH(cpg, ((EqualityExpr)_exp).getOp()));
    }
    else {
        translateFilter(classGen, methodGen);
    }
}
 
Example #7
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: Text.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generates code that loads the array that will contain the character
 * data represented by this Text node, followed by the offset of the
 * data from the start of the array, and then the length of the data.
 *
 * The pre-condition to calling this method is that
 * canLoadAsArrayOffsetLength() returns true.
 * @see #canLoadArrayOffsetLength()
 */
public void loadAsArrayOffsetLength(ClassGenerator classGen,
                                    MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    final XSLTC xsltc = classGen.getParser().getXSLTC();

    // The XSLTC object keeps track of character data
    // that is to be stored in char arrays.
    final int offset = xsltc.addCharacterData(_text);
    final int length = _text.length();
    String charDataFieldName =
        STATIC_CHAR_DATA_FIELD + (xsltc.getCharacterDataCount()-1);

    il.append(new GETSTATIC(cpg.addFieldref(xsltc.getClassName(),
                                   charDataFieldName,
                                   STATIC_CHAR_DATA_FIELD_SIG)));
    il.append(new PUSH(cpg, offset));
    il.append(new PUSH(cpg, _text.length()));
}
 
Example #8
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: NumberCall.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final InstructionList il = methodGen.getInstructionList();
    Type targ;

    if (argumentCount() == 0) {
        il.append(methodGen.loadContextNode());
        targ = Type.Node;
    }
    else {
        final Expression arg = argument();
        arg.translate(classGen, methodGen);
        arg.startIterator(classGen, methodGen);
        targ = arg.getType();
    }

    if (!targ.identicalTo(Type.Real)) {
        targ.translateTo(classGen, methodGen, Type.Real);
    }
}
 
Example #9
Source Project: openjdk-8   Author: bpupadhyaya   File: FilterExpr.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void translateFilterExpr(ClassGenerator classGen,
                                 MethodGenerator methodGen,
                                 int predicateIndex) {
    if (predicateIndex >= 0) {
        translatePredicates(classGen, methodGen, predicateIndex);
    }
    else {
        _primary.translate(classGen, methodGen);
    }
}
 
Example #10
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: BooleanExpr.java    License: MIT License 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final InstructionList il = methodGen.getInstructionList();
    if (_value) {
        il.append(NOP);     // true list falls through
    }
    else {
        _falseList.add(il.append(new GOTO(null)));
    }
}
 
Example #11
Source Project: TencentKona-8   Author: Tencent   File: TopLevelElement.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translate this node into a fresh instruction list.
 * The original instruction list is saved and restored.
 */
public InstructionList compile(ClassGenerator classGen,
                               MethodGenerator methodGen) {
    final InstructionList result, save = methodGen.getInstructionList();
    methodGen.setInstructionList(result = new InstructionList());
    translate(classGen, methodGen);
    methodGen.setInstructionList(save);
    return result;
}
 
Example #12
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: NamespaceUriCall.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translate code that leaves a node's namespace URI (as a String)
 * on the stack
 */
public void translate(ClassGenerator classGen,
                      MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Returns the string value for a node in the DOM
    final int getNamespace = cpg.addInterfaceMethodref(DOM_INTF,
                                                       "getNamespaceName",
                                                       "(I)"+STRING_SIG);
    super.translate(classGen, methodGen);
    il.append(new INVOKEINTERFACE(getNamespace, 2));
}
 
Example #13
Source Project: hottub   Author: dsrg-uoft   File: VariableBase.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Map this variable to a register
 */
public void mapRegister(MethodGenerator methodGen) {
    if (_local == null) {
        final InstructionList il = methodGen.getInstructionList();
        final String name = getEscapedName(); // TODO: namespace ?
        final com.sun.org.apache.bcel.internal.generic.Type varType = _type.toJCType();
        _local = methodGen.addLocalVariable2(name, varType, il.getEnd());
    }
}
 
Example #14
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: UnparsedEntityUriCall.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    // Feck the this pointer on the stack...
    il.append(methodGen.loadDOM());
    // ...then the entity name...
    _entity.translate(classGen, methodGen);
    // ...to get the URI from the DOM object.
    il.append(new INVOKEINTERFACE(
                     cpg.addInterfaceMethodref(DOM_INTF,
                                               GET_UNPARSED_ENTITY_URI,
                                               GET_UNPARSED_ENTITY_URI_SIG),
                     2));
}
 
Example #15
Source Project: TencentKona-8   Author: Tencent   File: VariableBase.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Map this variable to a register
 */
public void mapRegister(MethodGenerator methodGen) {
    if (_local == null) {
        final InstructionList il = methodGen.getInstructionList();
        final String name = getEscapedName(); // TODO: namespace ?
        final com.sun.org.apache.bcel.internal.generic.Type varType = _type.toJCType();
        _local = methodGen.addLocalVariable2(name, varType, il.getEnd());
    }
}
 
Example #16
Source Project: TencentKona-8   Author: Tencent   File: Expression.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translate this node into a fresh instruction list.
 * The original instruction list is saved and restored.
 */
public final InstructionList compile(ClassGenerator classGen,
                                     MethodGenerator methodGen) {
    final InstructionList result, save = methodGen.getInstructionList();
    methodGen.setInstructionList(result = new InstructionList());
    translate(classGen, methodGen);
    methodGen.setInstructionList(save);
    return result;
}
 
Example #17
Source Project: openjdk-8   Author: bpupadhyaya   File: FormatNumberCall.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    _value.translate(classGen, methodGen);
    _format.translate(classGen, methodGen);

    final int fn3arg = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                        "formatNumber",
                                        "(DLjava/lang/String;"+
                                        "Ljava/text/DecimalFormat;)"+
                                        "Ljava/lang/String;");
    final int get = cpg.addMethodref(TRANSLET_CLASS,
                                     "getDecimalFormat",
                                     "(Ljava/lang/String;)"+
                                     "Ljava/text/DecimalFormat;");

    il.append(classGen.loadTranslet());
    if (_name == null) {
        il.append(new PUSH(cpg, EMPTYSTRING));
    }
    else if (_resolvedQName != null) {
        il.append(new PUSH(cpg, _resolvedQName.toString()));
    }
    else {
        _name.translate(classGen, methodGen);
    }
    il.append(new INVOKEVIRTUAL(get));
    il.append(new INVOKESTATIC(fn3arg));
}
 
Example #18
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: RoundCall.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    // Get two copies of the argument on the stack
    argument().translate(classGen, methodGen);
            il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                                        "roundF", "(D)D")));
}
 
Example #19
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: AlternativePattern.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final InstructionList il = methodGen.getInstructionList();

    _left.translate(classGen, methodGen);
    final InstructionHandle gotot = il.append(new GOTO(null));
    il.append(methodGen.loadContextNode());
    _right.translate(classGen, methodGen);

    _left._trueList.backPatch(gotot);
    _left._falseList.backPatch(gotot.getNext());

    _trueList.append(_right._trueList.add(gotot));
    _falseList.append(_right._falseList);
}
 
Example #20
Source Project: Bytecoder   Author: mirkosertic   File: ContainsCall.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Compile expression and update true/false-lists
 */
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    _base.translate(classGen, methodGen);
    _token.translate(classGen, methodGen);
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS,
                                                 "indexOf",
                                                 "("+STRING_SIG+")I")));
    _falseList.add(il.append(new IFLT(null)));
}
 
Example #21
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: XslElement.java    License: MIT License 5 votes vote down vote up
/**
 * Override this method to make sure that xsl:attributes are not
 * copied to output if this xsl:element is to be ignored
 */
public void translateContents(ClassGenerator classGen,
                              MethodGenerator methodGen) {
    final int n = elementCount();
    for (int i = 0; i < n; i++) {
        final SyntaxTreeNode item = getContents().get(i);
        if (_ignore && item instanceof XslAttribute) continue;
        item.translate(classGen, methodGen);
    }
}
 
Example #22
Source Project: openjdk-8   Author: bpupadhyaya   File: ContainsCall.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Compile expression and update true/false-lists
 */
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    _base.translate(classGen, methodGen);
    _token.translate(classGen, methodGen);
    il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS,
                                                 "indexOf",
                                                 "("+STRING_SIG+")I")));
    _falseList.add(il.append(new IFLT(null)));
}
 
Example #23
Source Project: openjdk-8-source   Author: keerath   File: Whitespace.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Compiles the predicate method
 */
private static void compileDefault(int defaultAction,
                                   ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = new InstructionList();
    final XSLTC xsltc = classGen.getParser().getXSLTC();

    // private boolean Translet.stripSpace(int type) - cannot be static
    final MethodGenerator stripSpace =
        new MethodGenerator(ACC_PUBLIC | ACC_FINAL ,
                    com.sun.org.apache.bcel.internal.generic.Type.BOOLEAN,
                    new com.sun.org.apache.bcel.internal.generic.Type[] {
                        Util.getJCRefType(DOM_INTF_SIG),
                        com.sun.org.apache.bcel.internal.generic.Type.INT,
                        com.sun.org.apache.bcel.internal.generic.Type.INT
                    },
                    new String[] { "dom","node","type" },
                    "stripSpace",classGen.getClassName(),il,cpg);

    classGen.addInterface("com/sun/org/apache/xalan/internal/xsltc/StripFilter");

    if (defaultAction == STRIP_SPACE)
        il.append(ICONST_1);
    else
        il.append(ICONST_0);
    il.append(IRETURN);

    classGen.addMethod(stripSpace);
}
 
Example #24
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: EqualityExpr.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final Type tleft = _left.getType();
    final InstructionList il = methodGen.getInstructionList();

    if (tleft instanceof BooleanType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);
    _falseList.add(il.append(_op == Operators.EQ ?
                                 (BranchInstruction)new IF_ICMPNE(null) :
                                 (BranchInstruction)new IF_ICMPEQ(null)));
    }
    else if (tleft instanceof NumberType) {
        _left.translate(classGen, methodGen);
        _right.translate(classGen, methodGen);

        if (tleft instanceof RealType) {
            il.append(DCMPG);
    _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IFNE(null) :
                                     (BranchInstruction)new IFEQ(null)));
        }
        else {
        _falseList.add(il.append(_op == Operators.EQ ?
                                     (BranchInstruction)new IF_ICMPNE(null) :
                                     (BranchInstruction)new IF_ICMPEQ(null)));
        }
    }
    else {
        translate(classGen, methodGen);
        desynthesize(classGen, methodGen);
    }
}
 
Example #25
Source Project: jdk8u60   Author: chenghanpeng   File: BooleanExpr.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final InstructionList il = methodGen.getInstructionList();
    if (_value) {
        il.append(NOP);     // true list falls through
    }
    else {
        _falseList.add(il.append(new GOTO(null)));
    }
}
 
Example #26
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: BooleanExpr.java    License: Apache License 2.0 5 votes vote down vote up
public void translateDesynthesized(ClassGenerator classGen,
                                   MethodGenerator methodGen) {
    final InstructionList il = methodGen.getInstructionList();
    if (_value) {
        il.append(NOP);     // true list falls through
    }
    else {
        _falseList.add(il.append(new GOTO(null)));
    }
}
 
Example #27
Source Project: hottub   Author: dsrg-uoft   File: TopLevelElement.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translate this node into a fresh instruction list.
 * The original instruction list is saved and restored.
 */
public InstructionList compile(ClassGenerator classGen,
                               MethodGenerator methodGen) {
    final InstructionList result, save = methodGen.getInstructionList();
    methodGen.setInstructionList(result = new InstructionList());
    translate(classGen, methodGen);
    methodGen.setInstructionList(save);
    return result;
}
 
Example #28
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: Whitespace.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Compiles the predicate method
 */
private static void compileDefault(int defaultAction,
                                   ClassGenerator classGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = new InstructionList();
    final XSLTC xsltc = classGen.getParser().getXSLTC();

    // private boolean Translet.stripSpace(int type) - cannot be static
    final MethodGenerator stripSpace =
        new MethodGenerator(ACC_PUBLIC | ACC_FINAL ,
                    com.sun.org.apache.bcel.internal.generic.Type.BOOLEAN,
                    new com.sun.org.apache.bcel.internal.generic.Type[] {
                        Util.getJCRefType(DOM_INTF_SIG),
                        com.sun.org.apache.bcel.internal.generic.Type.INT,
                        com.sun.org.apache.bcel.internal.generic.Type.INT
                    },
                    new String[] { "dom","node","type" },
                    "stripSpace",classGen.getClassName(),il,cpg);

    classGen.addInterface("com/sun/org/apache/xalan/internal/xsltc/StripFilter");

    if (defaultAction == STRIP_SPACE)
        il.append(ICONST_1);
    else
        il.append(ICONST_0);
    il.append(IRETURN);

    classGen.addMethod(stripSpace);
}
 
Example #29
Source Project: Bytecoder   Author: mirkosertic   File: FormatNumberCall.java    License: Apache License 2.0 5 votes vote down vote up
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    _value.translate(classGen, methodGen);
    _format.translate(classGen, methodGen);

    final int fn3arg = cpg.addMethodref(BASIS_LIBRARY_CLASS,
                                        "formatNumber",
                                        "(DLjava/lang/String;"+
                                        "Ljava/text/DecimalFormat;)"+
                                        "Ljava/lang/String;");
    final int get = cpg.addMethodref(TRANSLET_CLASS,
                                     "getDecimalFormat",
                                     "(Ljava/lang/String;)"+
                                     "Ljava/text/DecimalFormat;");

    il.append(classGen.loadTranslet());
    if (_name == null) {
        il.append(new PUSH(cpg, EMPTYSTRING));
    }
    else if (_resolvedQName != null) {
        il.append(new PUSH(cpg, _resolvedQName.toString()));
    }
    else {
        _name.translate(classGen, methodGen);
    }
    il.append(new INVOKEVIRTUAL(get));
    il.append(new INVOKESTATIC(fn3arg));
}
 
Example #30
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: Expression.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Translate this node into a fresh instruction list.
 * The original instruction list is saved and restored.
 */
public final InstructionList compile(ClassGenerator classGen,
                                     MethodGenerator methodGen) {
    final InstructionList result, save = methodGen.getInstructionList();
    methodGen.setInstructionList(result = new InstructionList());
    translate(classGen, methodGen);
    methodGen.setInstructionList(save);
    return result;
}