Package com.facebook.presto.byteCode

Examples of com.facebook.presto.byteCode.Block.comment()


            generatePrimitiveSerializer(serializerBody, getGetter(clazz, fields.get(0)));
        }
        else {
            LocalVariableDefinition slice = compilerContext.declareVariable(Slice.class, "slice");
            int size = serializedSizeOf(clazz);
            serializerBody.comment("Slice slice = Slices.allocate(%d);", size)
                    .push(size)
                    .invokeStatic(Slices.class, "allocate", Slice.class, int.class)
                    .putVariable(slice);

            for (StateField field : fields) {
View Full Code Here


                    .putVariable(slice);

            for (StateField field : fields) {
                generateSerializeFieldToSlice(serializerBody, slice, getGetter(clazz, field), offsetOfField(field, fields));
            }
            serializerBody.comment("out.appendSlice(slice);")
                    .getVariable("out")
                    .getVariable(slice)
                    .invokeInterface(BlockBuilder.class, "appendSlice", BlockBuilder.class, Slice.class);
        }
        serializerBody.ret();
View Full Code Here

        Block getEstimatedSize = definition.declareMethod(new CompilerContext(null), a(PUBLIC), "getEstimatedSize", type(long.class))
                .getBody()
                .comment("long size = 0;")
                .push(0L);
        for (FieldDefinition field : fieldDefinitions) {
            getEstimatedSize
                    .comment("size += %s.sizeOf();", field.getName())
                    .pushThis()
                    .getField(field)
                    .invokeVirtual(field.getType(), "sizeOf", type(long.class))
                    .longAdd();
View Full Code Here

                    .pushThis()
                    .getField(field)
                    .invokeVirtual(field.getType(), "sizeOf", type(long.class))
                    .longAdd();
        }
        getEstimatedSize.comment("return size;");
        getEstimatedSize.retLong();

        return defineClass(definition, clazz, classLoader);
    }
View Full Code Here

            SortOrder sortOrder = sortOrders.get(i);

            Block block = new Block(compilerContext)
                    .setDescription("compare channel " + sortChannel + " " + sortOrder);

            block.comment("push leftBlock -- pagesIndex.getChannel(sortChannel).get(leftBlockIndex)")
                    .getVariable("pagesIndex")
                    .push(sortChannel)
                    .invokeVirtual(PagesIndex.class, "getChannel", ObjectArrayList.class, int.class)
                    .getVariable(leftBlockIndex)
                    .invokeVirtual(ObjectArrayList.class, "get", Object.class, int.class)
View Full Code Here

                    .invokeVirtual(PagesIndex.class, "getChannel", ObjectArrayList.class, int.class)
                    .getVariable(leftBlockIndex)
                    .invokeVirtual(ObjectArrayList.class, "get", Object.class, int.class)
                    .checkCast(com.facebook.presto.spi.block.Block.class);

            block.comment("push sortOrder")
                    .getStaticField(SortOrder.class, sortOrder.name(), SortOrder.class);

            block.comment("push leftBlockPosition")
                    .getVariable(leftBlockPosition);
View Full Code Here

                    .checkCast(com.facebook.presto.spi.block.Block.class);

            block.comment("push sortOrder")
                    .getStaticField(SortOrder.class, sortOrder.name(), SortOrder.class);

            block.comment("push leftBlockPosition")
                    .getVariable(leftBlockPosition);

            block.comment("push rightBlock -- pagesIndex.getChannel(sortChannel).get(rightBlockIndex)")
                    .getVariable("pagesIndex")
                    .push(sortChannel)
View Full Code Here

                    .getStaticField(SortOrder.class, sortOrder.name(), SortOrder.class);

            block.comment("push leftBlockPosition")
                    .getVariable(leftBlockPosition);

            block.comment("push rightBlock -- pagesIndex.getChannel(sortChannel).get(rightBlockIndex)")
                    .getVariable("pagesIndex")
                    .push(sortChannel)
                    .invokeVirtual(PagesIndex.class, "getChannel", ObjectArrayList.class, int.class)
                    .getVariable(rightBlockIndex)
                    .invokeVirtual(ObjectArrayList.class, "get", Object.class, int.class)
View Full Code Here

                    .invokeVirtual(PagesIndex.class, "getChannel", ObjectArrayList.class, int.class)
                    .getVariable(rightBlockIndex)
                    .invokeVirtual(ObjectArrayList.class, "get", Object.class, int.class)
                    .checkCast(com.facebook.presto.spi.block.Block.class);

            block.comment("push rightBlockPosition")
                    .getVariable(rightBlockPosition);

            block.comment("invoke compareTo")
                    .invokeInterface(com.facebook.presto.spi.block.Block.class, "compareTo", int.class, SortOrder.class, int.class, com.facebook.presto.spi.block.Block.class, int.class);
View Full Code Here

                    .checkCast(com.facebook.presto.spi.block.Block.class);

            block.comment("push rightBlockPosition")
                    .getVariable(rightBlockPosition);

            block.comment("invoke compareTo")
                    .invokeInterface(com.facebook.presto.spi.block.Block.class, "compareTo", int.class, SortOrder.class, int.class, com.facebook.presto.spi.block.Block.class, int.class);

            LabelNode equal = new LabelNode("equal");
            block.comment("if (compare != 0) return compare")
                    .dup()
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.