当前位置: 首页>>代码示例>>Java>>正文


Java Translator.BY_SUITE属性代码示例

本文整理汇总了Java中com.sun.squawk.translator.Translator.BY_SUITE属性的典型用法代码示例。如果您正苦于以下问题:Java Translator.BY_SUITE属性的具体用法?Java Translator.BY_SUITE怎么用?Java Translator.BY_SUITE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sun.squawk.translator.Translator的用法示例。


在下文中一共展示了Translator.BY_SUITE属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transform

/**
 * Do the transformations to the IR.
 */
public void transform(Translator translator) {
    boolean recordCalls = translator.getTranslationStrategy() >= Translator.BY_SUITE;

    /*
     * Pass 0 - Count the uses of every stack producer.
     */
    new IRUseCounter().count(ir);

    /*
     * Pass 1 - Iterate over the instructions to insert loads for stack values that must be spilt.
     */
    MethodDB.Entry callerEntry = null;
    if (recordCalls) {
        callerEntry = translator.methodDB.lookupMethodEntry(method);
    }
    Instruction instruction = ir.getHead();
    while (instruction != null) {
        oneOrMoreOperandsSpilt = false;
        instruction.visit(this);

        /*
         * The filling for reversing parameters is done here instead of doOperand.
         */
        if (instructionNeedParametersReversed(instruction)) {
            Invoke invoke = (Invoke)instruction;
            StackProducer[] parameters = invoke.getParameters();
            for (int i = parameters.length - 1; i >= 0; --i) {
                fillReversedParameters(invoke, parameters[i]);
            }
        }

        /*
         * Record method calls
         */
        if (recordCalls && instruction instanceof Invoke) {
            Invoke inv = (Invoke)instruction;
            translator.methodDB.recordMethodCall(callerEntry, inv.getMethod());
        }

        instruction = instruction.getNext();
    }

    /*
     * Pass 2 - Iterate over all the instructions to spill stack
     * values for the loads which were inserted in the previous pass.
     */
    for (instruction = ir.getHead() ; instruction != null ; instruction = instruction.getNext()) {

        /*
         * Spill the instruction's result if necessary.
         */
        if (instruction instanceof StackProducer) {
            StackProducer producer = (StackProducer)instruction;
            if (producer.isSpilt()) {
                Local local = producer.getSpillLocal();
                Assert.that(local != null);

                /*
                 * If the current instruction is the fill corresponding to the pending
                 * spill and the spill was not due to a dup or a phi merge, then
                 * cancel the spill and remove the fill
                 */
                if (!producer.isDuped() && !(producer instanceof StackMerge) && producer.getNext() instanceof LoadLocal) {
                    LoadLocal load = (LoadLocal)instruction.getNext();
                    if (load.getLocal() == local) {
                        ir.remove(load);
                        continue;
                    }
                }

                Instruction store = new StoreLocal(local, producer);
                ir.insertAfter(store, instruction);
                instruction = store;
            }
        }
    }

}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:81,代码来源:IRTransformer.java


注:本文中的com.sun.squawk.translator.Translator.BY_SUITE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。