Examples of ExceptionTable


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

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                maxStack, // maxStack
                                3, // maxLocals
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());
        augmenter.addMethod(methodName, methodSig, accessFlags,
                            codeAttr, exceptAttr);
    }
View Full Code Here

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

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                maxStack, // maxStack
                                3, // maxLocals
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());
        augmenter.addMethod(methodName, methodSig, accessFlags,
                            codeAttr, exceptAttr);
    }
View Full Code Here

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

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                3, // maxStack
                                3, // maxLocals
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());
        augmenter.addMethod(methodName, methodSig, accessFlags,
                            codeAttr, exceptAttr);
    }
View Full Code Here

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

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                4, // maxStack
                                6, // maxLocals
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());
        augmenter.addMethod(methodName, methodSig, accessFlags,
                            codeAttr, exceptAttr);
    }
View Full Code Here

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

            final CodeAttribute codeAttr
                = new CodeAttribute(getCodeAttributeUtf8(),
                                    1, // maxStack
                                    1, // maxLocals
                                    begin,
                                    new ExceptionTable(),
                                    new AttributeVector());
            augmenter.addMethod(methodName, methodSig, accessFlags,
                                codeAttr, exceptAttr);
            return;
        }
        affirm(keyClassName != null);

        // push a newly created an instance of this class
        insn = insn.append(
            Insn.create(opc_new,
                        pool.addClass(keyClassName)));
        insn = insn.append(Insn.create(opc_dup));
        insn = insn.append(
            Insn.create(opc_invokespecial,
                        pool.addMethodRef(
                            keyClassName,
                            NameHelper.constructorName(),
                            NameHelper.constructorSig())));

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

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                2, // maxStack
                                1, // maxLocals
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());
        augmenter.addMethod(methodName, methodSig, accessFlags,
                            codeAttr, exceptAttr);
    }
View Full Code Here

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

            final CodeAttribute codeAttr
                = new CodeAttribute(getCodeAttributeUtf8(),
                                    1, // maxStack
                                    2, // maxLocals
                                    begin,
                                    new ExceptionTable(),
                                    new AttributeVector());
            augmenter.addMethod(methodName, methodSig, accessFlags,
                                codeAttr, exceptAttr);
            return;
        }
        affirm(keyClassName != null);

        // TODO: support for single field identity

        // push a newly created an instance of this class
        insn = insn.append(
            Insn.create(opc_new,
                        pool.addClass(keyClassName)));
        insn = insn.append(Insn.create(opc_dup));
        insn = insn.append(Insn.create(opc_aload_1));
        insn = insn.append(Insn.create(opc_checkcast,
                                       pool.addClass(JAVA_String_Path)));
        insn = insn.append(
            Insn.create(opc_invokespecial,
                        pool.addMethodRef(
                            keyClassName,
                            NameHelper.constructorName(),
                            NameHelper.constructorSig(JAVA_String_Sig))));

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

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                3, // maxStack
                                2, // maxLocals
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());
        augmenter.addMethod(methodName, methodSig, accessFlags,
                            codeAttr, exceptAttr);
    }
View Full Code Here

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

            final CodeAttribute codeAttr
                = new CodeAttribute(getCodeAttributeUtf8(),
                                    0, // maxStack
                                    2, // maxLocals
                                    begin,
                                    new ExceptionTable(),
                                    new AttributeVector());
            augmenter.addMethod(methodName, methodSig, accessFlags,
                                codeAttr, exceptAttr);
            return;
        }
        affirm(keyClassName != null);

        // check oid argument
        final ConstClass keyConstClass = pool.addClass(keyClassName);
        affirm(keyConstClass != null);
        insn = appendCheckVarInstanceOf(insn, 1, keyConstClass,
                                        JAVA_IllegalArgumentException_Path,
                                        "arg1");

        // downcast argument
        insn = insn.append(Insn.create(opc_aload_1));
        insn = insn.append(Insn.create(opc_checkcast, keyConstClass));
        insn = insn.append(Insn.create(opc_astore_2));

        // check argument or delegate to superclass
        final boolean isPCRoot = analyzer.isAugmentableAsRoot();
        if (!isPCRoot) {
            // call super.jdoCopyKeyFieldsToObjectId(oid)

            //^olsen: javac uses the truelly declaring class
            //final ConstClass superConstClass = classFile.superName();
            //affirm(superConstClass != null);
            //final String superClassName = superConstClass.asString();
            //affirm(superClassName != null);

            final String superClassName
                = analyzer.getPCSuperKeyOwnerClassName();
            affirm(superClassName != null);
            insn = insn.append(Insn.create(opc_aload_0));
            insn = insn.append(Insn.create(opc_aload_2));
            insn = insn.append(
                Insn.create(opc_invokespecial,
                            pool.addMethodRef(
                                superClassName,
                                methodName,
                                methodSig)));
        }
       
        // get types of and field references of the key fields
        final int keyFieldCount = analyzer.getKeyFieldCount();
        final ConstFieldRef[] keyFieldRefs = getKeyFieldRefs();
        final ConstFieldRef[] keyClassKeyFieldRefs = getKeyClassKeyFieldRefs();
        affirm(keyFieldRefs.length == keyFieldCount);
        affirm(keyClassKeyFieldRefs.length == keyFieldCount);

        // generate the assignment statements
        int maxFieldSize = 0;
        for (int i = 0; i < keyFieldCount; i++) {
            // assign key field
            final ConstFieldRef thisClassKeyRef = keyFieldRefs[i];
            final ConstFieldRef keyClassKeyRef = keyClassKeyFieldRefs[i];
            affirm(thisClassKeyRef != null);
            affirm(keyClassKeyRef != null);
            if (isToOid) {
                insn = insn.append(Insn.create(opc_aload_2));
                insn = insn.append(Insn.create(opc_aload_0));
                insn = insn.append(Insn.create(opc_getfield, thisClassKeyRef));
                insn = insn.append(Insn.create(opc_putfield, keyClassKeyRef));
            } else {
                insn = insn.append(Insn.create(opc_aload_0));
                insn = insn.append(Insn.create(opc_aload_2));
                insn = insn.append(Insn.create(opc_getfield, keyClassKeyRef));
                insn = insn.append(Insn.create(opc_putfield, thisClassKeyRef));
            }

            // compute stack demand
            final String sig
                = thisClassKeyRef.nameAndType().signature().asString();
            affirm(sig != null && sig.length() > 0);
            maxFieldSize = max(maxFieldSize, Descriptor.countFieldWords(sig));
        }

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

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                max(maxFieldSize + 1, 3), // maxStack
                                3, // maxLocals
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());
        augmenter.addMethod(methodName, methodSig, accessFlags,
                            codeAttr, exceptAttr);
    }
