Package serp.bytecode

Examples of serp.bytecode.Code.constant()


            int cacheable = 0;
            for (int i = 0; i < fields.length; i++) {
                if (!usesImplData(fields[i]))
                    continue;
                // case x: arrIdx = y; break;
                lswitch.addCase(i, code.constant().setValue(cacheable++));
                code.istore().setLocal(arrIdx);
                code.go2().setTarget(switchTarget);
            }
            lswitch.setDefaultTarget(switchTarget);
            code.next();    // step over switch target
View Full Code Here


            }
            lswitch.setDefaultTarget(switchTarget);
            code.next();    // step over switch target

            // if (arrIdx != -1)
            code.constant().setValue(-1);
            JumpInstruction ifins = code.ificmpne();
            code.vreturn();

            // create null target, then move before it
            Instruction nullTarget = code.aload().setThis();
View Full Code Here

            //     fieldImpl = new Object[fields];
            code.aload().setThis();
            code.getfield().setField(impl);
            ifins = code.ifnonnull();
            code.aload().setThis();
            code.constant().setValue(count);
            code.anewarray().setType(Object.class);
            code.putfield().setField(impl);

            // fieldImpl[arrIdx] = obj;
            // return;
View Full Code Here

            ifins = code.ifnonnull();
            code.vreturn();
            ifins.setTarget(code.aload().setThis());
            code.getfield().setField(impl);
            code.iload().setLocal(arrIdx);
            code.constant().setNull();
            code.aastore();
            code.vreturn();
        }
        code.calculateMaxStack();
        code.calculateMaxLocals();
View Full Code Here

        FieldMetaData[] fmds = meta.getFields();
        Collection jumps = new LinkedList();
        Collection jumps2;
   
        int local = code.getNextLocalsIndex();
        code.constant().setNull();
        code.astore().setLocal(local);
        int inter = code.getNextLocalsIndex();
        code.constant().setNull();
        code.astore().setLocal(inter);
View Full Code Here

   
        int local = code.getNextLocalsIndex();
        code.constant().setNull();
        code.astore().setLocal(local);
        int inter = code.getNextLocalsIndex();
        code.constant().setNull();
        code.astore().setLocal(inter);

        int objectCount = 0;
        boolean intermediate;
        for (int i = 0; i < fmds.length; i++) {
View Full Code Here

            jumps2 = new LinkedList();
            intermediate = usesIntermediate(fmds[i]);
            setTarget(code.aload().setThis(), jumps);
            // if (loaded.get(i)) or (!loaded.get(i)) depending on inter resp
            code.getfield().setField("loaded", BitSet.class);
            code.constant().setValue(i);
            code.invokevirtual().setMethod(BitSet.class, "get",
                boolean.class, new Class[]{ int.class });
            jumps.add(code.ifne());

            if (intermediate)
View Full Code Here

            // if (fetch.requiresFetch(fmds[i])!=FetchConfiguration.FETCH_NONE)
            setTarget(code.aload().setParam(1), jumps);
            code.aload().setParam(0);
            code.invokeinterface().setMethod(OpenJPAStateManager.class,
                "getMetaData", ClassMetaData.class, null);
            code.constant().setValue(fmds[i].getIndex());
            code.invokevirtual().setMethod(ClassMetaData.class,
                "getField", FieldMetaData.class, new Class[]{int.class});
            code.invokeinterface().setMethod (FetchConfiguration.class,
                "requiresFetch", int.class, new Class[]{FieldMetaData.class});
            code.constant().setValue(FetchConfiguration.FETCH_NONE);
View Full Code Here

            code.constant().setValue(fmds[i].getIndex());
            code.invokevirtual().setMethod(ClassMetaData.class,
                "getField", FieldMetaData.class, new Class[]{int.class});
            code.invokeinterface().setMethod (FetchConfiguration.class,
                "requiresFetch", int.class, new Class[]{FieldMetaData.class});
            code.constant().setValue(FetchConfiguration.FETCH_NONE);
            jumps2.add(code.ificmpeq());
            addLoad(bc, code, fmds[i], objectCount, local, false);

            jumps = jumps2;
            if (replaceType(fmds[i]) >= JavaTypes.OBJECT)
View Full Code Here

        // awhite: the above should work, but I'm seeing a messed up situation
        // all of a sudden where when a subclass calls this method, it somehow
        // happens before <clinit> is ever invoked, and so our
        // pcInheritedFieldCount field isn't initialized!  so instead,
        // return <fields> + <superclass>.pcGetManagedFieldCount ()
        code.constant().setValue(_meta.getDeclaredFields().length);
        if (_meta.getPCSuperclass() != null) {
            Class superClass = getType(_meta.getPCSuperclassMetaData());
            String superName = getCreateSubclass() ?
                PCEnhancer.toPCSubclassName(superClass) :
                superClass.getName();
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.