Further refactoring of debugger

This commit is contained in:
konsoletyper 2014-08-29 18:01:52 +04:00
parent 45c336ebb8
commit deea4e995a
43 changed files with 194 additions and 200 deletions

View File

@ -12,7 +12,7 @@ import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.ObjectMapper;
import org.teavm.chromerdp.data.*; import org.teavm.chromerdp.data.*;
import org.teavm.chromerdp.messages.*; import org.teavm.chromerdp.messages.*;
import org.teavm.debugging.*; import org.teavm.debugging.javascript.*;
/** /**
* *

View File

@ -16,8 +16,8 @@
package org.teavm.chromerdp; package org.teavm.chromerdp;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.teavm.debugging.JavaScriptBreakpoint; import org.teavm.debugging.javascript.JavaScriptBreakpoint;
import org.teavm.debugging.JavaScriptLocation; import org.teavm.debugging.javascript.JavaScriptLocation;
/** /**
* *

View File

@ -17,9 +17,9 @@ package org.teavm.chromerdp;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
import org.teavm.debugging.JavaScriptCallFrame; import org.teavm.debugging.javascript.JavaScriptCallFrame;
import org.teavm.debugging.JavaScriptLocation; import org.teavm.debugging.javascript.JavaScriptLocation;
import org.teavm.debugging.JavaScriptVariable; import org.teavm.debugging.javascript.JavaScriptVariable;
/** /**
* *

View File

@ -1,7 +1,7 @@
package org.teavm.chromerdp; package org.teavm.chromerdp;
import org.teavm.debugging.JavaScriptValue; import org.teavm.debugging.javascript.JavaScriptValue;
import org.teavm.debugging.JavaScriptVariable; import org.teavm.debugging.javascript.JavaScriptVariable;
/** /**
* *

View File

@ -3,8 +3,8 @@ package org.teavm.chromerdp;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.teavm.debugging.JavaScriptValue; import org.teavm.debugging.javascript.JavaScriptValue;
import org.teavm.debugging.JavaScriptVariable; import org.teavm.debugging.javascript.JavaScriptVariable;
/** /**
* *

View File

@ -17,6 +17,8 @@ package org.teavm.debugging;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.teavm.debugging.information.SourceLocation;
import org.teavm.debugging.javascript.JavaScriptBreakpoint;
/** /**
* *

View File

@ -17,6 +17,8 @@ package org.teavm.debugging;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
import org.teavm.debugging.information.SourceLocation;
import org.teavm.debugging.javascript.JavaScriptLocation;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
/** /**

View File

@ -20,6 +20,8 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import org.teavm.debugging.information.*;
import org.teavm.debugging.javascript.*;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
/** /**

View File

@ -19,6 +19,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.teavm.debugging.javascript.JavaScriptVariable;
/** /**
* *

View File

@ -17,6 +17,7 @@ package org.teavm.debugging;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.teavm.debugging.javascript.JavaScriptValue;
/** /**
* *

View File

@ -20,6 +20,8 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.teavm.debugging.javascript.JavaScriptLocation;
import org.teavm.debugging.javascript.JavaScriptVariable;
/** /**
* *

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
/** /**
* *

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
@ -48,7 +48,7 @@ public class DebugInformation {
RecordArray callSiteMapping; RecordArray callSiteMapping;
RecordArray[] variableMappings; RecordArray[] variableMappings;
RecordArray[] lineCallSites; RecordArray[] lineCallSites;
CFG[] controlFlowGraphs; RecordArray[] controlFlowGraphs;
List<ClassMetadata> classesMetadata; List<ClassMetadata> classesMetadata;
RecordArray methodEntrances; RecordArray methodEntrances;
MethodTree methodTree; MethodTree methodTree;
@ -216,28 +216,26 @@ public class DebugInformation {
if (fileIndex == null) { if (fileIndex == null) {
return null; return null;
} }
CFG cfg = controlFlowGraphs[fileIndex]; RecordArray cfg = controlFlowGraphs[fileIndex];
if (cfg == null) { if (cfg == null) {
return null; return null;
} }
if (location.getLine() >= cfg.offsets.length - 1) { if (location.getLine() >= cfg.size()) {
return null; return null;
} }
int start = cfg.offsets[location.getLine()]; int type = cfg.get(location.getLine()).get(0);
int end = cfg.offsets[location.getLine() + 1]; if (type == 0) {
if (end - start == 1 && cfg.offsets[start] == -1) {
return new SourceLocation[0];
} else if (start == end) {
return null; return null;
} }
SourceLocation[] result = new SourceLocation[end - start]; int[] data = cfg.get(location.getLine()).getArray(0);
for (int i = 0; i < result.length; ++i) { int length = data.length / 2;
int line = cfg.lines[i + start]; int size = length;
if (line >= 0) { if (type == 2) {
result[i] = new SourceLocation(fileNames[cfg.files[i + start]], line); ++size;
} else {
result[i] = null;
} }
SourceLocation[] result = new SourceLocation[size];
for (int i = 0; i < length; ++i) {
result[i] = new SourceLocation(fileNames[data[i * 2]], data[i * 2 + 1]);
} }
return result; return result;
} }
@ -598,11 +596,6 @@ public class DebugInformation {
int[] methods; int[] methods;
} }
static class CFG {
int[] lines;
int[] files;
int[] offsets;
}
class MethodTree { class MethodTree {
int[] data; int[] data;

View File

@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import java.util.*; import java.util.*;
import org.teavm.codegen.LocationProvider; import org.teavm.codegen.LocationProvider;
import org.teavm.common.IntegerArray;
import org.teavm.common.RecordArray; import org.teavm.common.RecordArray;
import org.teavm.common.RecordArrayBuilder; import org.teavm.common.RecordArrayBuilder;
import org.teavm.model.MethodDescriptor; import org.teavm.model.MethodDescriptor;
@ -41,14 +40,14 @@ public class DebugInformationBuilder implements DebugInformationEmitter {
private RecordArrayBuilder lineMapping = new RecordArrayBuilder(3, 0); private RecordArrayBuilder lineMapping = new RecordArrayBuilder(3, 0);
private RecordArrayBuilder classMapping = new RecordArrayBuilder(3, 0); private RecordArrayBuilder classMapping = new RecordArrayBuilder(3, 0);
private RecordArrayBuilder methodMapping = new RecordArrayBuilder(3, 0); private RecordArrayBuilder methodMapping = new RecordArrayBuilder(3, 0);
private RecordArrayBuilder callSiteMapping = new RecordArrayBuilder(3, 1); private RecordArrayBuilder callSiteMapping = new RecordArrayBuilder(4, 0);
private Map<Integer, RecordArrayBuilder> variableMappings = new HashMap<>(); private Map<Integer, RecordArrayBuilder> variableMappings = new HashMap<>();
private MethodDescriptor currentMethod; private MethodDescriptor currentMethod;
private String currentClass; private String currentClass;
private String currentFileName; private String currentFileName;
private int currentClassMetadata = -1; private int currentClassMetadata = -1;
private List<ClassMetadata> classesMetadata = new ArrayList<>(); private List<ClassMetadata> classesMetadata = new ArrayList<>();
private List<CFG> cfgs = new ArrayList<>(); private List<RecordArrayBuilder> cfgs = new ArrayList<>();
private int currentLine; private int currentLine;
public LocationProvider getLocationProvider() { public LocationProvider getLocationProvider() {
@ -149,20 +148,17 @@ public class DebugInformationBuilder implements DebugInformationEmitter {
@Override @Override
public void setVirtualMethod(MethodReference method) { public void setVirtualMethod(MethodReference method) {
record.set(2, DebuggerCallSite.VIRTUAL); record.set(2, DebuggerCallSite.VIRTUAL);
RecordArrayBuilder.RecordSubArray array = record.getArray(0); record.set(3, getExactMethodIndex(method));
array.clear();
array.add(getExactMethodIndex(method));
} }
@Override @Override
public void setStaticMethod(MethodReference method) { public void setStaticMethod(MethodReference method) {
record.set(2, DebuggerCallSite.STATIC); record.set(2, DebuggerCallSite.STATIC);
RecordArrayBuilder.RecordSubArray array = record.getArray(0); record.set(3, getExactMethodIndex(method));
array.clear();
array.add(getExactMethodIndex(method));
} }
@Override @Override
public void clean() { public void clean() {
record.set(2, DebuggerCallSite.NONE); record.set(2, DebuggerCallSite.NONE);
record.set(3, 0);
} }
private int getExactMethodIndex(MethodReference method) { private int getExactMethodIndex(MethodReference method) {
int methodIndex = methods.index(method.getDescriptor().toString()); int methodIndex = methods.index(method.getDescriptor().toString());
@ -202,19 +198,21 @@ public class DebugInformationBuilder implements DebugInformationEmitter {
@Override @Override
public void addSuccessors(SourceLocation location, SourceLocation[] successors) { public void addSuccessors(SourceLocation location, SourceLocation[] successors) {
int fileIndex = files.index(location.getFileName()); int fileIndex = files.index(location.getFileName());
if (cfgs.size() <= fileIndex) { while (cfgs.size() <= fileIndex) {
cfgs.addAll(Collections.<CFG>nCopies(fileIndex - cfgs.size() + 1, null)); cfgs.add(new RecordArrayBuilder(1, 1));
} }
CFG cfg = cfgs.get(fileIndex); RecordArrayBuilder cfg = cfgs.get(fileIndex);
if (cfg == null) { RecordArrayBuilder.Record record = cfg.get(location.getLine());
cfg = new CFG(); if (record.get(0) == 0) {
cfgs.set(fileIndex, cfg); record.set(0, 1);
} }
RecordArrayBuilder.RecordSubArray array = record.getArray(0);
for (SourceLocation succ : successors) { for (SourceLocation succ : successors) {
if (succ == null) { if (succ == null) {
cfg.add(location.getLine(), -1, fileIndex); record.set(0, 2);
} else { } else {
cfg.add(location.getLine(), succ.getLine(), files.index(succ.getFileName())); array.add(files.index(succ.getFileName()));
array.add(succ.getLine());
} }
} }
} }
@ -297,7 +295,7 @@ public class DebugInformationBuilder implements DebugInformationEmitter {
} }
debugInformation.classesMetadata = builtMetadata; debugInformation.classesMetadata = builtMetadata;
DebugInformation.CFG[] cfgs = new DebugInformation.CFG[files.list.size()]; RecordArray[] cfgs = new RecordArray[files.list.size()];
for (int i = 0; i < this.cfgs.size(); ++i) { for (int i = 0; i < this.cfgs.size(); ++i) {
if (this.cfgs.get(i) != null) { if (this.cfgs.get(i) != null) {
cfgs[i] = this.cfgs.get(i).build(); cfgs[i] = this.cfgs.get(i).build();
@ -339,59 +337,4 @@ public class DebugInformationBuilder implements DebugInformationEmitter {
int parentIndex; int parentIndex;
Map<Integer, Integer> fieldMap = new HashMap<>(); Map<Integer, Integer> fieldMap = new HashMap<>();
} }
static class CFG {
IntegerArray start = new IntegerArray(1);
IntegerArray next = new IntegerArray(1);
IntegerArray lines = new IntegerArray(1);
IntegerArray files = new IntegerArray(1);
public void add(int line, int succLine, int succFile) {
while (start.size() <= line) {
start.add(-1);
}
int ptr = start.get(line);
start.set(line, lines.size());
next.add(ptr);
lines.add(succLine);
files.add(succFile);
}
public DebugInformation.CFG build() {
int[] offsets = new int[start.size() + 1];
IntegerArray linesData = new IntegerArray(1);
IntegerArray filesData = new IntegerArray(1);
for (int i = 0; i < start.size(); ++i) {
IntegerArray linesChunk = new IntegerArray(1);
IntegerArray filesChunk = new IntegerArray(1);
int ptr = start.get(i);
while (ptr >= 0) {
linesChunk.add(lines.get(ptr));
filesChunk.add(files.get(ptr));
ptr = next.get(ptr);
}
long[] pairs = new long[linesChunk.size()];
for (int j = 0; j < pairs.length; ++j) {
pairs[j] = (((long)filesChunk.get(j)) << 32) | linesChunk.get(j);
}
Arrays.sort(pairs);
int distinctSize = 0;
for (int j = 0; j < pairs.length; ++j) {
long pair = pairs[j];
if (distinctSize == 0 || pair != pairs[distinctSize - 1]) {
pairs[distinctSize++] = pair;
filesData.add((int)(pair >>> 32));
linesData.add((int)pair);
}
}
offsets[i + 1] = linesData.size();
}
DebugInformation.CFG cfg = new DebugInformation.CFG();
cfg.offsets = offsets;
cfg.lines = linesData.getAll();
cfg.files = filesData.getAll();
return cfg;
}
}
} }

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import org.teavm.codegen.LocationProvider; import org.teavm.codegen.LocationProvider;
import org.teavm.model.MethodDescriptor; import org.teavm.model.MethodDescriptor;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
/** /**
* *

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import java.io.EOFException; import java.io.EOFException;
import java.io.IOException; import java.io.IOException;
@ -21,6 +21,7 @@ import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.teavm.common.IntegerArray; import org.teavm.common.IntegerArray;
import org.teavm.common.RecordArray;
/** /**
* *
@ -54,8 +55,8 @@ class DebugInformationReader {
return debugInfo; return debugInfo;
} }
private DebugInformation.MultiMapping[] readVariableMappings(int count) throws IOException { private RecordArray[] readVariableMappings(int count) throws IOException {
DebugInformation.MultiMapping[] mappings = new DebugInformation.MultiMapping[count]; RecordArray[] mappings = new RecordArray[count];
int varCount = readUnsignedNumber(); int varCount = readUnsignedNumber();
int lastVar = 0; int lastVar = 0;
while (varCount-- > 0) { while (varCount-- > 0) {
@ -136,7 +137,7 @@ class DebugInformationReader {
return !negative ? number : -number; return !negative ? number : -number;
} }
private DebugInformation.MultiMapping readMultiMapping() throws IOException { private RecordArray readMultiMapping() throws IOException {
int[] lines = readRle(); int[] lines = readRle();
int last = 0; int last = 0;
for (int i = 0; i < lines.length; ++i) { for (int i = 0; i < lines.length; ++i) {

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import java.io.DataOutput; import java.io.DataOutput;
import java.io.IOException; import java.io.IOException;
@ -21,8 +21,9 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.teavm.common.IntegerArray;
import org.teavm.common.RecordArray; import org.teavm.common.RecordArray;
import org.teavm.debugging.DebugInformation.ClassMetadata; import org.teavm.debugging.information.DebugInformation.ClassMetadata;
/** /**
* *
@ -48,7 +49,7 @@ class DebugInformationWriter {
writeMapping(debugInfo.lineMapping); writeMapping(debugInfo.lineMapping);
writeMapping(debugInfo.classMapping); writeMapping(debugInfo.classMapping);
writeMapping(debugInfo.methodMapping); writeMapping(debugInfo.methodMapping);
writeMapping(debugInfo.callSiteMapping); writeCallSiteMapping(debugInfo.callSiteMapping);
writeVariableMappings(debugInfo); writeVariableMappings(debugInfo);
writeClassMetadata(debugInfo.classesMetadata); writeClassMetadata(debugInfo.classesMetadata);
writeCFGs(debugInfo); writeCFGs(debugInfo);
@ -115,27 +116,6 @@ class DebugInformationWriter {
} }
} }
private void writeLinesAndColumns(RecordArray mapping) throws IOException {
int[] lines = mapping.cut(0);
int last = 0;
for (int i = 0; i < lines.length; ++i) {
int next = lines[i];
lines[i] -= last;
last = next;
}
writeRle(lines);
resetRelativeNumber();
int[] columns = mapping.cut(1);
int lastLine = -1;
for (int i = 0; i < columns.length; ++i) {
if (lastLine != mapping.get(i).get(0)) {
resetRelativeNumber();
lastLine = mapping.get(i).get(0);
}
writeRelativeNumber(columns[i]);
}
}
private void writeMultiMapping(RecordArray mapping) throws IOException { private void writeMultiMapping(RecordArray mapping) throws IOException {
writeLinesAndColumns(mapping); writeLinesAndColumns(mapping);
for (int i = 0; i < mapping.size(); ++i) { for (int i = 0; i < mapping.size(); ++i) {
@ -151,47 +131,108 @@ class DebugInformationWriter {
private void writeMapping(RecordArray mapping) throws IOException { private void writeMapping(RecordArray mapping) throws IOException {
writeLinesAndColumns(mapping); writeLinesAndColumns(mapping);
resetRelativeNumber(); writeRle(extractValues(mapping));
int[] values = mapping.cut(2);
for (int i = 0; i < values.length; ++i) {
writeRelativeNumber(values[i]);
} }
private void writeCallSiteMapping(RecordArray mapping) throws IOException {
writeLinesAndColumns(mapping);
writeRle(extractValues(mapping));
writeRle(extractCallSites(mapping));
}
private void writeLinesAndColumns(RecordArray mapping) throws IOException {
writeUnsignedNumber(mapping.size());
writeRle(extractLines(mapping));
writeRle(extractColumns(mapping));
}
private int[] extractLines(RecordArray mapping) {
int[] lines = mapping.cut(0);
int last = 0;
for (int i = 0; i < lines.length; ++i) {
int next = lines[i];
lines[i] -= last;
last = next;
}
return lines;
}
private int[] extractColumns(RecordArray mapping) {
int[] columns = mapping.cut(1);
int lastLine = -1;
int lastColumn = 0;
for (int i = 0; i < columns.length; ++i) {
if (lastLine != mapping.get(i).get(0)) {
lastColumn = 0;
lastLine = mapping.get(i).get(0);
}
int column = columns[i];
columns[i] = column - lastColumn;
lastColumn = column;
}
return columns;
}
private int[] extractValues(RecordArray mapping) {
int[] values = mapping.cut(2);
int last = 0;
for (int i = 0; i < values.length; ++i) {
int value = values[i];
if (value == -1) {
values[i] = 0;
} else {
values[i] = 1 + convertToSigned(value - last);
last = value;
}
}
return values;
}
private int[] extractCallSites(RecordArray mapping) {
int[] callSites = mapping.cut(3);
int last = 0;
int j = 0;
for (int i = 0; i < callSites.length; ++i) {
int type = mapping.get(i).get(2);
if (type != 0) {
int callSite = callSites[i];
callSites[j++] = 1 + convertToSigned(callSite - last);
last = callSite;
}
}
return Arrays.copyOf(callSites, j);
} }
private void writeCFGs(DebugInformation debugInfo) throws IOException { private void writeCFGs(DebugInformation debugInfo) throws IOException {
for (int i = 0; i < debugInfo.controlFlowGraphs.length; ++i) { for (int i = 0; i < debugInfo.controlFlowGraphs.length; ++i) {
writeCFG(debugInfo.controlFlowGraphs[i], i); writeCFG(debugInfo.controlFlowGraphs[i]);
} }
} }
private void writeCFG(DebugInformation.CFG mapping, int fileIndex) throws IOException { private void writeCFG(RecordArray mapping) throws IOException {
writeUnsignedNumber(mapping.lines.length); writeUnsignedNumber(mapping.size());
int lastLine = -1; writeRle(mapping.cut(0));
for (int i = 0; i < mapping.offsets.length - 1; ++i) { IntegerArray files = new IntegerArray(1);
int start = mapping.offsets[i]; IntegerArray lines = new IntegerArray(1);
int sz = mapping.offsets[i + 1] - start; int lastFile = 0;
if (sz == 0) { int lastLine = 0;
for (int i = 0; i < mapping.size(); ++i) {
int type = mapping.get(i).get(0);
if (type == 0) {
continue; continue;
} }
writeUnsignedNumber(i - lastLine); int[] data = mapping.get(i).getArray(0);
if (sz == 1 && mapping.lines[start] == -1) { for (int j = 0; j < data.length; j += 2) {
writeUnsignedNumber(0); int file = data[j];
} else if (sz == 1 && mapping.lines[start] == i + 1 && mapping.files[start] == fileIndex) { int line = data[j + 1];
writeUnsignedNumber(1); files.add(file - lastFile);
} else { lines.add(line - lastLine);
writeUnsignedNumber(1 + sz); lastFile = file;
int[] lines = Arrays.copyOfRange(mapping.lines, start, start + sz); lastLine = line;
int[] files = Arrays.copyOfRange(mapping.files, start, start + sz);
int last = i;
for (int j = 0; j < sz; ++j) {
int succ = lines[j];
writeNumber(succ - last);
writeNumber(files[j] - fileIndex);
last = succ;
} }
} }
lastLine = i; writeRle(files.getAll());
} writeRle(lines.getAll());
} }
private void writeNumber(int number) throws IOException { private void writeNumber(int number) throws IOException {
@ -214,20 +255,26 @@ class DebugInformationWriter {
} }
private void writeRle(int[] array) throws IOException { private void writeRle(int[] array) throws IOException {
writeUnsignedNumber(array.length); int last = 0;
for (int i = 0; i < array.length;) { for (int i = 0; i < array.length;) {
int e = array[i]; int e = array[i];
int count = 1; int count = 1;
int current = i;
++i; ++i;
while (i < array.length && array[i] == e) { while (i < array.length && array[i] == e) {
++count; ++count;
++i; ++i;
} }
if (count > 1) { if (count > 1) {
if (current > last) {
writeUnsignedNumber(convertToSigned(current - last) | 0);
while (last < current) {
writeUnsignedNumber(array[last++]);
}
}
writeUnsignedNumber((convertToSigned(e) << 1) | 1); writeUnsignedNumber((convertToSigned(e) << 1) | 1);
writeUnsignedNumber(count); writeUnsignedNumber(count);
} else { last = i;
writeUnsignedNumber(convertToSigned(e) << 1);
} }
} }
} }

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
/** /**
* *

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
/** /**
* *

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;

View File

@ -13,13 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import org.teavm.codegen.LocationProvider; import org.teavm.codegen.LocationProvider;
import org.teavm.model.MethodDescriptor; import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
/** /**
* *
* @author Alexey Andreev * @author Alexey Andreev

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import org.teavm.common.RecordArray; import org.teavm.common.RecordArray;
import org.teavm.model.MethodDescriptor; import org.teavm.model.MethodDescriptor;

View File

@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
/** /**
* *

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
/** /**
* *

View File

@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
/** /**
* *

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import org.teavm.model.MethodDescriptor; import org.teavm.model.MethodDescriptor;

View File

@ -13,8 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
/** /**
* *

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import org.teavm.common.RecordArray; import org.teavm.common.RecordArray;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import java.io.IOException; import java.io.IOException;
import java.io.Writer; import java.io.Writer;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.information;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.javascript;
/** /**
* *

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.javascript;
import java.util.Map; import java.util.Map;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.javascript;
/** /**
* *

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.javascript;
/** /**
* *

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.javascript;
import java.util.Objects; import java.util.Objects;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.javascript;
import java.util.Map; import java.util.Map;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.debugging; package org.teavm.debugging.javascript;
/** /**
* *

View File

@ -23,9 +23,9 @@ import org.teavm.codegen.NamingException;
import org.teavm.codegen.NamingStrategy; import org.teavm.codegen.NamingStrategy;
import org.teavm.codegen.SourceWriter; import org.teavm.codegen.SourceWriter;
import org.teavm.common.ServiceRepository; import org.teavm.common.ServiceRepository;
import org.teavm.debugging.DebugInformationEmitter; import org.teavm.debugging.information.DebugInformationEmitter;
import org.teavm.debugging.DeferredCallSite; import org.teavm.debugging.information.DeferredCallSite;
import org.teavm.debugging.DummyDebugInformationEmitter; import org.teavm.debugging.information.DummyDebugInformationEmitter;
import org.teavm.javascript.ast.*; import org.teavm.javascript.ast.*;
import org.teavm.javascript.ni.GeneratorContext; import org.teavm.javascript.ni.GeneratorContext;
import org.teavm.javascript.ni.InjectedBy; import org.teavm.javascript.ni.InjectedBy;

View File

@ -21,8 +21,8 @@ import java.util.List;
import java.util.Properties; import java.util.Properties;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.teavm.common.ThreadPoolFiniteExecutor; import org.teavm.common.ThreadPoolFiniteExecutor;
import org.teavm.debugging.DebugInformation; import org.teavm.debugging.information.DebugInformation;
import org.teavm.debugging.DebugInformationBuilder; import org.teavm.debugging.information.DebugInformationBuilder;
import org.teavm.javascript.RenderingContext; import org.teavm.javascript.RenderingContext;
import org.teavm.model.ClassHolderTransformer; import org.teavm.model.ClassHolderTransformer;
import org.teavm.model.MethodDescriptor; import org.teavm.model.MethodDescriptor;

View File

@ -20,8 +20,8 @@ import java.util.*;
import org.teavm.codegen.*; import org.teavm.codegen.*;
import org.teavm.common.FiniteExecutor; import org.teavm.common.FiniteExecutor;
import org.teavm.common.ServiceRepository; import org.teavm.common.ServiceRepository;
import org.teavm.debugging.DebugInformationEmitter; import org.teavm.debugging.information.DebugInformationEmitter;
import org.teavm.debugging.SourceLocation; import org.teavm.debugging.information.SourceLocation;
import org.teavm.dependency.*; import org.teavm.dependency.*;
import org.teavm.javascript.Decompiler; import org.teavm.javascript.Decompiler;
import org.teavm.javascript.Renderer; import org.teavm.javascript.Renderer;