View Full Code Here

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

            final CodeAttribute codeAttr
                = new CodeAttribute(getCodeAttributeUtf8(),
                                    0, // maxStack
                                    3, // maxLocals
                                    begin,
                                    new ExceptionTable(),
                                    new AttributeVector());
            augmenter.addMethod(methodName, methodSig, accessFlags,
                                codeAttr, exceptAttr);
            return;
        }
        affirm(keyClassName != null);

        // check fm argument
        insn = appendCheckVarNonNull(insn, 1,
                                     JAVA_IllegalArgumentException_Path,
                                     "arg1");
       
        // check oid argument
        final ConstClass keyConstClass = pool.addClass(keyClassName);
        affirm(keyConstClass != null);
        insn = appendCheckVarInstanceOf(insn, 2, keyConstClass,
                                        JAVA_IllegalArgumentException_Path,
                                        "arg2");

        // downcast argument
        insn = insn.append(Insn.create(opc_aload_2));
        insn = insn.append(Insn.create(opc_checkcast, keyConstClass));
        insn = insn.append(Insn.create(opc_astore_3));

        // call super.jdoCopyKeyFieldsToObjectId(oid)
        final boolean isPCRoot = analyzer.isAugmentableAsRoot();
        if (!isPCRoot) {
            // call super.jdoCopyKeyFieldsToObjectId(oid)

            //^olsen: javac uses the truelly declaring class
            //final ConstClass superConstClass = classFile.superName();
            //affirm(superConstClass != null);
            //final String superClassName = superConstClass.asString();
            //affirm(superClassName != null);

            final String superClassName
                = analyzer.getPCSuperKeyOwnerClassName();
            insn = insn.append(Insn.create(opc_aload_0));
            insn = insn.append(Insn.create(opc_aload_1));
            insn = insn.append(Insn.create(opc_aload_3));
            insn = insn.append(
                Insn.create(opc_invokespecial,
                            pool.addMethodRef(
                                superClassName,
                                methodName,
                                methodSig)));
        }
       
        // get types of and field references of the key fields
        final int keyFieldCount = analyzer.getKeyFieldCount();
        final ConstFieldRef[] keyFieldRefs = getKeyFieldRefs();
        final ConstFieldRef[] keyClassKeyFieldRefs = getKeyClassKeyFieldRefs();
        affirm(keyFieldRefs.length == keyFieldCount);
        affirm(keyClassKeyFieldRefs.length == keyFieldCount);

        // generate the case-targets for the method calls
        final SizeHolder sizeHolder = new SizeHolder();
        if (isToOid) {
            insn = appendStatementsForCopyKeyFieldsToOid(insn, sizeHolder);
        } else {
            insn = appendStatementsForCopyKeyFieldsFromOid(insn, sizeHolder);
        }

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

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                max(sizeHolder.size
                                    + (isToOid ? 3 : 2), 3), // maxStack
                                4, // maxLocals
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());
        augmenter.addMethod(methodName, methodSig, accessFlags,
                            codeAttr, exceptAttr);
    }
View Full Code Here

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

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                fieldSize, // maxStack
                                1, // maxLocals
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());
        augmenter.addMethod(methodName, methodSig, accessFlags,
                            codeAttr, exceptAttr);
    }
View Full Code Here

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

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                fieldSize + 3, // maxStack
                                2, // maxLocals
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());

        augmenter.addMethod(methodName, methodSig, accessFlags,
                            codeAttr, exceptAttr);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.