List of usage examples for org.objectweb.asm Opcodes GETSTATIC
int GETSTATIC
To view the source code for org.objectweb.asm Opcodes GETSTATIC.
Click Source Link
From source file:jerl.bcm.inj.impl.InjectCollection.java
License:Apache License
public void injectMemberFieldArraySystemOut(MethodVisitor mv, String clazz, String field, String type, String printType, String prefix, boolean isStatic, int index) { mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); mv.visitLdcInsn(prefix);//from w w w .j a v a 2 s . com mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/io/PrintStream", "print", "(Ljava/lang/String;)V"); mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); if (isStatic) { mv.visitFieldInsn(Opcodes.GETSTATIC, clazz, field, type); } else { mv.visitVarInsn(Opcodes.ALOAD, 0); // this mv.visitFieldInsn(Opcodes.GETFIELD, clazz, field, type); } mv.visitLdcInsn(new Integer(index)); if (type.endsWith("[Z") || type.endsWith("[B")) { mv.visitInsn(Opcodes.BALOAD); } else if (type.endsWith("[C")) { mv.visitInsn(Opcodes.CALOAD); } else if (type.endsWith("[D")) { mv.visitInsn(Opcodes.DALOAD); } else if (type.endsWith("[F")) { mv.visitInsn(Opcodes.FALOAD); } else if (type.endsWith("[I")) { mv.visitInsn(Opcodes.IALOAD); } else if (type.endsWith("[J")) { mv.visitInsn(Opcodes.LALOAD); } else if (type.endsWith("[S")) { mv.visitInsn(Opcodes.SALOAD); } else { mv.visitInsn(Opcodes.AALOAD); } mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/io/PrintStream", "println", "(" + printType + ")V"); }
From source file:jerl.bcm.inj.impl.InjectCollection.java
License:Apache License
public void injectSystemOutCurThread(MethodVisitor mv, String str) { mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); mv.visitLdcInsn(str);/*from ww w. j a v a 2 s .c om*/ mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/io/PrintStream", "print", "(Ljava/lang/String;)V"); mv.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Thread", "currentThread", "()Ljava/lang/Thread;"); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/Object;)V"); }
From source file:jerl.semc.MethodEntryLog.java
License:Apache License
public static void injectSEMCLogging(MethodVisitor mv, String logMsg, String className) { mv.visitFieldInsn(Opcodes.GETSTATIC, className, FieldAddSEMCLog.LOG_FIELD_NAME, "L" + FieldAddSEMCLog.LOG_CLASS_NAME + ";"); mv.visitLdcInsn(logMsg);//from w ww . j a v a 2s. c o m mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, FieldAddSEMCLog.LOG_CLASS_NAME, "trace", "(Ljava/lang/String;)V"); }
From source file:jpcsp.Allegrex.compiler.CodeBlock.java
License:Open Source License
private void addNonStaticMethods(CompilerContext context, ClassVisitor cv) { MethodVisitor mv;// www . j a v a2 s .co m // public int exec(int returnAddress, int alternativeReturnAddress, boolean isJump) throws Exception; mv = cv.visitMethod(Opcodes.ACC_PUBLIC, context.getExecMethodName(), context.getExecMethodDesc(), null, exceptions); mv.visitCode(); mv.visitMethodInsn(Opcodes.INVOKESTATIC, getClassName(), context.getStaticExecMethodName(), context.getStaticExecMethodDesc()); mv.visitInsn(Opcodes.IRETURN); mv.visitMaxs(1, 1); mv.visitEnd(); // private static IExecutable e; FieldVisitor fv = cv.visitField(Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC, context.getReplaceFieldName(), executableDescriptor, null, null); fv.visitEnd(); // public void setExecutable(IExecutable e); mv = cv.visitMethod(Opcodes.ACC_PUBLIC, context.getReplaceMethodName(), context.getReplaceMethodDesc(), null, exceptions); mv.visitCode(); mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitFieldInsn(Opcodes.PUTSTATIC, getClassName(), context.getReplaceFieldName(), executableDescriptor); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(1, 2); mv.visitEnd(); // public IExecutable getExecutable(); mv = cv.visitMethod(Opcodes.ACC_PUBLIC, context.getGetMethodName(), context.getGetMethodDesc(), null, exceptions); mv.visitCode(); mv.visitFieldInsn(Opcodes.GETSTATIC, getClassName(), context.getReplaceFieldName(), executableDescriptor); mv.visitInsn(Opcodes.ARETURN); mv.visitMaxs(1, 1); mv.visitEnd(); }
From source file:jpcsp.Allegrex.compiler.CompilerContext.java
License:Open Source License
private void loadCpu() { if (storeCpuLocal) { mv.visitVarInsn(Opcodes.ALOAD, LOCAL_CPU); } else {//from w w w .j a va2s . c o m mv.visitFieldInsn(Opcodes.GETSTATIC, runtimeContextInternalName, "cpu", cpuDescriptor); } }
From source file:jpcsp.Allegrex.compiler.CompilerContext.java
License:Open Source License
@Override public void loadProcessor() { mv.visitFieldInsn(Opcodes.GETSTATIC, runtimeContextInternalName, "processor", processorDescriptor); }
From source file:jpcsp.Allegrex.compiler.CompilerContext.java
License:Open Source License
private void loadMemory() { mv.visitFieldInsn(Opcodes.GETSTATIC, runtimeContextInternalName, "memory", memoryDescriptor); }
From source file:jpcsp.Allegrex.compiler.CompilerContext.java
License:Open Source License
private void loadModule(String moduleName) { mv.visitFieldInsn(Opcodes.GETSTATIC, Type.getInternalName(Modules.class), moduleName + "Module", "Ljpcsp/HLE/modules/" + moduleName + ";"); }
From source file:jpcsp.Allegrex.compiler.CompilerContext.java
License:Open Source License
private void loadFpr() { mv.visitFieldInsn(Opcodes.GETSTATIC, runtimeContextInternalName, "fpr", "[F"); }
From source file:jpcsp.Allegrex.compiler.CompilerContext.java
License:Open Source License
@Override public void loadVprFloat() { mv.visitFieldInsn(Opcodes.GETSTATIC, runtimeContextInternalName, "vprFloat", "[F"); }