Thank you very much. After a bit of experimenting, I'm currently trying to find out, why the following function hangs indefinitly. It's a function which scans a portion (from this.idx to this.next) of an array for a given sequence, starting at an offset using a given stepping width.
find(sequence, offset, stepping) {
"jit";
if (stepping === undefined) {
stepping = 1;
}
if (offset === undefined) {
offset = 0;
}
for (let i = this.idx + offset; i < this.next - sequence.length; i+=stepping) {
if (this.buffer[i] !== sequence[0]) {
continue;
}
let idx = i;
for (let j = 1; j < sequence.length; j++) {
if (this.buffer[i + j] !== sequence[j]) {
idx = -1;
// JIT lacks break statement
j = sequence.length - 1;
}
}
if (idx !== -1) {
return idx;
}
}
return -1;
}
When I run it without jit it works as expected. If the function is jitted, the application hangs without any error. Thank you for your reply
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thank you very much. After a bit of experimenting, I'm currently trying to find out, why the following function hangs indefinitly. It's a function which scans a portion (from this.idx to this.next) of an array for a given sequence, starting at an offset using a given stepping width.
When I run it without jit it works as expected. If the function is jitted, the application hangs without any error. Thank you for your reply