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

📄 frame.java

📁 jboss规则引擎
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                push( interpreter.binaryOperation( insn,
                                                   value1,
                                                   value2 ) );
                break;
            case Opcodes.INEG :
            case Opcodes.LNEG :
            case Opcodes.FNEG :
            case Opcodes.DNEG :
                push( interpreter.unaryOperation( insn,
                                                  pop() ) );
                break;
            case Opcodes.ISHL :
            case Opcodes.LSHL :
            case Opcodes.ISHR :
            case Opcodes.LSHR :
            case Opcodes.IUSHR :
            case Opcodes.LUSHR :
            case Opcodes.IAND :
            case Opcodes.LAND :
            case Opcodes.IOR :
            case Opcodes.LOR :
            case Opcodes.IXOR :
            case Opcodes.LXOR :
                value2 = pop();
                value1 = pop();
                push( interpreter.binaryOperation( insn,
                                                   value1,
                                                   value2 ) );
                break;
            case Opcodes.IINC :
                var = ((IincInsnNode) insn).var;
                setLocal( var,
                          interpreter.unaryOperation( insn,
                                                      getLocal( var ) ) );
                break;
            case Opcodes.I2L :
            case Opcodes.I2F :
            case Opcodes.I2D :
            case Opcodes.L2I :
            case Opcodes.L2F :
            case Opcodes.L2D :
            case Opcodes.F2I :
            case Opcodes.F2L :
            case Opcodes.F2D :
            case Opcodes.D2I :
            case Opcodes.D2L :
            case Opcodes.D2F :
            case Opcodes.I2B :
            case Opcodes.I2C :
            case Opcodes.I2S :
                push( interpreter.unaryOperation( insn,
                                                  pop() ) );
                break;
            case Opcodes.LCMP :
            case Opcodes.FCMPL :
            case Opcodes.FCMPG :
            case Opcodes.DCMPL :
            case Opcodes.DCMPG :
                value2 = pop();
                value1 = pop();
                push( interpreter.binaryOperation( insn,
                                                   value1,
                                                   value2 ) );
                break;
            case Opcodes.IFEQ :
            case Opcodes.IFNE :
            case Opcodes.IFLT :
            case Opcodes.IFGE :
            case Opcodes.IFGT :
            case Opcodes.IFLE :
                interpreter.unaryOperation( insn,
                                            pop() );
                break;
            case Opcodes.IF_ICMPEQ :
            case Opcodes.IF_ICMPNE :
            case Opcodes.IF_ICMPLT :
            case Opcodes.IF_ICMPGE :
            case Opcodes.IF_ICMPGT :
            case Opcodes.IF_ICMPLE :
            case Opcodes.IF_ACMPEQ :
            case Opcodes.IF_ACMPNE :
                value2 = pop();
                value1 = pop();
                interpreter.binaryOperation( insn,
                                             value1,
                                             value2 );
                break;
            case Opcodes.GOTO :
                break;
            case Opcodes.JSR :
                push( interpreter.newOperation( insn ) );
                break;
            case Opcodes.RET :
                break;
            case Opcodes.TABLESWITCH :
            case Opcodes.LOOKUPSWITCH :
            case Opcodes.IRETURN :
            case Opcodes.LRETURN :
            case Opcodes.FRETURN :
            case Opcodes.DRETURN :
            case Opcodes.ARETURN :
                interpreter.unaryOperation( insn,
                                            pop() );
                break;
            case Opcodes.RETURN :
                break;
            case Opcodes.GETSTATIC :
                push( interpreter.newOperation( insn ) );
                break;
            case Opcodes.PUTSTATIC :
                interpreter.unaryOperation( insn,
                                            pop() );
                break;
            case Opcodes.GETFIELD :
                push( interpreter.unaryOperation( insn,
                                                  pop() ) );
                break;
            case Opcodes.PUTFIELD :
                value2 = pop();
                value1 = pop();
                interpreter.binaryOperation( insn,
                                             value1,
                                             value2 );
                break;
            case Opcodes.INVOKEVIRTUAL :
            case Opcodes.INVOKESPECIAL :
            case Opcodes.INVOKESTATIC :
            case Opcodes.INVOKEINTERFACE :
                values = new ArrayList();
                final String desc = ((MethodInsnNode) insn).desc;
                for ( int i = Type.getArgumentTypes( desc ).length; i > 0; --i ) {
                    values.add( 0,
                                pop() );
                }
                if ( insn.getOpcode() != Opcodes.INVOKESTATIC ) {
                    values.add( 0,
                                pop() );
                }
                if ( Type.getReturnType( desc ) == Type.VOID_TYPE ) {
                    interpreter.naryOperation( insn,
                                               values );
                } else {
                    push( interpreter.naryOperation( insn,
                                                     values ) );
                }
                break;
            case Opcodes.NEW :
                push( interpreter.newOperation( insn ) );
                break;
            case Opcodes.NEWARRAY :
            case Opcodes.ANEWARRAY :
            case Opcodes.ARRAYLENGTH :
                push( interpreter.unaryOperation( insn,
                                                  pop() ) );
                break;
            case Opcodes.ATHROW :
                interpreter.unaryOperation( insn,
                                            pop() );
                break;
            case Opcodes.CHECKCAST :
            case Opcodes.INSTANCEOF :
                push( interpreter.unaryOperation( insn,
                                                  pop() ) );
                break;
            case Opcodes.MONITORENTER :
            case Opcodes.MONITOREXIT :
                interpreter.unaryOperation( insn,
                                            pop() );
                break;
            case Opcodes.MULTIANEWARRAY :
                values = new ArrayList();
                for ( int i = ((MultiANewArrayInsnNode) insn).dims; i > 0; --i ) {
                    values.add( 0,
                                pop() );
                }
                push( interpreter.naryOperation( insn,
                                                 values ) );
                break;
            case Opcodes.IFNULL :
            case Opcodes.IFNONNULL :
                interpreter.unaryOperation( insn,
                                            pop() );
                break;
            default :
                throw new RuntimeException( "Illegal opcode" );
        }
    }

    /**
     * Merges this frame with the given frame.
     * 
     * @param frame a frame.
     * @param interpreter the interpreter used to merge values.
     * @return <tt>true</tt> if this frame has been changed as a result of the
     *         merge operation, or <tt>false</tt> otherwise.
     * @throws AnalyzerException if the frames have incompatible sizes.
     */
    public boolean merge(final Frame frame,
                         final Interpreter interpreter) throws AnalyzerException {
        if ( this.top != frame.top ) {
            throw new AnalyzerException( "Incompatible stack heights" );
        }
        boolean changes = false;
        for ( int i = 0; i < this.locals + this.top; ++i ) {
            final Value v = interpreter.merge( this.values[i],
                                               frame.values[i] );
            if ( v != this.values[i] ) {
                this.values[i] = v;
                changes |= true;
            }
        }
        return changes;
    }

    /**
     * Merges this frame with the given frame (case of a RET instruction).
     * 
     * @param frame a frame
     * @param access the local variables that have been accessed by the
     *        subroutine to which the RET instruction corresponds.
     * @return <tt>true</tt> if this frame has been changed as a result of the
     *         merge operation, or <tt>false</tt> otherwise.
     */
    public boolean merge(final Frame frame,
                         final boolean[] access) {
        boolean changes = false;
        for ( int i = 0; i < this.locals; ++i ) {
            if ( !access[i] && !this.values[i].equals( frame.values[i] ) ) {
                this.values[i] = frame.values[i];
                changes = true;
            }
        }
        return changes;
    }

    /**
     * Returns a string representation of this frame.
     * 
     * @return a string representation of this frame.
     */
    public String toString() {
        final StringBuffer b = new StringBuffer();
        for ( int i = 0; i < this.locals; ++i ) {
            b.append( this.values[i] ).append( ' ' );
        }
        b.append( ' ' );
        for ( int i = 0; i < this.top; ++i ) {
            b.append( this.values[i + this.locals].toString() ).append( ' ' );
        }
        return b.toString();
    }
}

⌨️ 快捷键说明

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