List of usage examples for org.objectweb.asm Opcodes ILOAD
int ILOAD
To view the source code for org.objectweb.asm Opcodes ILOAD.
Click Source Link
From source file:org.elasticsearch.painless.node.LVariable.java
License:Apache License
@Override void load(final CompilerSettings settings, final Definition definition, final GeneratorAdapter adapter) { adapter.visitVarInsn(after.type.getOpcode(Opcodes.ILOAD), slot); }
From source file:org.elasticsearch.painless.node.SEach.java
License:Apache License
void writeArray(MethodWriter writer, Globals globals) { expression.write(writer, globals);/*from ww w . j a va2 s . c om*/ writer.visitVarInsn(array.type.type.getOpcode(Opcodes.ISTORE), array.getSlot()); writer.push(-1); writer.visitVarInsn(index.type.type.getOpcode(Opcodes.ISTORE), index.getSlot()); Label begin = new Label(); Label end = new Label(); writer.mark(begin); writer.visitIincInsn(index.getSlot(), 1); writer.visitVarInsn(index.type.type.getOpcode(Opcodes.ILOAD), index.getSlot()); writer.visitVarInsn(array.type.type.getOpcode(Opcodes.ILOAD), array.getSlot()); writer.arrayLength(); writer.ifICmp(MethodWriter.GE, end); writer.visitVarInsn(array.type.type.getOpcode(Opcodes.ILOAD), array.getSlot()); writer.visitVarInsn(index.type.type.getOpcode(Opcodes.ILOAD), index.getSlot()); writer.arrayLoad(indexed.type); writer.writeCast(cast); writer.visitVarInsn(variable.type.type.getOpcode(Opcodes.ISTORE), variable.getSlot()); block.write(writer, globals); writer.goTo(begin); writer.mark(end); }
From source file:org.elasticsearch.painless.node.SEach.java
License:Apache License
void writeIterable(MethodWriter writer, Globals globals) { expression.write(writer, globals);//from ww w. j a va 2 s.co m if (method == null) { Type itr = Definition.getType("Iterator"); org.objectweb.asm.Type methodType = org.objectweb.asm.Type.getMethodType(itr.type, Definition.DEF_TYPE.type); writer.invokeDefCall("iterator", methodType, DefBootstrap.ITERATOR); } else { method.write(writer); } writer.visitVarInsn(iterator.type.type.getOpcode(Opcodes.ISTORE), iterator.getSlot()); Label begin = new Label(); Label end = new Label(); writer.mark(begin); writer.visitVarInsn(iterator.type.type.getOpcode(Opcodes.ILOAD), iterator.getSlot()); writer.invokeInterface(ITERATOR_TYPE, ITERATOR_HASNEXT); writer.ifZCmp(MethodWriter.EQ, end); writer.visitVarInsn(iterator.type.type.getOpcode(Opcodes.ILOAD), iterator.getSlot()); writer.invokeInterface(ITERATOR_TYPE, ITERATOR_NEXT); writer.writeCast(cast); writer.visitVarInsn(variable.type.type.getOpcode(Opcodes.ISTORE), variable.getSlot()); block.write(writer, globals); writer.goTo(begin); writer.mark(end); }
From source file:org.elasticsearch.painless.node.SSubEachArray.java
License:Apache License
@Override void write(MethodWriter writer, Globals globals) { writer.writeStatementOffset(location); expression.write(writer, globals);// w ww .j a va 2 s . c o m writer.visitVarInsn(array.type.type.getOpcode(Opcodes.ISTORE), array.getSlot()); writer.push(-1); writer.visitVarInsn(index.type.type.getOpcode(Opcodes.ISTORE), index.getSlot()); Label begin = new Label(); Label end = new Label(); writer.mark(begin); writer.visitIincInsn(index.getSlot(), 1); writer.visitVarInsn(index.type.type.getOpcode(Opcodes.ILOAD), index.getSlot()); writer.visitVarInsn(array.type.type.getOpcode(Opcodes.ILOAD), array.getSlot()); writer.arrayLength(); writer.ifICmp(MethodWriter.GE, end); writer.visitVarInsn(array.type.type.getOpcode(Opcodes.ILOAD), array.getSlot()); writer.visitVarInsn(index.type.type.getOpcode(Opcodes.ILOAD), index.getSlot()); writer.arrayLoad(indexed.type); writer.writeCast(cast); writer.visitVarInsn(variable.type.type.getOpcode(Opcodes.ISTORE), variable.getSlot()); if (loopCounter != null) { writer.writeLoopCounter(loopCounter.getSlot(), statementCount, location); } block.continu = begin; block.brake = end; block.write(writer, globals); writer.goTo(begin); writer.mark(end); }
From source file:org.elasticsearch.painless.node.SSubEachIterable.java
License:Apache License
@Override void write(MethodWriter writer, Globals globals) { writer.writeStatementOffset(location); expression.write(writer, globals);/*from w ww . j a va 2 s. c om*/ if (method == null) { Type itr = Definition.getType("Iterator"); org.objectweb.asm.Type methodType = org.objectweb.asm.Type.getMethodType(itr.type, Definition.DEF_TYPE.type); writer.invokeDefCall("iterator", methodType, DefBootstrap.ITERATOR); } else { method.write(writer); } writer.visitVarInsn(iterator.type.type.getOpcode(Opcodes.ISTORE), iterator.getSlot()); Label begin = new Label(); Label end = new Label(); writer.mark(begin); writer.visitVarInsn(iterator.type.type.getOpcode(Opcodes.ILOAD), iterator.getSlot()); writer.invokeInterface(ITERATOR_TYPE, ITERATOR_HASNEXT); writer.ifZCmp(MethodWriter.EQ, end); writer.visitVarInsn(iterator.type.type.getOpcode(Opcodes.ILOAD), iterator.getSlot()); writer.invokeInterface(ITERATOR_TYPE, ITERATOR_NEXT); writer.writeCast(cast); writer.visitVarInsn(variable.type.type.getOpcode(Opcodes.ISTORE), variable.getSlot()); if (loopCounter != null) { writer.writeLoopCounter(loopCounter.getSlot(), statementCount, location); } block.continu = begin; block.brake = end; block.write(writer, globals); writer.goTo(begin); writer.mark(end); }
From source file:org.elasticsearch.painless.Writer.java
License:Apache License
private void writeLoopCounter(final int count) { final Label end = new Label(); execute.iinc(metadata.loopCounterSlot, -count); execute.visitVarInsn(Opcodes.ILOAD, metadata.loopCounterSlot); execute.push(0);/*from w w w.j a v a 2 s. c o m*/ execute.ifICmp(GeneratorAdapter.GT, end); execute.throwException(PAINLESS_ERROR_TYPE, "The maximum number of statements that can be executed in a loop has been reached."); execute.mark(end); }
From source file:org.elasticsearch.painless.Writer.java
License:Apache License
private void writeLoadStoreVariable(final ParserRuleContext source, final boolean store, final Type type, final int slot) { if (type.sort == Sort.VOID) { throw new IllegalStateException(Metadata.error(source) + "Cannot load/store void type."); }//from w ww.j a v a 2 s. co m if (store) { execute.visitVarInsn(type.type.getOpcode(Opcodes.ISTORE), slot); } else { execute.visitVarInsn(type.type.getOpcode(Opcodes.ILOAD), slot); } }
From source file:org.elasticsearch.painless.WriterExternal.java
License:Apache License
private void writeLoadStoreVariable(final ParserRuleContext source, final boolean store, final Type type, int slot) { if (type.sort == Sort.VOID) { throw new IllegalStateException(WriterUtility.error(source) + "Cannot load/store void type."); }//from www .j a v a2 s . c o m if (store) { execute.visitVarInsn(type.type.getOpcode(Opcodes.ISTORE), slot); } else { execute.visitVarInsn(type.type.getOpcode(Opcodes.ILOAD), slot); } }
From source file:org.elasticsearch.plan.a.Writer.java
License:Apache License
private void writeLoopCounter(final int count) { final Label end = new Label(); execute.iinc(metadata.loopCounterSlot, -count); execute.visitVarInsn(Opcodes.ILOAD, metadata.loopCounterSlot); execute.push(0);//from w w w. j av a 2s. co m execute.ifICmp(GeneratorAdapter.GT, end); execute.throwException(PLAN_A_ERROR_TYPE, "The maximum number of statements that can be executed in a loop has been reached."); execute.mark(end); }
From source file:org.elasticsearch.plan.a.Writer.java
License:Apache License
private void writeLoadStoreVariable(final ParserRuleContext source, final boolean store, final Type type, final int slot) { if (type.sort == Sort.VOID) { throw new IllegalStateException(error(source) + "Cannot load/store void type."); }//from www .j a v a2 s. c o m if (store) { execute.visitVarInsn(type.type.getOpcode(Opcodes.ISTORE), slot); } else { execute.visitVarInsn(type.type.getOpcode(Opcodes.ILOAD), slot); } }