当前位置: 首页>>代码示例>>Java>>正文


Java InstructionList.append方法代码示例

本文整理汇总了Java中org.apache.bcel.generic.InstructionList.append方法的典型用法代码示例。如果您正苦于以下问题:Java InstructionList.append方法的具体用法?Java InstructionList.append怎么用?Java InstructionList.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.bcel.generic.InstructionList的用法示例。


在下文中一共展示了InstructionList.append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: insertDeleteSpawncounter

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
InstructionHandle insertDeleteSpawncounter(InstructionList il,
    InstructionHandle i, int maxLocals) {
    // In this case, jumps to the return must in fact jump to
    // the new instruction sequence! So, we change the instruction
    // at the handle.

    // First, save the return instruction.
    Instruction r = i.getInstruction();

    i.setInstruction(new ALOAD(maxLocals));
    i = il
        .append(i, ins_f.createInvoke(
            "ibis.cashmere.impl.spawnSync.SpawnCounter", "deleteSpawnCounter",
            Type.VOID, new Type[] { spawnCounterType },
            Constants.INVOKESTATIC));
    i = il.append(i, r);

    return i;
}
 
开发者ID:pieterhijma,项目名称:cashmere,代码行数:20,代码来源:Cashmerec.java

示例2: createHelperMethodForDotClassCalls

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
/**
 * Creates a method class$(String) which is used
 * during SomeClass.class instruction
 *
 * @param generatedClassName the instance class name
 */
