本文整理汇总了Java中org.apache.bcel.generic.GOTO类的典型用法代码示例。如果您正苦于以下问题:Java GOTO类的具体用法?Java GOTO怎么用?Java GOTO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GOTO类属于org.apache.bcel.generic包,在下文中一共展示了GOTO类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: insertTypecheckCode
import org.apache.bcel.generic.GOTO; //导入依赖的package包/类
InstructionHandle insertTypecheckCode(MethodGen m, InstructionList il,
InstructionHandle pos, int spawnId, int exceptionPos) {
ArrayList<CodeExceptionGen> catches = mtab.getCatchTypes(m, spawnId);
InstructionHandle[] jumpTargets = new InstructionHandle[catches.size() + 1];
BranchHandle[] jumps = new BranchHandle[catches.size()];
for (int i = 0; i < catches.size(); i++) {
CodeExceptionGen e = catches.get(i);
ObjectType type = e.getCatchType();
InstructionHandle catchTarget = e.getHandlerPC();
jumpTargets[i] = il.insert(pos, new ALOAD(exceptionPos));
il.insert(pos, new INSTANCEOF(cpg.addClass(type)));
il.insert(pos, new BIPUSH((byte) 1));
jumps[i] = il.insert(pos, new IF_ICMPNE(null));
il.insert(pos, new ALOAD(exceptionPos));
il.insert(pos, ins_f.createCheckCast(type));
il.insert(pos, new GOTO(catchTarget));
}
InstructionHandle t = il.insert(pos, new ALOAD(exceptionPos));
il.insert(pos, new ATHROW());
jumpTargets[catches.size()] = t;
for (int i = 0; i < catches.size(); i++) {
jumps[i].setTarget(jumpTargets[i + 1]);
}
return pos;
}
开发者ID:pieterhijma,项目名称:cashmere,代码行数:34,代码来源:Cashmerec.java
示例2: createInstructionGoto
import org.apache.bcel.generic.GOTO; //导入依赖的package包/类
@SuppressWarnings("unused")
// Called using reflection
private Instruction createInstructionGoto(Element inst) {
int id = Integer.parseInt(inst.getAttributeValue("label"));
BranchInstruction bi = new GOTO(null);
instructionHandlerManager.registerBranchInstruction(bi, id);
return bi;
}
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:JavaByteCodeOutputProcess.java
示例3: addBranch
import org.apache.bcel.generic.GOTO; //导入依赖的package包/类
public void addBranch( int pc, int branchType, int targetpc ) {
switch ( branchType ) {
default:
case BRANCH_GOTO: branches[pc] = new GOTO(null); break;
case BRANCH_IFNE: branches[pc] = new IFNE(null); break;
case BRANCH_IFEQ: branches[pc] = new IFEQ(null); break;
}
targets[pc] = targetpc;
append(branches[pc]);
}
开发者ID:gnosygnu,项目名称:luaj_xowa,代码行数:11,代码来源:JavaBuilder.java
示例4: generateMain
import org.apache.bcel.generic.GOTO; //导入依赖的package包/类
void generateMain(ClassGen clg, Method origMain) {
InstructionList il = new InstructionList();
MethodGen new_main = new MethodGen(Constants.ACC_STATIC
| Constants.ACC_PUBLIC, Type.VOID, new Type[] { new ArrayType(
Type.STRING, 1) }, new String[] { "argv" }, "main", clg
.getClassName(), il, clg.getConstantPool());
il.append(ins_f.createNew(cashmereType));
il.append(new DUP());
il.append(ins_f.createInvoke("ibis.cashmere.impl.Cashmere", "<init>",
Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
il.append(ins_f.createInvoke("ibis.cashmere.impl.Cashmere", "isMaster",
Type.BOOLEAN, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
BranchHandle ifcmp = il.append(new IFEQ(null));
InstructionHandle origMain_handle = il.append(new ALOAD(0));
InstructionHandle try_start = il.append(ins_f.createInvoke(clg
.getClassName(), origMain.getName(), Type.VOID,
new Type[] { new ArrayType(Type.STRING, 1) },
Constants.INVOKESTATIC));
BranchHandle try_end = il.append(new GOTO(null));
InstructionHandle e_handler = il.append(getCashmere(ins_f));
il.append(new SWAP());
il.append(ins_f.createInvoke("ibis.cashmere.impl.Cashmere", "exit",
Type.VOID, new Type[] { new ObjectType("java.lang.Throwable")},
Constants.INVOKEVIRTUAL));
BranchHandle gto2 = il.append(new GOTO(null));
InstructionHandle ifeq_target = il.append(getCashmere(ins_f));
ifcmp.setTarget(ifeq_target);
il.append(ins_f.createInvoke("ibis.cashmere.impl.Cashmere", "client",
Type.VOID, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
il.append(getCashmere(ins_f));
il.append(ins_f.createInvoke("ibis.cashmere.impl.Cashmere", "isMaster",
Type.BOOLEAN, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
il.append(new IFNE(origMain_handle));
InstructionHandle gto_target = il.append(getCashmere(ins_f));
try_end.setTarget(gto_target);
il.append(ins_f.createInvoke("ibis.cashmere.impl.Cashmere", "exit",
Type.VOID, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
InstructionHandle gto2_target = il.append(new RETURN());
gto2.setTarget(gto2_target);
new_main.addExceptionHandler(try_start, try_end, e_handler,
new ObjectType("java.lang.Throwable"));
new_main.setMaxStack();
new_main.setMaxLocals();
new_main.addLocalVariable("argv", new ArrayType(Type.STRING, 1), 0,
origMain_handle, null);
removeLocalTypeTables(new_main);
Method main = new_main.getMethod();
gen_c.addMethod(main);
}
开发者ID:pieterhijma,项目名称:cashmere,代码行数:66,代码来源:Cashmerec.java
注:本文中的org.apache.bcel.generic.GOTO类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论