Package org.teavm.common

Examples of org.teavm.common.RecordArrayBuilder$SubArray


    }

    void rebuildFileDescriptions() {
        RecordArrayBuilder[] builders = new RecordArrayBuilder[fileNames.length];
        for (int i = 0; i < builders.length; ++i) {
            builders[i] = new RecordArrayBuilder(0, 1);
        }
        for (SourceLocationIterator iter = iterateOverSourceLocations(); !iter.isEndReached(); iter.next()) {
            if (iter.getFileNameId() >= 0 && iter.getLine() >= 0) {
                RecordArrayBuilder builder = builders[iter.getFileNameId()];
                while (builder.size() <= iter.getLine()) {
                    builder.add();
                }
                GeneratedLocation loc = iter.getLocation();
                RecordArrayBuilder.SubArray array = builder.get(iter.getLine()).getArray(0);
                array.add(loc.getLine());
                array.add(loc.getColumn());
            }
        }
        fileDescriptions = new RecordArray[builders.length];
View Full Code Here


            fileDescriptions[i] = builders[i].build();
        }
    }

    void rebuildEntrances() {
        RecordArrayBuilder builder = new RecordArrayBuilder(0, 1);
        for (int i = 0; i < exactMethods.length; ++i) {
            builder.add();
        }
        GeneratedLocation prevLocation = new GeneratedLocation(0, 0);
        MethodReference prevMethod = null;
        int prevMethodId = -1;
        for (ExactMethodIterator iter = iterateOverExactMethods(); !iter.isEndReached(); iter.next()) {
            int id = iter.getExactMethodId();
            if (prevMethod != null) {
                int lineIndex = Math.max(0, indexByKey(lineMapping, prevLocation));
                while (lineIndex < lineMapping.size()) {
                    if (key(lineMapping.get(lineIndex)).compareTo(iter.getLocation()) >= 0) {
                        break;
                    }
                    int line = lineMapping.get(lineIndex).get(2);
                    if (line >= 0) {
                        GeneratedLocation firstLineLoc = key(lineMapping.get(lineIndex));
                        RecordArrayBuilder.SubArray array = builder.get(prevMethodId).getArray(0);
                        array.add(firstLineLoc.getLine());
                        array.add(firstLineLoc.getColumn());
                        break;
                    }
                    ++lineIndex;
                }
            }
            prevMethod = iter.getExactMethod();
            prevMethodId = id;
            prevLocation = iter.getLocation();
        }
        methodEntrances = builder.build();
    }
View Full Code Here

    private void rebuildLineCallSites() {
        lineCallSites = new RecordArray[fileNames.length];
        RecordArrayBuilder[] builders = new RecordArrayBuilder[fileNames.length];
        for (int i = 0; i < lineCallSites.length; ++i) {
            builders[i] = new RecordArrayBuilder(0, 1);
        }
        for (int i = 0; i < callSiteMapping.size(); ++i) {
            RecordArray.Record callSiteRec = callSiteMapping.get(i);
            GeneratedLocation loc = key(callSiteRec);
            int callSiteType = callSiteRec.get(2);
            if (callSiteType != DebuggerCallSite.NONE) {
                int line = valueByKey(lineMapping, loc);
                int fileId = valueByKey(fileMapping, loc);
                if (fileId >= 0 && line >= 0) {
                    RecordArrayBuilder builder = builders[fileId];
                    while (builder.size() <= line) {
                        builder.add();
                    }
                    builder.get(line).getArray(0).add(i);
                }
            }
        }
        for (int i = 0; i < lineCallSites.length; ++i) {
            lineCallSites[i] = builders[i].build();
View Full Code Here

        }
        return cfgs;
    }

    private RecordArray readCFG() throws IOException {
        RecordArrayBuilder builder = new RecordArrayBuilder(1, 1);
        int size = readUnsignedNumber();
        for (int i = 0; i < size; ++i) {
            builder.add();
        }
        int[] types = readRle(size);
        int nonEmptyItems = 0;
        for (int i = 0; i < size; ++i) {
            int type = types[i];
            builder.get(i).set(0, type);
            if (type != 0) {
                ++nonEmptyItems;
            }
        }
        int[] sizes = readRle(nonEmptyItems);
        int j = 0;
        int totalSize = 0;
        for (int sz : sizes) {
            totalSize += sz;
        }
        int[] files = readRle(totalSize);
        int[] lines = readRle(totalSize);
        int lastFile = 0;
        int lastLine = 0;
        int index = 0;
        for (int i = 0; i < sizes.length; ++i) {
            while (types[j] == 0) {
                ++j;
            }
            size = sizes[i];
            RecordArrayBuilder.SubArray array = builder.get(j++).getArray(0);
            for (int k = 0; k < size; ++k) {
                lastFile += processSign(files[index]);
                lastLine += processSign(lines[index]);
                array.add(lastFile);
                array.add(lastLine);
                ++index;
            }
        }
        return builder.build();
    }
