⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 code.java

📁 是一款用JAVA 编写的编译器 具有很强的编译功能
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
	    state.push(syms.floatType);	    break;	case daload:	    state.pop(2);	    state.push(syms.doubleType);	    break;	case istore_0:	case istore_1:	case istore_2:	case istore_3:	case fstore_0:	case fstore_1:	case fstore_2:	case fstore_3:	case astore_0:	case astore_1:	case astore_2:	case astore_3:	case pop:	case lshr:	case lshl:	case lushr:	    state.pop(1);	    break;	case areturn:	case ireturn:	case freturn:	    assert state.nlocks == 0;	    state.pop(1);	    markDead();	    break;	case athrow:	    state.pop(1);	    markDead();	    break;	case lstore_0:	case lstore_1:	case lstore_2:	case lstore_3:	case dstore_0:	case dstore_1:	case dstore_2:	case dstore_3:	case pop2:	    state.pop(2);	    break;	case lreturn:	case dreturn:	    assert state.nlocks == 0;	    state.pop(2);	    markDead();	    break;	case dup:	    state.push(state.stack[state.stacksize-1]);	    break;	case return_:	    assert state.nlocks == 0;	    markDead();	    break;	case arraylength:	    state.pop(1);	    state.push(syms.intType);	    break;	case isub:	case iadd:	case imul:	case idiv:	case imod:	case ishl:	case ishr:	case iushr:	case iand:	case ior:	case ixor:	    state.pop(1);	    // state.pop(1);	    // state.push(syms.intType);	    break;	case aastore:	    state.pop(3);	    break;	case land:	case lor:	case lxor:	case lmod:	case ldiv:	case lmul:	case lsub:	case ladd:	    state.pop(2);	    break;	case lcmp:	    state.pop(4);	    state.push(syms.intType);	    break;	case l2i:	    state.pop(2);	    state.push(syms.intType);	    break;	case i2l:	    state.pop(1);	    state.push(syms.longType);	    break;	case i2f:	    state.pop(1);	    state.push(syms.floatType);	    break;	case i2d:	    state.pop(1);	    state.push(syms.doubleType);	    break;	case l2f:	    state.pop(2);	    state.push(syms.floatType);	    break;	case l2d:	    state.pop(2);	    state.push(syms.doubleType);	    break;	case f2i:	    state.pop(1);	    state.push(syms.intType);	    break;	case f2l:	    state.pop(1);	    state.push(syms.longType);	    break;	case f2d:	    state.pop(1);	    state.push(syms.doubleType);	    break;	case d2i:	    state.pop(2);	    state.push(syms.intType);	    break;	case d2l:	    state.pop(2);	    state.push(syms.longType);	    break;	case d2f:	    state.pop(2);	    state.push(syms.floatType);	    break;	case tableswitch:	case lookupswitch:	    state.pop(1);	    // the caller is responsible for patching up the state	    break;	case dup_x1: {	    Type val1 = state.pop1();	    Type val2 = state.pop1();	    state.push(val1);	    state.push(val2);	    state.push(val1);	    break;	}	case bastore:	    state.pop(3);	    break;	case int2byte:	case int2char:	case int2short:	    break;	case fmul:	case fadd:	case fsub:	case fdiv:	case fmod:	    state.pop(1);	    break;	case castore:	case iastore:	case fastore:	case sastore:	    state.pop(3);	    break;	case lastore:	case dastore:	    state.pop(4);	    break;	case dup2:	    if (state.stack[state.stacksize-1] != null) {		Type value1 = state.pop1();		Type value2 = state.pop1();		state.push(value2);		state.push(value1);		state.push(value2);		state.push(value1);	    } else {		Type value = state.pop2();		state.push(value);		state.push(value);	    }	    break;	case dup2_x1:	    if (state.stack[state.stacksize-1] != null) {		Type value1 = state.pop1();		Type value2 = state.pop1();		Type value3 = state.pop1();		state.push(value2);		state.push(value1);		state.push(value3);		state.push(value2);		state.push(value1);	    } else {		Type value1 = state.pop2();		Type value2 = state.pop1();		state.push(value1);		state.push(value2);		state.push(value1);	    }	    break;	case dup2_x2:	    if (state.stack[state.stacksize-1] != null) {		Type value1 = state.pop1();		Type value2 = state.pop1();		if (state.stack[state.stacksize-1] != null) {		    // form 1		    Type value3 = state.pop1();		    Type value4 = state.pop1();		    state.push(value2);		    state.push(value1);		    state.push(value4);		    state.push(value3);		    state.push(value2);		    state.push(value1);		} else {		    // form 3		    Type value3 = state.pop2();		    state.push(value2);		    state.push(value1);		    state.push(value3);		    state.push(value2);		    state.push(value1);		}	    } else {		Type value1 = state.pop2();		if (state.stack[state.stacksize-1] != null) {		    // form 2		    Type value2 = state.pop1();		    Type value3 = state.pop1();		    state.push(value1);		    state.push(value3);		    state.push(value2);		    state.push(value1);		} else {		    // form 4		    Type value2 = state.pop2();		    state.push(value1);		    state.push(value2);		    state.push(value1);		}	    }	    break;	case dup_x2: {	    Type value1 = state.pop1();	    if (state.stack[state.stacksize-1] != null) {		// form 1		Type value2 = state.pop1();		Type value3 = state.pop1();		state.push(value1);		state.push(value3);		state.push(value2);		state.push(value1);	    } else {		// form 2		Type value2 = state.pop2();		state.push(value1);		state.push(value2);		state.push(value1);	    }	}	    break;	case fcmpl:	case fcmpg:	    state.pop(2);	    state.push(syms.intType);	    break;	case dcmpl:	case dcmpg:	    state.pop(4);	    state.push(syms.intType);	    break;	case swap: {	    Type value1 = state.pop1();	    Type value2 = state.pop1();	    state.push(value1);	    state.push(value2);	    break;	}	case dadd:	case dsub:	case dmul:	case ddiv:	case dmod:	    state.pop(2);	    break;	case ret:	    markDead();	    break;	case wide:	    // must be handled by the caller.	    return;	case monitorenter:	case monitorexit:	    state.pop(1);	    break;	default:	    throw new AssertionError(mnem(op)); 	}	postop();    }    /** Emit an opcode with a one-byte operand field.     */    public void emitop1(int op, int od) {	emitop(op);	if (!alive) return;	emit1(od);	switch (op) {	case bipush:	    state.push(syms.intType);	    break;	case ldc1:	    state.push(typeForPool(pool.pool[od]));	    break;	default:	    throw new AssertionError(mnem(op));	}	postop();    }    /** The type of a constant pool entry. */    private Type typeForPool(Object o) {	if (o instanceof Integer) return syms.intType;	if (o instanceof Float) return syms.floatType;	if (o instanceof String) return syms.stringType;	if (o instanceof Long) return syms.longType;	if (o instanceof Double) return syms.doubleType;	if (o instanceof ClassSymbol) return syms.classType;	if (o instanceof Type.ArrayType) return syms.classType;	throw new AssertionError(o);    }    /** Emit an opcode with a one-byte operand field;     *  widen if field does not fit in a byte.     */    public void emitop1w(int op, int od) {	if (od > 0xFF) {	    emitop(wide);	    emitop(op);	    emit2(od);	} else {	    emitop(op);	    emit1(od);	}	if (!alive) return;	switch (op) {	case iload:	    state.push(syms.intType);	    break;	case lload:	    state.push(syms.longType);	    break;	case fload:	    state.push(syms.floatType);	    break;	case dload:	    state.push(syms.doubleType);	    break;	case aload:	    state.push(lvar[od].sym.type);	    break;	case lstore:	case dstore:	    state.pop(2);	    break;	case istore:	case fstore:	case astore:	    state.pop(1);	    break;	case ret:	    markDead();	    break;	default:	    throw new AssertionError(mnem(op));	}	postop();    }    /** Emit an opcode with two one-byte operand fields;     *  widen if either field does not fit in a byte.     */    public void emitop1w(int op, int od1, int od2) {	if (od1 > 0xFF || od2 < -128 || od2 > 127) {	    emitop(wide);	    emitop(op);	    emit2(od1);	    emit2(od2);	} else {	    emitop(op);	    emit1(od1);	    emit1(od2);	}	if (!alive) return;	switch (op) {	case iinc:	    break;	default:	    throw new AssertionError(mnem(op));	}    }    /** Emit an opcode with a two-byte operand field.     */    public void emitop2(int op, int od) {        emitop(op);	if (!alive) return;	emit2(od);	switch (op) {	case getstatic:	    state.push(((Symbol)(pool.pool[od])).erasure(types));	    break;	case putstatic:	    state.pop(((Symbol)(pool.pool[od])).erasure(types));	    break;	case new_:	    state.push(uninitializedObject(((Symbol)(pool.pool[od])).erasure(types), cp-3));	    break;	case sipush:	    state.push(syms.intType);	    break;	case if_acmp_null:	case if_acmp_nonnull:	case ifeq:	case ifne:	case iflt:	case ifge:	case ifgt:	case ifle:	    state.pop(1);	    break;	case if_icmpeq:	case if_icmpne:	case if_icmplt:	case if_icmpge:	case if_icmpgt:	case if_icmple:	case if_acmpeq:	case if_acmpne:	    state.pop(2);	    break;	case goto_:	    markDead();	    break;	case putfield:	    state.pop(((Symbol)(pool.pool[od])).erasure(types));	    state.pop(1); // object ref	    break;	case getfield:	    state.pop(1); // object ref	    state.push(((Symbol)(pool.pool[od])).erasure(types));	    break;	case checkcast: {	    state.pop(1); // object ref	    Object o = pool.pool[od];	    Type t = (o instanceof Symbol)		? ((Symbol)o).erasure(types)		: types.erasure(((Type)o));	    state.push(t);	    break; }	case ldc2w:	    state.push(typeForPool(pool.pool[od]));	    break;	case instanceof_:	    state.pop(1);	    state.push(syms.intType);	    break;	case ldc2:	    state.push(typeForPool(pool.pool[od]));	    break;	case jsr:	    break;	default:	    throw new AssertionError(mnem(op));	}	// postop();    }    /** Emit an opcode with a four-byte operand field.     */    public void emitop4(int op, int od) {        emitop(op);	if (!alive) return;	emit4(od);	switch (op) {	case goto_w:	    markDead();	    break;	case jsr_w:	    break;	default:	    throw new AssertionError(mnem(op));	}	// postop();    }    /** Align code pointer to next `incr' boundary.     */    public void align(int incr) {        if (alive)            while (cp % incr != 0) emitop0(nop);    }    /** Place a byte into code at address pc. Pre: pc + 1 <= cp.     */    private void put1(int pc, int op) {        code[pc] = (byte)op;    }    /** Place two bytes into code at address pc. Pre: pc + 2 <= cp.     */    private void put2(int pc, int od) {        // pre: pc + 2 <= cp        put1(pc, od >> 8);        put1(pc+1, od);    }    /** Place four  bytes into code at address pc. Pre: pc + 4 <= cp.     */    public void put4(int pc, int od) {        // pre: pc + 4 <= cp        put1(pc  , od >> 24);        put1(pc+1, od >> 16);        put1(pc+2, od >> 8);        put1(pc+3, od);    }    /** Return code byte at position pc as an unsigned int.     */    private int get1(int pc) {        return code[pc] & 0xFF;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -