List of usage examples for org.objectweb.asm MethodVisitor visitLabel
public void visitLabel(final Label label)
From source file:org.batoo.jpa.core.impl.instance.Enhancer.java
License:Open Source License
private static void createMethodGetManagedInstance(final String enhancedClassName, final String descEnhancer, final ClassWriter cw) { final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, Enhancer.METHOD_ENHANCED_GET_MANAGED_INSTANCE, Enhancer.makeDescription(ManagedInstance.class), null, null); mv.visitCode();//from w ww.j a v a 2 s . c o m final Label l0 = new Label(); mv.visitLabel(l0); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_MANAGED_INSTANCE, Enhancer.DESCRIPTOR_MANAGED_INSTANCE); mv.visitInsn(Opcodes.ARETURN); final Label l1 = new Label(); mv.visitLabel(l1); mv.visitLocalVariable(Enhancer.THIS, descEnhancer, null, l0, l1, 0); mv.visitMaxs(0, 0); mv.visitEnd(); }
From source file:org.batoo.jpa.core.impl.instance.Enhancer.java
License:Open Source License
private static void createMethodIsInitialized(final String enhancedClassName, final String descEnhancer, final ClassWriter cw) { final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, Enhancer.METHOD_ENHANCED_IS_INITIALIZED, Enhancer.makeDescription(Boolean.TYPE), null, null); mv.visitCode();/*from w w w.j a va2 s . c om*/ final Label l0 = new Label(); mv.visitLabel(l0); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_INITIALIZED, Enhancer.DESCRIPTOR_BOOLEAN); mv.visitInsn(Opcodes.IRETURN); final Label l1 = new Label(); mv.visitLabel(l1); mv.visitLocalVariable(Enhancer.THIS, descEnhancer, null, l0, l1, 0); mv.visitMaxs(0, 0); mv.visitEnd(); }
From source file:org.batoo.jpa.core.impl.instance.Enhancer.java
License:Open Source License
private static void createMethodSetInitialized(final String enhancedClassName, final String descEnhancer, final ClassWriter cw) { final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, Enhancer.METHOD_ENHANCED_SET_INITIALIZED, Enhancer.makeDescription(Void.TYPE), null, null); mv.visitCode();/*from ww w .ja va 2 s. c o m*/ final Label l0 = new Label(); mv.visitLabel(l0); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitInsn(Opcodes.ICONST_1); mv.visitFieldInsn(Opcodes.PUTFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_INITIALIZED, Enhancer.DESCRIPTOR_BOOLEAN); mv.visitInsn(Opcodes.RETURN); final Label l1 = new Label(); mv.visitLabel(l1); mv.visitLocalVariable(Enhancer.THIS, descEnhancer, null, l0, l1, 0); mv.visitMaxs(0, 0); mv.visitEnd(); }
From source file:org.batoo.jpa.core.impl.instance.Enhancer.java
License:Open Source License
private static void createMethodSetInternal(final String enhancedClassName, final String descEnhancer, final ClassWriter cw) { final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, Enhancer.METHOD_ENHANCED_SET_INTERNAL, Enhancer.makeDescription(Void.TYPE, Boolean.TYPE), null, null); mv.visitCode();//w w w. jav a 2 s. com final Label l0 = new Label(); mv.visitLabel(l0); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitVarInsn(Opcodes.ILOAD, 1); mv.visitFieldInsn(Opcodes.PUTFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_INTERNAL, Enhancer.DESCRIPTOR_BOOLEAN); mv.visitInsn(Opcodes.RETURN); final Label l1 = new Label(); mv.visitLabel(l1); mv.visitLocalVariable(Enhancer.THIS, descEnhancer, null, l0, l1, 0); mv.visitLocalVariable("internal", Enhancer.DESCRIPTOR_BOOLEAN, null, l0, l1, 1); mv.visitMaxs(0, 0); mv.visitEnd(); // final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "__enhanced__$$__setInternalCall", "(Z)V", null, null); // mv.visitCode(); // final Label l0 = new Label(); // mv.visitLabel(l0); // mv.visitLineNumber(81, l0); // mv.visitVarInsn(Opcodes.ALOAD, 0); // mv.visitVarInsn(Opcodes.ILOAD, 1); // mv.visitFieldInsn(Opcodes.PUTFIELD, descEnhancer, Enhancer.FIELD_ENHANCED_INTERNAL, Enhancer.DESCRIPTOR_BOOLEAN); // final Label l1 = new Label(); // mv.visitLabel(l1); // mv.visitLineNumber(82, l1); // mv.visitInsn(Opcodes.RETURN); // final Label l2 = new Label(); // mv.visitLabel(l2); // mv.visitLocalVariable("this", descEnhancer, null, l0, l2, 0); // mv.visitLocalVariable("internal", "Z", null, l0, l2, 1); // mv.visitMaxs(2, 2); // mv.visitEnd(); }
From source file:org.batoo.jpa.core.impl.instance.Enhancer.java
License:Open Source License
private static void createMethodSetManagedInstance(final String enhancedClassName, final String descEnhancer, final ClassWriter cw) { final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, Enhancer.METHOD_ENHANCED_SET_MANAGED_INSTANCE, Enhancer.makeDescription(Void.TYPE, ManagedInstance.class), null, null); mv.visitCode();//from w w w.j a v a 2 s .c o m final Label l0 = new Label(); mv.visitLabel(l0); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitFieldInsn(Opcodes.PUTFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_MANAGED_INSTANCE, Enhancer.DESCRIPTOR_MANAGED_INSTANCE); mv.visitInsn(Opcodes.RETURN); final Label l1 = new Label(); mv.visitLabel(l1); mv.visitLocalVariable(Enhancer.THIS, descEnhancer, null, l0, l1, 0); mv.visitLocalVariable("instance", Enhancer.DESCRIPTOR_MANAGED_INSTANCE, null, l0, l1, 1); mv.visitMaxs(0, 0); mv.visitEnd(); }
From source file:org.batoo.jpa.core.impl.instance.Enhancer.java
License:Open Source License
private static void createNoArgConstructor(final String enhancingClassName, final String enhancedClassName, final String descEnhancer, final ClassWriter cw) { final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, Enhancer.CONSTRUCTOR_INIT, Enhancer.makeDescription(Void.TYPE), null, null); mv.visitCode();/* w w w .j av a2 s.co m*/ final Label l0 = new Label(); mv.visitLabel(l0); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, enhancingClassName, Enhancer.CONSTRUCTOR_INIT, Enhancer.makeDescription(Void.TYPE)); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitInsn(Opcodes.ACONST_NULL); mv.visitFieldInsn(Opcodes.PUTFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_ID, Enhancer.DESCRIPTOR_OBJECT); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitInsn(Opcodes.ACONST_NULL); mv.visitFieldInsn(Opcodes.PUTFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_TYPE, Enhancer.DESCRIPTOR_CLASS); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitInsn(Opcodes.ACONST_NULL); mv.visitFieldInsn(Opcodes.PUTFIELD, enhancedClassName, Enhancer.FIELD_ENHANCED_SESSION, Enhancer.DESCRIPTOR_SESSION); mv.visitInsn(Opcodes.RETURN); final Label l1 = new Label(); mv.visitLabel(l1); mv.visitLocalVariable(Enhancer.THIS, descEnhancer, null, l0, l1, 0); mv.visitMaxs(0, 0); mv.visitEnd(); }
From source file:org.batoo.jpa.core.impl.instance.Enhancer.java
License:Open Source License
private static void createOverrriddenMethod(final String enhancingClassName, final String enhancedClassName, final String descEnhancer, final ClassWriter cw, Method method) { final String methodDescription = Enhancer.makeDescription(method.getReturnType(), method.getParameterTypes()); // TODO Exception types for (int i = 0; i < method.getExceptionTypes().length; i++) { }/*w w w.jav a 2s . co m*/ final MethodVisitor mv = cw.visitMethod(method.getModifiers(), method.getName(), methodDescription, null, null); mv.visitCode(); // this.__enhanced_$$__check(); final Label lCheck = new Label(); mv.visitLabel(lCheck); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, enhancedClassName, Enhancer.METHOD_ENHANCED_CHECK, Enhancer.makeDescription(Void.TYPE)); mv.visitVarInsn(Opcodes.ALOAD, 0); // load this // infer the method parameters for (int i = 0, r = 1; i < method.getParameterTypes().length; i++, r++) { final Class<?> paramClass = method.getParameterTypes()[i]; mv.visitVarInsn(Enhancer.getLoadType(paramClass), r); // load parameter if ((paramClass == Double.TYPE) || (paramClass == Long.TYPE)) { r++; } } // super.method(...); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, enhancingClassName, method.getName(), methodDescription); if (method.getReturnType() != Void.TYPE) { // non void return mv.visitInsn(Enhancer.getReturnType(method.getReturnType())); } else { // void return mv.visitInsn(Opcodes.RETURN); } final Label lOut = new Label(); mv.visitLabel(lOut); Enhancer.registerLocals(descEnhancer, method, mv, lCheck, lOut); mv.visitMaxs(0, 0); mv.visitEnd(); }
From source file:org.boretti.drools.integration.drools5.DroolsClassVisitor.java
License:Open Source License
@Override public void visitEnd() { FieldVisitor fv = null;//from w w w . j a v a 2 s.c om if (isNeedChangeForBoth()) { fv = super.visitField(Opcodes.ACC_PRIVATE, DROOLS_FIELD_NAME, Type.BOOLEAN_TYPE.getDescriptor(), null, null); if (fv != null) { AnnotationVisitor av = fv.visitAnnotation(Type.getType(Generated.class).getDescriptor(), true); AnnotationVisitor value = av.visitArray("value"); value.visit("", "Generated by Drools5IntegrationHelper Maven plugin"); value.visitEnd(); av.visit("date", new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz").format(current)); av.visitEnd(); fv.visitEnd(); } } if (isNeedChangeForField()) { fv = super.visitField(Opcodes.ACC_PRIVATE, DROOLS_FIELD_RULE, Type.getType(RuleBase.class).getDescriptor(), null, null); if (fv != null) { AnnotationVisitor av = fv.visitAnnotation(Type.getType(Generated.class).getDescriptor(), true); AnnotationVisitor value = av.visitArray("value"); value.visit("", "Generated by Drools5IntegrationHelper Maven plugin"); value.visitEnd(); av.visit("date", new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz").format(current)); av.visitEnd(); fv.visitEnd(); } MethodVisitor mv = super.visitMethod(Opcodes.ACC_PRIVATE, DROOLS_METHOD_RUN, "()V", null, null); AnnotationVisitor av = mv.visitAnnotation(Type.getType(Generated.class).getDescriptor(), true); AnnotationVisitor value = av.visitArray("value"); value.visit("", "Generated by Drools5IntegrationHelper Maven plugin"); value.visitEnd(); av.visit("date", new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz").format(current)); av.visitEnd(); mv.visitCode(); Label start = new Label(); mv.visitLabel(start); Label doIt = new Label(); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, Type.getObjectType(me).getInternalName(), DROOLS_FIELD_NAME, Type.BOOLEAN_TYPE.getDescriptor()); mv.visitJumpInsn(Opcodes.IFEQ, doIt); mv.visitInsn(Opcodes.RETURN); mv.visitLabel(doIt); mv.visitFrame(Opcodes.F_SAME, 1, new Object[] { Type.getObjectType(me).getInternalName() }, 0, new Object[] {}); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn(Opcodes.GETFIELD, Type.getObjectType(me).getInternalName(), DROOLS_FIELD_RULE, Type.getType(RuleBase.class).getDescriptor()); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getType(RuleBase.class).getInternalName(), "newStatelessSession", "()Lorg/drools/StatelessSession;"); mv.visitInsn(Opcodes.DUP); mv.visitLdcInsn(FIELD_NAME_LOGGER); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getType(Object.class).getInternalName(), "getClass", "()Ljava/lang/Class;"); mv.visitMethodInsn(Opcodes.INVOKESTATIC, Type.getType(org.apache.log4j.Logger.class).getInternalName(), "getLogger", "(Ljava/lang/Class;)Lorg/apache/log4j/Logger;"); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getType(StatelessSession.class).getInternalName(), "setGlobal", "(Ljava/lang/String;Ljava/lang/Object;)V"); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, Type.getType(StatelessSession.class).getInternalName(), "execute", "(Ljava/lang/Object;)V"); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitInsn(Opcodes.ICONST_1); mv.visitFieldInsn(Opcodes.PUTFIELD, Type.getObjectType(me).getInternalName(), DROOLS_FIELD_NAME, Type.BOOLEAN_TYPE.getDescriptor()); mv.visitInsn(Opcodes.RETURN); Label end = new Label(); mv.visitLabel(end); mv.visitLocalVariable("this", Type.getObjectType(me).getDescriptor(), null, start, end, 0); mv.visitMaxs(4, 1); mv.visitEnd(); } super.visitEnd(); }
From source file:org.cacheonix.impl.transformer.CacheonixMethodGenerator.java
License:LGPL
/** * Generates a new method body for implementing DataSource with the old name to look into the Cacheonix cache first * before calling the original method/* ww w . j av a 2 s .c o m*/ * * @param cv ClassVisitor that this class delegates the calls to * @param className Name of the class for which the method is being generated * @param access Method level access * @param desc Method descriptor * @param signature Method signature * @param exceptions Any exceptions that the method can throw * @param name original name of the method * @param newName the original method renamed to the format:orig$Cacheonix$methodName * @param metaData Annotation information for the method * @param cacheonixCacheFieldValue cacheName specified at the class level */ public static void generateCacheAddBody(final ClassVisitor cv, final String className, final int access, final String desc, final String signature, final String[] exceptions, final String name, final String newName, final MethodMetaData metaData, final String cacheonixCacheFieldValue) { final Type[] args = Type.getArgumentTypes(desc); final LocalStackUtil stackFrame = new LocalStackUtil(args); int expirationTime = CacheonixAnnotation.CACHEDATASOURCE_EXPIRATION_TIME_MILLIS_DEFAULT_VALUE; if (metaData.isAnnotationsPresent()) { final Object expTime = metaData.getAnnotationParameterValue( CacheonixAnnotation.CACHE_DATA_SOURCE_DESCRIPTOR, CacheonixAnnotation.CACHEDATASOURCE_EXPIRATION_TIME_MILLIS); if (expTime != null) { expirationTime = Integer.parseInt(expTime.toString()); } } // Start final MethodVisitor mv = cv.visitMethod(access, name, desc, signature, exceptions); mv.visitCode(); final Label l0 = new Label(); final Label l1 = new Label(); final Label l2 = new Label(); mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Exception"); final String classCan = 'L' + className + ';'; mv.visitLdcInsn(Type.getType(classCan)); mv.visitMethodInsn(INVOKESTATIC, "org/cacheonix/impl/util/logging/Logger", "getLogger", "(Ljava/lang/Class;)Lorg/cacheonix/impl/util/logging/Logger;"); mv.visitVarInsn(ASTORE, stackFrame.getLogLocalStackPos()); mv.visitInsn(ACONST_NULL); mv.visitVarInsn(ASTORE, stackFrame.getValObjLocalStackPos()); // val generateKeyAggregationSequence(mv, args, stackFrame, cacheonixCacheFieldValue, metaData.getMethodParamAnnotationInfo()); mv.visitInsn(ACONST_NULL); mv.visitVarInsn(ASTORE, stackFrame.getCacheRefLocalStackPos()); // cache // printingToSysout(mv, "!!!!! G E N E R A T E D !!!!!! '" + name + "' is Called"); mv.visitLabel(l0); // Config file from annotation on Class level mv.visitFieldInsn(GETSTATIC, className, CacheonixClassAdapter.CACHEONIX_CONFIG_FILE_FIELD, "Ljava/lang/String;"); mv.visitMethodInsn(INVOKESTATIC, "cacheonix/cache/CacheManager", "getInstance", "(Ljava/lang/String;)Lcacheonix/cache/CacheManager;"); mv.visitVarInsn(ASTORE, stackFrame.getCacheManagerLocalStackPos()); // inst // CATCH Block mv.visitLabel(l1); final Label l3 = new Label(); mv.visitJumpInsn(GOTO, l3); mv.visitLabel(l2); mv.visitVarInsn(ASTORE, stackFrame.getExceptionLocalStackPos()); // exception mv.visitInsn(ACONST_NULL); mv.visitVarInsn(ASTORE, stackFrame.getCacheManagerLocalStackPos()); // inst mv.visitVarInsn(ALOAD, stackFrame.getLogLocalStackPos()); // log mv.visitLdcInsn(">>>>> Exception getting CacheManager "); mv.visitVarInsn(ALOAD, stackFrame.getExceptionLocalStackPos()); // exception mv.visitMethodInsn(INVOKEVIRTUAL, "org/cacheonix/impl/util/logging/Logger", "e", "(Ljava/lang/Object;Ljava/lang/Throwable;)V"); // END OF TRY CACTCH mv.visitLabel(l3); // printingToSysout(mv, "!!!!! INST is NOT NULL !!!!!! '" + name + "' is Called"); mv.visitVarInsn(ALOAD, stackFrame.getCacheManagerLocalStackPos()); // inst final Label l4 = new Label(); mv.visitJumpInsn(IFNULL, l4); mv.visitVarInsn(ALOAD, stackFrame.getCacheManagerLocalStackPos()); // inst mv.visitFieldInsn(GETSTATIC, className, CacheonixClassAdapter.CACHE_NAME_FIELD, "Ljava/lang/String;"); mv.visitMethodInsn(INVOKEVIRTUAL, "cacheonix/cache/CacheManager", "getCache", "(Ljava/lang/String;)Lcacheonix/cache/Cache;"); mv.visitVarInsn(ASTORE, stackFrame.getCacheRefLocalStackPos()); // cache mv.visitVarInsn(ALOAD, stackFrame.getCacheRefLocalStackPos()); // cache mv.visitVarInsn(ALOAD, stackFrame.getKeyGenLocalStackPos()); // key mv.visitMethodInsn(INVOKEINTERFACE, "cacheonix/cache/Cache", "get", "(Ljava/lang/Object;)Ljava/lang/Object;"); mv.visitVarInsn(ASTORE, stackFrame.getValObjLocalStackPos()); // val mv.visitVarInsn(ALOAD, stackFrame.getValObjLocalStackPos()); // val mv.visitJumpInsn(IFNONNULL, l4); // printingToSysout(mv, "!!!!! VALUE IN CACHE IS NULL !!!!!! '" + name + "' is Called"); generateMethodParameterLoadingSequence(mv, args); mv.visitMethodInsn(INVOKESPECIAL, className, newName, desc); mv.visitVarInsn(ASTORE, stackFrame.getValObjLocalStackPos()); // val mv.visitVarInsn(ALOAD, stackFrame.getCacheRefLocalStackPos()); // cache mv.visitVarInsn(ALOAD, stackFrame.getKeyGenLocalStackPos()); // key mv.visitVarInsn(ALOAD, stackFrame.getValObjLocalStackPos()); // val if (expirationTime == -1) { mv.visitMethodInsn(INVOKEINTERFACE, "cacheonix/cache/Cache", "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); } else { mv.visitLdcInsn(Long.valueOf(expirationTime)); mv.visitMethodInsn(INVOKEINTERFACE, "cacheonix/cache/Cache", "put", "(Ljava/lang/Object;Ljava/lang/Object;J)Ljava/lang/Object;"); } mv.visitInsn(POP); mv.visitLabel(l4); mv.visitVarInsn(ALOAD, stackFrame.getValObjLocalStackPos()); // val // Return type final String retType = Type.getReturnType(desc).getInternalName(); mv.visitTypeInsn(CHECKCAST, retType); mv.visitInsn(ARETURN); mv.visitMaxs(6, 10); mv.visitEnd(); }
From source file:org.cacheonix.impl.transformer.CacheonixMethodGenerator.java
License:LGPL
/** * Generates a new method body for implementing CacheInvalidate with the old name to look into the Cacheonix cache * first before calling the original method * * @param cv ClassVisitor that this class delegates the calls to * @param className Name of the class for which the method is being generated * @param access Method level access * @param desc Method descriptor * @param signature Method signature * @param exceptions Any exceptions that the method can throw * @param name original name of the method * @param newName the original method renamed to the format:orig$Cacheonix$methodName * @param metaData Annotation information for the method * @param cacheonixCacheFieldValue cacheName specified at the class level *///from w w w .j a v a2 s . c o m public static void generateCacheRemoveBody(final ClassVisitor cv, final String className, final int access, final String desc, final String signature, final String[] exceptions, final String name, final String newName, final MethodMetaData metaData, final String cacheonixCacheFieldValue) { final Type[] args = Type.getArgumentTypes(desc); final LocalStackUtil stackFrame = new LocalStackUtil(args); // Start final MethodVisitor mv = cv.visitMethod(access, name, desc, signature, exceptions); mv.visitCode(); final Label l0 = new Label(); final Label l1 = new Label(); final Label l2 = new Label(); mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Exception"); final Label l3 = new Label(); final Label l4 = new Label(); final Label l5 = new Label(); mv.visitTryCatchBlock(l3, l4, l5, "java/lang/Exception"); final String classCan = 'L' + className + ';'; mv.visitLdcInsn(Type.getType(classCan)); mv.visitMethodInsn(INVOKESTATIC, "org/cacheonix/impl/util/logging/Logger", "getLogger", "(Ljava/lang/Class;)Lorg/cacheonix/impl/util/logging/Logger;"); mv.visitVarInsn(ASTORE, stackFrame.getCILogLocalStackPos()); // Log mv.visitInsn(ACONST_NULL); mv.visitVarInsn(ASTORE, stackFrame.getCICacheManagerLocalStackPos()); // inst // try mv.visitLabel(l0); mv.visitFieldInsn(GETSTATIC, className, CacheonixClassAdapter.CACHEONIX_CONFIG_FILE_FIELD, "Ljava/lang/String;"); mv.visitMethodInsn(INVOKESTATIC, "cacheonix/cache/CacheManager", "getInstance", "(Ljava/lang/String;)Lcacheonix/cache/CacheManager;"); mv.visitVarInsn(ASTORE, stackFrame.getCICacheManagerLocalStackPos()); // inst // catch in mv.visitLabel(l1); mv.visitJumpInsn(GOTO, l3); // catch out mv.visitLabel(l2); mv.visitVarInsn(ASTORE, stackFrame.getCIExceptionLocalStackPos()); // Exception1 mv.visitInsn(ACONST_NULL); mv.visitVarInsn(ASTORE, stackFrame.getCIExceptionLocalStackPos()); // inst <- null mv.visitVarInsn(ALOAD, stackFrame.getCILogLocalStackPos()); // Log mv.visitLdcInsn(">>>>> Exception getting CacheManager "); mv.visitVarInsn(ALOAD, stackFrame.getCIExceptionLocalStackPos()); // Exception mv.visitMethodInsn(INVOKEVIRTUAL, "org/cacheonix/impl/util/logging/Logger", "e", "(Ljava/lang/Object;Ljava/lang/Throwable;)V"); // END OF TRY CACTCH // try mv.visitLabel(l3); // printingToSysout(mv, "!!!!! INVALIDATE | INST is NOT NULL !!!!!! '" + name + "' is Called"); mv.visitVarInsn(ALOAD, stackFrame.getCICacheManagerLocalStackPos()); // inst final Label l6 = new Label(); mv.visitJumpInsn(IFNULL, l6); // Key Loop generateKeyAggregationSequence(mv, args, stackFrame, cacheonixCacheFieldValue, metaData.getMethodParamAnnotationInfo()); mv.visitVarInsn(ALOAD, stackFrame.getCICacheManagerLocalStackPos()); // inst mv.visitFieldInsn(GETSTATIC, className, CacheonixClassAdapter.CACHE_NAME_FIELD, "Ljava/lang/String;"); mv.visitMethodInsn(INVOKEVIRTUAL, "cacheonix/cache/CacheManager", "getCache", "(Ljava/lang/String;)Lcacheonix/cache/Cache;"); mv.visitVarInsn(ASTORE, stackFrame.getCICacheRefLocalStackPos()); // cache mv.visitVarInsn(ALOAD, stackFrame.getCICacheRefLocalStackPos()); // cache mv.visitJumpInsn(IFNULL, l6); mv.visitVarInsn(ALOAD, stackFrame.getCICacheRefLocalStackPos()); // cache mv.visitVarInsn(ALOAD, stackFrame.getCIKeyGenLocalStackPos()); // Key mv.visitMethodInsn(INVOKEINTERFACE, "cacheonix/cache/Cache", "remove", "(Ljava/lang/Object;)Ljava/lang/Object;"); mv.visitInsn(POP); // Ignore result mv.visitLabel(l4); mv.visitJumpInsn(GOTO, l6); mv.visitLabel(l5); mv.visitVarInsn(ASTORE, stackFrame.getCIEExceptionLocalStackPos()); // EException mv.visitVarInsn(ALOAD, stackFrame.getCILogLocalStackPos()); // Log mv.visitLdcInsn(">>>>> Exception while removing key "); mv.visitVarInsn(ALOAD, stackFrame.getCIEExceptionLocalStackPos()); // EException mv.visitMethodInsn(INVOKEVIRTUAL, "org/cacheonix/impl/util/logging/Logger", "e", "(Ljava/lang/Object;Ljava/lang/Throwable;)V"); mv.visitLabel(l6); // generateMethodParameterLoadingSequence(mv, args); mv.visitMethodInsn(INVOKESPECIAL, className, newName, desc); // final int op = ByteInstruction.getReturnCode(desc); mv.visitInsn(op); mv.visitMaxs(6, 9); mv.visitEnd(); }