/** * Rebuilds a stack map table. If no stack map table is included, * a new one is created. If this <code>MethodInfo</code> does not * include a code attribute, nothing happens. * * @param pool used for making type hierarchy. * @see StackMapTable * @since 3.6 */ public void rebuildStackMap(ClassPool pool) throws BadBytecode { CodeAttribute ca = getCodeAttribute(); if (ca != null) { StackMapTable smt = MapMaker.make(pool, this); ca.setAttribute(smt); } }
/** * Runs an analyzer (Phase 1 and 2). */ void make(TypedBlock[] blocks, byte[] code) throws BadBytecode { make(code, blocks[0]); findDeadCatchers(code, blocks); try { fixTypes(code, blocks); } catch (NotFoundException e) { throw new BadBytecode("failed to resolve types", e); } }
/** * Rebuilds a stack map table. If no stack map table is included, * a new one is created. If this <code>MethodInfo</code> does not * include a code attribute, nothing happens. * * @param pool used for making type hierarchy. * @see StackMapTable * @since 3.6 */ public void rebuildStackMap(ClassPool pool) throws BadBytecode { CodeAttribute ca = getCodeAttribute(); if (ca != null) { StackMapTable smt = MapMaker.make(pool, this); ca.setAttribute(smt); } }
/** * Runs an analyzer (Phase 1 and 2). */ void make(TypedBlock[] blocks, byte[] code) throws BadBytecode { make(code, blocks[0]); findDeadCatchers(code, blocks); try { fixTypes(code, blocks); } catch (NotFoundException e) { throw new BadBytecode("failed to resolve types", e); } }
/** * Computes the stack map table of the given method and returns it. * It returns null if the given method does not have to have a * stack map table or it includes JSR. */ public static StackMapTable make(ClassPool classes, MethodInfo minfo) throws BadBytecode { CodeAttribute ca = minfo.getCodeAttribute(); if (ca == null) return null; TypedBlock[] blocks; try { blocks = TypedBlock.makeBlocks(minfo, ca, true); } catch (BasicBlock.JsrBytecode e) { return null; } if (blocks == null) return null; MapMaker mm = new MapMaker(classes, minfo, ca); try { mm.make(blocks, ca.getCode()); } catch (BadBytecode bb) { throw new BadBytecode(minfo, bb); } return mm.toStackMap(blocks); }
private void traceException(byte[] code, TypedBlock.Catch handler) throws BadBytecode { while (handler != null) { TypedBlock tb = (TypedBlock)handler.body; if (tb.alreadySet()) { mergeMap(tb, false); if (tb.stackTop < 1) throw new BadBytecode("bad catch clause: " + handler.typeIndex); tb.stackTypes[0] = merge(toExceptionType(handler.typeIndex), tb.stackTypes[0]); } else { recordStackMap(tb, handler.typeIndex); MapMaker maker = new MapMaker(this); maker.make(code, tb); } handler = handler.next; } }
/** * Computes the stack map table for J2ME. * It returns null if the given method does not have to have a * stack map table or it includes JSR. */ public static StackMap make2(ClassPool classes, MethodInfo minfo) throws BadBytecode { CodeAttribute ca = minfo.getCodeAttribute(); if (ca == null) return null; TypedBlock[] blocks; try { blocks = TypedBlock.makeBlocks(minfo, ca, true); } catch (BasicBlock.JsrBytecode e) { return null; } if (blocks == null) return null; MapMaker mm = new MapMaker(classes, minfo, ca); try { mm.make(blocks, ca.getCode()); } catch (BadBytecode bb) { throw new BadBytecode(minfo, bb); } return mm.toStackMap2(minfo.getConstPool(), blocks); }
/** * Computes the stack map table of the given method and returns it. * It returns null if the given method does not have to have a * stack map table or it includes JSR. */ public static StackMapTable make(ClassPool classes, MethodInfo minfo) throws BadBytecode { CodeAttribute ca = minfo.getCodeAttribute(); if (ca == null) return null; TypedBlock[] blocks; try { blocks = TypedBlock.makeBlocks(minfo, ca, true); } catch (BasicBlock.JsrBytecode e) { return null; } if (blocks == null) return null; MapMaker mm = new MapMaker(classes, minfo, ca); try { mm.make(blocks, ca.getCode()); } catch (BadBytecode bb) { throw new BadBytecode(minfo, bb); } return mm.toStackMap(blocks); }
private void traceException(byte[] code, TypedBlock.Catch handler) throws BadBytecode { while (handler != null) { TypedBlock tb = (TypedBlock)handler.body; if (tb.alreadySet()) { mergeMap(tb, false); if (tb.stackTop < 1) throw new BadBytecode("bad catch clause: " + handler.typeIndex); tb.stackTypes[0] = merge(toExceptionType(handler.typeIndex), tb.stackTypes[0]); } else { recordStackMap(tb, handler.typeIndex); MapMaker maker = new MapMaker(this); maker.make(code, tb); } handler = handler.next; } }
private void make(byte[] code, TypedBlock tb) throws BadBytecode { copyTypeData(tb.stackTop, tb.stackTypes, stackTypes); stackTop = tb.stackTop; copyTypeData(tb.localsTypes.length, tb.localsTypes, localsTypes); traceException(code, tb.toCatch); int pos = tb.position; int end = pos + tb.length; while (pos < end) { pos += doOpcode(pos, code); traceException(code, tb.toCatch); } if (tb.exit != null) { for (int i = 0; i < tb.exit.length; i++) { TypedBlock e = (TypedBlock)tb.exit[i]; if (e.alreadySet()) mergeMap(e, true); else { recordStackMap(e); MapMaker maker = new MapMaker(this); maker.make(code, e); } } } }
/** * Computes the stack map table for J2ME. * It returns null if the given method does not have to have a * stack map table or it includes JSR. */ public static StackMap make2(ClassPool classes, MethodInfo minfo) throws BadBytecode { CodeAttribute ca = minfo.getCodeAttribute(); if (ca == null) return null; TypedBlock[] blocks; try { blocks = TypedBlock.makeBlocks(minfo, ca, true); } catch (BasicBlock.JsrBytecode e) { return null; } if (blocks == null) return null; MapMaker mm = new MapMaker(classes, minfo, ca); try { mm.make(blocks, ca.getCode()); } catch (BadBytecode bb) { throw new BadBytecode(minfo, bb); } return mm.toStackMap2(minfo.getConstPool(), blocks); }
methodInfo.getCodeAttribute().setAttribute( MapMaker.make( classPool, methodInfo ) );
private void make(byte[] code, TypedBlock tb) throws BadBytecode { copyTypeData(tb.stackTop, tb.stackTypes, stackTypes); stackTop = tb.stackTop; copyTypeData(tb.localsTypes.length, tb.localsTypes, localsTypes); traceException(code, tb.toCatch); int pos = tb.position; int end = pos + tb.length; while (pos < end) { pos += doOpcode(pos, code); traceException(code, tb.toCatch); } if (tb.exit != null) { for (int i = 0; i < tb.exit.length; i++) { TypedBlock e = (TypedBlock)tb.exit[i]; if (e.alreadySet()) mergeMap(e, true); else { recordStackMap(e); MapMaker maker = new MapMaker(this); maker.make(code, e); } } } }
methodInfo.getCodeAttribute().setAttribute( MapMaker.make( classPool, methodInfo ) );
/** * Rebuilds a stack map table. If no stack map table is included, * a new one is created. If this <code>MethodInfo</code> does not * include a code attribute, nothing happens. * * @param pool used for making type hierarchy. * @see StackMapTable * @since 3.6 */ public void rebuildStackMap(ClassPool pool) throws BadBytecode { CodeAttribute ca = getCodeAttribute(); if (ca != null) { StackMapTable smt = MapMaker.make(pool, this); ca.setAttribute(smt); } }
/** * Runs an analyzer (Phase 1 and 2). */ void make(TypedBlock[] blocks, byte[] code) throws BadBytecode { make(code, blocks[0]); findDeadCatchers(code, blocks); try { fixTypes(code, blocks); } catch (NotFoundException e) { throw new BadBytecode("failed to resolve types", e); } }
/** * Runs an analyzer (Phase 1 and 2). */ void make(TypedBlock[] blocks, byte[] code) throws BadBytecode { make(code, blocks[0]); findDeadCatchers(code, blocks); try { fixTypes(code, blocks); } catch (NotFoundException e) { throw new BadBytecode("failed to resolve types", e); } }
/** * Runs an analyzer (Phase 1 and 2). */ void make(TypedBlock[] blocks, byte[] code) throws BadBytecode { make(code, blocks[0]); findDeadCatchers(code, blocks); try { fixTypes(code, blocks); } catch (NotFoundException e) { throw new BadBytecode("failed to resolve types", e); } }
/** * Runs an analyzer (Phase 1 and 2). */ void make(TypedBlock[] blocks, byte[] code) throws BadBytecode { TypedBlock first = blocks[0]; fixParamTypes(first); TypeData[] srcTypes = first.localsTypes; copyFrom(srcTypes.length, srcTypes, this.localsTypes); make(code, first); int n = blocks.length; for (int i = 0; i < n; i++) evalExpected(blocks[i]); }
/** * Runs an analyzer (Phase 1 and 2). */ void make(TypedBlock[] blocks, byte[] code) throws BadBytecode { TypedBlock first = blocks[0]; fixParamTypes(first); TypeData[] srcTypes = first.localsTypes; copyFrom(srcTypes.length, srcTypes, this.localsTypes); make(code, first); int n = blocks.length; for (int i = 0; i < n; i++) evalExpected(blocks[i]); }