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

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


        // mediate access
        insn = appendMediatedReadAccess(insn, fieldIndex, fieldRef, varStart);

        // end of method body

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


        insn = insn.append(mediate);
        insn = appendMediatedReadAccess(insn, fieldIndex, fieldRef, varStart);

        // end of method body

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

        affirm(fieldRef != null);

        // write argument to field and return
        insn = appendDirectWriteReturn(insn, fieldRef);

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                3, // maxStack: allow for long/double
                                3, // maxLocals: allow for long/double
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());
View Full Code Here

        // mediate access
        insn = appendMediatedWriteAccess(insn, fieldIndex, fieldRef, varStart);

        // end of method body

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

        insn = insn.append(mediate);
        insn = appendMediatedWriteAccess(insn, fieldIndex, fieldRef, varStart);

        // end of method body

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

        }

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

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                3, // maxStack
                                1, // maxLocals
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());
View Full Code Here

        // return newObject;

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

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                1, //3, //3, // maxStack
                                1, //2, // maxLocals
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());
View Full Code Here

        insn = appendThrowJavaException(
            insn, JAVA_UnsupportedOperationException_Path,
            "Method " + methodName + " not yet implemented");

        final CodeAttribute codeAttr
            = new CodeAttribute(getCodeAttributeUtf8(),
                                3, // maxStack
                                countMethodArgWords(methodSig), // maxLocals
                                begin,
                                new ExceptionTable(),
                                new AttributeVector());
View Full Code Here

    private int hasAnnotation(PrintWriter out,
                              ClassMethod method,
                              String methodName)
        throws EnhancerMetaDataUserException, EnhancerMetaDataFatalError
    {
        final CodeAttribute codeAttr = method.codeAttribute();

        // return if method is abstract or native
        if (codeAttr == null)
            return NEGATIVE;

        int res = NEGATIVE;
        // don't annotate readObject(ObjectInputStream) or any jdo* methods
        // except for jdoPreStore() and jdoPreDelete().
        final boolean jdoMethod
            = ((methodName.startsWith("jdo")
                && !(methodName.equals("jdoPreStore()")
                     || methodName.equals("jdoPreDelete()")))
               || methodName.equals("readObject(java.io.ObjectInputStream)"));

        // first instruction is a target
        final Insn firstInsn = codeAttr.theCode();
        Insn insn = firstInsn.next();
        while (insn != null) {
            switch(insn.opcode()) {
            case VMConstants.opc_getfield:
            case VMConstants.opc_putfield: {
View Full Code Here

        // check the found method
        affirm(!method.isAbstract(),
               "Attempt to add code to an abstract method.");
        affirm(!method.isNative(),
               "Attempt to add code to a native method.");
        final CodeAttribute foundCodeAttr = method.codeAttribute();
        affirm(foundCodeAttr != null)// by JVM spec

        // prepend the new code to the current one
        final Insn firstInsn = codeAttr.theCode();
        affirm(firstInsn != null);
        final Insn foundFirstInsn = foundCodeAttr.theCode();
        affirm(foundFirstInsn != null);
        final Insn lastInsn = firstInsn.append(foundFirstInsn);
        affirm(lastInsn != null);
        foundCodeAttr.setTheCode(firstInsn);

        // ajust the method's stack and locals demand
        foundCodeAttr.setStackUsed(max(foundCodeAttr.stackUsed(),
                                       codeAttr.stackUsed()));
        foundCodeAttr.setLocalsUsed(max(foundCodeAttr.localsUsed(),
                                        codeAttr.localsUsed()));

        // add the exception attribute or its exceptions
        if (exceptAttr != null) {
            affirm((exceptAttr.getExceptions().size()
View Full Code Here

TOP

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

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.