Package org.apache.jdo.impl.enhancer.classfile

Examples of org.apache.jdo.impl.enhancer.classfile.Insn


        //^olsen: exceptAttr != null ???

        // begin of method body
        final InsnTarget begin = new InsnTarget();
        Insn insn = begin;

        // store the sm field into local var
        insn = insn.append(Insn.create(opc_aload_0));
        insn = insn.append(
            Insn.create(
                opc_getfield,
                getjdoStateManagerFieldRef()));
        insn = insn.append(Insn.create(opc_astore_2));

        // test the sm field and call the sm if nonnull
        final InsnTarget check = new InsnTarget();
        insn = insn.append(Insn.create(opc_aload_2));
        insn = insn.append(Insn.create(opc_ifnull, check));

        // load 'this' on the stack
        insn = insn.append(Insn.create(opc_aload_0));

        // call the sm's method with 'this' and 'sm' arguments
        insn = insn.append(Insn.create(opc_aload_2));
        insn = insn.append(Insn.create(opc_aload_0));
        insn = insn.append(Insn.create(opc_aload_1));
        insn = insn.append(
            new InsnInterfaceInvoke(
                pool.addInterfaceMethodRef(
                    JDO_StateManager_Path,
                    JDO_SM_replacingStateManager_Name,
                    JDO_SM_replacingStateManager_Sig),
                countMethodArgWords(JDO_SM_replacingStateManager_Sig)));

        // put result value to sm field and return
        insn = insn.append(
            Insn.create(opc_putfield,
                        getjdoStateManagerFieldRef()));
        insn = insn.append(Insn.create(opc_return));

        // invoke JDOImplHelper.checkAuthorizedStateManager with 'sm' argument
        insn = insn.append(check);
        insn = insn.append(Insn.create(opc_aload_1));
        insn = insn.append(
            Insn.create(opc_invokestatic,
                        pool.addMethodRef(
                            JDO_JDOImplHelper_Path,
                            JDO_JDOImplHelper_checkAuthorizedStateManager_Name,
                            JDO_JDOImplHelper_checkAuthorizedStateManager_Sig)));

        // put argument value to jdoStateManager field
        insn = insn.append(Insn.create(opc_aload_0));
        insn = insn.append(Insn.create(opc_aload_1));
        insn = insn.append(
            Insn.create(opc_putfield,
                        getjdoStateManagerFieldRef()));

        // reset flags to LOAD_REQUIRED
        insn = insn.append(Insn.create(opc_aload_0));
        insn = insn.append(Insn.create(opc_iconst_1));
        insn = insn.append(
            Insn.create(opc_putfield,
                        getjdoFlagsFieldRef()));

        // end of method body
        insn = insn.append(Insn.create(opc_return));

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                4, // maxStack
                                3, // maxLocals
View Full Code Here


        final int accessFlags = JDO_PC_jdoReplaceFlags_Mods;
        final ExceptionsAttribute exceptAttr = null;

        // begin of method body
        final InsnTarget begin = new InsnTarget();
        Insn insn = begin;

        // store the sm field into local var
        insn = insn.append(Insn.create(opc_aload_0));
        insn = insn.append(
            Insn.create(
                opc_getfield,
                getjdoStateManagerFieldRef()));
        insn = insn.append(Insn.create(opc_astore_1));

        // test the sm field and goto end if null
        final InsnTarget end = new InsnTarget();
        insn = insn.append(Insn.create(opc_aload_1));
        insn = insn.append(Insn.create(opc_ifnull, end));

        // load 'this' on the stack
        insn = insn.append(Insn.create(opc_aload_0));

        // call the sm's method with 'this' argument
        insn = insn.append(Insn.create(opc_aload_1));
        insn = insn.append(Insn.create(opc_aload_0));
        insn = insn.append(
            new InsnInterfaceInvoke(
                pool.addInterfaceMethodRef(
                    JDO_StateManager_Path,
                    JDO_SM_replacingFlags_Name,
                    JDO_SM_replacingFlags_Sig),
                countMethodArgWords(JDO_SM_replacingFlags_Sig)));

        // put result value to flags field
        insn = insn.append(
            Insn.create(opc_putfield,
                        getjdoFlagsFieldRef()));

        // end of method body
        insn = insn.append(end);
        insn = insn.append(Insn.create(opc_return));

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                3, // maxStack
                                2, // maxLocals
View Full Code Here

        final int accessFlags = JDO_PC_jdoMakeDirty_Mods;
        final ExceptionsAttribute exceptAttr = null;

        // begin of method body
        final InsnTarget begin = new InsnTarget();
        Insn insn = begin;

        // store the sm field into local var
        insn = insn.append(Insn.create(opc_aload_0));
        insn = insn.append(
            Insn.create(
                opc_getfield,
                getjdoStateManagerFieldRef()));
        insn = insn.append(Insn.create(opc_astore_2));

        // test the sm field and goto end if null
        final InsnTarget end = new InsnTarget();
        insn = insn.append(Insn.create(opc_aload_2));
        insn = insn.append(Insn.create(opc_ifnull, end));

        // call the sm's method with 'this' and 'fieldname' arguments
        insn = insn.append(Insn.create(opc_aload_2));
        insn = insn.append(Insn.create(opc_aload_0));
        insn = insn.append(Insn.create(opc_aload_1));
        insn = insn.append(
            new InsnInterfaceInvoke(
                pool.addInterfaceMethodRef(
                    JDO_StateManager_Path,
                    JDO_SM_makeDirty_Name,
                    JDO_SM_makeDirty_Sig),
                countMethodArgWords(JDO_SM_makeDirty_Sig)));

        // end of method body
        insn = insn.append(end);
        insn = insn.append(Insn.create(opc_return));

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                3, // maxStack
                                3, // maxLocals
View Full Code Here

        final int accessFlags = JDO_PC_jdoPreSerialize_Mods;
        final ExceptionsAttribute exceptAttr = null;

        // begin of method body
        final InsnTarget begin = new InsnTarget();
        Insn insn = begin;

        // store the sm field into local var
        insn = insn.append(Insn.create(opc_aload_0));
        insn = insn.append(
            Insn.create(
                opc_getfield,
                getjdoStateManagerFieldRef()));
        insn = insn.append(Insn.create(opc_astore_1));

        // test the sm field and goto end if null
        final InsnTarget end = new InsnTarget();
        insn = insn.append(Insn.create(opc_aload_1));
        insn = insn.append(Insn.create(opc_ifnull, end));

        // call the sm's method with 'this' argument
        insn = insn.append(Insn.create(opc_aload_1));
        insn = insn.append(Insn.create(opc_aload_0));
        insn = insn.append(
            new InsnInterfaceInvoke(
                pool.addInterfaceMethodRef(
                    JDO_StateManager_Path,
                    JDO_SM_preSerialize_Name,
                    JDO_SM_preSerialize_Sig),
                countMethodArgWords(JDO_SM_preSerialize_Sig)));

        // end of method body
        insn = insn.append(end);
        insn = insn.append(Insn.create(opc_return));

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                2, // maxStack
                                2, // maxLocals
View Full Code Here

TOP

Related Classes of org.apache.jdo.impl.enhancer.classfile.Insn

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.