Package net.openhft.jpsg

Examples of net.openhft.jpsg.PrimitiveType


        gen.lines("a[resultIndex++] = " + gen.viewElem() + ";");
    }

    @Override
    public void end() {
        PrimitiveType elemType = (PrimitiveType) cxt.viewOption();
        gen.lines(
                "if (a.length > resultIndex)",
                "    a[resultIndex] = " + elemType.formatValue("0") + ";"
        );
        gen.ret("a");
    }
View Full Code Here


    @Override
    public void loopBody() {
        String methodName = "remove";
        if (cxt.isPrimitiveView()) {
            PrimitiveType viewType = (PrimitiveType) cxt.viewOption();
            methodName += viewType.title;
        }
        gen.lines("changed |= s." + methodName + "(" + gen.viewElem() + ");");
    }
View Full Code Here

            }
            String keyUnwrap = indent + cxt.keyUnwrappedType() + " k = " + unwrapKey(key) + ";";
            lines.add(0, keyUnwrap);
        }
        else if (cxt.isPrimitiveKey() && cxt.genericVersion()) {
            PrimitiveType keyType = (PrimitiveType) cxt.keyOption();
            int keyUsages = 0;
            for (String line : lines) {
                keyUsages += countOccurrences(line, KEY_SUB);
            }
            if (permissions.contains(Permission.INSERT) || permissions.contains(SET_VALUE)) {
View Full Code Here

public final class ToPrimitiveArray extends BulkMethod {

    @Override
    public void beginning() {
        PrimitiveType elemType = (PrimitiveType) cxt.viewOption();
        gen.lines(
                "int size = size();",
                "if (a.length < size)",
                "    a = new " + elemType.standalone + "[size];",
                "if (size == 0) {",
                "    if (a.length > 0)",
                "        a[0] = " + elemType.formatValue("0") + ";",
                "    return a;",
                "}",
                "int resultIndex = 0;"
        );
    }
View Full Code Here

        }
        if (valuesUsed && !parallelKV(cxt))
            lines(cxt.valueUnwrappedType() + "[] vals = values;");

        if (unsafeLoop()) {
            PrimitiveType key = (PrimitiveType) cxt.keyOption();
            lines("long base = " + TableType.INSTANCE.apply(key).upper + "_BASE + " +
                            key.upper + "_KEY_OFFSET;");
        } else {
            declareEntry(this, cxt);
        }
View Full Code Here

    static String tableEntryType(MethodContext cxt) {
        if (cxt.isObjectOrNullKey()) {
            return "Object";
        } else {
            PrimitiveType tableType = TableType.INSTANCE.apply((PrimitiveType) cxt.keyOption());
            // jvm stack slot type
            if (tableType == PrimitiveType.LONG) {
                return LONG.standalone;
            } else {
                return INT.standalone;
View Full Code Here

        } else if (cxt.isObjectOrNullKey()) {
            hash = (distinctNullKey ? "keyHashCode" : "nullableKeyHashCode") + "(" + key + ")";
            mixingClass += "Obj";
        } else {
            hash = key;
            PrimitiveType keyOption = (PrimitiveType) cxt.keyOption();
            mixingClass += keyOption.title;
        }
        mixingClass += "KeyMixing";
        return mixingClass + ".mix(" + hash + ")";
    }
View Full Code Here

            String key = table + "[" + index + "]";
            if (cxt.isObjectOrNullKey())
                key = "(" + cxt.keyUnwrappedType() + ") " + key;
            return key;
        } else {
            PrimitiveType keyType = (PrimitiveType) cxt.keyOption();
            String entryTableUpper = TableType.INSTANCE.apply(keyType).upper;
            String base = entryTableUpper + "_BASE";
            String offset = base + " + " + keyType.upper + "_KEY_OFFSET + " +
                    "(((long) (" + index + ")) << " + entryTableUpper + "_SCALE_SHIFT)";
            return cxt.unsafeGetKeyBits(table, offset);
View Full Code Here

        if (!parallelKV(cxt)) {
            g.lines(keys + "[" + index + "] = " + key + ";");
        } else if (doubleSizedParallel(cxt)) {
            g.lines(table + "[" + index + "] = " + key + ";");
        } else {
            PrimitiveType keyType = (PrimitiveType) cxt.keyOption();
            String entryTableUpper = TableType.INSTANCE.apply(keyType).upper;
            String base = entryTableUpper + "_BASE";
            String offset = base + " + " + keyType.upper + "_KEY_OFFSET + " +
                    "(((long) (" + index + ")) << " + entryTableUpper + "_SCALE_SHIFT)";
            cxt.unsafePutKeyBits(g, table, offset, key);
View Full Code Here

            String value = table + "[" + index + " + 1]";
            if (cxt.isObjectValue())
                value = "(" + cxt.valueGenericType() + ") " + value;
            return value;
        } else {
            PrimitiveType valueType = (PrimitiveType) cxt.mapValueOption();
            return "(" + valueType.bitsType().standalone + ") " +
                    "(entry >>> " + bitsWidth(valueType) + ")";
        }
    }
View Full Code Here

TOP

Related Classes of net.openhft.jpsg.PrimitiveType

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.