protected void createHelperMethodForDotClassCalls(String generatedClassName) {
    InstructionList il = new InstructionList();
    MethodGen method = new MethodGen(Constants.ACC_STATIC, new ObjectType("java.lang.Class"), new Type[]{Type.STRING}, new String[]{"arg0"}, "class$", generatedClassName, il, constantsPool);
    InstructionHandle ih0 = il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
    il.append(factory.createInvoke("java.lang.Class", "forName", new ObjectType("java.lang.Class"), new Type[]{Type.STRING}, Constants.INVOKESTATIC));
    InstructionHandle ih4 = il.append(InstructionFactory.createReturn(Type.OBJECT));
    InstructionHandle ih5 = il.append(InstructionFactory.createStore(Type.OBJECT, 1));
    il.append(factory.createNew("java.lang.NoClassDefFoundError"));
    il.append(InstructionConstants.DUP);
    il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
    il.append(factory.createInvoke("java.lang.Throwable", "getMessage", Type.STRING, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
    il.append(factory.createInvoke("java.lang.NoClassDefFoundError", "<init>", Type.VOID, new Type[]{Type.STRING}, Constants.INVOKESPECIAL));
    il.append(InstructionConstants.ATHROW);
    method.addExceptionHandler(ih0, ih4, ih5, new ObjectType("java.lang.ClassNotFoundException"));
    method.setMaxStack();
    method.setMaxLocals();
    classGen.addMethod(method.getMethod());
    il.dispose();
}
 
开发者ID:paul-hammant,项目名称:JRemoting,代码行数:26,代码来源:BcelStubGenerator.java

示例3: generateEqualsMethod

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
private void generateEqualsMethod(String generatedClassName) {

        /* public boolean equals(Object o) {
         *   return stubHelper.isEquals(this,o);
         * }
         */

        InstructionList il = new InstructionList();
        MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.BOOLEAN, new Type[]{Type.OBJECT}, new String[]{"arg0"}, "equals", generatedClassName, il, constantsPool);

        il.append(InstructionFactory.createLoad(Type.OBJECT, 0));

        il.append(factory.createFieldAccess(generatedClassName, "stubHelper", new ObjectType("org.codehaus.jremoting.client.StubHelper"), Constants.GETFIELD));
        il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
        il.append(InstructionFactory.createLoad(Type.OBJECT, 1));

        il.append(factory.createInvoke("org.codehaus.jremoting.client.StubHelper", "isEquals", Type.BOOLEAN, new Type[]{Type.OBJECT, Type.OBJECT}, Constants.INVOKEINTERFACE));
        il.append(InstructionFactory.createReturn(Type.INT));
        method.setMaxStack();
        method.setMaxLocals();
        classGen.addMethod(method.getMethod());
        il.dispose();
    }
 
开发者ID:paul-hammant,项目名称:JRemoting,代码行数:24,代码来源:BcelStubGenerator.java

示例4: addTransactionMethod

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
protected void addTransactionMethod(ParsedMethod pm) {
    String et = EntityTransaction.class.getCanonicalName();

    GeneratedMethod gm = new GeneratedMethod(pm);
    InstructionList il = gm.start();

    writeMethodPreamble(gm, il);
    il.append(_factory.createInvoke(EM_TYPE, "getTransaction",
        new ObjectType(et), Type.NO_ARGS, Constants.INVOKEINTERFACE));
    il.append(_factory.createInvoke(et, pm.getMethod().getName(),
        Type.VOID, Type.NO_ARGS, Constants.INVOKEINTERFACE));

    il.append(InstructionFactory.createReturn(Type.VOID));

    gm.done();
}
 
开发者ID:abassouk,项目名称:autodao,代码行数:17,代码来源:DAOAnalysis.java

示例5: addPassThruMethod

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
protected void addPassThruMethod(ParsedMethod m) {
    GeneratedMethod gm = new GeneratedMethod(m);
    InstructionList il = gm.start();
    Type returnType = gm.getReturnType();

    boolean hasArg = m.getArgumentLength() > 0;

    writeMethodPreamble(gm, il);
    if (hasArg)
        il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
    il.append(_factory.createInvoke(EM_TYPE, m.getMethod().getName(),
        returnType == Type.VOID ? Type.VOID : Type.OBJECT,
        hasArg ? new Type[] { Type.OBJECT } : Type.NO_ARGS,
        Constants.INVOKEINTERFACE));

    if (returnType != Type.VOID) {
        il.append(_factory.createCheckCast(((ReferenceType) returnType)));
    }
    il.append(InstructionFactory.createReturn(returnType));

    gm.done();
}
 
开发者ID:abassouk,项目名称:autodao,代码行数:23,代码来源:DAOAnalysis.java

示例6: addFindMethod

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
protected void addFindMethod(ParsedMethod m) {
    GeneratedMethod gm = new GeneratedMethod(m);
    InstructionList il = gm.start();

    writeMethodPreamble(gm, il);
    il.append(new PUSH(_cp, (ObjectType) gm.getReturnType()));

    m.getArguments()[0].pushAsObject(il);

    il.append(_factory.createInvoke(EM_TYPE, "find", Type.OBJECT,
        new Type[] { Type.CLASS, Type.OBJECT }, Constants.INVOKEINTERFACE));

    il.append(_factory.createCheckCast(((ReferenceType) gm.getReturnType())));
    il.append(InstructionFactory.createReturn(gm.getReturnType()));

    gm.done();
}
 
开发者ID:abassouk,项目名称:autodao,代码行数:18,代码来源:DAOAnalysis.java

示例7: processMethodAnnotations

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
protected void processMethodAnnotations(ParsedMethod m, InstructionList il) {
    MaxResults mr = m.getMethod().getAnnotation(MaxResults.class);
    if (mr != null) {
        if (mr.value() < 0) {
            throw new IllegalArgumentException(
                    "MaxResults without a value on " + m.getMethod());
        }
        il.append(new PUSH(_cp, mr.value()));
        il.append(_factory.createInvoke(TQ_CLASS, "setMaxResults",
            new ObjectType(TQ_CLASS), new Type[] { Type.INT },
            Constants.INVOKEINTERFACE));
    }

    FirstResult fr = m.getMethod().getAnnotation(FirstResult.class);
    if (fr != null && fr.value() > -1) {
        il.append(new PUSH(_cp, fr.value()));
        il.append(_factory.createInvoke(TQ_CLASS, "setFirstResult",
            new ObjectType(TQ_CLASS), new Type[] { Type.INT },
            Constants.INVOKEINTERFACE));
    }
}
 
开发者ID:abassouk,项目名称:autodao,代码行数:22,代码来源:DAOAnalysis.java

示例8: processQuerySetOperation

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
protected void processQuerySetOperation(ParsedMethod m, Argument arg,
        InstructionList il, String methodName, String queryClass) {
    Class<?> type = arg.getArgumentClass();
    if (type == Integer.class) {
        arg.push(il);
        il.append(_factory.createInvoke(INT_CLASS, "intValue", Type.INT,
            Type.NO_ARGS, Constants.INVOKEINTERFACE));
    } else if (type == int.class) {
        arg.pushPrimitive(il);
    } else {
        throw new IllegalArgumentException("Parameter #" + arg.getArgNo()
                + " of " + m.getMethod() + " needs to be Integer or int.");
    }
    il.append(_factory
            .createInvoke(queryClass, methodName,
                new ObjectType(queryClass), new Type[] { Type.INT },
                Constants.INVOKEINTERFACE));
}
 
开发者ID:abassouk,项目名称:autodao,代码行数:19,代码来源:DAOAnalysis.java

示例9: generateConfigureOptimizations

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
@Override
public void generateConfigureOptimizations(InstructionList il, InstructionFactory ifact, GenScope scope) {
	if ( getOptimizations().size() > 1 ) throw new UnsupportedOperationException("Only one optimization at a time supported by now");
	if ( getOptimizations().size() == 1 ) {
		AccessByFeatureOptimization opt = (AccessByFeatureOptimization) getOptimizations().get(0);

		il.append(new DUP());		
		il.append(ifact.createConstant(opt.getFeatureName()));
		il.append(ifact.createInvoke(this.getClassName(), "configureAccessByFeatureOptimization",
				Type.VOID, new Type[] { Type.STRING }, Constants.INVOKEVIRTUAL));				
		
		// TODO: Configure if the access is speculative...
	}


	// Sets the model of the queue statically
	// It is compulsory to have a type for the queue to enable optimizations
	if ( getOptimizations().size() > 0 ) {
		il.append(new DUP());	
		scope.generateGetModel(this.getType_().getModel().getName());
		il.append(ifact.createInvoke(this.getClassName(), "setModel",
				Type.VOID, new Type[] { DefaultTypes.IModel }, Constants.INVOKEVIRTUAL));				
	}
}
 
开发者ID:jesusc,项目名称:eclectic,代码行数:25,代码来源:LocalQueueJVMGen.java

示例10: generateInitField

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
@Override
public void generateInitField(InstructionList il, InstructionFactory ifact, GenScope scope) {
	LocalQueueJVMGen jvmQ = this;
	ClassGen cg = scope.getClassGen();
	
	il.append(ifact.createNew(jvmQ.getType().getClassName()));
	il.append(new DUP());		

	il.append(ifact.createConstant(jvmQ.getName()));
	il.append(InstructionConstants.THIS); 
	il.append(ifact.createInvoke(jvmQ.getClassName(), "<init>",
				Type.VOID, new Type[] { Type.STRING, DefaultTypes.QoolTransformation }, Constants.INVOKESPECIAL));				
	
	// Stack: queue
	il.append(InstructionConstants.THIS); 
	il.append(InstructionConstants.SWAP); 

	il.append( ifact.createPutField(cg.getClassName(), jvmQ.getFieldName(), jvmQ.getType()) );		
}
 
开发者ID:jesusc,项目名称:eclectic,代码行数:20,代码来源:LocalQueueJVMGen.java

示例11: generateReadCode

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
public void generateReadCode(InstructionList il, InstructionFactory factory, ConstantPoolGen cp, String className)
{
   String leafClassName = getClass().getName();
   int arrayDim = getArrayDim();
   if (arrayDim == 0)
      il.append(factory.createInvoke(leafClassName, "getValue", Type.BOOLEAN, new Type[]
            {
               Type.LONG
            }, INVOKEVIRTUAL));
   else
      il.append(factory.createInvoke(leafClassName, "getWrappedValue", Type.OBJECT, new Type[]
            {
               Type.LONG
            }, INVOKEVIRTUAL));
}
 
开发者ID:diana-hep,项目名称:root4j,代码行数:16,代码来源:TLeafORep.java

示例12: generateReadCode

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
public void generateReadCode(InstructionList il, InstructionFactory factory, ConstantPoolGen cp, String className)
{
   String leafClassName = getClass().getName();
   int arrayDim = getArrayDim();
   if (arrayDim == 0)
      il.append(factory.createInvoke(leafClassName, "getValue", Type.FLOAT, new Type[]
            {
               Type.LONG
            }, INVOKEVIRTUAL));
   else
      il.append(factory.createInvoke(leafClassName, "getWrappedValue", Type.OBJECT, new Type[]
            {
               Type.LONG
            }, INVOKEVIRTUAL));
}
 
开发者ID:diana-hep,项目名称:root4j,代码行数:16,代码来源:TLeafFRep.java

示例13: generateReadCode

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
public void generateReadCode(InstructionList il, InstructionFactory factory, ConstantPoolGen cp, String className)
{
   String leafClassName = getClass().getName();
   int arrayDim = getArrayDim();
   if (arrayDim == 0)
      il.append(factory.createInvoke(leafClassName, "getValue", Type.DOUBLE, new Type[]
            {
               Type.LONG
            }, INVOKEVIRTUAL));
   else
      il.append(factory.createInvoke(leafClassName, "getWrappedValue", Type.OBJECT, new Type[]
            {
               Type.LONG
            }, INVOKEVIRTUAL));
}
 
开发者ID:diana-hep,项目名称:root4j,代码行数:16,代码来源:TLeafDRep.java

示例14: generateReadArrayCode

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
public void generateReadArrayCode(InstructionList il, InstructionFactory factory, ConstantPoolGen cp, int dim, int[] maxIndex)
{
   for (int i = 0; i < dim; i++)
      il.append(new PUSH(cp, maxIndex[i]));
   il.append((Instruction) factory.createNewArray(type, (short) dim));
   il.append(InstructionFactory.DUP_X1);
   if (dim == 1)
      il.append(factory.createInvoke("org.dianahep.root4j.core.RootInput", "readFixedArray", Type.VOID, arrayArgType, INVOKEINTERFACE));
   else
      il.append(factory.createInvoke("org.dianahep.root4j.core.RootInput", "readMultiArray", Type.VOID, objectArrayArgType, INVOKEINTERFACE));
}
 
开发者ID:diana-hep,项目名称:root4j,代码行数:12,代码来源:IntrinsicRootClass.java

示例15: generateReadCode

import org.apache.bcel.generic.InstructionList; //导入方法依赖的package包/类
public void generateReadCode(InstructionList il, InstructionFactory factory, ConstantPoolGen cp, String className)
{
   String leafClassName = getClass().getName();
   int arrayDim = getArrayDim();
   if (arrayDim == 0)
      il.append(factory.createInvoke(leafClassName, "getValue", Type.STRING, new Type[]
            {
               Type.LONG
            }, INVOKEVIRTUAL));
   else
      il.append(factory.createInvoke(leafClassName, "getWrappedValue", Type.OBJECT, new Type[]
            {
               Type.LONG
            }, INVOKEVIRTUAL));
}
 
开发者ID:diana-hep,项目名称:root4j,代码行数:16,代码来源:TLeafCRep.java


注:本文中的org.apache.bcel.generic.InstructionList.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。