List of usage examples for org.objectweb.asm Opcodes ACONST_NULL
int ACONST_NULL
To view the source code for org.objectweb.asm Opcodes ACONST_NULL.
Click Source Link
From source file:org.elasticsearch.painless.node.ENull.java
License:Apache License
@Override void write(MethodWriter writer, Globals globals) { writer.visitInsn(Opcodes.ACONST_NULL); }
From source file:org.elasticsearch.painless.node.SDeclaration.java
License:Apache License
@Override void write(MethodWriter writer, Globals globals) { writer.writeStatementOffset(location); if (expression == null) { switch (variable.type.sort) { case VOID: throw createError(new IllegalStateException("Illegal tree structure.")); case BOOL: case BYTE: case SHORT: case CHAR: case INT: writer.push(0);// w w w .j av a 2s . c o m break; case LONG: writer.push(0L); break; case FLOAT: writer.push(0.0F); break; case DOUBLE: writer.push(0.0); break; default: writer.visitInsn(Opcodes.ACONST_NULL); } } else { expression.write(writer, globals); } writer.visitVarInsn(variable.type.type.getOpcode(Opcodes.ISTORE), variable.getSlot()); }
From source file:org.elasticsearch.painless.node.SSource.java
License:Apache License
@Override void write(MethodWriter writer, Globals globals) { if (reserved.usesScore()) { // if the _score value is used, we do this once: // final double _score = scorer.score(); Variable scorer = mainMethod.getVariable(null, Locals.SCORER); Variable score = mainMethod.getVariable(null, Locals.SCORE); writer.visitVarInsn(Opcodes.ALOAD, scorer.getSlot()); writer.invokeVirtual(WriterConstants.SCORER_TYPE, WriterConstants.SCORER_SCORE); writer.visitInsn(Opcodes.F2D);//from w w w .j av a 2 s . c om writer.visitVarInsn(Opcodes.DSTORE, score.getSlot()); } if (reserved.usesCtx()) { // if the _ctx value is used, we do this once: // final Map<String,Object> ctx = input.get("ctx"); Variable input = mainMethod.getVariable(null, Locals.PARAMS); Variable ctx = mainMethod.getVariable(null, Locals.CTX); writer.visitVarInsn(Opcodes.ALOAD, input.getSlot()); writer.push(Locals.CTX); writer.invokeInterface(MAP_TYPE, MAP_GET); writer.visitVarInsn(Opcodes.ASTORE, ctx.getSlot()); } if (reserved.getMaxLoopCounter() > 0) { // if there is infinite loop protection, we do this once: // int #loop = settings.getMaxLoopCounter() Variable loop = mainMethod.getVariable(null, Locals.LOOP); writer.push(reserved.getMaxLoopCounter()); writer.visitVarInsn(Opcodes.ISTORE, loop.getSlot()); } for (AStatement statement : statements) { statement.write(writer, globals); } if (!methodEscape) { writer.visitInsn(Opcodes.ACONST_NULL); writer.returnValue(); } }
From source file:org.elasticsearch.painless.Writer.java
License:Apache License
@Override public Void visitSource(final SourceContext ctx) { final Metadata.StatementMetadata sourcesmd = metadata.getStatementMetadata(ctx); for (final StatementContext sctx : ctx.statement()) { visit(sctx);//from w w w . j a va 2s . co m } if (!sourcesmd.methodEscape) { execute.visitInsn(Opcodes.ACONST_NULL); execute.returnValue(); } return null; }
From source file:org.elasticsearch.painless.Writer.java
License:Apache License
@Override public Void visitDeclvar(final DeclvarContext ctx) { final Metadata.ExpressionMetadata declvaremd = metadata.getExpressionMetadata(ctx); final org.objectweb.asm.Type type = declvaremd.to.type; final Sort sort = declvaremd.to.sort; final int slot = (int) declvaremd.postConst; final ExpressionContext exprctx = ctx.expression(); final boolean initialize = exprctx == null; if (!initialize) { visit(exprctx);/*from w w w . j a v a 2 s .c o m*/ } switch (sort) { case VOID: throw new IllegalStateException(Metadata.error(ctx) + "Unexpected writer state."); case BOOL: case BYTE: case SHORT: case CHAR: case INT: if (initialize) execute.push(0); break; case LONG: if (initialize) execute.push(0L); break; case FLOAT: if (initialize) execute.push(0.0F); break; case DOUBLE: if (initialize) execute.push(0.0); break; default: if (initialize) execute.visitInsn(Opcodes.ACONST_NULL); } execute.visitVarInsn(type.getOpcode(Opcodes.ISTORE), slot); return null; }
From source file:org.elasticsearch.painless.Writer.java
License:Apache License
@Override public Void visitNull(final NullContext ctx) { final Metadata.ExpressionMetadata nullemd = metadata.getExpressionMetadata(ctx); execute.visitInsn(Opcodes.ACONST_NULL); checkWriteCast(nullemd);// w w w .j a v a 2 s . c om checkWriteBranch(ctx); return null; }
From source file:org.elasticsearch.painless.WriterExpression.java
License:Apache License
void processNull(final NullContext ctx) { final ExpressionMetadata nullemd = metadata.getExpressionMetadata(ctx); execute.visitInsn(Opcodes.ACONST_NULL); caster.checkWriteCast(nullemd);/*from w ww . j a v a 2s. c o m*/ utility.checkWriteBranch(ctx); }
From source file:org.elasticsearch.painless.WriterStatement.java
License:Apache License
void processSource(final SourceContext ctx) { final StatementMetadata sourcesmd = metadata.getStatementMetadata(ctx); for (final StatementContext sctx : ctx.statement()) { writer.visit(sctx);/*ww w . j av a 2 s . co m*/ } if (!sourcesmd.methodEscape) { execute.visitInsn(Opcodes.ACONST_NULL); execute.returnValue(); } }
From source file:org.elasticsearch.painless.WriterStatement.java
License:Apache License
void processDeclvar(final DeclvarContext ctx) { final ExpressionMetadata declvaremd = metadata.getExpressionMetadata(ctx); final org.objectweb.asm.Type type = declvaremd.to.type; final Sort sort = declvaremd.to.sort; int slot = (int) declvaremd.postConst; final ExpressionContext exprctx = ctx.expression(); final boolean initialize = exprctx == null; if (!initialize) { writer.visit(exprctx);/*from w w w.j a va2s . c o m*/ } switch (sort) { case VOID: throw new IllegalStateException(WriterUtility.error(ctx) + "Unexpected state."); case BOOL: case BYTE: case SHORT: case CHAR: case INT: if (initialize) execute.push(0); break; case LONG: if (initialize) execute.push(0L); break; case FLOAT: if (initialize) execute.push(0.0F); break; case DOUBLE: if (initialize) execute.push(0.0); break; default: if (initialize) execute.visitInsn(Opcodes.ACONST_NULL); } execute.visitVarInsn(type.getOpcode(Opcodes.ISTORE), slot); }
From source file:org.elasticsearch.plan.a.Writer.java
License:Apache License
@Override public Void visitSource(final SourceContext ctx) { final StatementMetadata sourcesmd = metadata.getStatementMetadata(ctx); for (final StatementContext sctx : ctx.statement()) { visit(sctx);/*ww w. j av a 2 s .c om*/ } if (!sourcesmd.methodEscape) { execute.visitInsn(Opcodes.ACONST_NULL); execute.returnValue(); } return null; }