warpo 3.1.3 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assemblyscript/std/README.md +5 -0
- package/assemblyscript/std/assembly/array.ts +542 -0
- package/assemblyscript/std/assembly/arraybuffer.ts +72 -0
- package/assemblyscript/std/assembly/builtins.ts +2312 -0
- package/assemblyscript/std/assembly/compat.ts +2 -0
- package/assemblyscript/std/assembly/dataview.ts +144 -0
- package/assemblyscript/std/assembly/date.ts +383 -0
- package/assemblyscript/std/assembly/diagnostics.ts +11 -0
- package/assemblyscript/std/assembly/error.ts +39 -0
- package/assemblyscript/std/assembly/function.ts +44 -0
- package/assemblyscript/std/assembly/iterator.ts +24 -0
- package/assemblyscript/std/assembly/map.ts +304 -0
- package/assemblyscript/std/assembly/math.ts +3401 -0
- package/assemblyscript/std/assembly/memory.ts +110 -0
- package/assemblyscript/std/assembly/number.ts +388 -0
- package/assemblyscript/std/assembly/object.ts +30 -0
- package/assemblyscript/std/assembly/polyfills.ts +24 -0
- package/assemblyscript/std/assembly/process.ts +7 -0
- package/assemblyscript/std/assembly/promise.ts +172 -0
- package/assemblyscript/std/assembly/reference.ts +48 -0
- package/assemblyscript/std/assembly/regexp.ts +16 -0
- package/assemblyscript/std/assembly/rt/common.ts +79 -0
- package/assemblyscript/std/assembly/rt/index-incremental.ts +4 -0
- package/assemblyscript/std/assembly/rt/index-radical.ts +4 -0
- package/assemblyscript/std/assembly/rt/index.d.ts +37 -0
- package/assemblyscript/std/assembly/rt/itcms.ts +415 -0
- package/assemblyscript/std/assembly/rt/tcms.ts +276 -0
- package/assemblyscript/std/assembly/rt/tlsf.ts +564 -0
- package/assemblyscript/std/assembly/rt.ts +71 -0
- package/assemblyscript/std/assembly/set.ts +261 -0
- package/assemblyscript/std/assembly/shared/feature.ts +69 -0
- package/assemblyscript/std/assembly/shared/host.ts +12 -0
- package/assemblyscript/std/assembly/shared/runtime.ts +9 -0
- package/assemblyscript/std/assembly/shared/target.ts +9 -0
- package/assemblyscript/std/assembly/shared/tsconfig.json +9 -0
- package/assemblyscript/std/assembly/shared/typeinfo.ts +72 -0
- package/assemblyscript/std/assembly/staticarray.ts +446 -0
- package/assemblyscript/std/assembly/string.ts +892 -0
- package/assemblyscript/std/assembly/symbol.ts +61 -0
- package/assemblyscript/std/assembly/table.ts +15 -0
- package/assemblyscript/std/assembly/tsconfig.json +4 -0
- package/assemblyscript/std/assembly/tuple.ts +36 -0
- package/assemblyscript/std/assembly/typedarray.ts +2000 -0
- package/assemblyscript/std/assembly/uri.ts +17 -0
- package/assemblyscript/std/assembly/util/bytes.ts +90 -0
- package/assemblyscript/std/assembly/util/casemap.ts +264 -0
- package/assemblyscript/std/assembly/util/error.ts +54 -0
- package/assemblyscript/std/assembly/util/hash.ts +117 -0
- package/assemblyscript/std/assembly/util/math.ts +1922 -0
- package/assemblyscript/std/assembly/util/memory.ts +309 -0
- package/assemblyscript/std/assembly/util/number.ts +884 -0
- package/assemblyscript/std/assembly/util/sort.ts +282 -0
- package/assemblyscript/std/assembly/util/string.ts +1075 -0
- package/assemblyscript/std/assembly/util/uri.ts +251 -0
- package/assemblyscript/std/assembly/vector.ts +3 -0
- package/dist/common/leb128.d.ts +5 -0
- package/dist/common/leb128.js +17 -0
- package/dist/common/leb128.js.map +1 -0
- package/dist/debug_server/debugSession.d.ts +31 -1
- package/dist/debug_server/debugSession.js +477 -99
- package/dist/debug_server/debugSession.js.map +1 -1
- package/dist/debug_server/debugTrace.d.ts +2 -0
- package/dist/debug_server/debugTrace.js +38 -0
- package/dist/debug_server/debugTrace.js.map +1 -0
- package/dist/debug_server/debugger.d.ts +5 -1
- package/dist/debug_server/debuggerWasmModule.d.ts +9 -0
- package/dist/debug_server/debuggerWasmModule.js +182 -4
- package/dist/debug_server/debuggerWasmModule.js.map +1 -1
- package/dist/debug_server/nodeDebugger.d.ts +12 -1
- package/dist/debug_server/nodeDebugger.js +74 -28
- package/dist/debug_server/nodeDebugger.js.map +1 -1
- package/dist/debug_server/tests/debugSession.test.js +556 -22
- package/dist/debug_server/tests/debugSession.test.js.map +1 -1
- package/dist/debug_server/tests/testModule/debugger_breakpoint_validation.d.ts +1 -0
- package/dist/debug_server/tests/testModule/debugger_breakpoint_validation.js +12 -0
- package/dist/debug_server/tests/testModule/debugger_breakpoint_validation.js.map +1 -0
- package/dist/debug_server/tests/testModule/debugger_closure_stepping.d.ts +1 -0
- package/dist/debug_server/tests/testModule/debugger_closure_stepping.js +12 -0
- package/dist/debug_server/tests/testModule/debugger_closure_stepping.js.map +1 -0
- package/dist/debug_server/tests/testModule/debugger_function_closure.d.ts +1 -0
- package/dist/debug_server/tests/testModule/debugger_function_closure.js +24 -0
- package/dist/debug_server/tests/testModule/debugger_function_closure.js.map +1 -0
- package/dist/debug_server/tests/testModule/debugger_import.case.d.ts +1 -0
- package/dist/debug_server/tests/testModule/debugger_import.case.js +9 -0
- package/dist/debug_server/tests/testModule/debugger_import.case.js.map +1 -0
- package/dist/debug_server/tests/testModule/debugger_import.d.ts +1 -0
- package/dist/debug_server/tests/testModule/debugger_import.js +6 -0
- package/dist/debug_server/tests/testModule/debugger_import.js.map +1 -0
- package/dist/debug_server/tests/testModule/debugger_pause.d.ts +1 -0
- package/dist/debug_server/tests/testModule/debugger_pause.js +9 -0
- package/dist/debug_server/tests/testModule/debugger_pause.js.map +1 -0
- package/dist/debug_server/tests/testModule/debugger_std_array.d.ts +1 -0
- package/dist/debug_server/tests/testModule/debugger_std_array.js +6 -0
- package/dist/debug_server/tests/testModule/debugger_std_array.js.map +1 -0
- package/dist/debug_server/tests/testModule/debugger_stepping.d.ts +3 -0
- package/dist/debug_server/tests/testModule/debugger_stepping.js +28 -0
- package/dist/debug_server/tests/testModule/debugger_stepping.js.map +1 -0
- package/dist/debug_server/tests/testModule/debugger_string_stepping.d.ts +1 -0
- package/dist/debug_server/tests/testModule/debugger_string_stepping.js +9 -0
- package/dist/debug_server/tests/testModule/debugger_string_stepping.js.map +1 -0
- package/dist/debug_server/tests/testModule/debugger_typed_array.d.ts +1 -0
- package/dist/debug_server/tests/testModule/debugger_typed_array.js +52 -0
- package/dist/debug_server/tests/testModule/debugger_typed_array.js.map +1 -0
- package/dist/debug_server/tests/testModule/debugger_utf8_const_str.d.ts +1 -0
- package/dist/debug_server/tests/testModule/debugger_utf8_const_str.js +10 -0
- package/dist/debug_server/tests/testModule/debugger_utf8_const_str.js.map +1 -0
- package/dist/dwarf/dwarfParser.js +6 -13
- package/dist/dwarf/dwarfParser.js.map +1 -1
- package/dist/dwarf/functionDebugInfo.d.ts +3 -0
- package/dist/dwarf/functionDebugInfo.js +24 -0
- package/dist/dwarf/functionDebugInfo.js.map +1 -1
- package/package.json +7 -7
- package/warpo_extension/std/tsconfig.json +4 -0
- package/warpo_extension/std/warpo/ffi.ts +16 -0
- package/warpo_extension/std/warpo/test/comparison.ts +122 -0
- package/warpo_extension/std/warpo/test/env.ts +33 -0
- package/warpo_extension/std/warpo/test/expect.ts +101 -0
- package/warpo_extension/std/warpo/test/formatPrint.ts +99 -0
- package/warpo_extension/std/warpo/test/implement.ts +41 -0
- package/warpo_extension/std/warpo/test/index.d.ts +0 -0
- package/warpo_extension/std/warpo/test/index.ts +39 -0
- package/warpo_extension/std/warpo/test/mockInstrument.ts +26 -0
- package/warpo_extension/std/warpo/utf8/const_str.ts +17 -0
- package/warpo_extension/std/wasi_snapshot_preview1/LICENSE +202 -0
- package/warpo_extension/std/wasi_snapshot_preview1/README.md +1 -0
- package/warpo_extension/std/wasi_snapshot_preview1/bindings/wasi_snapshot_preview1.ts +1731 -0
- package/warpo_extension/std/wasi_snapshot_preview1/wasi_console.ts +96 -0
- package/warpo_extension/std/wasi_snapshot_preview1/wasi_crypto.ts +8 -0
- package/warpo_extension/std/wasi_snapshot_preview1/wasi_date.ts +13 -0
- package/warpo_extension/std/wasi_snapshot_preview1/wasi_internal.ts +119 -0
- package/warpo_extension/std/wasi_snapshot_preview1/wasi_performance.ts +11 -0
- package/warpo_extension/std/wasi_snapshot_preview1/wasi_process.ts +191 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { E_URI_MALFORMED } from "./error";
|
|
2
|
+
import { CharCode } from "./string";
|
|
3
|
+
|
|
4
|
+
// Truncated lookup boolean table that helps us quickly determine
|
|
5
|
+
// if a char needs to be escaped for URIs (RFC 2396).
|
|
6
|
+
// @ts-ignore: decorator
|
|
7
|
+
@lazy export const URI_UNSAFE = memory.data<u8>([
|
|
8
|
+
/* skip 32 + 1 always set to '1' head slots
|
|
9
|
+
*/ 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
10
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
11
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0 /*
|
|
12
|
+
skip 128 + 1 always set to '1' tail slots */,
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
// Truncated lookup boolean table that helps us quickly determine
|
|
16
|
+
// if a char needs to be escaped for URLs (RFC 3986).
|
|
17
|
+
// @ts-ignore: decorator
|
|
18
|
+
@lazy export const URL_UNSAFE = memory.data<u8>([
|
|
19
|
+
/* skip 32 + 1 always set to '1' head slots
|
|
20
|
+
*/ 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
|
|
21
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
22
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0 /*
|
|
23
|
+
skip 128 + 1 always set to '1' tail slots */,
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
// Truncated lookup boolean table for determine reserved chars: ;/?:@&=+$,#
|
|
27
|
+
// @ts-ignore: decorator
|
|
28
|
+
@lazy export const URI_RESERVED = memory.data<u8>([
|
|
29
|
+
/* skip 32 + 3 always set to '0' head slots
|
|
30
|
+
*/ 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1,
|
|
31
|
+
1 /* skip 191 always set to '0' tail slots */,
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
export function encode(src: usize, len: usize, table: usize): usize {
|
|
35
|
+
if (!len) return src;
|
|
36
|
+
|
|
37
|
+
let i: usize = 0,
|
|
38
|
+
offset: usize = 0,
|
|
39
|
+
outSize = len << 1;
|
|
40
|
+
let dst = __new(outSize, idof<String>());
|
|
41
|
+
|
|
42
|
+
while (i < len) {
|
|
43
|
+
let org = i;
|
|
44
|
+
let c: u32, c1: u32;
|
|
45
|
+
// fast scan a check chars until it valid ASCII
|
|
46
|
+
// and safe for copying without escaping.
|
|
47
|
+
do {
|
|
48
|
+
c = <u32>load<u16>(src + (i << 1));
|
|
49
|
+
// is it valid ASCII and safe?
|
|
50
|
+
if (c - 33 < 94) {
|
|
51
|
+
// 127 - 33
|
|
52
|
+
if (load<u8>(table + (c - 33))) break;
|
|
53
|
+
} else break;
|
|
54
|
+
} while (++i < len);
|
|
55
|
+
|
|
56
|
+
// if we have some safe range of sequence just copy it without encoding
|
|
57
|
+
if (i > org) {
|
|
58
|
+
let size = (i - org) << 1;
|
|
59
|
+
if (offset + size > outSize) {
|
|
60
|
+
outSize = offset + size;
|
|
61
|
+
dst = __renew(dst, outSize);
|
|
62
|
+
}
|
|
63
|
+
// TODO: should we optimize for short cases like 2 byte size?
|
|
64
|
+
memory.copy(dst + offset, src + (org << 1), size);
|
|
65
|
+
offset += size;
|
|
66
|
+
// return if we reach end on input string
|
|
67
|
+
if (i >= len) break;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// decode UTF16 with checking for unpaired surrogates
|
|
71
|
+
if (c >= 0xd800) {
|
|
72
|
+
if (c >= 0xdc00 && c <= 0xdfff) {
|
|
73
|
+
throw new URIError(E_URI_MALFORMED);
|
|
74
|
+
}
|
|
75
|
+
if (c <= 0xdbff) {
|
|
76
|
+
if (i >= len) {
|
|
77
|
+
throw new URIError(E_URI_MALFORMED);
|
|
78
|
+
}
|
|
79
|
+
c1 = <u32>load<u16>(src + (++i << 1));
|
|
80
|
+
if (c1 < 0xdc00 || c1 > 0xdfff) {
|
|
81
|
+
throw new URIError(E_URI_MALFORMED);
|
|
82
|
+
}
|
|
83
|
+
c = (((c & 0x3ff) << 10) | (c1 & 0x3ff)) + 0x10000;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let estSize = offset + (c < 0x80 ? 1 * 6 : 4 * 6);
|
|
88
|
+
if (estSize > outSize) {
|
|
89
|
+
// doubling estimated size but only for greater than one
|
|
90
|
+
// input length due to we already estimated it for worst case
|
|
91
|
+
outSize = len > 1 ? estSize << 1 : estSize;
|
|
92
|
+
dst = __renew(dst, outSize);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (c < 0x80) {
|
|
96
|
+
// encode ASCII unsafe code point
|
|
97
|
+
storeHex(dst, offset, c);
|
|
98
|
+
offset += 6;
|
|
99
|
+
} else {
|
|
100
|
+
// encode UTF-8 unsafe code point
|
|
101
|
+
if (c < 0x800) {
|
|
102
|
+
storeHex(dst, offset, (c >> 6) | 0xc0);
|
|
103
|
+
offset += 6;
|
|
104
|
+
} else {
|
|
105
|
+
if (c < 0x10000) {
|
|
106
|
+
storeHex(dst, offset, (c >> 12) | 0xe0);
|
|
107
|
+
offset += 6;
|
|
108
|
+
} else {
|
|
109
|
+
storeHex(dst, offset, (c >> 18) | 0xf0);
|
|
110
|
+
offset += 6;
|
|
111
|
+
storeHex(dst, offset, ((c >> 12) & 0x3f) | 0x80);
|
|
112
|
+
offset += 6;
|
|
113
|
+
}
|
|
114
|
+
storeHex(dst, offset, ((c >> 6) & 0x3f) | 0x80);
|
|
115
|
+
offset += 6;
|
|
116
|
+
}
|
|
117
|
+
storeHex(dst, offset, (c & 0x3f) | 0x80);
|
|
118
|
+
offset += 6;
|
|
119
|
+
}
|
|
120
|
+
++i;
|
|
121
|
+
}
|
|
122
|
+
// shrink output string buffer if necessary
|
|
123
|
+
if (outSize > offset) {
|
|
124
|
+
dst = __renew(dst, offset);
|
|
125
|
+
}
|
|
126
|
+
return dst;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function decode(src: usize, len: usize, component: bool): usize {
|
|
130
|
+
if (!len) return src;
|
|
131
|
+
|
|
132
|
+
let i: usize = 0,
|
|
133
|
+
offset: usize = 0,
|
|
134
|
+
ch: u32 = 0;
|
|
135
|
+
let dst = __new(len << 1, idof<String>());
|
|
136
|
+
|
|
137
|
+
while (i < len) {
|
|
138
|
+
let org = i;
|
|
139
|
+
while (i < len && (ch = load<u16>(src + (i << 1))) != CharCode.PERCENT) i++;
|
|
140
|
+
|
|
141
|
+
if (i > org) {
|
|
142
|
+
let size = (i - org) << 1;
|
|
143
|
+
// TODO: should we optimize for short cases like 2 byte size?
|
|
144
|
+
memory.copy(dst + offset, src + (org << 1), size);
|
|
145
|
+
offset += size;
|
|
146
|
+
if (i >= len) break;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// decode hex
|
|
150
|
+
if (i + 2 >= len || ch != CharCode.PERCENT || (ch = loadHex(src, (i + 1) << 1)) == -1)
|
|
151
|
+
throw new URIError(E_URI_MALFORMED);
|
|
152
|
+
|
|
153
|
+
i += 3;
|
|
154
|
+
if (ch < 0x80) {
|
|
155
|
+
if (!component && isReserved(ch)) {
|
|
156
|
+
ch = CharCode.PERCENT;
|
|
157
|
+
i -= 2;
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
// decode UTF-8 sequence
|
|
161
|
+
let nb = utf8LenFromUpperByte(ch);
|
|
162
|
+
// minimal surrogate: 2 => 0x80, 3 => 0x800, 4 => 0x10000, _ => -1
|
|
163
|
+
let lo: u32 = 1 << (((17 * nb) >> 2) - 1);
|
|
164
|
+
// mask: 2 => 31, 3 => 15, 4 => 7, _ => 0
|
|
165
|
+
ch &= nb ? (0x80 >> nb) - 1 : 0;
|
|
166
|
+
|
|
167
|
+
while (--nb != 0) {
|
|
168
|
+
let c1: u32;
|
|
169
|
+
// decode hex
|
|
170
|
+
if (i + 2 >= len || load<u16>(src + (i << 1)) != CharCode.PERCENT || (c1 = loadHex(src, (i + 1) << 1)) == -1)
|
|
171
|
+
throw new URIError(E_URI_MALFORMED);
|
|
172
|
+
|
|
173
|
+
i += 3;
|
|
174
|
+
if ((c1 & 0xc0) != 0x80) {
|
|
175
|
+
ch = 0;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
ch = (ch << 6) | (c1 & 0x3f);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// check if UTF8 code point properly fit into invalid UTF16 encoding
|
|
182
|
+
if (ch < lo || lo == -1 || ch > 0x10ffff || (ch >= 0xd800 && ch < 0xe000)) {
|
|
183
|
+
throw new URIError(E_URI_MALFORMED);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// encode UTF16
|
|
187
|
+
if (ch >= 0x10000) {
|
|
188
|
+
ch -= 0x10000;
|
|
189
|
+
let lo = (ch >> 10) | 0xd800;
|
|
190
|
+
let hi = (ch & 0x03ff) | 0xdc00;
|
|
191
|
+
store<u32>(dst + offset, lo | (hi << 16));
|
|
192
|
+
offset += 4;
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
store<u16>(dst + offset, ch);
|
|
197
|
+
offset += 2;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
assert(offset <= len << 1);
|
|
201
|
+
// shrink output string buffer if necessary
|
|
202
|
+
if (len << 1 > offset) {
|
|
203
|
+
dst = __renew(dst, offset);
|
|
204
|
+
}
|
|
205
|
+
return dst;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function storeHex(dst: usize, offset: usize, ch: u32): void {
|
|
209
|
+
// @ts-ignore: decorator
|
|
210
|
+
const HEX_CHARS = memory.data<u8>([
|
|
211
|
+
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46,
|
|
212
|
+
]);
|
|
213
|
+
|
|
214
|
+
store<u16>(dst + offset, CharCode.PERCENT, 0); // %
|
|
215
|
+
store<u32>(
|
|
216
|
+
dst + offset,
|
|
217
|
+
(<u32>load<u8>(HEX_CHARS + ((ch >> 4) & 0x0f))) | ((<u32>load<u8>(HEX_CHARS + (ch & 0x0f))) << 16),
|
|
218
|
+
2
|
|
219
|
+
); // XX
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function loadHex(src: usize, offset: usize): u32 {
|
|
223
|
+
let c0 = <u32>load<u16>(src + offset, 0);
|
|
224
|
+
let c1 = <u32>load<u16>(src + offset, 2);
|
|
225
|
+
return isHex(c0) && isHex(c1) ? (fromHex(c0) << 4) | fromHex(c1) : -1;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// @ts-ignore: decorator
|
|
229
|
+
@inline function fromHex(ch: u32): u32 {
|
|
230
|
+
return ((ch | 32) % 39) - 9;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// @ts-ignore: decorator
|
|
234
|
+
@inline function utf8LenFromUpperByte(c0: u32): u32 {
|
|
235
|
+
// same as
|
|
236
|
+
// if (c0 - 0xC0 <= 0xDF - 0xC0) return 2;
|
|
237
|
+
// if (c0 - 0xE0 <= 0xEF - 0xE0) return 3;
|
|
238
|
+
// if (c0 - 0xF0 <= 0xF7 - 0xF0) return 4;
|
|
239
|
+
// return 0;
|
|
240
|
+
return c0 - 0xc0 < 56 ? clz(~(c0 << 24)) : 0;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// @ts-ignore: decorator
|
|
244
|
+
@inline function isReserved(ch: u32): bool {
|
|
245
|
+
return ch - 35 < 30 ? <bool>load<u8>(URI_RESERVED + (ch - 35)) : false;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// @ts-ignore: decorator
|
|
249
|
+
@inline function isHex(ch: u32): bool {
|
|
250
|
+
return ch - CharCode._0 < 10 || (ch | 32) - CharCode.a < 6;
|
|
251
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright (C) 2026 wasm-ecosystem
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export function readULEB128(bytes, offset) {
|
|
4
|
+
const startOffset = offset;
|
|
5
|
+
let value = 0;
|
|
6
|
+
let shift = 0;
|
|
7
|
+
while (offset < bytes.byteLength) {
|
|
8
|
+
const byte = bytes[offset++];
|
|
9
|
+
value |= (byte & 0x7f) << shift;
|
|
10
|
+
shift += 7;
|
|
11
|
+
if ((byte & 0x80) === 0) {
|
|
12
|
+
return { value: value >>> 0, nextOffset: offset };
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
throw new Error(`ULEB128 read past end of buffer at offset ${startOffset}`);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=leb128.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leb128.js","sourceRoot":"","sources":["../../tools/common/leb128.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,sCAAsC;AAOtC,MAAM,UAAU,WAAW,CAAC,KAAiB,EAAE,MAAc;IAC3D,MAAM,WAAW,GAAG,MAAM,CAAC;IAC3B,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,MAAM,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7B,KAAK,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,KAAK,CAAC;QAChC,KAAK,IAAI,CAAC,CAAC;QACX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QACpD,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,6CAA6C,WAAW,EAAE,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -8,6 +8,7 @@ interface WarpoLaunchRequestArguments extends DebugProtocol.LaunchRequestArgumen
|
|
|
8
8
|
cwd?: string;
|
|
9
9
|
warpoPath?: string;
|
|
10
10
|
debugSessionLogging?: boolean;
|
|
11
|
+
debugSessionLogFile?: string;
|
|
11
12
|
args?: number[];
|
|
12
13
|
}
|
|
13
14
|
export declare class WarpoDebugSession extends LoggingDebugSession {
|
|
@@ -20,8 +21,11 @@ export declare class WarpoDebugSession extends LoggingDebugSession {
|
|
|
20
21
|
private nextVariablesReference;
|
|
21
22
|
private loadedModule;
|
|
22
23
|
private runtime;
|
|
24
|
+
private configurationDone;
|
|
23
25
|
private stoppedWasmBytecodeOffset;
|
|
24
26
|
private stoppedForTrap;
|
|
27
|
+
private stepMode;
|
|
28
|
+
private stepStartSourceLocation;
|
|
25
29
|
private debugSessionLogging;
|
|
26
30
|
private log;
|
|
27
31
|
private sendStoppedEvent;
|
|
@@ -30,22 +34,32 @@ export declare class WarpoDebugSession extends LoggingDebugSession {
|
|
|
30
34
|
protected setBreakPointsRequest(response: DebugProtocol.SetBreakpointsResponse, args: DebugProtocol.SetBreakpointsArguments): void;
|
|
31
35
|
protected configurationDoneRequest(response: DebugProtocol.ConfigurationDoneResponse, _args: DebugProtocol.ConfigurationDoneArguments): void;
|
|
32
36
|
protected launchRequest(response: DebugProtocol.LaunchResponse, args: WarpoLaunchRequestArguments): void;
|
|
37
|
+
protected restartRequest(response: DebugProtocol.RestartResponse, _args: DebugProtocol.RestartArguments): void;
|
|
38
|
+
private doRestartRequest;
|
|
33
39
|
private doLaunchRequest;
|
|
34
40
|
protected threadsRequest(response: DebugProtocol.ThreadsResponse): void;
|
|
35
41
|
protected stackTraceRequest(response: DebugProtocol.StackTraceResponse, args: DebugProtocol.StackTraceArguments): void;
|
|
36
42
|
protected scopesRequest(response: DebugProtocol.ScopesResponse, args: DebugProtocol.ScopesArguments): void;
|
|
37
43
|
protected variablesRequest(response: DebugProtocol.VariablesResponse, args: DebugProtocol.VariablesArguments): void;
|
|
38
44
|
protected continueRequest(response: DebugProtocol.ContinueResponse, _args: DebugProtocol.ContinueArguments): void;
|
|
45
|
+
protected stepInRequest(response: DebugProtocol.StepInResponse, _args: DebugProtocol.StepInArguments): void;
|
|
46
|
+
protected nextRequest(response: DebugProtocol.NextResponse, _args: DebugProtocol.NextArguments): void;
|
|
47
|
+
protected pauseRequest(response: DebugProtocol.PauseResponse, _args: DebugProtocol.PauseArguments): void;
|
|
48
|
+
protected terminateRequest(response: DebugProtocol.TerminateResponse, _args: DebugProtocol.TerminateArguments): void;
|
|
49
|
+
protected stepOutRequest(response: DebugProtocol.StepOutResponse, _args: DebugProtocol.StepOutArguments): void;
|
|
39
50
|
protected disconnectRequest(response: DebugProtocol.DisconnectResponse, _args: DebugProtocol.DisconnectArguments): void;
|
|
51
|
+
private doDisconnectRequest;
|
|
40
52
|
private doStackTraceRequest;
|
|
41
53
|
private resolveSourceLocation;
|
|
42
54
|
private doScopesRequest;
|
|
43
55
|
private doVariablesRequest;
|
|
44
56
|
private resolveLocalScopes;
|
|
45
57
|
private resolveLocalScopeVariables;
|
|
58
|
+
private decodeScopeChainVariables;
|
|
59
|
+
private resolveClosureScopeVariables;
|
|
46
60
|
private decodeObjectAtAddress;
|
|
47
61
|
private resolveRawWasmValues;
|
|
48
|
-
private
|
|
62
|
+
private resolveClosureTupleAddress;
|
|
49
63
|
private resolvePausedStackFrame;
|
|
50
64
|
private toDebugSessionVariable;
|
|
51
65
|
private toDebugSessionVariableValue;
|
|
@@ -60,12 +74,14 @@ export declare class WarpoDebugSession extends LoggingDebugSession {
|
|
|
60
74
|
private readTupleElementValues;
|
|
61
75
|
private decodeTupleElements;
|
|
62
76
|
private resolveObjectFields;
|
|
77
|
+
private decodeFunctionElements;
|
|
63
78
|
private resolveRuntimeObjectPayloadSize;
|
|
64
79
|
private decodeTupleReferenceValue;
|
|
65
80
|
private decodeTupleBasicValue;
|
|
66
81
|
private decodeTupleReferenceElement;
|
|
67
82
|
private decodeArrayElements;
|
|
68
83
|
private decodeArrayBufferElements;
|
|
84
|
+
private decodeTypedArrayElements;
|
|
69
85
|
private decodeStaticArrayElements;
|
|
70
86
|
private decodeArrayElementVariables;
|
|
71
87
|
private decodeSetElements;
|
|
@@ -81,13 +97,27 @@ export declare class WarpoDebugSession extends LoggingDebugSession {
|
|
|
81
97
|
private decodeIntegerBySize;
|
|
82
98
|
private decodeStringAtAddress;
|
|
83
99
|
private doContinueRequest;
|
|
100
|
+
private doStepRequest;
|
|
101
|
+
private handleStepPause;
|
|
102
|
+
private handleNonStepPause;
|
|
103
|
+
private hasReachedNextSourceLine;
|
|
104
|
+
private isLibrarySource;
|
|
105
|
+
private advanceStep;
|
|
106
|
+
private completeStep;
|
|
107
|
+
private handleStepFailure;
|
|
108
|
+
private cancelStep;
|
|
84
109
|
private resumeRuntime;
|
|
85
110
|
private handleRuntimeExit;
|
|
86
111
|
private disposeRuntimeAndTerminate;
|
|
87
112
|
private resetRuntimeState;
|
|
113
|
+
private queueAllBreakpointUpdates;
|
|
88
114
|
private logAllBreakpoints;
|
|
115
|
+
private toDebugProtocolBreakpoint;
|
|
89
116
|
private requestBreakpointUpdate;
|
|
117
|
+
private maybeStartRuntime;
|
|
90
118
|
private applyPendingBreakpointUpdates;
|
|
119
|
+
private collectBreakpointOffsets;
|
|
120
|
+
private collectBreakpointLocations;
|
|
91
121
|
private disposeLoadedModule;
|
|
92
122
|
}
|
|
93
123
|
export {};
|