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


Java Opcodes.DUP属性代码示例

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


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

示例1: visitTypeInsn

public void visitTypeInsn(int opcode, String type) {
	if (firstInstruction)
		addInc();
	super.visitTypeInsn(opcode, type);
	// we deal with Opcodes.NEW through the constructors
	if (opcode == Opcodes.ANEWARRAY) {
		int   siteId = getNextSiteId();
		addLog(true, siteId);
	} else if (DO_NEW_INVOKESPECIAL_SEQUENCE && opcode == Opcodes.NEW) {
		super.visitInsn(Opcodes.DUP);
		Triplet p = new Triplet();
		p.type = type;
		p.var = this.localsBase + 1 + newTypeStack.size();
		p.siteId = getNextSiteId();
		if (this.maxLocals < p.var) {
			this.maxLocals = p.var;
			methodToLargestLocal.put(this.encodedName, new Integer(
					p.var));
		}
		super.setLocalType(p.var, JAVA_LANG_OBJECT_TYPE); // super.newLocal(OBJECT_TYPE);
		newTypeStack.addLast(p);
		super.visitVarInsn(Opcodes.ASTORE, p.var);
	}
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:24,代码来源:AllocateInstrument.java

示例2: addWhereAmI

private void addWhereAmI() {
	// 0: new #2; //class java/lang/Exception
	// 3: dup
	// 4: invokespecial #3; //Method java/lang/Exception."<init>":()V
	// 7: invokevirtual #4; //Method
	// java/lang/Exception.printStackTrace:()V
	// 10: return
	// super.visitTypeInsn(Opcodes.NEW, type);
	String exClass = Type.getInternalName(Exception.class);
	super.visitTypeInsn(Opcodes.NEW, exClass);
	super.visitInsn(Opcodes.DUP);
	super.visitMethodInsn(Opcodes.INVOKESPECIAL, exClass, "<init>",
			"()V");
	super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, exClass,
			"printStackTrace", "()V");
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:16,代码来源:AllocateInstrument.java

示例3: onMethodEnter

@SuppressWarnings("unused")
protected void onMethodEnter() {
	if (done) return;

	overridden = true;
	Label start  = new Label();
	Label normal = new Label();
	super.visitLabel(start);
	super.visitFieldInsn(Opcodes.GETSTATIC, CONFIGURATION, CONFIGURATION_FIELD_NAME, Type.INT_TYPE.getDescriptor());
	super.visitInsn(Opcodes.DUP);
	super.visitJumpInsn(Opcodes.IFEQ, normal);
	super.visitInsn(Opcodes.IRETURN);
	super.visitLabel(normal);
	super.visitInsn(Opcodes.POP);
	Label end = new Label();
	super.visitJumpInsn(Opcodes.GOTO, end);
	super.visitLabel(end);
	super.visitTryCatchBlock(start, normal, end, Type.getType(Throwable.class).getDescriptor());
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:19,代码来源:RuntimeInstrument.java

示例4: visitFieldInsn

public void visitFieldInsn(int opcode, String owner, String fieldName,
		String desc) {
	if (firstInstruction)
		addInc();
	if (logPointerChange && opcode == Opcodes.PUTFIELD
			&& desc.charAt(0) == 'L') {
		if (constructor && !doneSuperConstructor && name.equals(owner)
				&& finalFields.contains(fieldName))
			delayedFieldPointer.put(fieldName, desc);
		else {
			// instrument reference changes from
			// putfield ...,obj,v' => ...
			// to
			// dup2 ...,obj,v' => ...,obj,v',obj,v'
			// swap ...,obj,v',obj,v' => ...,obj,v',v',obj
			// dup ...,obj,v',v',obj => ...,obj,v',v',obj,obj
			// getfield ...,obj,v',v',obj,obj => ...,obj,v',v',obj,v
			// invokespecial
			// pointerchangelog(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
			// ...,obj,v',v',obj,v => ...,obj,v'
			// putfield ...,obj,v' =>
			super.visitInsn(Opcodes.DUP2);
			super.visitInsn(Opcodes.SWAP);
			super.visitInsn(Opcodes.DUP);
			super.visitFieldInsn(Opcodes.GETFIELD, owner, fieldName,
					desc);
			super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
					LOG_INTERNAL_POINTER_CHANGE,
					POINTER_CHANGE_SIGNATURE);
		}
	} else if (logPointerChange && opcode == Opcodes.PUTSTATIC
			&& desc.charAt(0) == 'L') {
		// if (finalFields.contains(fieldName)) {
		// // assume field is initially null
		// super.visitInsn(Opcodes.DUP);
		// } else {
		// instrument reference changes from
		// putstatic ...,v' => ...
		// to
		// dup ...,v' => ...,v',v'
		// ldc owner.class ...,v',v' => ...,v',v',k
		// getstatic ...,v',v',k => ...,v',v',k,v
		// invokespecial
		// staticpointerchangelog(Ljava/lang/Object;Ljava/lang/Class;Ljava/lang/Object;)V
		// ...,v',v',k,v => ...,v'
		super.visitInsn(Opcodes.DUP);
		super.visitLdcInsn(Type.getObjectType(owner));
		super.visitFieldInsn(Opcodes.GETSTATIC, owner, fieldName, desc);
		super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
				LOG_INTERNAL_STATIC_POINTER_CHANGE,
				STATIC_POINTER_CHANGE_SIGNATURE);
		// }
	}
	super.visitFieldInsn(opcode, owner, fieldName, desc);
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:55,代码来源:AllocateInstrument.java

示例5: addLog

private void addLog(boolean dup, int site) {
	if (dup)
		super.visitInsn(Opcodes.DUP);
	super.visitLdcInsn(new Integer(site));
	super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
			LOG_INTERNAL_ALLOC_REPORT, OBJECT_SITE_SIGNATURE);
	if (!constructor)
		super.visitMethodInsn(Opcodes.INVOKESTATIC, name,
				LOG_INTERNAL_ALLOC_DONE, VOID_SIGNATURE);
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:10,代码来源:AllocateInstrument.java


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