Package javassist.bytecode

Examples of javassist.bytecode.CodeIterator$Branch16


/*     */     }
/* 128 */     int maxLocals = codeAttribute.getMaxLocals();
/* 129 */     int maxStack = codeAttribute.getMaxStack();
/* 130 */     int codeLength = codeAttribute.getCodeLength();
/*     */
/* 132 */     CodeIterator iter = codeAttribute.iterator();
/* 133 */     IntQueue queue = new IntQueue();
/*     */
/* 135 */     this.exceptions = buildExceptionInfo(method);
/* 136 */     this.subroutines = this.scanner.scan(method);
/*     */
/* 138 */     Executor executor = new Executor(clazz.getClassPool(), method.getConstPool());
/* 139 */     this.frames = new Frame[codeLength];
/* 140 */     this.frames[iter.lookAhead()] = firstFrame(method, maxLocals, maxStack);
/* 141 */     queue.add(iter.next());
/* 142 */     while (!queue.isEmpty()) {
/* 143 */       analyzeNextEntry(method, iter, queue, executor);
/*     */     }
/*     */
/* 146 */     return this.frames;
View Full Code Here


/* 497 */     if ((codeAttr == null) || (this.transformers == null))
/* 498 */       return;
/* 499 */     for (Transformer t = this.transformers; t != null; t = t.getNext()) {
/* 500 */       t.initialize(cp, clazz, minfo);
/*     */     }
/* 502 */     CodeIterator iterator = codeAttr.iterator();
/* 503 */     while (iterator.hasNext()) {
/*     */       try {
/* 505 */         int pos = iterator.next();
/* 506 */         for (t = this.transformers; t != null; t = t.getNext())
/* 507 */           pos = t.transform(clazz, pos, iterator, cp);
/*     */       }
/*     */       catch (BadBytecode e) {
/* 510 */         throw new CannotCompileException(e);
View Full Code Here

/*     */   {
/*  81 */     CodeAttribute codeAttr = minfo.getCodeAttribute();
/*  82 */     if (codeAttr == null) {
/*  83 */       return false;
/*     */     }
/*  85 */     CodeIterator iterator = codeAttr.iterator();
/*  86 */     boolean edited = false;
/*  87 */     LoopContext context = new LoopContext(codeAttr.getMaxLocals());
/*     */
/*  89 */     while (iterator.hasNext()) {
/*  90 */       if (loopBody(iterator, clazz, minfo, context))
/*  91 */         edited = true;
/*     */     }
/*  93 */     ExceptionTable et = codeAttr.getExceptionTable();
/*  94 */     int n = et.size();
View Full Code Here

/*     */     public BasicBlock[] make(MethodInfo minfo) throws BadBytecode {
/* 148 */       CodeAttribute ca = minfo.getCodeAttribute();
/* 149 */       if (ca == null) {
/* 150 */         return null;
/*     */       }
/* 152 */       CodeIterator ci = ca.iterator();
/* 153 */       return make(ci, 0, ci.getCodeLength(), ca.getExceptionTable());
/*     */     }
View Full Code Here

/*  692 */     cc.checkModify();
/*  693 */     CodeAttribute ca = this.methodInfo.getCodeAttribute();
/*  694 */     if (ca == null) {
/*  695 */       throw new CannotCompileException("no method body");
/*      */     }
/*  697 */     CodeIterator iterator = ca.iterator();
/*  698 */     Javac jv = new Javac(cc);
/*      */     try {
/*  700 */       int nvars = jv.recordParams(getParameterTypes(), Modifier.isStatic(getModifiers()));
/*      */
/*  702 */       jv.recordParamNames(ca, nvars);
/*  703 */       jv.recordLocalVariables(ca, 0);
/*  704 */       jv.recordType(getReturnType0());
/*  705 */       jv.compileStmnt(src);
/*  706 */       Bytecode b = jv.getBytecode();
/*  707 */       int stack = b.getMaxStack();
/*  708 */       int locals = b.getMaxLocals();
/*      */
/*  710 */       if (stack > ca.getMaxStack()) {
/*  711 */         ca.setMaxStack(stack);
/*      */       }
/*  713 */       if (locals > ca.getMaxLocals()) {
/*  714 */         ca.setMaxLocals(locals);
/*      */       }
/*  716 */       int pos = iterator.insertEx(b.get());
/*  717 */       iterator.insert(b.getExceptionTable(), pos);
/*  718 */       if (rebuild)
/*  719 */         this.methodInfo.rebuildStackMapIf6(cc.getClassPool(), cc.getClassFile2());
/*      */     }
/*      */     catch (NotFoundException e) {
/*  722 */       throw new CannotCompileException(e);
View Full Code Here

/*  763 */     ConstPool pool = this.methodInfo.getConstPool();
/*  764 */     CodeAttribute ca = this.methodInfo.getCodeAttribute();
/*  765 */     if (ca == null) {
/*  766 */       throw new CannotCompileException("no method body");
/*      */     }
/*  768 */     CodeIterator iterator = ca.iterator();
/*  769 */     int retAddr = ca.getMaxLocals();
/*  770 */     Bytecode b = new Bytecode(pool, 0, retAddr + 1);
/*  771 */     b.setStackDepth(ca.getMaxStack() + 1);
/*  772 */     Javac jv = new Javac(b, cc);
/*      */     try {
/*  774 */       int nvars = jv.recordParams(getParameterTypes(), Modifier.isStatic(getModifiers()));
/*      */
/*  776 */       jv.recordParamNames(ca, nvars);
/*  777 */       CtClass rtype = getReturnType0();
/*  778 */       int varNo = jv.recordReturnType(rtype, true);
/*  779 */       jv.recordLocalVariables(ca, 0);
/*      */
/*  782 */       int handlerLen = insertAfterHandler(asFinally, b, rtype, varNo, jv, src);
/*      */
/*  785 */       insertAfterAdvice(b, jv, src, pool, rtype, varNo);
/*      */
/*  787 */       ca.setMaxStack(b.getMaxStack());
/*  788 */       ca.setMaxLocals(b.getMaxLocals());
/*      */
/*  790 */       int gapPos = iterator.append(b.get());
/*  791 */       iterator.append(b.getExceptionTable(), gapPos);
/*      */
/*  793 */       if (asFinally) {
/*  794 */         ca.getExceptionTable().add(getStartPosOfBody(ca), gapPos, gapPos, 0);
/*      */       }
/*  796 */       int gapLen = iterator.getCodeLength() - gapPos - handlerLen;
/*  797 */       int subr = iterator.getCodeLength() - gapLen;
/*      */
/*  799 */       while (iterator.hasNext()) {
/*  800 */         int pos = iterator.next();
/*  801 */         if (pos >= subr) {
/*      */           break;
/*      */         }
/*  804 */         int c = iterator.byteAt(pos);
/*  805 */         if ((c == 176) || (c == 172) || (c == 174) || (c == 173) || (c == 175) || (c == 177))
/*      */         {
/*  808 */           insertGoto(iterator, subr, pos);
/*  809 */           subr = iterator.getCodeLength() - gapLen;
/*      */         }
/*      */       }
/*      */
/*  813 */       this.methodInfo.rebuildStackMapIf6(cc.getClassPool(), cc.getClassFile2());
/*      */     }
View Full Code Here

/*      */   {
/* 1006 */     CtClass cc = this.declaringClass;
/* 1007 */     cc.checkModify();
/* 1008 */     ConstPool cp = this.methodInfo.getConstPool();
/* 1009 */     CodeAttribute ca = this.methodInfo.getCodeAttribute();
/* 1010 */     CodeIterator iterator = ca.iterator();
/* 1011 */     Bytecode b = new Bytecode(cp, ca.getMaxStack(), ca.getMaxLocals());
/* 1012 */     b.setStackDepth(1);
/* 1013 */     Javac jv = new Javac(b, cc);
/*      */     try {
/* 1015 */       jv.recordParams(getParameterTypes(), Modifier.isStatic(getModifiers()));
/*      */
/* 1017 */       int var = jv.recordVariable(exceptionType, exceptionName);
/* 1018 */       b.addAstore(var);
/* 1019 */       jv.compileStmnt(src);
/*      */
/* 1021 */       int stack = b.getMaxStack();
/* 1022 */       int locals = b.getMaxLocals();
/*      */
/* 1024 */       if (stack > ca.getMaxStack()) {
/* 1025 */         ca.setMaxStack(stack);
/*      */       }
/* 1027 */       if (locals > ca.getMaxLocals()) {
/* 1028 */         ca.setMaxLocals(locals);
/*      */       }
/* 1030 */       int len = iterator.getCodeLength();
/* 1031 */       int pos = iterator.append(b.get());
/* 1032 */       ca.getExceptionTable().add(getStartPosOfBody(ca), len, len, cp.addClassInfo(exceptionType));
/*      */
/* 1034 */       iterator.append(b.getExceptionTable(), pos);
/* 1035 */       this.methodInfo.rebuildStackMapIf6(cc.getClassPool(), cc.getClassFile2());
/*      */     }
/*      */     catch (NotFoundException e) {
/* 1038 */       throw new CannotCompileException(e);
/*      */     }
View Full Code Here

/* 1113 */     if (!modify) {
/* 1114 */       return lineNum;
/*      */     }
/* 1116 */     CtClass cc = this.declaringClass;
/* 1117 */     cc.checkModify();
/* 1118 */     CodeIterator iterator = ca.iterator();
/* 1119 */     Javac jv = new Javac(cc);
/*      */     try {
/* 1121 */       jv.recordLocalVariables(ca, index);
/* 1122 */       jv.recordParams(getParameterTypes(), Modifier.isStatic(getModifiers()));
/*      */
/* 1124 */       jv.setMaxLocals(ca.getMaxLocals());
/* 1125 */       jv.compileStmnt(src);
/* 1126 */       Bytecode b = jv.getBytecode();
/* 1127 */       int locals = b.getMaxLocals();
/* 1128 */       int stack = b.getMaxStack();
/* 1129 */       ca.setMaxLocals(locals);
/*      */
/* 1134 */       if (stack > ca.getMaxStack()) {
/* 1135 */         ca.setMaxStack(stack);
/*      */       }
/* 1137 */       index = iterator.insertAt(index, b.get());
/* 1138 */       iterator.insert(b.getExceptionTable(), index);
/* 1139 */       this.methodInfo.rebuildStackMapIf6(cc.getClassPool(), cc.getClassFile2());
/* 1140 */       return lineNum;
/*      */     }
/*      */     catch (NotFoundException e) {
/* 1143 */       throw new CannotCompileException(e);
View Full Code Here

/*     */   {
/* 224 */     CodeAttribute ca = getMethodInfo2().getCodeAttribute();
/* 225 */     if (ca == null) {
/* 226 */       return (getModifiers() & 0x400) != 0;
/*     */     }
/* 228 */     CodeIterator it = ca.iterator();
/*     */     try {
/* 230 */       return (it.hasNext()) && (it.byteAt(it.next()) == 177) && (!it.hasNext());
/*     */     }
/*     */     catch (BadBytecode e) {
/*     */     }
/* 234 */     return false;
/*     */   }
View Full Code Here

/* 152 */     if (ca == null) {
/* 153 */       return false;
/*     */     }
/*     */
/* 156 */     ConstPool cp = ca.getConstPool();
/* 157 */     CodeIterator it = ca.iterator();
/*     */     try
/*     */     {
/* 160 */       int op0 = it.byteAt(it.next());
/*     */       int pos;
/*     */       int desc;
/* 161 */       return (op0 == 177) || ((op0 == 42) && (it.byteAt(pos = it.next()) == 183) && ((desc = cp.isConstructor(getSuperclassName(), it.u16bitAt(pos + 1))) != 0) && ("()V".equals(cp.getUtf8Info(desc))) && (it.byteAt(it.next()) == 177) && (!it.hasNext()));
/*     */     }
/*     */     catch (BadBytecode e)
/*     */     {
/*     */     }
/*     */
View Full Code Here

TOP

Related Classes of javassist.bytecode.CodeIterator$Branch16

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.