Package serp.bytecode

Examples of serp.bytecode.Code.constant()


        if (changeTracker) {
            m = bc.declareMethod("getChangeTracker", ChangeTracker.class, null);
            m.makePublic();
            code = m.getCode(true);
            code.constant().setNull();
            code.areturn();
            code.calculateMaxStack();
            code.calculateMaxLocals();
        }
    }
View Full Code Here


        BCField loaded = addBeanField(bc, "loaded", BitSet.class);
        loaded.setFinal(true);
        code.aload().setThis();
        code.anew().setType(BitSet.class);
        code.dup();
        code.constant().setValue(bc.getFields().length);
        code.invokespecial().setMethod(BitSet.class, "<init>", void.class,
            new Class[]{ int.class });
        code.putfield().setField(loaded);

        code.calculateMaxStack();
View Full Code Here

        Collection jumps = new LinkedList();
        jumps.add(code.ifnonnull());
        ExceptionHandler handler = code.addExceptionHandler();

        handler.setTryStart(code.constant().setValue
            (meta.getDescribedType().getName()));
        code.constant().setValue(true);
        code.invokestatic().setMethod(Thread.class, "currentThread",
            Thread.class, null);
        code.invokevirtual().setMethod(Thread.class, "getContextClassLoader",
View Full Code Here

        jumps.add(code.ifnonnull());
        ExceptionHandler handler = code.addExceptionHandler();

        handler.setTryStart(code.constant().setValue
            (meta.getDescribedType().getName()));
        code.constant().setValue(true);
        code.invokestatic().setMethod(Thread.class, "currentThread",
            Thread.class, null);
        code.invokevirtual().setMethod(Thread.class, "getContextClassLoader",
            ClassLoader.class, null);
        code.invokestatic().setMethod(Class.class, "forName", Class.class,
View Full Code Here

        JumpInstruction ifins = code.ifeq();
        code.aload().setLocal(ret);
        code.anew().setType(CollectionChangeTrackerImpl.class);
        code.dup();
        code.aload().setLocal(ret);
        code.constant().setValue(allowsDuplicates(type));
        code.constant().setValue(isOrdered(type));
        code.invokespecial().setMethod(CollectionChangeTrackerImpl.class,
            "<init>", void.class, new Class[] { Collection.class,
            boolean.class, boolean.class });
        code.putfield().setField(changeTracker);
View Full Code Here

        code.aload().setLocal(ret);
        code.anew().setType(CollectionChangeTrackerImpl.class);
        code.dup();
        code.aload().setLocal(ret);
        code.constant().setValue(allowsDuplicates(type));
        code.constant().setValue(isOrdered(type));
        code.invokespecial().setMethod(CollectionChangeTrackerImpl.class,
            "<init>", void.class, new Class[] { Collection.class,
            boolean.class, boolean.class });
        code.putfield().setField(changeTracker);
View Full Code Here

            code.getfield().setField(impl);
            JumpInstruction ifins2 = code.ifnull();
            code.aload().setParam(0);
            code.aload().setThis();
            code.getfield().setField(impl);
            code.constant().setValue(true);
            code.invokeinterface().setMethod(OpenJPAStateManager.class,
                "setImplData", void.class,
                new Class[]{ Object.class, boolean.class });
            Instruction ins = code.vreturn();
            ifins.setTarget(ins);
View Full Code Here

            JumpInstruction ifins = code.ifnonnull();
            code.vreturn();

            // Object obj = null;
            int obj = code.getNextLocalsIndex();
            ifins.setTarget(code.constant().setNull());
            code.astore().setLocal(obj);

            // establish switch target, then move before it
            Instruction target = code.aload().setLocal(obj);
            code.previous();
View Full Code Here

                if (!usesImplData(fields[i]))
                    continue;
                // case x: obj = fieldImpl[y]; break;
                lswitch.addCase(i, code.aload().setThis());
                code.getfield().setField(impl);
                code.constant().setValue(cacheable++);
                code.aaload();
                code.astore().setLocal(obj);
                code.go2().setTarget(target);
            }
            lswitch.setDefaultTarget(target);
View Full Code Here

            code.vreturn();
        else {
            // int arrIdx = -1;
            // switch(index)
            int arrIdx = code.getNextLocalsIndex();
            code.constant().setValue(-1);
            code.istore().setLocal(arrIdx);
            code.iload().setParam(1);
            LookupSwitchInstruction lswitch = code.lookupswitch();

            // establish switch target, then move before it
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.