Search in sources :

Example 1 with CtPrimitiveType

use of org.hotswap.agent.javassist.CtPrimitiveType in project HotswapAgent by HotswapProjects.

the class Expr method storeStack0.

private static void storeStack0(int i, int n, CtClass[] params, int regno, Bytecode bytecode) {
    if (i >= n)
        return;
    else {
        CtClass c = params[i];
        int size;
        if (c instanceof CtPrimitiveType)
            size = ((CtPrimitiveType) c).getDataSize();
        else
            size = 1;
        storeStack0(i + 1, n, params, regno + size, bytecode);
        bytecode.addStore(regno, c);
    }
}
Also used : CtClass(org.hotswap.agent.javassist.CtClass) CtPrimitiveType(org.hotswap.agent.javassist.CtPrimitiveType)

Example 2 with CtPrimitiveType

use of org.hotswap.agent.javassist.CtPrimitiveType in project HotswapAgent by HotswapProjects.

the class Javac method makeDefaultBody.

private static void makeDefaultBody(Bytecode b, CtClass type) {
    int op;
    int value;
    if (type instanceof CtPrimitiveType) {
        CtPrimitiveType pt = (CtPrimitiveType) type;
        op = pt.getReturnOp();
        if (op == Opcode.DRETURN)
            value = Opcode.DCONST_0;
        else if (op == Opcode.FRETURN)
            value = Opcode.FCONST_0;
        else if (op == Opcode.LRETURN)
            value = Opcode.LCONST_0;
        else if (op == Opcode.RETURN)
            value = Opcode.NOP;
        else
            value = Opcode.ICONST_0;
    } else {
        op = Opcode.ARETURN;
        value = Opcode.ACONST_NULL;
    }
    if (value != Opcode.NOP)
        b.addOpcode(value);
    b.addOpcode(op);
}
Also used : CtPrimitiveType(org.hotswap.agent.javassist.CtPrimitiveType)

Aggregations

CtPrimitiveType (org.hotswap.agent.javassist.CtPrimitiveType)2 CtClass (org.hotswap.agent.javassist.CtClass)1