Package com.facebook.presto.byteCode

Examples of com.facebook.presto.byteCode.CompilerContext


                .retBoolean();
    }

    private void generateGetCurrentJoinPosition(ClassDefinition classDefinition, FieldDefinition lookupSourceField, FieldDefinition probeCursorsArrayField)
    {
        CompilerContext compilerContext = new CompilerContext(bootstrapMethod);
        classDefinition.declareMethod(compilerContext,
                a(PUBLIC),
                "getCurrentJoinPosition",
                type(long.class))
                .getBody()
View Full Code Here


                .retLong();
    }

    private void generateCurrentRowContainsNull(ClassDefinition classDefinition, List<FieldDefinition> probeCursorFields)
    {
        Block body = classDefinition.declareMethod(new CompilerContext(bootstrapMethod),
                a(PRIVATE),
                "currentRowContainsNull",
                type(boolean.class))
                .getBody();
View Full Code Here

        return new PagesIndexOrdering(comparator);
    }

    private Class<? extends PagesIndexComparator> compilePagesIndexComparator(List<Integer> sortChannels, List<SortOrder> sortOrders, DynamicClassLoader classLoader)
    {
        ClassDefinition classDefinition = new ClassDefinition(new CompilerContext(bootstrapMethod),
                a(PUBLIC, FINAL),
                typeFromPathName("PagesIndexComparator" + CLASS_ID.incrementAndGet()),
                type(Object.class),
                type(PagesIndexComparator.class));
View Full Code Here

        return joinHashClass;
    }

    private void generateConstructor(ClassDefinition classDefinition)
    {
        classDefinition.declareConstructor(new CompilerContext(bootstrapMethod),
                a(PUBLIC))
                .getBody()
                .comment("super();")
                .pushThis()
                .invokeConstructor(Object.class)
View Full Code Here

                .ret();
    }

    private void generateCompareTo(ClassDefinition classDefinition, List<Integer> sortChannels, List<SortOrder> sortOrders)
    {
        CompilerContext compilerContext = new CompilerContext(bootstrapMethod);
        MethodDefinition compareToMethod = classDefinition.declareMethod(compilerContext,
                a(PUBLIC),
                "compareTo",
                type(int.class),
                arg("pagesIndex", PagesIndex.class),
                arg("leftPosition", int.class),
                arg("rightPosition", int.class));

        LocalVariableDefinition valueAddresses = compilerContext.declareVariable(LongArrayList.class, "valueAddresses");
        compareToMethod
                .getBody()
                .comment("LongArrayList valueAddresses = pagesIndex.valueAddresses")
                .getVariable("pagesIndex")
                .invokeVirtual(PagesIndex.class, "getValueAddresses", LongArrayList.class)
                .putVariable(valueAddresses);

        LocalVariableDefinition leftPageAddress = compilerContext.declareVariable(long.class, "leftPageAddress");
        compareToMethod
                .getBody()
                .comment("long leftPageAddress = valueAddresses.getLong(leftPosition)")
                .getVariable(valueAddresses)
                .getVariable("leftPosition")
                .invokeVirtual(LongArrayList.class, "getLong", long.class, int.class)
                .putVariable(leftPageAddress);

        LocalVariableDefinition leftBlockIndex = compilerContext.declareVariable(int.class, "leftBlockIndex");
        compareToMethod
                .getBody()
                .comment("int leftBlockIndex = decodeSliceIndex(leftPageAddress)")
                .getVariable(leftPageAddress)
                .invokeStatic(SyntheticAddress.class, "decodeSliceIndex", int.class, long.class)
                .putVariable(leftBlockIndex);

        LocalVariableDefinition leftBlockPosition = compilerContext.declareVariable(int.class, "leftBlockPosition");
        compareToMethod
                .getBody()
                .comment("int leftBlockPosition = decodePosition(leftPageAddress)")
                .getVariable(leftPageAddress)
                .invokeStatic(SyntheticAddress.class, "decodePosition", int.class, long.class)
                .putVariable(leftBlockPosition);

        LocalVariableDefinition rightPageAddress = compilerContext.declareVariable(long.class, "rightPageAddress");
        compareToMethod
                .getBody()
                .comment("long rightPageAddress = valueAddresses.getLong(rightPosition);")
                .getVariable(valueAddresses)
                .getVariable("rightPosition")
                .invokeVirtual(LongArrayList.class, "getLong", long.class, int.class)
                .putVariable(rightPageAddress);

        LocalVariableDefinition rightBlockIndex = compilerContext.declareVariable(int.class, "rightBlockIndex");
        compareToMethod
                .getBody()
                .comment("int rightBlockIndex = decodeSliceIndex(rightPageAddress)")
                .getVariable(rightPageAddress)
                .invokeStatic(SyntheticAddress.class, "decodeSliceIndex", int.class, long.class)
                .putVariable(rightBlockIndex);

        LocalVariableDefinition rightBlockPosition = compilerContext.declareVariable(int.class, "rightBlockPosition");
        compareToMethod
                .getBody()
                .comment("int rightBlockPosition = decodePosition(rightPageAddress)")
                .getVariable(rightPageAddress)
                .invokeStatic(SyntheticAddress.class, "decodePosition", int.class, long.class)
View Full Code Here

        return new PagesHashStrategyFactory(pagesHashStrategyClass);
    }

    private Class<? extends PagesHashStrategy> compilePagesHashStrategy(int channelCount, List<Integer> joinChannels, DynamicClassLoader classLoader)
    {
        ClassDefinition classDefinition = new ClassDefinition(new CompilerContext(bootstrapMethod),
                a(PUBLIC, FINAL),
                typeFromPathName("PagesHashStrategy_" + CLASS_ID.incrementAndGet()),
                type(Object.class),
                type(PagesHashStrategy.class));
View Full Code Here

    private void generateConstructor(ClassDefinition classDefinition,
            List<Integer> joinChannels,
            List<FieldDefinition> channelFields,
            List<FieldDefinition> joinChannelFields)
    {
        Block constructor = classDefinition.declareConstructor(new CompilerContext(bootstrapMethod),
                a(PUBLIC),
                arg("channels", type(List.class, type(List.class, RandomAccessBlock.class))))
                .getBody()
                .comment("super();")
                .pushThis()
View Full Code Here

        constructor.ret();
    }

    private void generateGetChannelCountMethod(ClassDefinition classDefinition, List<FieldDefinition> channelFields)
    {
        classDefinition.declareMethod(new CompilerContext(bootstrapMethod),
                a(PUBLIC),
                "getChannelCount",
                type(int.class))
                .getBody()
                .push(channelFields.size())
View Full Code Here

                .retInt();
    }

    private void generateAppendToMethod(ClassDefinition classDefinition, List<FieldDefinition> channelFields)
    {
        Block appendToBody = classDefinition.declareMethod(new CompilerContext(bootstrapMethod),
                a(PUBLIC),
                "appendTo",
                type(void.class),
                arg("blockIndex", int.class),
                arg("blockPosition", int.class),
View Full Code Here

        appendToBody.ret();
    }

    private void generateHashPositionMethod(ClassDefinition classDefinition, List<FieldDefinition> joinChannelFields)
    {
        MethodDefinition hashPositionMethod = classDefinition.declareMethod(new CompilerContext(bootstrapMethod),
                a(PUBLIC),
                "hashPosition",
                type(int.class),
                arg("blockIndex", int.class),
                arg("blockPosition", int.class));
View Full Code Here

TOP

Related Classes of com.facebook.presto.byteCode.CompilerContext

Copyright © 2018 www.massapicom. 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.