View Full Code Here

        number >>>= 1;
        return !negative ? number : -number;
    }

    private RecordArray readMultiMapping() throws IOException {
        RecordArrayBuilder builder = readLinesAndColumns(2, 1);
        for (int i = 0; i < builder.size(); ++i) {
            int count = readUnsignedNumber();
            RecordArrayBuilder.SubArray array = builder.get(i).getArray(0);
            int last = 0;
            for (int j = 0; j < count; ++j) {
                last += readNumber();
                array.add(last);
            }
        }
        return builder.build();
    }
View Full Code Here

        }
        return builder.build();
    }

    private RecordArray readBooleanMapping() throws IOException {
        RecordArrayBuilder builder = readLinesAndColumns(2, 0);
        return builder.build();
    }
View Full Code Here

        RecordArrayBuilder builder = readLinesAndColumns(2, 0);
        return builder.build();
    }

    private RecordArray readMapping() throws IOException {
        RecordArrayBuilder builder = readLinesAndColumns(3, 0);
        readValues(builder);
        return builder.build();
    }
View Full Code Here

        readValues(builder);
        return builder.build();
    }

    private RecordArray readCallSiteMapping() throws IOException {
        RecordArrayBuilder builder = readLinesAndColumns(4, 0);
        readValues(builder);
        readCallSites(builder);
        return builder.build();
    }
View Full Code Here

        readCallSites(builder);
        return builder.build();
    }

    private RecordArrayBuilder readLinesAndColumns(int fields, int arrays) throws IOException {
        RecordArrayBuilder builder = new RecordArrayBuilder(fields, arrays);
        int size = readUnsignedNumber();
        for (int i = 0; i < size; ++i) {
            builder.add();
        }
        int[] lines = extractLines(readRle(builder.size()));
        int[] columns = extractColumns(readRle(builder.size()), lines);
        for (int i = 0; i < builder.size(); ++i) {
            RecordArrayBuilder.Record record = builder.get(i);
            record.set(0, lines[i]);
            record.set(1, columns[i]);
        }
        return builder;
    }
View Full Code Here

        for (int i = 0; i < sourceIndexes.length; ++i) {
            sourceIndexes[i] = variableNames.index(sourceNames[i]);
        }
        Arrays.sort(sourceIndexes);
        int generatedIndex = variableNames.index(generatedName);
        RecordArrayBuilder mapping = variableMappings.get(generatedIndex);
        if (mapping == null) {
            mapping = new RecordArrayBuilder(2, 1);
            variableMappings.put(generatedIndex, mapping);
        }

        RecordArrayBuilder.Record record = add(mapping);
        RecordArrayBuilder.SubArray array = record.getArray(0);
View Full Code Here

TOP

Related Classes of org.teavm.common.RecordArrayBuilder$SubArray

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.