List of usage examples for org.objectweb.asm Opcodes IFEQ
int IFEQ
To view the source code for org.objectweb.asm Opcodes IFEQ.
Click Source Link
From source file:lucee.transformer.bytecode.statement.tag.TagLoop.java
License:Open Source License
/** * write out file loop// w ww .j a v a2 s . c o m * @param adapter * @throws TemplateException */ private void writeOutTypeFile(BytecodeContext bc) throws BytecodeException { WhileVisitor whileVisitor = new WhileVisitor(); loopVisitor = whileVisitor; GeneratorAdapter adapter = bc.getAdapter(); // charset=@charset int charset = adapter.newLocal(Types.STRING); Attribute attrCharset = getAttribute("charset"); if (attrCharset == null) adapter.visitInsn(Opcodes.ACONST_NULL); else attrCharset.getValue().writeOut(bc, Expression.MODE_REF); adapter.storeLocal(charset); // startline=@startline int startline = adapter.newLocal(Types.INT_VALUE); Attribute attrStartLine = getAttribute("startline"); if (attrStartLine == null) attrStartLine = getAttribute("from"); // CF8 if (attrStartLine == null) adapter.push(1); else { attrStartLine.getValue().writeOut(bc, Expression.MODE_VALUE); adapter.visitInsn(Opcodes.D2I); } adapter.storeLocal(startline); // endline=@endline int endline = adapter.newLocal(Types.INT_VALUE); Attribute attrEndLine = getAttribute("endline"); if (attrEndLine == null) attrEndLine = getAttribute("to"); if (attrEndLine == null) adapter.push(-1); else { attrEndLine.getValue().writeOut(bc, Expression.MODE_VALUE); adapter.visitInsn(Opcodes.D2I); } adapter.storeLocal(endline); //VariableReference index=VariableInterpreter.getVariableReference(pc,@index); int index = -1, item = -1; // item Attribute attrItem = getAttribute("item"); if (attrItem != null) { item = adapter.newLocal(Types.VARIABLE_REFERENCE); adapter.loadArg(0); attrItem.getValue().writeOut(bc, Expression.MODE_REF); adapter.invokeStatic(Types.VARIABLE_INTERPRETER, GET_VARIABLE_REFERENCE); adapter.storeLocal(item); } // index Attribute attrIndex = getAttribute("index"); if (attrIndex != null) { index = adapter.newLocal(Types.VARIABLE_REFERENCE); adapter.loadArg(0); attrIndex.getValue().writeOut(bc, Expression.MODE_REF); adapter.invokeStatic(Types.VARIABLE_INTERPRETER, GET_VARIABLE_REFERENCE); adapter.storeLocal(index); } //java.io.File file=FileUtil.toResourceExisting(pc,@file); int resource = adapter.newLocal(Types.RESOURCE); adapter.loadArg(0); getAttribute("file").getValue().writeOut(bc, Expression.MODE_REF); adapter.invokeStatic(RESOURCE_UTIL, TO_RESOURCE_EXISTING); adapter.storeLocal(resource); // pc.getConfig().getSecurityManager().checkFileLocation(resource); adapter.loadArg(0); adapter.invokeVirtual(Types.PAGE_CONTEXT, GET_CONFIG); adapter.invokeInterface(Types.CONFIG_WEB, GET_SECURITY_MANAGER); adapter.loadLocal(resource); adapter.invokeInterface(Types.SECURITY_MANAGER, CHECK_FILE_LOCATION); // char[] carr=new char[characters]; Attribute attr = getAttribute("characters"); int carr = -1; if (attr != null) { carr = adapter.newLocal(Types.CHAR_ARRAY); attr.getValue().writeOut(bc, Expression.MODE_VALUE); adapter.cast(Types.DOUBLE_VALUE, Types.INT_VALUE); adapter.newArray(Types.CHAR); adapter.storeLocal(carr); } // BufferedReader reader = IOUtil.getBufferedReader(resource,charset); final int br = adapter.newLocal(Types.BUFFERED_READER); adapter.loadLocal(resource); adapter.loadLocal(charset); adapter.invokeStatic(IO_UTIL, GET_BUFFERED_READER); adapter.storeLocal(br); // String line; int line = adapter.newLocal(Types.STRING); // int count=0; int count = adapter.newLocal(Types.INT_VALUE); adapter.push(0); adapter.storeLocal(count); TryFinallyVisitor tfv = new TryFinallyVisitor(new OnFinally() { public void _writeOut(BytecodeContext bc) { bc.getAdapter().loadLocal(br); bc.getAdapter().invokeStatic(IO_UTIL, CLOSE_EL); } }, null); //TryFinallyVisitor tcfv=new TryFinallyVisitor(); // try tfv.visitTryBegin(bc); //tcfv.visitTryBegin(bc); // while((line=br.readLine())!=null) { //WhileVisitor wv=new WhileVisitor(); whileVisitor.visitBeforeExpression(bc); DecisionObjectVisitor dv = new DecisionObjectVisitor(); dv.visitBegin(); if (attr != null) { // IOUtil.read(bufferedreader,12) adapter.loadLocal(br); adapter.loadLocal(carr); adapter.arrayLength(); adapter.invokeStatic(Types.IOUTIL, READ); } else { // br.readLine() adapter.loadLocal(br); adapter.invokeVirtual(Types.BUFFERED_READER, READ_LINE); } adapter.dup(); adapter.storeLocal(line); dv.visitNEQ(); adapter.visitInsn(Opcodes.ACONST_NULL); dv.visitEnd(bc); whileVisitor.visitAfterExpressionBeforeBody(bc); //if(++count < startLine) continue; DecisionIntVisitor dv2 = new DecisionIntVisitor(); dv2.visitBegin(); adapter.iinc(count, 1); adapter.loadLocal(count); dv2.visitLT(); adapter.loadLocal(startline); dv2.visitEnd(bc); Label end = new Label(); adapter.ifZCmp(Opcodes.IFEQ, end); whileVisitor.visitContinue(bc); adapter.visitLabel(end); // if(endLine!=-1 && count > endLine) break; DecisionIntVisitor div = new DecisionIntVisitor(); div.visitBegin(); adapter.loadLocal(endline); div.visitNEQ(); adapter.push(-1); div.visitEnd(bc); Label end2 = new Label(); adapter.ifZCmp(Opcodes.IFEQ, end2); DecisionIntVisitor div2 = new DecisionIntVisitor(); div2.visitBegin(); adapter.loadLocal(count); div2.visitGT(); adapter.loadLocal(endline); div2.visitEnd(bc); Label end3 = new Label(); adapter.ifZCmp(Opcodes.IFEQ, end3); whileVisitor.visitBreak(bc); adapter.visitLabel(end3); adapter.visitLabel(end2); // index and item if (index != -1 && item != -1) { // index.set(pc,line); adapter.loadLocal(index); adapter.loadArg(0); adapter.loadLocal(count); adapter.cast(Types.INT_VALUE, Types.DOUBLE_VALUE); adapter.invokeStatic(Types.CASTER, Methods.METHOD_TO_DOUBLE_FROM_DOUBLE); adapter.invokeVirtual(Types.VARIABLE_REFERENCE, SET); adapter.pop(); // item.set(pc,line); adapter.loadLocal(item); adapter.loadArg(0); adapter.loadLocal(line); adapter.invokeVirtual(Types.VARIABLE_REFERENCE, SET); adapter.pop(); } // only index else if (index != -1) { // index.set(pc,line); adapter.loadLocal(index); adapter.loadArg(0); adapter.loadLocal(line); adapter.invokeVirtual(Types.VARIABLE_REFERENCE, SET); adapter.pop(); } // only item else { // item.set(pc,line); adapter.loadLocal(item); adapter.loadArg(0); adapter.loadLocal(line); adapter.invokeVirtual(Types.VARIABLE_REFERENCE, SET); adapter.pop(); } getBody().writeOut(bc); whileVisitor.visitAfterBody(bc, getEnd()); tfv.visitTryEnd(bc); }
From source file:lucee.transformer.bytecode.statement.tag.TagLoop.java
License:Open Source License
/** * write out index loop//ww w.jav a2s . c o m * @param adapter * @throws TemplateException */ private void writeOutTypeFromTo(BytecodeContext bc) throws BytecodeException { ForDoubleVisitor forDoubleVisitor = new ForDoubleVisitor(); loopVisitor = forDoubleVisitor; GeneratorAdapter adapter = bc.getAdapter(); // int from=(int)@from; int from = adapter.newLocal(Types.DOUBLE_VALUE); ExpressionUtil.writeOutSilent(getAttribute("from").getValue(), bc, Expression.MODE_VALUE); adapter.storeLocal(from); // int to=(int)@to; int to = adapter.newLocal(Types.DOUBLE_VALUE); ExpressionUtil.writeOutSilent(getAttribute("to").getValue(), bc, Expression.MODE_VALUE); adapter.storeLocal(to); // int step=(int)@step; int step = adapter.newLocal(Types.DOUBLE_VALUE); Attribute attrStep = getAttribute("step"); if (attrStep != null) { ExpressionUtil.writeOutSilent(attrStep.getValue(), bc, Expression.MODE_VALUE); } else { adapter.push(1D); } adapter.storeLocal(step); // boolean dirPlus=(step > 0); int dirPlus = adapter.newLocal(Types.BOOLEAN_VALUE); DecisionDoubleVisitor div = new DecisionDoubleVisitor(); div.visitBegin(); adapter.loadLocal(step); div.visitGT(); adapter.push(0D); div.visitEnd(bc); adapter.storeLocal(dirPlus); //if(step!=0) { div = new DecisionDoubleVisitor(); div.visitBegin(); adapter.loadLocal(step); div.visitNEQ(); adapter.push(0D); div.visitEnd(bc); Label ifEnd = new Label(); adapter.ifZCmp(Opcodes.IFEQ, ifEnd); // VariableReference index>=VariableInterpreter.getVariableReference(pc,@index)); int index = adapter.newLocal(Types.VARIABLE_REFERENCE); adapter.loadArg(0); Attribute attr = getAttribute("index"); if (attr == null) attr = getAttribute("item"); ExpressionUtil.writeOutSilent(attr.getValue(), bc, Expression.MODE_REF); adapter.invokeStatic(Types.VARIABLE_INTERPRETER, GET_VARIABLE_REFERENCE); adapter.storeLocal(index); // index.set(from); adapter.loadLocal(index); adapter.loadLocal(from); adapter.invokeVirtual(Types.VARIABLE_REFERENCE, SET_DOUBLE); // for //int i=forConditionVisitor.visitBeforeExpression(adapter,from,step,true); // init adapter.visitLabel(forDoubleVisitor.beforeInit); forDoubleVisitor.forInit(adapter, from, true); adapter.goTo(forDoubleVisitor.beforeExpr); // update adapter.visitLabel(forDoubleVisitor.beforeUpdate); adapter.loadLocal(index); //forConditionVisitor.forUpdate(adapter, step, true); adapter.visitVarInsn(Opcodes.DLOAD, forDoubleVisitor.i); adapter.loadLocal(step); adapter.visitInsn(Opcodes.DADD); adapter.visitInsn(Opcodes.DUP2); adapter.visitVarInsn(Opcodes.DSTORE, forDoubleVisitor.i); adapter.invokeVirtual(Types.VARIABLE_REFERENCE, SET_DOUBLE); // expression adapter.visitLabel(forDoubleVisitor.beforeExpr); int i = forDoubleVisitor.i; adapter.loadLocal(dirPlus); Label l1 = new Label(); adapter.visitJumpInsn(Opcodes.IFEQ, l1); div = new DecisionDoubleVisitor(); div.visitBegin(); adapter.visitVarInsn(Opcodes.DLOAD, i); div.visitLTE(); adapter.loadLocal(to); div.visitEnd(bc); Label l2 = new Label(); adapter.visitJumpInsn(Opcodes.GOTO, l2); adapter.visitLabel(l1); div = new DecisionDoubleVisitor(); div.visitBegin(); adapter.visitVarInsn(Opcodes.DLOAD, i); div.visitGTE(); adapter.loadLocal(to); div.visitEnd(bc); adapter.visitLabel(l2); forDoubleVisitor.visitAfterExpressionBeginBody(adapter); //adapter.loadLocal(index); //adapter.visitVarInsn(Opcodes.DLOAD, i); //adapter.invokeVirtual(Types.VARIABLE_REFERENCE, SET_DOUBLE); getBody().writeOut(bc); forDoubleVisitor.visitEndBody(bc, getEnd()); ////// set i after usage //adapter.loadLocal(index); //adapter.visitVarInsn(Opcodes.DLOAD, i); //adapter.invokeVirtual(Types.VARIABLE_REFERENCE, SET_DOUBLE); adapter.visitLabel(ifEnd); }
From source file:lucee.transformer.bytecode.statement.tag.TagSilent.java
License:Open Source License
/** * * @see lucee.transformer.bytecode.statement.tag.TagBase#_writeOut(org.objectweb.asm.commons.GeneratorAdapter) *///from w w w . ja v a 2 s . com public void _writeOut(BytecodeContext bc) throws BytecodeException { final GeneratorAdapter adapter = bc.getAdapter(); final int silentMode = adapter.newLocal(Types.BOOLEAN_VALUE); // boolean silentMode= pc.setSilent(); adapter.loadArg(0); adapter.invokeVirtual(Types.PAGE_CONTEXT, SET_SILENT); adapter.storeLocal(silentMode); // call must be TryFinallyVisitor tfv = new TryFinallyVisitor(new OnFinally() { public void _writeOut(BytecodeContext bc) { //if(fcf!=null && fcf.getAfterFinalGOTOLabel()!=null)ASMUtil.visitLabel(adapter,fcf.getFinalEntryLabel()); // if(!silentMode)pc.unsetSilent(); Label _if = new Label(); adapter.loadLocal(silentMode); NotVisitor.visitNot(bc); adapter.ifZCmp(Opcodes.IFEQ, _if); adapter.loadArg(0); adapter.invokeVirtual(Types.PAGE_CONTEXT, UNSET_SILENT); adapter.pop(); adapter.visitLabel(_if); /*if(fcf!=null) { Label l = fcf.getAfterFinalGOTOLabel(); if(l!=null)adapter.visitJumpInsn(Opcodes.GOTO, l); }*/ } }, getFlowControlFinal()); tfv.visitTryBegin(bc); getBody().writeOut(bc); tfv.visitTryEnd(bc); }
From source file:lucee.transformer.bytecode.statement.tag.TagTry.java
License:Open Source License
/** * * @see lucee.transformer.bytecode.statement.tag.TagBase#_writeOut(org.objectweb.asm.commons.GeneratorAdapter) *///www . ja v a 2s.c om public void _writeOut(BytecodeContext bc) throws BytecodeException { GeneratorAdapter adapter = bc.getAdapter(); adapter.visitLabel(begin); Body tryBody = new BodyBase(); List<Tag> catches = new ArrayList<Tag>(); Tag tmpFinal = null; tryBody.setParent(getBody().getParent()); List<Statement> statements = getBody().getStatements(); Statement stat; Tag tag; { Iterator<Statement> it = statements.iterator(); while (it.hasNext()) { stat = it.next(); if (stat instanceof Tag) { tag = (Tag) stat; if (tag.getTagLibTag().getTagClassName().equals("lucee.runtime.tag.Catch")) { catches.add(tag); continue; } else if (tag.getTagLibTag().getTagClassName().equals("lucee.runtime.tag.Finally")) { tmpFinal = tag; continue; } } tryBody.addStatement(stat); } ; } final Tag _finally = tmpFinal; // has no try body, if there is no try body, no catches are executed, only finally if (!tryBody.hasStatements()) { if (_finally != null && _finally.getBody() != null) { BodyBase.writeOut(bc, _finally.getBody()); //ExpressionUtil.writeOut(_finally.getBody(), bc); } return; } TryCatchFinallyVisitor tcfv = new TryCatchFinallyVisitor(new OnFinally() { public void _writeOut(BytecodeContext bc) throws BytecodeException { if (_finally != null) { ExpressionUtil.visitLine(bc, _finally.getStart()); BodyBase.writeOut(bc, _finally.getBody()); //ExpressionUtil.writeOut(_finally.getBody(), bc); } } }, getFlowControlFinal()); // Try tcfv.visitTryBegin(bc); BodyBase.writeOut(bc, tryBody); //ExpressionUtil.writeOut(tryBody, bc); int e = tcfv.visitTryEndCatchBeging(bc); // if(e instanceof lucee.runtime.exp.Abort) throw e; Label abortEnd = new Label(); adapter.loadLocal(e); // Abort.isAbort(t); adapter.invokeStatic(Types.ABORT, TryCatchFinally.IS_ABORT); //adapter.instanceOf(Types.ABORT); adapter.ifZCmp(Opcodes.IFEQ, abortEnd); adapter.loadLocal(e); adapter.throwException(); adapter.visitLabel(abortEnd); // PageExceptionImpl old=pc.getCatch(); int old = adapter.newLocal(Types.PAGE_EXCEPTION); adapter.loadArg(0); adapter.invokeVirtual(Types.PAGE_CONTEXT, GET_CATCH); adapter.storeLocal(old); // PageException pe=Caster.toPageEception(e); int pe = adapter.newLocal(Types.PAGE_EXCEPTION); adapter.loadLocal(e); adapter.invokeStatic(Types.CASTER, TO_PAGE_EXCEPTION); adapter.storeLocal(pe); Iterator<Tag> it = catches.iterator(); Attribute attrType; Expression type; Label endAllIfs = new Label(); Tag tagElse = null; while (it.hasNext()) { tag = it.next(); Label endIf = new Label(); attrType = tag.getAttribute("type"); type = ANY; if (attrType != null) type = attrType.getValue(); if (type instanceof LitString && ((LitString) type).getString().equalsIgnoreCase("any")) { tagElse = tag; continue; } ExpressionUtil.visitLine(bc, tag.getStart()); // if(pe.typeEqual(@type) adapter.loadLocal(pe); type.writeOut(bc, Expression.MODE_REF); adapter.invokeVirtual(Types.PAGE_EXCEPTION, TYPE_EQUAL); adapter.ifZCmp(Opcodes.IFEQ, endIf); catchBody(bc, adapter, tag, pe, true, true); adapter.visitJumpInsn(Opcodes.GOTO, endAllIfs); adapter.visitLabel(endIf); } // else if (tagElse != null) { catchBody(bc, adapter, tagElse, pe, true, true); } else { // pc.setCatch(pe,true); adapter.loadArg(0); adapter.loadLocal(pe); adapter.push(false); adapter.push(true); adapter.invokeVirtual(Types.PAGE_CONTEXT, SET_CATCH3); //throw pe; adapter.loadLocal(pe); adapter.throwException(); } adapter.visitLabel(endAllIfs); // PageExceptionImpl old=pc.getCatch(); adapter.loadArg(0); adapter.loadLocal(old); adapter.invokeVirtual(Types.PAGE_CONTEXT, SET_CATCH_PE); tcfv.visitCatchEnd(bc); }
From source file:lucee.transformer.bytecode.statement.tag.TagTry2.java
License:Open Source License
@Override public void _writeOut(BytecodeContext bc) throws TransformerException { GeneratorAdapter adapter = bc.getAdapter(); adapter.visitLabel(begin);// w w w. j a v a 2 s.c o m Body tryBody = new BodyBase(getFactory()); List<Tag> catches = new ArrayList<Tag>(); Tag tmpFinal = null; tryBody.setParent(getBody().getParent()); List<Statement> statements = getBody().getStatements(); Statement stat; Tag tag; { Iterator<Statement> it = statements.iterator(); while (it.hasNext()) { stat = it.next(); if (stat instanceof Tag) { tag = (Tag) stat; if (tag.getTagLibTag().getTagClassDefinition().isClassNameEqualTo("lucee.runtime.tag.Catch")) { catches.add(tag); continue; } else if (tag.getTagLibTag().getTagClassDefinition() .isClassNameEqualTo("lucee.runtime.tag.Finally")) { tmpFinal = tag; continue; } } tryBody.addStatement(stat); } ; } final Tag _finally = tmpFinal; // has no try body, if there is no try body, no catches are executed, only finally if (!tryBody.hasStatements()) { if (_finally != null && _finally.getBody() != null) { BodyBase.writeOut(bc, _finally.getBody()); //ExpressionUtil.writeOut(_finally.getBody(), bc); } return; } TryCatchFinallyVisitor tcfv = new TryCatchFinallyVisitor(new OnFinally() { @Override public void _writeOut(BytecodeContext bc) throws TransformerException { if (_finally != null) { ExpressionUtil.visitLine(bc, _finally.getStart()); BodyBase.writeOut(bc, _finally.getBody()); //ExpressionUtil.writeOut(_finally.getBody(), bc); } } }, getFlowControlFinal()); // Try tcfv.visitTryBegin(bc); BodyBase.writeOut(bc, tryBody); //ExpressionUtil.writeOut(tryBody, bc); int e = tcfv.visitTryEndCatchBeging(bc); // if(e instanceof lucee.runtime.exp.Abort) throw e; Label abortEnd = new Label(); adapter.loadLocal(e); // Abort.isAbort(t); adapter.invokeStatic(Types.ABORT, TryCatchFinally.IS_ABORT); //adapter.instanceOf(Types.ABORT); adapter.ifZCmp(Opcodes.IFEQ, abortEnd); adapter.loadLocal(e); adapter.throwException(); adapter.visitLabel(abortEnd); // PageExceptionImpl old=pc.getCatch(); int oldPE = adapter.newLocal(Types.PAGE_EXCEPTION); int oldName = adapter.newLocal(Types.STRING); adapter.loadArg(0); adapter.invokeVirtual(Types.PAGE_CONTEXT, GET_CATCH); adapter.storeLocal(oldPE); adapter.loadArg(0); adapter.checkCast(Types.PAGE_CONTEXT_IMPL); adapter.invokeVirtual(Types.PAGE_CONTEXT_IMPL, GET_CATCH_NAME); adapter.storeLocal(oldName); // PageException pe=Caster.toPageEception(e); int pe = adapter.newLocal(Types.PAGE_EXCEPTION); adapter.loadLocal(e); adapter.invokeStatic(Types.CASTER, TO_PAGE_EXCEPTION); adapter.storeLocal(pe); Iterator<Tag> it = catches.iterator(); Attribute attrType; Expression type; Label endAllIfs = new Label(); Tag tagElse = null; while (it.hasNext()) { tag = it.next(); Label endIf = new Label(); // type attrType = tag.getAttribute("type"); type = bc.getFactory().createLitString("any"); if (attrType != null) type = attrType.getValue(); if (type instanceof LitString && ((LitString) type).getString().equalsIgnoreCase("any")) { tagElse = tag; continue; } ExpressionUtil.visitLine(bc, tag.getStart()); // if(pe.typeEqual(@type) adapter.loadLocal(pe); type.writeOut(bc, Expression.MODE_REF); adapter.invokeVirtual(Types.PAGE_EXCEPTION, TYPE_EQUAL); adapter.ifZCmp(Opcodes.IFEQ, endIf); catchBody(bc, adapter, tag, pe, true, true, extractName(tag)); adapter.visitJumpInsn(Opcodes.GOTO, endAllIfs); adapter.visitLabel(endIf); } // else if (tagElse != null) { catchBody(bc, adapter, tagElse, pe, true, true, extractName(tagElse)); } else { // pc.setCatch(pe,true); adapter.loadArg(0); adapter.loadLocal(pe); adapter.push(false); adapter.push(true); adapter.invokeVirtual(Types.PAGE_CONTEXT, SET_CATCH3); //throw pe; adapter.loadLocal(pe); adapter.throwException(); } adapter.visitLabel(endAllIfs); adapter.loadLocal(oldName); Label notNull = new Label(); adapter.visitJumpInsn(Opcodes.IFNONNULL, notNull); // NULL adapter.loadArg(0); adapter.loadLocal(oldPE); adapter.invokeVirtual(Types.PAGE_CONTEXT, SET_CATCH_PE); Label end = new Label(); adapter.visitJumpInsn(Opcodes.GOTO, end); adapter.visitLabel(notNull); // NOT NULL adapter.loadArg(0); adapter.checkCast(Types.PAGE_CONTEXT_IMPL); adapter.loadLocal(oldPE); adapter.loadLocal(oldName); adapter.invokeVirtual(Types.PAGE_CONTEXT_IMPL, SET_CATCH_PE2); adapter.visitLabel(end); tcfv.visitCatchEnd(bc); }
From source file:lucee.transformer.bytecode.statement.TryCatchFinally.java
License:Open Source License
private void _writeOutCatch(BytecodeContext bc, int lRef, int lThrow) throws BytecodeException { GeneratorAdapter adapter = bc.getAdapter(); int pe = adapter.newLocal(Types.PAGE_EXCEPTION); // instance of Abort Label abortEnd = new Label(); adapter.loadLocal(lThrow);/*from ww w . j av a2 s. c o m*/ adapter.invokeStatic(Types.ABORT, TryCatchFinally.IS_ABORT); //adapter.instanceOf(Types.ABORT); adapter.ifZCmp(Opcodes.IFEQ, abortEnd); adapter.loadLocal(lThrow); adapter.throwException(); adapter.visitLabel(abortEnd); // PageExceptionImpl old=pc.getCatch(); int old = adapter.newLocal(Types.PAGE_EXCEPTION); adapter.loadArg(0); adapter.invokeVirtual(Types.PAGE_CONTEXT, TagTry.GET_CATCH); adapter.storeLocal(old); // cast to PageException Caster.toPagException(t); adapter.loadLocal(lThrow); adapter.invokeStatic(Types.CASTER, TO_PAGE_EXCEPTION); // PageException pe=... adapter.storeLocal(pe); // catch loop Label endAllIf = new Label(); Iterator<Catch> it = catches.iterator(); Catch ctElse = null; while (it.hasNext()) { Catch ct = it.next(); // store any for else if (ct.type != null && ct.type instanceof LitString && ((LitString) ct.type).getString().equalsIgnoreCase("any")) { ctElse = ct; continue; } ExpressionUtil.visitLine(bc, ct.line); // pe.typeEqual(type) if (ct.type == null) { LitBoolean.TRUE.writeOut(bc, Expression.MODE_VALUE); } else { adapter.loadLocal(pe); ct.type.writeOut(bc, Expression.MODE_REF); adapter.invokeVirtual(Types.PAGE_EXCEPTION, TYPE_EQUAL); } Label endIf = new Label(); adapter.ifZCmp(Opcodes.IFEQ, endIf); catchBody(bc, adapter, ct, pe, lRef, true, true); adapter.visitJumpInsn(Opcodes.GOTO, endAllIf); adapter.visitLabel(endIf); } if (ctElse != null) { catchBody(bc, adapter, ctElse, pe, lRef, true, true); } else { // pc.setCatch(pe,true); adapter.loadArg(0); adapter.loadLocal(pe); adapter.push(false); adapter.push(false); adapter.invokeVirtual(Types.PAGE_CONTEXT, TagTry.SET_CATCH3); adapter.loadLocal(pe); adapter.throwException(); } adapter.visitLabel(endAllIf); // PageExceptionImpl old=pc.setCatch(old); adapter.loadArg(0); adapter.loadLocal(old); adapter.invokeVirtual(Types.PAGE_CONTEXT, TagTry.SET_CATCH_PE); }
From source file:lucee.transformer.bytecode.statement.While.java
License:Open Source License
@Override public void _writeOut(BytecodeContext bc) throws BytecodeException { GeneratorAdapter adapter = bc.getAdapter(); adapter.visitLabel(begin);/*from w w w.j a v a 2 s.c om*/ expr.writeOut(bc, Expression.MODE_VALUE); adapter.ifZCmp(Opcodes.IFEQ, end); body.writeOut(bc); adapter.visitJumpInsn(Opcodes.GOTO, begin); adapter.visitLabel(end); }
From source file:lucee.transformer.bytecode.visitor.AndVisitor.java
License:Open Source License
public void visitMiddle(BytecodeContext bc) { bc.getAdapter().ifZCmp(Opcodes.IFEQ, end); }
From source file:lucee.transformer.bytecode.visitor.AndVisitor.java
License:Open Source License
public void visitEnd(BytecodeContext bc) { GeneratorAdapter adapter = bc.getAdapter(); adapter.ifZCmp(Opcodes.IFEQ, end); adapter.push(true);// w w w . ja v a 2 s. co m adapter.visitJumpInsn(Opcodes.GOTO, l2); adapter.visitLabel(end); adapter.push(false); adapter.visitLabel(l2); }
From source file:lucee.transformer.bytecode.visitor.ConditionVisitor.java
License:Open Source License
public void visitWhenAfterExprBeforeBody(BytecodeContext bc) { endIf = new Label(); bc.getAdapter().ifZCmp(Opcodes.IFEQ, endIf); }