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


Java Translator类代码示例

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


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

示例1: checkMethodCallable

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
/**
 * Verifies that the method is callable - it is not hosted, or has been deleted.
 */
private void checkMethodCallable(Method callee) {
    int offset = callee.getOffset();
    if (offset == Klass.ILLEGAL_METHOD_OFFSET) {
    	throw new NoSuchMethodError("Call to hosted or other no longer available method: " + Klass.toString(callee, false) + " in " + Klass.toString(method, false));
    }
    
    Klass klass = callee.getDefiningClass();
    if (klass.getState() >= Klass.STATE_CONVERTED && !callee.isAbstract()) {
        Object m = klass.getMethodObject(callee);
        if (m == null || Klass.isMissingMethodObject(m, callee.isStatic())) {
            if (Translator.FORCE_DME_ERRORS) {
                System.out.println("WARNING: Call to deleted method: " + Klass.toString(callee, false) + " in " + Klass.toString(method, false));
                System.out.println("    Leaving call in to test error handling");
                return;
            } else {
            	throw new NoSuchMethodError("Call to deleted method: " + Klass.toString(callee, false) + " in " + Klass.toString(method, false));
            }
        }
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:24,代码来源:InstructionEmitter.java

示例2: traceType

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
/**
 * Traces a type on the operand stack or in a local variable.
 *
 * @param type       the type to trace
 * @param prefix     the prefix to use if <code>isDerived</code> is true
 *                   otherwise a prefix of spaces the same length as
 *                   <code>prefix</code> is used instead
 * @param isDerived  specifies if this a type derived by the verifer or
 *                   is specified by a stack map entry
 */
private void traceType(Klass type, String prefix, boolean isDerived) {
    if (Translator.TRACING_ENABLED) {
        if (!isDerived) {
            char[] spaces = new char[prefix.length()];
            Arrays.fill(spaces, ' ');
            Tracer.trace(new String(spaces));
        } else {
            Tracer.trace(prefix);
        }
        String name = (type == null ? "-T-" : type.getInternalName());
        if (isDerived) {
            Tracer.traceln(" "+name);
        } else {
            Tracer.traceln("{"+name+"}");
        }
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:28,代码来源:Frame.java

示例3: traceStack

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
/**
 * Traces the state of the operand stack at the current verification
 * address.
 *
 * @param target  the stack map (if any) at the current verification address
 */
private void traceStack(Target target) {
    if (Translator.TRACING_ENABLED) {
        Klass[] map = target == null ? Klass.NO_CLASSES : target.getStack();
        int r = 0;  // index into recorded stack (i.e. from stack map)
        int d = 0;  // index into derived stack
        while (r < map.length || d < sp) {
            Klass derived  = (d < sp)         ? getStackTypeAt(d) : null;
            Klass recorded = (r < map.length) ? map[r]            : null;
            String prefix = "  stack["+r+"]: ";
            traceType(derived, prefix, true);
            if (recorded != null) {
                traceType(recorded, prefix, false);
            }
            ++r;
            ++d;
        }
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:25,代码来源:Frame.java

示例4: traceLocals

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
/**
 * Traces the state of the local variables at the current verification address.
 *
 * @param target  the stack map (if any) at the current verification address
 */
private void traceLocals(Target target) {
    if (Translator.TRACING_ENABLED) {
        Klass[] map = (target == null) ? Klass.NO_CLASSES : target.getLocals();
        int i = 0;
        int l = 0;
        while (i < map.length || l < localTypes.length) {
            Klass derived  = (l < localTypes.length) ? localTypes[l] : null;
            Klass recorded = (i < map.length)        ? map[i]        : null;
            String prefix  = "  local["+l+"]: ";
            traceType(derived, prefix, true);
            if (recorded != null) {
                traceType(recorded, prefix, false);
            }
            i++;
            l++;
        }
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:24,代码来源:Frame.java

示例5: traceFrameState

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
/**
 * Traces the frame state at the current verification address.
 *
 * @param  opcode   the opcode of the instruction at <code>address</code>
 * @param  address  the current verification address
 */
public void traceFrameState(int opcode, int address) {
    /*
     * Trace the recorded and derived types
     */
    if (Translator.TRACING_ENABLED) {
        Target target = null;
        try {
            target = codeParser.getTarget(address);
        } catch (NoClassDefFoundError e) {
            /* Just means there is no stack map at this address */
        }
        Tracer.traceln("Frame state @ "+address+" [ "+ Opcode.mnemonics[opcode]+" ]");
        traceLocals(target);
        traceStack(target);
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:23,代码来源:Frame.java

示例6: do_invoke

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
private void do_invoke(Method m, Klass t, Klass rtype) {
    frame.mayCauseGC();
    Klass params[] = m.getParameterTypes();
    if (Translator.REVERSE_PARAMETERS) {
        for (int i = 0; i < params.length; i++) {
            frame.pop(grow(params[i]));
        }
    } else {
        for (int i = params.length - 1; i >= 0; i--) {
            frame.pop(grow(params[i]));
        }
    }
    check(frame.isStackEmpty(), "stack not empty after popping parameters to callee");
    checkGeneralType(t, rtype);
    if (t != VOID) {
        frame.push(rtype);
    }
    frame.fallthrough();
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:20,代码来源:VerifierBase.java

示例7: do_invokesuper

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
protected void do_invokesuper(Klass t) {
    Klass superklass = (Klass)frame.popObject();
    Klass fklass = null;
    if (Translator.REVERSE_PARAMETERS) {
        fklass = frame.pop();
    } else {
        Vector stack = new Vector();
        while (!frame.isStackEmpty()) {
            fklass = frame.pop();
            stack.addElement(fklass);
        }
        for (int i = stack.size() - 2; i >= 0; i--) {
            frame.push((Klass)stack.elementAt(i));
        }
    }
    check(Frame.isAssignable(superklass, fklass), "invalid superclass");
    Method m = getVirtualMethod(superklass, iparm);
    do_invoke(m, t);
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:20,代码来源:VerifierBase.java

示例8: do_invokeslot

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
protected void do_invokeslot(Klass t) {
    frame.mayCauseGC();
    Method m = frame.popMethodSlot();
    if (Translator.REVERSE_PARAMETERS) {
        frame.pop(m.getDefiningClass());
    } else {
        Vector stack = new Vector();
        Klass fklass = null;
        while (!frame.isStackEmpty()) {
            fklass = frame.pop();
            stack.addElement(fklass);
        }
        check(Frame.isAssignable(m.getDefiningClass(), fklass), "input to invokeslot does not match input to findslot");
        for (int i = stack.size() - 2; i >= 0; i--) {
            frame.push((Klass)stack.elementAt(i));
        }
    }
    do_invoke(m, t);
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:20,代码来源:VerifierBase.java

示例9: initializeTranslator

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
/**
     * Creates and initializes the translator.
     *
     * @param classPath   the class search path
     */
    static void initializeTranslator(String classPath) {
        Suite suite = new Suite("-open-", null, Suite.EXTENDABLE_LIBRARY);
        Isolate isolate = new Isolate(null, null, suite);
        VM.setCurrentIsolate(isolate);

        isolate.setTranslator(new Translator());
        VM.translator = (Translator)isolate.getTranslator();
        VM.translator.open(suite, classPath);

//Tracer.enableFeature("loading");

        /*
         * Trigger the class initializer for java.lang.Klass. An error will have
         * occurred if it was triggered before this point.
         */
        Klass.TOP.getClass();
    }
 
开发者ID:tomatsu,项目名称:squawk,代码行数:23,代码来源:VM.java

示例10: InstructionEmitter

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param ir
 * @param classFile the class file for the method being converted
 * @param method    the method of the ir
 * @param clearedSlots the number of local variables (after the first one) that need clearing
 */
InstructionEmitter(IR ir, ClassFile classFile, Method method, int clearedSlots) {
    this.ir           = ir;
    this.classFile    = classFile;
    this.method       = method;
    this.clearedSlots = clearedSlots;
    this.trace        = Translator.TRACING_ENABLED && Tracer.isTracing("emitter", method.toString());

    if (VM.getCurrentIsolate().getLeafSuite().isBootstrap()) {
        isAppClass = !isSystemClass(classFile.getDefinedClass());
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:20,代码来源:InstructionEmitter.java

示例11: emitOpcode

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
/**
    * Emit the opcode.
    *
    * @param opcode the opcode
    */
   private void emitOpcode(int opcode) {
       if (opcode > 255) {
           emit(OPC.ESCAPE);
    Translator.opcodeSet.set(OPC.ESCAPE);
       }
       emit(opcode & 0xFF);
Translator.opcodeSet.set(opcode & 0xFF);
   }
 
开发者ID:tomatsu,项目名称:squawk,代码行数:14,代码来源:InstructionEmitter.java

示例12: emitWide0Opcode

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
/**
 * Emit a wide_0 instruction.
 *
 * @param opcode the opcode
 */
private void emitWide0Opcode(int opcode) {
    if (opcode < 256) {
        emit(OPC.WIDE_0);
 Translator.opcodeSet.set(OPC.WIDE_0);
 Translator.opcodeSet.set((opcode & 0xFF) + OPC.Properties.WIDE_DELTA);
    } else {
        emit(OPC.ESCAPE_WIDE_0);
 Translator.opcodeSet.set(OPC.ESCAPE_WIDE_0);
 Translator.opcodeSet.set((opcode & 0xFF) + OPC.Properties.ESCAPE_WIDE_DELTA);
    }
    emitOpcode(opcode & 0xFF);
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:18,代码来源:InstructionEmitter.java

示例13: emitWide1Opcode

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
/**
 * Emit a wide_1 instruction.
 *
 * @param opcode the opcode
 */
private void emitWide1Opcode(int opcode) {
    if (opcode < 256) {
        emit(OPC.WIDE_1);
 Translator.opcodeSet.set(OPC.WIDE_1);
 Translator.opcodeSet.set((opcode & 0xFF) + OPC.Properties.WIDE_DELTA);
    } else {
        emit(OPC.ESCAPE_WIDE_1);
 Translator.opcodeSet.set(OPC.ESCAPE_WIDE_1);
 Translator.opcodeSet.set((opcode & 0xFF) + OPC.Properties.ESCAPE_WIDE_DELTA);
    }
    emitOpcode(opcode & 0xFF);
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:18,代码来源:InstructionEmitter.java

示例14: emitWideM1Opcode

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
/**
 * Emit a wide_m1 instruction.
 *
 * @param opcode the opcode
 */
private void emitWideM1Opcode(int opcode) {
    if (opcode < 256) {
        emit(OPC.WIDE_M1);
 Translator.opcodeSet.set(OPC.WIDE_M1);
 Translator.opcodeSet.set((opcode & 0xFF) + OPC.Properties.WIDE_DELTA);
    } else {
        emit(OPC.ESCAPE_WIDE_M1);
 Translator.opcodeSet.set(OPC.ESCAPE_WIDE_M1);
 Translator.opcodeSet.set((opcode & 0xFF) + OPC.Properties.ESCAPE_WIDE_DELTA);
    }
    emitOpcode(opcode & 0xFF);
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:18,代码来源:InstructionEmitter.java

示例15: emitWideShortOpcode

import com.sun.squawk.translator.Translator; //导入依赖的package包/类
/**
 * Emit a wide_short instruction.
 *
 * @param opcode the opcode
 */
private void emitWideShortOpcode(int opcode) {
    if (opcode < 256) {
        emit(OPC.WIDE_SHORT);
 Translator.opcodeSet.set(OPC.WIDE_SHORT);
 Translator.opcodeSet.set((opcode & 0xFF) + OPC.Properties.WIDE_DELTA);
    } else {
        emit(OPC.ESCAPE_WIDE_SHORT);
 Translator.opcodeSet.set(OPC.ESCAPE_WIDE_SHORT);
 Translator.opcodeSet.set((opcode & 0xFF) + OPC.Properties.ESCAPE_WIDE_DELTA);
    }
    emitOpcode(opcode & 0xFF);
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:18,代码来源:InstructionEmitter.java


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