/home/travis/build/MoarVM/MoarVM/src/core/interp.c
Line | Count | Source (jump to first uncovered line) |
1 | | #include "moar.h" |
2 | | #include <math.h> |
3 | | #include "platform/time.h" |
4 | | #include "strings/unicode_ops.h" |
5 | | |
6 | | /* Macros for getting things from the bytecode stream. */ |
7 | | #if MVM_GC_DEBUG == 2 |
8 | | MVM_STATIC_INLINE MVMuint16 check_reg(MVMThreadContext *tc, MVMRegister *reg_base, MVMuint16 idx) { |
9 | | MVMFrame *f = tc->cur_frame; |
10 | | MVMuint16 kind = f->spesh_cand && f->spesh_cand->local_types |
11 | | ? f->spesh_cand->local_types[idx] |
12 | | : f->static_info->body.local_types[idx]; |
13 | | if (kind == MVM_reg_obj || kind == MVM_reg_str) |
14 | | MVM_ASSERT_NOT_FROMSPACE(tc, reg_base[idx].o); |
15 | | return idx; |
16 | | } |
17 | | #define GET_REG(pc, idx) reg_base[check_reg(tc, reg_base, *((MVMuint16 *)(pc + idx)))] |
18 | | #else |
19 | 510M | #define GET_REG(pc, idx) reg_base[*((MVMuint16 *)(pc + idx))] |
20 | | #endif |
21 | | #if MVM_GC_DEBUG == 2 |
22 | | MVM_STATIC_INLINE MVMuint16 check_lex(MVMThreadContext *tc, MVMFrame *f, MVMuint16 idx) { |
23 | | MVMuint16 kind = f->spesh_cand && f->spesh_cand->lexical_types |
24 | | ? f->spesh_cand->lexical_types[idx] |
25 | | : f->static_info->body.lexical_types[idx]; |
26 | | if (kind == MVM_reg_obj || kind == MVM_reg_str) |
27 | | MVM_ASSERT_NOT_FROMSPACE(tc, f->env[idx].o); |
28 | | return idx; |
29 | | } |
30 | | #define GET_LEX(pc, idx, f) f->env[check_lex(tc, f, *((MVMuint16 *)(pc + idx)))] |
31 | | #else |
32 | 3.92M | #define GET_LEX(pc, idx, f) f->env[*((MVMuint16 *)(pc + idx))] |
33 | | #endif |
34 | 41.5M | #define GET_I16(pc, idx) *((MVMint16 *)(pc + idx)) |
35 | 75.7M | #define GET_UI16(pc, idx) *((MVMuint16 *)(pc + idx)) |
36 | 4.53k | #define GET_I32(pc, idx) *((MVMint32 *)(pc + idx)) |
37 | 55.8M | #define GET_UI32(pc, idx) *((MVMuint32 *)(pc + idx)) |
38 | | #define GET_N32(pc, idx) *((MVMnum32 *)(pc + idx)) |
39 | | |
40 | 333M | #define NEXT_OP (op = *(MVMuint16 *)(cur_op), cur_op += 2, op) |
41 | | |
42 | | #if MVM_CGOTO |
43 | | #define DISPATCH(op) |
44 | 333M | #define OP(name) OP_ ## name |
45 | 333M | #define NEXT *LABELS[NEXT_OP] |
46 | | #else |
47 | | #define DISPATCH(op) switch (op) |
48 | | #define OP(name) case MVM_OP_ ## name |
49 | | #define NEXT runloop |
50 | | #endif |
51 | | |
52 | | static int tracing_enabled = 0; |
53 | | |
54 | | /* This is the interpreter run loop. We have one of these per thread. */ |
55 | 260 | void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContext *, void *), void *invoke_data) { |
56 | 260 | #if MVM_CGOTO |
57 | 260 | #include "oplabels.h" |
58 | 260 | #endif |
59 | 260 | |
60 | 260 | /* Points to the current opcode. */ |
61 | 260 | MVMuint8 *cur_op = NULL; |
62 | 260 | |
63 | 260 | /* The current frame's bytecode start. */ |
64 | 260 | MVMuint8 *bytecode_start = NULL; |
65 | 260 | |
66 | 260 | /* Points to the base of the current register set for the frame we |
67 | 260 | * are presently in. */ |
68 | 260 | MVMRegister *reg_base = NULL; |
69 | 260 | |
70 | 260 | /* Points to the current compilation unit. */ |
71 | 260 | MVMCompUnit *cu = NULL; |
72 | 260 | |
73 | 260 | /* The current call site we're constructing. */ |
74 | 260 | MVMCallsite *cur_callsite = NULL; |
75 | 260 | |
76 | 260 | /* Stash addresses of current op, register base and SC deref base |
77 | 260 | * in the TC; this will be used by anything that needs to switch |
78 | 260 | * the current place we're interpreting. */ |
79 | 260 | tc->interp_cur_op = &cur_op; |
80 | 260 | tc->interp_bytecode_start = &bytecode_start; |
81 | 260 | tc->interp_reg_base = ®_base; |
82 | 260 | tc->interp_cu = &cu; |
83 | 260 | |
84 | 260 | /* With everything set up, do the initial invocation (exactly what this does |
85 | 260 | * varies depending on if this is starting a new thread or is the top-level |
86 | 260 | * program entry point). */ |
87 | 260 | initial_invoke(tc, invoke_data); |
88 | 260 | |
89 | 260 | /* Set jump point, for if we arrive back in the interpreter from an |
90 | 260 | * exception thrown from C code. */ |
91 | 260 | setjmp(tc->interp_jump); |
92 | 260 | |
93 | 260 | /* Enter runloop. */ |
94 | 363 | runloop: { |
95 | 363 | MVMuint16 op; |
96 | 363 | |
97 | 363 | #if MVM_TRACING |
98 | | if (tracing_enabled) { |
99 | | char *trace_line; |
100 | | tc->cur_frame->throw_address = cur_op; |
101 | | trace_line = MVM_exception_backtrace_line(tc, tc->cur_frame, 0); |
102 | | fprintf(stderr, "Op %d%s\n", (int)*((MVMuint16 *)cur_op), trace_line); |
103 | | /* slow tracing is slow. Feel free to speed it. */ |
104 | | MVM_free(trace_line); |
105 | | } |
106 | | #endif |
107 | 363 | |
108 | 363 | /* The ops should be in the same order here as in the oplist file, so |
109 | 363 | * the compiler can can optimise the switch properly */ |
110 | 363 | DISPATCH(NEXT_OP) { |
111 | 364 | OP(no_op): |
112 | 364 | goto NEXT; |
113 | 0 | OP(const_i8): |
114 | 0 | OP(const_i16): |
115 | 0 | OP(const_i32): |
116 | 0 | MVM_exception_throw_adhoc(tc, "const_iX NYI"); |
117 | 0 | OP(const_i64): |
118 | 0 | GET_REG(cur_op, 0).i64 = MVM_BC_get_I64(cur_op, 2); |
119 | 0 | cur_op += 10; |
120 | 0 | goto NEXT; |
121 | 0 | OP(const_n32): |
122 | 0 | MVM_exception_throw_adhoc(tc, "const_n32 NYI"); |
123 | 173k | OP(const_n64): |
124 | 173k | GET_REG(cur_op, 0).n64 = MVM_BC_get_N64(cur_op, 2); |
125 | 173k | cur_op += 10; |
126 | 173k | goto NEXT; |
127 | 10.4M | OP(const_s): |
128 | 10.4M | GET_REG(cur_op, 0).s = MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)); |
129 | 10.4M | cur_op += 6; |
130 | 10.4M | goto NEXT; |
131 | 33.7M | OP(set): |
132 | 33.7M | GET_REG(cur_op, 0) = GET_REG(cur_op, 2); |
133 | 33.7M | cur_op += 4; |
134 | 33.7M | goto NEXT; |
135 | 0 | OP(extend_u8): |
136 | 0 | GET_REG(cur_op, 0).u64 = (MVMuint64)GET_REG(cur_op, 2).u8; |
137 | 0 | cur_op += 4; |
138 | 0 | goto NEXT; |
139 | 0 | OP(extend_u16): |
140 | 0 | GET_REG(cur_op, 0).u64 = (MVMuint64)GET_REG(cur_op, 2).u16; |
141 | 0 | cur_op += 4; |
142 | 0 | goto NEXT; |
143 | 0 | OP(extend_u32): |
144 | 0 | GET_REG(cur_op, 0).u64 = (MVMuint64)GET_REG(cur_op, 2).u32; |
145 | 0 | cur_op += 4; |
146 | 0 | goto NEXT; |
147 | 2 | OP(extend_i8): |
148 | 2 | GET_REG(cur_op, 0).i64 = (MVMint64)GET_REG(cur_op, 2).i8; |
149 | 2 | cur_op += 4; |
150 | 2 | goto NEXT; |
151 | 2 | OP(extend_i16): |
152 | 2 | GET_REG(cur_op, 0).i64 = (MVMint64)GET_REG(cur_op, 2).i16; |
153 | 2 | cur_op += 4; |
154 | 2 | goto NEXT; |
155 | 2 | OP(extend_i32): |
156 | 2 | GET_REG(cur_op, 0).i64 = (MVMint64)GET_REG(cur_op, 2).i32; |
157 | 2 | cur_op += 4; |
158 | 2 | goto NEXT; |
159 | 0 | OP(trunc_u8): |
160 | 0 | GET_REG(cur_op, 0).u8 = (MVMuint8)GET_REG(cur_op, 2).u64; |
161 | 0 | cur_op += 4; |
162 | 0 | goto NEXT; |
163 | 0 | OP(trunc_u16): |
164 | 0 | GET_REG(cur_op, 0).u16 = (MVMuint16)GET_REG(cur_op, 2).u64; |
165 | 0 | cur_op += 4; |
166 | 0 | goto NEXT; |
167 | 0 | OP(trunc_u32): |
168 | 0 | GET_REG(cur_op, 0).u32 = (MVMuint32)GET_REG(cur_op, 2).u64; |
169 | 0 | cur_op += 4; |
170 | 0 | goto NEXT; |
171 | 2 | OP(trunc_i8): |
172 | 2 | GET_REG(cur_op, 0).i8 = (MVMint8)GET_REG(cur_op, 2).i64; |
173 | 2 | cur_op += 4; |
174 | 2 | goto NEXT; |
175 | 2 | OP(trunc_i16): |
176 | 2 | GET_REG(cur_op, 0).i16 = (MVMint16)GET_REG(cur_op, 2).i64; |
177 | 2 | cur_op += 4; |
178 | 2 | goto NEXT; |
179 | 2 | OP(trunc_i32): |
180 | 2 | GET_REG(cur_op, 0).i32 = (MVMint32)GET_REG(cur_op, 2).i64; |
181 | 2 | cur_op += 4; |
182 | 2 | goto NEXT; |
183 | 0 | OP(extend_n32): |
184 | 0 | GET_REG(cur_op, 0).n64 = (MVMnum64)GET_REG(cur_op, 2).n32; |
185 | 0 | cur_op += 4; |
186 | 0 | goto NEXT; |
187 | 0 | OP(trunc_n32): |
188 | 0 | GET_REG(cur_op, 0).n32 = (MVMnum32)GET_REG(cur_op, 2).n64; |
189 | 0 | cur_op += 4; |
190 | 0 | goto NEXT; |
191 | 8.53M | OP(goto): |
192 | 8.53M | cur_op = bytecode_start + GET_UI32(cur_op, 0); |
193 | 8.53M | GC_SYNC_POINT(tc); |
194 | 8.53M | goto NEXT; |
195 | 13.9M | OP(if_i): |
196 | 13.9M | if (GET_REG(cur_op, 0).i64) |
197 | 3.87M | cur_op = bytecode_start + GET_UI32(cur_op, 2); |
198 | 13.9M | else |
199 | 10.1M | cur_op += 6; |
200 | 13.9M | GC_SYNC_POINT(tc); |
201 | 13.9M | goto NEXT; |
202 | 10.7M | OP(unless_i): |
203 | 10.7M | if (GET_REG(cur_op, 0).i64) |
204 | 5.11M | cur_op += 6; |
205 | 10.7M | else |
206 | 5.63M | cur_op = bytecode_start + GET_UI32(cur_op, 2); |
207 | 10.7M | GC_SYNC_POINT(tc); |
208 | 10.7M | goto NEXT; |
209 | 4.76k | OP(if_n): |
210 | 4.76k | if (GET_REG(cur_op, 0).n64 != 0.0) |
211 | 4.76k | cur_op = bytecode_start + GET_UI32(cur_op, 2); |
212 | 4.76k | else |
213 | 0 | cur_op += 6; |
214 | 4.76k | GC_SYNC_POINT(tc); |
215 | 4.76k | goto NEXT; |
216 | 12.9k | OP(unless_n): |
217 | 12.9k | if (GET_REG(cur_op, 0).n64 != 0.0) |
218 | 6.18k | cur_op += 6; |
219 | 12.9k | else |
220 | 6.74k | cur_op = bytecode_start + GET_UI32(cur_op, 2); |
221 | 12.9k | GC_SYNC_POINT(tc); |
222 | 12.9k | goto NEXT; |
223 | 0 | OP(if_s): { |
224 | 0 | MVMString *str = GET_REG(cur_op, 0).s; |
225 | 0 | if (!str || MVM_string_graphs(tc, str) == 0) |
226 | 0 | cur_op += 6; |
227 | 0 | else |
228 | 0 | cur_op = bytecode_start + GET_UI32(cur_op, 2); |
229 | 0 | GC_SYNC_POINT(tc); |
230 | 0 | goto NEXT; |
231 | 0 | } |
232 | 0 | OP(unless_s): { |
233 | 0 | MVMString *str = GET_REG(cur_op, 0).s; |
234 | 0 | if (!str || MVM_string_graphs(tc, str) == 0) |
235 | 0 | cur_op = bytecode_start + GET_UI32(cur_op, 2); |
236 | 0 | else |
237 | 0 | cur_op += 6; |
238 | 0 | GC_SYNC_POINT(tc); |
239 | 0 | goto NEXT; |
240 | 0 | } |
241 | 11.3k | OP(if_s0): { |
242 | 11.3k | MVMString *str = GET_REG(cur_op, 0).s; |
243 | 11.3k | if (!MVM_coerce_istrue_s(tc, str)) |
244 | 0 | cur_op += 6; |
245 | 11.3k | else |
246 | 11.3k | cur_op = bytecode_start + GET_UI32(cur_op, 2); |
247 | 11.3k | GC_SYNC_POINT(tc); |
248 | 11.3k | goto NEXT; |
249 | 11.3k | } |
250 | 246k | OP(unless_s0): { |
251 | 246k | MVMString *str = GET_REG(cur_op, 0).s; |
252 | 246k | if (!MVM_coerce_istrue_s(tc, str)) |
253 | 45.2k | cur_op = bytecode_start + GET_UI32(cur_op, 2); |
254 | 246k | else |
255 | 200k | cur_op += 6; |
256 | 246k | GC_SYNC_POINT(tc); |
257 | 246k | goto NEXT; |
258 | 246k | } |
259 | 645k | OP(if_o): |
260 | 645k | GC_SYNC_POINT(tc); |
261 | 645k | MVM_coerce_istrue(tc, GET_REG(cur_op, 0).o, NULL, |
262 | 645k | bytecode_start + GET_UI32(cur_op, 2), |
263 | 645k | cur_op + 6, |
264 | 645k | 0); |
265 | 645k | goto NEXT; |
266 | 2.52M | OP(unless_o): |
267 | 2.52M | GC_SYNC_POINT(tc); |
268 | 2.52M | MVM_coerce_istrue(tc, GET_REG(cur_op, 0).o, NULL, |
269 | 2.52M | bytecode_start + GET_UI32(cur_op, 2), |
270 | 2.52M | cur_op + 6, |
271 | 2.52M | 1); |
272 | 2.52M | goto NEXT; |
273 | 381k | OP(jumplist): { |
274 | 381k | MVMint64 num_labels = MVM_BC_get_I64(cur_op, 0); |
275 | 381k | MVMint64 input = GET_REG(cur_op, 8).i64; |
276 | 381k | cur_op += 10; |
277 | 381k | /* the goto ops are guaranteed valid/existent by validation.c */ |
278 | 381k | if (input < 0 || input >= num_labels) { /* implicitly covers num_labels == 0 */ |
279 | 0 | /* skip the entire goto list block */ |
280 | 0 | cur_op += (6 /* size of each goto op */) * num_labels; |
281 | 0 | } |
282 | 381k | else { /* delve directly into the selected goto op */ |
283 | 381k | cur_op = bytecode_start + GET_UI32(cur_op, |
284 | 381k | input * (6 /* size of each goto op */) |
285 | 381k | + (2 /* size of the goto instruction itself */)); |
286 | 381k | } |
287 | 381k | GC_SYNC_POINT(tc); |
288 | 381k | goto NEXT; |
289 | 381k | } |
290 | 3.86M | OP(getlex): { |
291 | 3.86M | MVMFrame *f = tc->cur_frame; |
292 | 3.86M | MVMuint16 outers = GET_UI16(cur_op, 4); |
293 | 3.86M | MVMRegister found; |
294 | 9.33M | while (outers) { |
295 | 5.47M | if (!f->outer) |
296 | 0 | MVM_exception_throw_adhoc(tc, "getlex: outer index out of range"); |
297 | 5.47M | f = f->outer; |
298 | 5.47M | outers--; |
299 | 5.47M | } |
300 | 3.86M | GET_REG(cur_op, 0) = found = GET_LEX(cur_op, 2, f); |
301 | 3.86M | if (found.o == NULL) { |
302 | 238k | MVMuint16 idx = GET_UI16(cur_op, 2); |
303 | 1.17k | MVMuint16 *lexical_types = f->spesh_cand && f->spesh_cand->lexical_types |
304 | 0 | ? f->spesh_cand->lexical_types |
305 | 238k | : f->static_info->body.lexical_types; |
306 | 238k | if (lexical_types[idx] == MVM_reg_obj) |
307 | 1.18k | GET_REG(cur_op, 0).o = MVM_frame_vivify_lexical(tc, f, idx); |
308 | 238k | } |
309 | 3.86M | cur_op += 6; |
310 | 3.86M | goto NEXT; |
311 | 3.86M | } |
312 | 1.22M | OP(bindlex): { |
313 | 1.22M | MVMFrame *f = tc->cur_frame; |
314 | 1.22M | MVMuint16 outers = GET_UI16(cur_op, 2); |
315 | 173k | MVMuint16 kind = f->spesh_cand && f->spesh_cand->local_types |
316 | 156k | ? f->spesh_cand->local_types[GET_UI16(cur_op, 4)] |
317 | 1.06M | : f->static_info->body.local_types[GET_UI16(cur_op, 4)]; |
318 | 1.25M | while (outers) { |
319 | 34.7k | if (!f->outer) |
320 | 0 | MVM_exception_throw_adhoc(tc, "bindlex: outer index out of range"); |
321 | 34.7k | f = f->outer; |
322 | 34.7k | outers--; |
323 | 34.7k | } |
324 | 1.22M | if (kind == MVM_reg_obj || kind == MVM_reg_str) { |
325 | 1.16M | #if MVM_GC_DEGUG |
326 | | MVM_ASSERT_NOT_FROMSPACE(tc, GET_REG(cur_op, 4).o); |
327 | | #endif |
328 | 1.16M | MVM_ASSIGN_REF(tc, &(f->header), GET_LEX(cur_op, 0, f).o, |
329 | 1.16M | GET_REG(cur_op, 4).o); |
330 | 1.16M | } |
331 | 52.1k | else { |
332 | 52.1k | GET_LEX(cur_op, 0, f) = GET_REG(cur_op, 4); |
333 | 52.1k | } |
334 | 1.22M | cur_op += 6; |
335 | 1.22M | goto NEXT; |
336 | 1.22M | } |
337 | 0 | OP(getlex_ni): |
338 | 0 | GET_REG(cur_op, 0).i64 = MVM_frame_find_lexical_by_name(tc, |
339 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_reg_int64)->i64; |
340 | 0 | cur_op += 6; |
341 | 0 | goto NEXT; |
342 | 0 | OP(getlex_nn): |
343 | 0 | GET_REG(cur_op, 0).n64 = MVM_frame_find_lexical_by_name(tc, |
344 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_reg_num64)->n64; |
345 | 0 | cur_op += 6; |
346 | 0 | goto NEXT; |
347 | 0 | OP(getlex_ns): |
348 | 0 | GET_REG(cur_op, 0).s = MVM_frame_find_lexical_by_name(tc, |
349 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_reg_str)->s; |
350 | 0 | cur_op += 6; |
351 | 0 | goto NEXT; |
352 | 18.1k | OP(getlex_no): { |
353 | 18.1k | MVMRegister *found = MVM_frame_find_lexical_by_name(tc, |
354 | 18.1k | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_reg_obj); |
355 | 18.1k | GET_REG(cur_op, 0).o = found ? found->o : tc->instance->VMNull; |
356 | 18.1k | cur_op += 6; |
357 | 18.1k | goto NEXT; |
358 | 18.1k | } |
359 | 0 | OP(bindlex_ni): |
360 | 0 | MVM_frame_bind_lexical_by_name(tc, |
361 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 0)), |
362 | 0 | MVM_reg_int64, &(GET_REG(cur_op, 4))); |
363 | 0 | cur_op += 6; |
364 | 0 | goto NEXT; |
365 | 0 | OP(bindlex_nn): |
366 | 0 | MVM_frame_bind_lexical_by_name(tc, |
367 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 0)), |
368 | 0 | MVM_reg_num64, &(GET_REG(cur_op, 4))); |
369 | 0 | cur_op += 6; |
370 | 0 | goto NEXT; |
371 | 0 | OP(bindlex_ns): |
372 | 0 | MVM_frame_bind_lexical_by_name(tc, |
373 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 0)), |
374 | 0 | MVM_reg_str, &(GET_REG(cur_op, 4))); |
375 | 0 | cur_op += 6; |
376 | 0 | goto NEXT; |
377 | 0 | OP(bindlex_no): |
378 | 0 | MVM_frame_bind_lexical_by_name(tc, |
379 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 0)), |
380 | 0 | MVM_reg_obj, &(GET_REG(cur_op, 4))); |
381 | 0 | cur_op += 6; |
382 | 0 | goto NEXT; |
383 | 0 | OP(getlex_ng): |
384 | 0 | OP(bindlex_ng): |
385 | 0 | MVM_exception_throw_adhoc(tc, "get/bindlex_ng NYI"); |
386 | 490k | OP(getdynlex): { |
387 | 490k | GET_REG(cur_op, 0).o = MVM_frame_getdynlex(tc, GET_REG(cur_op, 2).s, |
388 | 490k | tc->cur_frame->caller); |
389 | 490k | cur_op += 4; |
390 | 490k | goto NEXT; |
391 | 490k | } |
392 | 7.71k | OP(binddynlex): { |
393 | 7.71k | MVM_frame_binddynlex(tc, GET_REG(cur_op, 0).s, GET_REG(cur_op, 2).o, |
394 | 7.71k | tc->cur_frame->caller); |
395 | 7.71k | cur_op += 4; |
396 | 7.71k | goto NEXT; |
397 | 7.71k | } |
398 | 0 | OP(setlexvalue): { |
399 | 0 | MVMObject *code = GET_REG(cur_op, 0).o; |
400 | 0 | MVMString *name = MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)); |
401 | 0 | MVMObject *val = GET_REG(cur_op, 6).o; |
402 | 0 | MVMint16 flag = GET_I16(cur_op, 8); |
403 | 0 | if (flag < 0 || flag > 2) |
404 | 0 | MVM_exception_throw_adhoc(tc, "setlexvalue provided with invalid flag"); |
405 | 0 | if (IS_CONCRETE(code) && REPR(code)->ID == MVM_REPR_ID_MVMCode) { |
406 | 0 | MVMStaticFrame *sf = ((MVMCode *)code)->body.sf; |
407 | 0 | MVMuint8 found = 0; |
408 | 0 | if (!sf->body.fully_deserialized) |
409 | 0 | MVM_bytecode_finish_frame(tc, sf->body.cu, sf, 0); |
410 | 0 | if (sf->body.lexical_names) { |
411 | 0 | MVMLexicalRegistry *entry; |
412 | 0 | MVM_HASH_GET(tc, sf->body.lexical_names, name, entry); |
413 | 0 | if (entry && sf->body.lexical_types[entry->value] == MVM_reg_obj) { |
414 | 0 | MVM_ASSIGN_REF(tc, &(sf->common.header), sf->body.static_env[entry->value].o, val); |
415 | 0 | sf->body.static_env_flags[entry->value] = (MVMuint8)flag; |
416 | 0 | found = 1; |
417 | 0 | } |
418 | 0 | } |
419 | 0 | if (!found) |
420 | 0 | MVM_exception_throw_adhoc(tc, "setstaticlex given invalid lexical name"); |
421 | 0 | } |
422 | 0 | else { |
423 | 0 | MVM_exception_throw_adhoc(tc, "setstaticlex needs a code ref"); |
424 | 0 | } |
425 | 0 | cur_op += 10; |
426 | 0 | goto NEXT; |
427 | 0 | } |
428 | 5.72k | OP(lexprimspec): { |
429 | 5.72k | MVMObject *ctx = GET_REG(cur_op, 2).o; |
430 | 5.72k | MVMString *name = GET_REG(cur_op, 4).s; |
431 | 5.72k | if (REPR(ctx)->ID != MVM_REPR_ID_MVMContext || !IS_CONCRETE(ctx)) |
432 | 0 | MVM_exception_throw_adhoc(tc, "lexprimspec needs a context"); |
433 | 5.72k | GET_REG(cur_op, 0).i64 = MVM_frame_lexical_primspec(tc, |
434 | 5.72k | ((MVMContext *)ctx)->body.context, name); |
435 | 5.72k | cur_op += 6; |
436 | 5.72k | goto NEXT; |
437 | 5.72k | } |
438 | 376k | OP(return_i): |
439 | 376k | MVM_args_set_result_int(tc, GET_REG(cur_op, 0).i64, |
440 | 376k | MVM_RETURN_CALLER_FRAME); |
441 | 376k | if (MVM_frame_try_return(tc) == 0) |
442 | 0 | goto return_label; |
443 | 376k | goto NEXT; |
444 | 880 | OP(return_n): |
445 | 880 | MVM_args_set_result_num(tc, GET_REG(cur_op, 0).n64, |
446 | 880 | MVM_RETURN_CALLER_FRAME); |
447 | 880 | if (MVM_frame_try_return(tc) == 0) |
448 | 0 | goto return_label; |
449 | 880 | goto NEXT; |
450 | 176k | OP(return_s): |
451 | 176k | MVM_args_set_result_str(tc, GET_REG(cur_op, 0).s, |
452 | 176k | MVM_RETURN_CALLER_FRAME); |
453 | 176k | if (MVM_frame_try_return(tc) == 0) |
454 | 0 | goto return_label; |
455 | 176k | goto NEXT; |
456 | 5.30M | OP(return_o): |
457 | 5.30M | MVM_args_set_result_obj(tc, GET_REG(cur_op, 0).o, |
458 | 5.30M | MVM_RETURN_CALLER_FRAME); |
459 | 5.30M | if (MVM_frame_try_return(tc) == 0) |
460 | 260 | goto return_label; |
461 | 5.30M | goto NEXT; |
462 | 25.0k | OP(return): |
463 | 25.0k | MVM_args_assert_void_return_ok(tc, MVM_RETURN_CALLER_FRAME); |
464 | 25.0k | if (MVM_frame_try_return(tc) == 0) |
465 | 0 | goto return_label; |
466 | 25.0k | goto NEXT; |
467 | 4.29M | OP(eq_i): |
468 | 4.29M | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 == GET_REG(cur_op, 4).i64; |
469 | 4.29M | cur_op += 6; |
470 | 4.29M | goto NEXT; |
471 | 608k | OP(ne_i): |
472 | 608k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 != GET_REG(cur_op, 4).i64; |
473 | 608k | cur_op += 6; |
474 | 608k | goto NEXT; |
475 | 5.07M | OP(lt_i): |
476 | 5.07M | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 < GET_REG(cur_op, 4).i64; |
477 | 5.07M | cur_op += 6; |
478 | 5.07M | goto NEXT; |
479 | 102k | OP(le_i): |
480 | 102k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 <= GET_REG(cur_op, 4).i64; |
481 | 102k | cur_op += 6; |
482 | 102k | goto NEXT; |
483 | 3.40M | OP(gt_i): |
484 | 3.40M | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 > GET_REG(cur_op, 4).i64; |
485 | 3.40M | cur_op += 6; |
486 | 3.40M | goto NEXT; |
487 | 720k | OP(ge_i): |
488 | 720k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 >= GET_REG(cur_op, 4).i64; |
489 | 720k | cur_op += 6; |
490 | 720k | goto NEXT; |
491 | 3 | OP(cmp_i): { |
492 | 3 | MVMint64 a = GET_REG(cur_op, 2).i64, b = GET_REG(cur_op, 4).i64; |
493 | 3 | GET_REG(cur_op, 0).i64 = (a > b) - (a < b); |
494 | 3 | cur_op += 6; |
495 | 3 | goto NEXT; |
496 | 3 | } |
497 | 930k | OP(add_i): |
498 | 930k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 + GET_REG(cur_op, 4).i64; |
499 | 930k | cur_op += 6; |
500 | 930k | goto NEXT; |
501 | 1.89M | OP(sub_i): |
502 | 1.89M | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 - GET_REG(cur_op, 4).i64; |
503 | 1.89M | cur_op += 6; |
504 | 1.89M | goto NEXT; |
505 | 2.35k | OP(mul_i): |
506 | 2.35k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 * GET_REG(cur_op, 4).i64; |
507 | 2.35k | cur_op += 6; |
508 | 2.35k | goto NEXT; |
509 | 43.3k | OP(div_i): { |
510 | 43.3k | MVMint64 num = GET_REG(cur_op, 2).i64; |
511 | 43.3k | MVMint64 denom = GET_REG(cur_op, 4).i64; |
512 | 43.3k | /* if we have a negative result, make sure we floor rather |
513 | 43.3k | * than rounding towards zero. */ |
514 | 43.3k | if (denom == 0) |
515 | 0 | MVM_exception_throw_adhoc(tc, "Division by zero"); |
516 | 43.3k | if ((num < 0) ^ (denom < 0)) { |
517 | 164 | if ((num % denom) != 0) { |
518 | 162 | GET_REG(cur_op, 0).i64 = num / denom - 1; |
519 | 2 | } else { |
520 | 2 | GET_REG(cur_op, 0).i64 = num / denom; |
521 | 2 | } |
522 | 43.1k | } else { |
523 | 43.1k | GET_REG(cur_op, 0).i64 = num / denom; |
524 | 43.1k | } |
525 | 43.3k | cur_op += 6; |
526 | 43.3k | goto NEXT; |
527 | 43.3k | } |
528 | 0 | OP(div_u): |
529 | 0 | GET_REG(cur_op, 0).u64 = GET_REG(cur_op, 2).u64 / GET_REG(cur_op, 4).u64; |
530 | 0 | cur_op += 6; |
531 | 0 | goto NEXT; |
532 | 807 | OP(mod_i): { |
533 | 807 | MVMint64 numer = GET_REG(cur_op, 2).i64; |
534 | 807 | MVMint64 denom = GET_REG(cur_op, 4).i64; |
535 | 807 | if (denom == 0) |
536 | 0 | MVM_exception_throw_adhoc(tc, "Modulation by zero"); |
537 | 807 | GET_REG(cur_op, 0).i64 = numer % denom; |
538 | 807 | cur_op += 6; |
539 | 807 | goto NEXT; |
540 | 807 | } |
541 | 0 | OP(mod_u): |
542 | 0 | GET_REG(cur_op, 0).u64 = GET_REG(cur_op, 2).u64 % GET_REG(cur_op, 4).u64; |
543 | 0 | cur_op += 6; |
544 | 0 | goto NEXT; |
545 | 327 | OP(neg_i): |
546 | 327 | GET_REG(cur_op, 0).i64 = -GET_REG(cur_op, 2).i64; |
547 | 327 | cur_op += 4; |
548 | 327 | goto NEXT; |
549 | 2 | OP(abs_i): { |
550 | 2 | MVMint64 v = GET_REG(cur_op, 2).i64, mask = v >> 63; |
551 | 2 | GET_REG(cur_op, 0).i64 = (v + mask) ^ mask; |
552 | 2 | cur_op += 4; |
553 | 2 | goto NEXT; |
554 | 2 | } |
555 | 1.36M | OP(inc_i): |
556 | 1.36M | GET_REG(cur_op, 0).i64++; |
557 | 1.36M | cur_op += 2; |
558 | 1.36M | goto NEXT; |
559 | 0 | OP(inc_u): |
560 | 0 | GET_REG(cur_op, 0).u64++; |
561 | 0 | cur_op += 2; |
562 | 0 | goto NEXT; |
563 | 1.40M | OP(dec_i): |
564 | 1.40M | GET_REG(cur_op, 0).i64--; |
565 | 1.40M | cur_op += 2; |
566 | 1.40M | goto NEXT; |
567 | 0 | OP(dec_u): |
568 | 0 | GET_REG(cur_op, 0).u64--; |
569 | 0 | cur_op += 2; |
570 | 0 | goto NEXT; |
571 | 160k | OP(band_i): |
572 | 160k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 & GET_REG(cur_op, 4).i64; |
573 | 160k | cur_op += 6; |
574 | 160k | goto NEXT; |
575 | 6.84k | OP(bor_i): |
576 | 6.84k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 | GET_REG(cur_op, 4).i64; |
577 | 6.84k | cur_op += 6; |
578 | 6.84k | goto NEXT; |
579 | 66 | OP(bxor_i): |
580 | 66 | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 ^ GET_REG(cur_op, 4).i64; |
581 | 66 | cur_op += 6; |
582 | 66 | goto NEXT; |
583 | 1 | OP(bnot_i): |
584 | 1 | GET_REG(cur_op, 0).i64 = ~GET_REG(cur_op, 2).i64; |
585 | 1 | cur_op += 4; |
586 | 1 | goto NEXT; |
587 | 196 | OP(blshift_i): |
588 | 196 | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 << GET_REG(cur_op, 4).i64; |
589 | 196 | cur_op += 6; |
590 | 196 | goto NEXT; |
591 | 54.6k | OP(brshift_i): |
592 | 54.6k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 >> GET_REG(cur_op, 4).i64; |
593 | 54.6k | cur_op += 6; |
594 | 54.6k | goto NEXT; |
595 | 1 | OP(pow_i): { |
596 | 1 | MVMint64 base = GET_REG(cur_op, 2).i64; |
597 | 1 | MVMint64 exp = GET_REG(cur_op, 4).i64; |
598 | 1 | MVMint64 result = 1; |
599 | 1 | /* "Exponentiation by squaring" */ |
600 | 1 | if (exp < 0) { |
601 | 0 | result = 0; /* because 1/base**-exp is between 0 and 1 */ |
602 | 0 | } |
603 | 1 | else { |
604 | 4 | while (exp) { |
605 | 3 | if (exp & 1) |
606 | 1 | result *= base; |
607 | 3 | exp >>= 1; |
608 | 3 | base *= base; |
609 | 3 | } |
610 | 1 | } |
611 | 1 | GET_REG(cur_op, 0).i64 = result; |
612 | 1 | } |
613 | 1 | cur_op += 6; |
614 | 1 | goto NEXT; |
615 | 1.02M | OP(not_i): { |
616 | 1.02M | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).i64 ? 0 : 1; |
617 | 1.02M | cur_op += 4; |
618 | 1.02M | goto NEXT; |
619 | 1.02M | } |
620 | 1 | OP(gcd_i): { |
621 | 1 | MVMint64 a = labs(GET_REG(cur_op, 2).i64), b = labs(GET_REG(cur_op, 4).i64), c; |
622 | 4 | while ( b != 0 ) { |
623 | 3 | c = a % b; a = b; b = c; |
624 | 3 | } |
625 | 1 | GET_REG(cur_op, 0).i64 = a; |
626 | 1 | cur_op += 6; |
627 | 1 | goto NEXT; |
628 | 1 | } |
629 | 1 | OP(lcm_i): { |
630 | 1 | MVMint64 a = GET_REG(cur_op, 2).i64, b = GET_REG(cur_op, 4).i64, c, a_ = a, b_ = b; |
631 | 4 | while ( b != 0 ) { |
632 | 3 | c = a % b; a = b; b = c; |
633 | 3 | } |
634 | 1 | c = a; |
635 | 1 | GET_REG(cur_op, 0).i64 = a_ / c * b_; |
636 | 1 | cur_op += 6; |
637 | 1 | goto NEXT; |
638 | 1 | } |
639 | 605k | OP(eq_n): |
640 | 605k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).n64 == GET_REG(cur_op, 4).n64; |
641 | 605k | cur_op += 6; |
642 | 605k | goto NEXT; |
643 | 96.1k | OP(ne_n): |
644 | 96.1k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).n64 != GET_REG(cur_op, 4).n64; |
645 | 96.1k | cur_op += 6; |
646 | 96.1k | goto NEXT; |
647 | 227k | OP(lt_n): |
648 | 227k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).n64 < GET_REG(cur_op, 4).n64; |
649 | 227k | cur_op += 6; |
650 | 227k | goto NEXT; |
651 | 5.33k | OP(le_n): |
652 | 5.33k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).n64 <= GET_REG(cur_op, 4).n64; |
653 | 5.33k | cur_op += 6; |
654 | 5.33k | goto NEXT; |
655 | 150k | OP(gt_n): |
656 | 150k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).n64 > GET_REG(cur_op, 4).n64; |
657 | 150k | cur_op += 6; |
658 | 150k | goto NEXT; |
659 | 188k | OP(ge_n): |
660 | 188k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).n64 >= GET_REG(cur_op, 4).n64; |
661 | 188k | cur_op += 6; |
662 | 188k | goto NEXT; |
663 | 3 | OP(cmp_n): { |
664 | 3 | MVMnum64 a = GET_REG(cur_op, 2).n64, b = GET_REG(cur_op, 4).n64; |
665 | 3 | GET_REG(cur_op, 0).i64 = (a > b) - (a < b); |
666 | 3 | cur_op += 6; |
667 | 3 | goto NEXT; |
668 | 3 | } |
669 | 48.4k | OP(add_n): |
670 | 48.4k | GET_REG(cur_op, 0).n64 = GET_REG(cur_op, 2).n64 + GET_REG(cur_op, 4).n64; |
671 | 48.4k | cur_op += 6; |
672 | 48.4k | goto NEXT; |
673 | 44.1k | OP(sub_n): |
674 | 44.1k | GET_REG(cur_op, 0).n64 = GET_REG(cur_op, 2).n64 - GET_REG(cur_op, 4).n64; |
675 | 44.1k | cur_op += 6; |
676 | 44.1k | goto NEXT; |
677 | 334 | OP(mul_n): |
678 | 334 | GET_REG(cur_op, 0).n64 = GET_REG(cur_op, 2).n64 * GET_REG(cur_op, 4).n64; |
679 | 334 | cur_op += 6; |
680 | 334 | goto NEXT; |
681 | 31.2k | OP(div_n): |
682 | 31.2k | GET_REG(cur_op, 0).n64 = GET_REG(cur_op, 2).n64 / GET_REG(cur_op, 4).n64; |
683 | 31.2k | cur_op += 6; |
684 | 31.2k | goto NEXT; |
685 | 5.40k | OP(mod_n): { |
686 | 5.40k | MVMnum64 a = GET_REG(cur_op, 2).n64; |
687 | 5.40k | MVMnum64 b = GET_REG(cur_op, 4).n64; |
688 | 5.40k | GET_REG(cur_op, 0).n64 = b == 0 ? a : a - b * floor(a / b); |
689 | 5.40k | cur_op += 6; |
690 | 5.40k | goto NEXT; |
691 | 5.40k | } |
692 | 222 | OP(neg_n): |
693 | 222 | GET_REG(cur_op, 0).n64 = -GET_REG(cur_op, 2).n64; |
694 | 222 | cur_op += 4; |
695 | 222 | goto NEXT; |
696 | 452 | OP(abs_n): |
697 | 452 | { |
698 | 452 | MVMnum64 num = GET_REG(cur_op, 2).n64; |
699 | 452 | /* The 1.0/num logic checks for a negative zero */ |
700 | 452 | if (num < 0 || (num == 0 && 1.0/num < 0) ) num = num * -1; |
701 | 452 | GET_REG(cur_op, 0).n64 = num; |
702 | 452 | cur_op += 4; |
703 | 452 | } |
704 | 452 | goto NEXT; |
705 | 276 | OP(pow_n): |
706 | 276 | GET_REG(cur_op, 0).n64 = pow(GET_REG(cur_op, 2).n64, GET_REG(cur_op, 4).n64); |
707 | 276 | cur_op += 6; |
708 | 276 | goto NEXT; |
709 | 6 | OP(ceil_n):{ |
710 | 6 | GET_REG(cur_op, 0).n64 = ceil(GET_REG(cur_op, 2).n64); |
711 | 6 | cur_op += 4; |
712 | 6 | goto NEXT; |
713 | 6 | } |
714 | 301 | OP(floor_n): { |
715 | 301 | GET_REG(cur_op, 0).n64 = floor(GET_REG(cur_op, 2).n64); |
716 | 301 | cur_op += 4; |
717 | 301 | goto NEXT; |
718 | 301 | } |
719 | 4 | OP(sin_n): |
720 | 4 | GET_REG(cur_op, 0).n64 = sin(GET_REG(cur_op, 2).n64); |
721 | 4 | cur_op += 4; |
722 | 4 | goto NEXT; |
723 | 5 | OP(asin_n): |
724 | 5 | GET_REG(cur_op, 0).n64 = asin(GET_REG(cur_op, 2).n64); |
725 | 5 | cur_op += 4; |
726 | 5 | goto NEXT; |
727 | 4 | OP(cos_n): |
728 | 4 | GET_REG(cur_op, 0).n64 = cos(GET_REG(cur_op, 2).n64); |
729 | 4 | cur_op += 4; |
730 | 4 | goto NEXT; |
731 | 5 | OP(acos_n): |
732 | 5 | GET_REG(cur_op, 0).n64 = acos(GET_REG(cur_op, 2).n64); |
733 | 5 | cur_op += 4; |
734 | 5 | goto NEXT; |
735 | 4 | OP(tan_n): |
736 | 4 | GET_REG(cur_op, 0).n64 = tan(GET_REG(cur_op, 2).n64); |
737 | 4 | cur_op += 4; |
738 | 4 | goto NEXT; |
739 | 5 | OP(atan_n): |
740 | 5 | GET_REG(cur_op, 0).n64 = atan(GET_REG(cur_op, 2).n64); |
741 | 5 | cur_op += 4; |
742 | 5 | goto NEXT; |
743 | 2 | OP(atan2_n): |
744 | 2 | GET_REG(cur_op, 0).n64 = atan2(GET_REG(cur_op, 2).n64, |
745 | 2 | GET_REG(cur_op, 4).n64); |
746 | 2 | cur_op += 6; |
747 | 2 | goto NEXT; |
748 | 4 | OP(sec_n): /* XXX TODO) handle edge cases */ |
749 | 4 | GET_REG(cur_op, 0).n64 = 1.0 / cos(GET_REG(cur_op, 2).n64); |
750 | 4 | cur_op += 4; |
751 | 4 | goto NEXT; |
752 | 4 | OP(asec_n): /* XXX TODO) handle edge cases */ |
753 | 4 | GET_REG(cur_op, 0).n64 = acos(1.0 / GET_REG(cur_op, 2).n64); |
754 | 4 | cur_op += 4; |
755 | 4 | goto NEXT; |
756 | 5 | OP(sinh_n): |
757 | 5 | GET_REG(cur_op, 0).n64 = sinh(GET_REG(cur_op, 2).n64); |
758 | 5 | cur_op += 4; |
759 | 5 | goto NEXT; |
760 | 5 | OP(cosh_n): |
761 | 5 | GET_REG(cur_op, 0).n64 = cosh(GET_REG(cur_op, 2).n64); |
762 | 5 | cur_op += 4; |
763 | 5 | goto NEXT; |
764 | 5 | OP(tanh_n): |
765 | 5 | GET_REG(cur_op, 0).n64 = tanh(GET_REG(cur_op, 2).n64); |
766 | 5 | cur_op += 4; |
767 | 5 | goto NEXT; |
768 | 5 | OP(sech_n): /* XXX TODO) handle edge cases */ |
769 | 5 | GET_REG(cur_op, 0).n64 = 1.0 / cosh(GET_REG(cur_op, 2).n64); |
770 | 5 | cur_op += 4; |
771 | 5 | goto NEXT; |
772 | 1 | OP(sqrt_n): |
773 | 1 | GET_REG(cur_op, 0).n64 = sqrt(GET_REG(cur_op, 2).n64); |
774 | 1 | cur_op += 4; |
775 | 1 | goto NEXT; |
776 | 402 | OP(log_n): |
777 | 402 | GET_REG(cur_op, 0).n64 = log(GET_REG(cur_op, 2).n64); |
778 | 402 | cur_op += 4; |
779 | 402 | goto NEXT; |
780 | 2 | OP(exp_n): |
781 | 2 | GET_REG(cur_op, 0).n64 = exp(GET_REG(cur_op, 2).n64); |
782 | 2 | cur_op += 4; |
783 | 2 | goto NEXT; |
784 | 1.09M | OP(coerce_in): |
785 | 1.09M | GET_REG(cur_op, 0).n64 = (MVMnum64)GET_REG(cur_op, 2).i64; |
786 | 1.09M | cur_op += 4; |
787 | 1.09M | goto NEXT; |
788 | 1.08M | OP(coerce_ni): |
789 | 1.08M | GET_REG(cur_op, 0).i64 = (MVMint64)GET_REG(cur_op, 2).n64; |
790 | 1.08M | cur_op += 4; |
791 | 1.08M | goto NEXT; |
792 | 13.9k | OP(coerce_is): { |
793 | 13.9k | GET_REG(cur_op, 0).s = MVM_coerce_i_s(tc, GET_REG(cur_op, 2).i64); |
794 | 13.9k | cur_op += 4; |
795 | 13.9k | goto NEXT; |
796 | 13.9k | } |
797 | 144 | OP(coerce_ns): { |
798 | 144 | GET_REG(cur_op, 0).s = MVM_coerce_n_s(tc, GET_REG(cur_op, 2).n64); |
799 | 144 | cur_op += 4; |
800 | 144 | goto NEXT; |
801 | 144 | } |
802 | 617 | OP(coerce_si): |
803 | 617 | GET_REG(cur_op, 0).i64 = MVM_coerce_s_i(tc, GET_REG(cur_op, 2).s); |
804 | 617 | cur_op += 4; |
805 | 617 | goto NEXT; |
806 | 12 | OP(coerce_sn): |
807 | 12 | GET_REG(cur_op, 0).n64 = MVM_coerce_s_n(tc, GET_REG(cur_op, 2).s); |
808 | 12 | cur_op += 4; |
809 | 12 | goto NEXT; |
810 | 2.62M | OP(smrt_numify): { |
811 | 2.62M | /* Increment PC before calling coercer, as it may make |
812 | 2.62M | * a method call to get the result. */ |
813 | 2.62M | MVMObject *obj = GET_REG(cur_op, 2).o; |
814 | 2.62M | MVMRegister *res = &GET_REG(cur_op, 0); |
815 | 2.62M | cur_op += 4; |
816 | 2.62M | MVM_coerce_smart_numify(tc, obj, res); |
817 | 2.62M | goto NEXT; |
818 | 2.62M | } |
819 | 1.55M | OP(smrt_strify): { |
820 | 1.55M | /* Increment PC before calling coercer, as it may make |
821 | 1.55M | * a method call to get the result. */ |
822 | 1.55M | MVMObject *obj = GET_REG(cur_op, 2).o; |
823 | 1.55M | MVMRegister *res = &GET_REG(cur_op, 0); |
824 | 1.55M | cur_op += 4; |
825 | 1.55M | MVM_coerce_smart_stringify(tc, obj, res); |
826 | 1.55M | goto NEXT; |
827 | 1.55M | } |
828 | 8.89M | OP(prepargs): |
829 | 8.89M | /* Store callsite in the frame so that the GC knows how to mark |
830 | 8.89M | * any arguments. Note that since none of the arg-setting ops can |
831 | 8.89M | * trigger GC, there's no way the setup can be interrupted, so we |
832 | 8.89M | * don't need to clear the args buffer before we start. */ |
833 | 8.89M | cur_callsite = cu->body.callsites[GET_UI16(cur_op, 0)]; |
834 | 8.89M | tc->cur_frame->cur_args_callsite = cur_callsite; |
835 | 8.89M | cur_op += 2; |
836 | 8.89M | goto NEXT; |
837 | 1.37M | OP(arg_i): |
838 | 1.37M | tc->cur_frame->args[GET_UI16(cur_op, 0)].i64 = GET_REG(cur_op, 2).i64; |
839 | 1.37M | cur_op += 4; |
840 | 1.37M | goto NEXT; |
841 | 15.1k | OP(arg_n): |
842 | 15.1k | tc->cur_frame->args[GET_UI16(cur_op, 0)].n64 = GET_REG(cur_op, 2).n64; |
843 | 15.1k | cur_op += 4; |
844 | 15.1k | goto NEXT; |
845 | 2.64M | OP(arg_s): |
846 | 2.64M | tc->cur_frame->args[GET_UI16(cur_op, 0)].s = GET_REG(cur_op, 2).s; |
847 | 2.64M | cur_op += 4; |
848 | 2.64M | goto NEXT; |
849 | 13.8M | OP(arg_o): |
850 | 13.8M | tc->cur_frame->args[GET_UI16(cur_op, 0)].o = GET_REG(cur_op, 2).o; |
851 | 13.8M | cur_op += 4; |
852 | 13.8M | goto NEXT; |
853 | 0 | OP(argconst_i): |
854 | 0 | tc->cur_frame->args[GET_UI16(cur_op, 0)].i64 = MVM_BC_get_I64(cur_op, 2); |
855 | 0 | cur_op += 10; |
856 | 0 | goto NEXT; |
857 | 0 | OP(argconst_n): |
858 | 0 | tc->cur_frame->args[GET_UI16(cur_op, 0)].n64 = MVM_BC_get_N64(cur_op, 2); |
859 | 0 | cur_op += 10; |
860 | 0 | goto NEXT; |
861 | 801k | OP(argconst_s): |
862 | 801k | tc->cur_frame->args[GET_UI16(cur_op, 0)].s = |
863 | 801k | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)); |
864 | 801k | cur_op += 6; |
865 | 801k | goto NEXT; |
866 | 338k | OP(invoke_v): |
867 | 338k | { |
868 | 338k | MVMObject *code = GET_REG(cur_op, 0).o; |
869 | 338k | MVMRegister *args = tc->cur_frame->args; |
870 | 338k | code = MVM_frame_find_invokee_multi_ok(tc, code, &cur_callsite, args); |
871 | 338k | tc->cur_frame->return_value = NULL; |
872 | 338k | tc->cur_frame->return_type = MVM_RETURN_VOID; |
873 | 338k | cur_op += 2; |
874 | 338k | tc->cur_frame->return_address = cur_op; |
875 | 338k | STABLE(code)->invoke(tc, code, cur_callsite, args); |
876 | 338k | } |
877 | 338k | goto NEXT; |
878 | 1 | OP(invoke_i): |
879 | 1 | { |
880 | 1 | MVMObject *code = GET_REG(cur_op, 2).o; |
881 | 1 | MVMRegister *args = tc->cur_frame->args; |
882 | 1 | code = MVM_frame_find_invokee_multi_ok(tc, code, &cur_callsite, args); |
883 | 1 | tc->cur_frame->return_value = &GET_REG(cur_op, 0); |
884 | 1 | tc->cur_frame->return_type = MVM_RETURN_INT; |
885 | 1 | cur_op += 4; |
886 | 1 | tc->cur_frame->return_address = cur_op; |
887 | 1 | STABLE(code)->invoke(tc, code, cur_callsite, args); |
888 | 1 | } |
889 | 1 | goto NEXT; |
890 | 0 | OP(invoke_n): |
891 | 0 | { |
892 | 0 | MVMObject *code = GET_REG(cur_op, 2).o; |
893 | 0 | MVMRegister *args = tc->cur_frame->args; |
894 | 0 | code = MVM_frame_find_invokee_multi_ok(tc, code, &cur_callsite, args); |
895 | 0 | tc->cur_frame->return_value = &GET_REG(cur_op, 0); |
896 | 0 | tc->cur_frame->return_type = MVM_RETURN_NUM; |
897 | 0 | cur_op += 4; |
898 | 0 | tc->cur_frame->return_address = cur_op; |
899 | 0 | STABLE(code)->invoke(tc, code, cur_callsite, args); |
900 | 0 | } |
901 | 0 | goto NEXT; |
902 | 283 | OP(invoke_s): |
903 | 283 | { |
904 | 283 | MVMObject *code = GET_REG(cur_op, 2).o; |
905 | 283 | MVMRegister *args = tc->cur_frame->args; |
906 | 283 | code = MVM_frame_find_invokee_multi_ok(tc, code, &cur_callsite, args); |
907 | 283 | tc->cur_frame->return_value = &GET_REG(cur_op, 0); |
908 | 283 | tc->cur_frame->return_type = MVM_RETURN_STR; |
909 | 283 | cur_op += 4; |
910 | 283 | tc->cur_frame->return_address = cur_op; |
911 | 283 | STABLE(code)->invoke(tc, code, cur_callsite, args); |
912 | 283 | } |
913 | 283 | goto NEXT; |
914 | 8.08M | OP(invoke_o): |
915 | 8.08M | { |
916 | 8.08M | MVMObject *code = GET_REG(cur_op, 2).o; |
917 | 8.08M | MVMRegister *args = tc->cur_frame->args; |
918 | 8.08M | code = MVM_frame_find_invokee_multi_ok(tc, code, &cur_callsite, args); |
919 | 8.08M | tc->cur_frame->return_value = &GET_REG(cur_op, 0); |
920 | 8.08M | tc->cur_frame->return_type = MVM_RETURN_OBJ; |
921 | 8.08M | cur_op += 4; |
922 | 8.08M | tc->cur_frame->return_address = cur_op; |
923 | 8.08M | STABLE(code)->invoke(tc, code, cur_callsite, args); |
924 | 8.08M | } |
925 | 8.08M | goto NEXT; |
926 | 4.03M | OP(checkarity): |
927 | 4.03M | MVM_args_checkarity(tc, &tc->cur_frame->params, GET_UI16(cur_op, 0), GET_UI16(cur_op, 2)); |
928 | 4.03M | cur_op += 4; |
929 | 4.03M | goto NEXT; |
930 | 406k | OP(param_rp_i): |
931 | 406k | GET_REG(cur_op, 0).i64 = MVM_args_get_pos_int(tc, &tc->cur_frame->params, |
932 | 406k | GET_UI16(cur_op, 2), MVM_ARG_REQUIRED).arg.i64; |
933 | 406k | cur_op += 4; |
934 | 406k | goto NEXT; |
935 | 0 | OP(param_rp_n): |
936 | 0 | GET_REG(cur_op, 0).n64 = MVM_args_get_pos_num(tc, &tc->cur_frame->params, |
937 | 0 | GET_UI16(cur_op, 2), MVM_ARG_REQUIRED).arg.n64; |
938 | 0 | cur_op += 4; |
939 | 0 | goto NEXT; |
940 | 721k | OP(param_rp_s): |
941 | 721k | GET_REG(cur_op, 0).s = MVM_args_get_pos_str(tc, &tc->cur_frame->params, |
942 | 721k | GET_UI16(cur_op, 2), MVM_ARG_REQUIRED).arg.s; |
943 | 721k | cur_op += 4; |
944 | 721k | goto NEXT; |
945 | 5.98M | OP(param_rp_o): |
946 | 5.98M | GET_REG(cur_op, 0).o = MVM_args_get_pos_obj(tc, &tc->cur_frame->params, |
947 | 5.98M | GET_UI16(cur_op, 2), MVM_ARG_REQUIRED).arg.o; |
948 | 5.98M | cur_op += 4; |
949 | 5.98M | goto NEXT; |
950 | 55.8k | OP(param_op_i): |
951 | 55.8k | { |
952 | 55.8k | MVMArgInfo param = MVM_args_get_pos_int(tc, &tc->cur_frame->params, |
953 | 55.8k | GET_UI16(cur_op, 2), MVM_ARG_OPTIONAL); |
954 | 55.8k | if (param.exists) { |
955 | 0 | GET_REG(cur_op, 0).i64 = param.arg.i64; |
956 | 0 | cur_op = bytecode_start + GET_UI32(cur_op, 4); |
957 | 0 | } |
958 | 55.8k | else { |
959 | 55.8k | cur_op += 8; |
960 | 55.8k | } |
961 | 55.8k | goto NEXT; |
962 | 55.8k | } |
963 | 0 | OP(param_op_n): |
964 | 0 | { |
965 | 0 | MVMArgInfo param = MVM_args_get_pos_num(tc, &tc->cur_frame->params, |
966 | 0 | GET_UI16(cur_op, 2), MVM_ARG_OPTIONAL); |
967 | 0 | if (param.exists) { |
968 | 0 | GET_REG(cur_op, 0).n64 = param.arg.n64; |
969 | 0 | cur_op = bytecode_start + GET_UI32(cur_op, 4); |
970 | 0 | } |
971 | 0 | else { |
972 | 0 | cur_op += 8; |
973 | 0 | } |
974 | 0 | goto NEXT; |
975 | 0 | } |
976 | 87.2k | OP(param_op_s): |
977 | 87.2k | { |
978 | 87.2k | MVMArgInfo param = MVM_args_get_pos_str(tc, &tc->cur_frame->params, |
979 | 87.2k | GET_UI16(cur_op, 2), MVM_ARG_OPTIONAL); |
980 | 87.2k | if (param.exists) { |
981 | 65.7k | GET_REG(cur_op, 0).s = param.arg.s; |
982 | 65.7k | cur_op = bytecode_start + GET_UI32(cur_op, 4); |
983 | 65.7k | } |
984 | 21.4k | else { |
985 | 21.4k | cur_op += 8; |
986 | 21.4k | } |
987 | 87.2k | goto NEXT; |
988 | 87.2k | } |
989 | 471k | OP(param_op_o): |
990 | 471k | { |
991 | 471k | MVMArgInfo param = MVM_args_get_pos_obj(tc, &tc->cur_frame->params, |
992 | 471k | GET_UI16(cur_op, 2), MVM_ARG_OPTIONAL); |
993 | 471k | if (param.exists) { |
994 | 186k | GET_REG(cur_op, 0).o = param.arg.o; |
995 | 186k | cur_op = bytecode_start + GET_UI32(cur_op, 4); |
996 | 186k | } |
997 | 285k | else { |
998 | 285k | cur_op += 8; |
999 | 285k | } |
1000 | 471k | goto NEXT; |
1001 | 471k | } |
1002 | 0 | OP(param_rn_i): |
1003 | 0 | GET_REG(cur_op, 0).i64 = MVM_args_get_named_int(tc, &tc->cur_frame->params, |
1004 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_REQUIRED).arg.i64; |
1005 | 0 | cur_op += 6; |
1006 | 0 | goto NEXT; |
1007 | 0 | OP(param_rn_n): |
1008 | 0 | GET_REG(cur_op, 0).n64 = MVM_args_get_named_num(tc, &tc->cur_frame->params, |
1009 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_REQUIRED).arg.n64; |
1010 | 0 | cur_op += 6; |
1011 | 0 | goto NEXT; |
1012 | 50.7k | OP(param_rn_s): |
1013 | 50.7k | GET_REG(cur_op, 0).s = MVM_args_get_named_str(tc, &tc->cur_frame->params, |
1014 | 50.7k | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_REQUIRED).arg.s; |
1015 | 50.7k | cur_op += 6; |
1016 | 50.7k | goto NEXT; |
1017 | 78.5k | OP(param_rn_o): |
1018 | 78.5k | GET_REG(cur_op, 0).o = MVM_args_get_named_obj(tc, &tc->cur_frame->params, |
1019 | 78.5k | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_REQUIRED).arg.o; |
1020 | 78.5k | cur_op += 6; |
1021 | 78.5k | goto NEXT; |
1022 | 32.5k | OP(param_on_i): |
1023 | 32.5k | { |
1024 | 32.5k | MVMArgInfo param = MVM_args_get_named_int(tc, &tc->cur_frame->params, |
1025 | 32.5k | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
1026 | 32.5k | if (param.exists) { |
1027 | 20.2k | GET_REG(cur_op, 0).i64 = param.arg.i64; |
1028 | 20.2k | cur_op = bytecode_start + GET_UI32(cur_op, 6); |
1029 | 20.2k | } |
1030 | 12.2k | else { |
1031 | 12.2k | cur_op += 10; |
1032 | 12.2k | } |
1033 | 32.5k | goto NEXT; |
1034 | 32.5k | } |
1035 | 0 | OP(param_on_n): |
1036 | 0 | { |
1037 | 0 | MVMArgInfo param = MVM_args_get_named_num(tc, &tc->cur_frame->params, |
1038 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
1039 | 0 | if (param.exists) { |
1040 | 0 | GET_REG(cur_op, 0).n64 = param.arg.n64; |
1041 | 0 | cur_op = bytecode_start + GET_UI32(cur_op, 6); |
1042 | 0 | } |
1043 | 0 | else { |
1044 | 0 | cur_op += 10; |
1045 | 0 | } |
1046 | 0 | goto NEXT; |
1047 | 0 | } |
1048 | 96.9k | OP(param_on_s): |
1049 | 96.9k | { |
1050 | 96.9k | MVMArgInfo param = MVM_args_get_named_str(tc, &tc->cur_frame->params, |
1051 | 96.9k | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
1052 | 96.9k | if (param.exists) { |
1053 | 47.8k | GET_REG(cur_op, 0).s = param.arg.s; |
1054 | 47.8k | cur_op = bytecode_start + GET_UI32(cur_op, 6); |
1055 | 47.8k | } |
1056 | 49.0k | else { |
1057 | 49.0k | cur_op += 10; |
1058 | 49.0k | } |
1059 | 96.9k | goto NEXT; |
1060 | 96.9k | } |
1061 | 564k | OP(param_on_o): |
1062 | 564k | { |
1063 | 564k | MVMArgInfo param = MVM_args_get_named_obj(tc, &tc->cur_frame->params, |
1064 | 564k | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
1065 | 564k | if (param.exists) { |
1066 | 265k | GET_REG(cur_op, 0).o = param.arg.o; |
1067 | 265k | cur_op = bytecode_start + GET_UI32(cur_op, 6); |
1068 | 265k | } |
1069 | 298k | else { |
1070 | 298k | cur_op += 10; |
1071 | 298k | } |
1072 | 564k | goto NEXT; |
1073 | 564k | } |
1074 | 351k | OP(param_sp): |
1075 | 351k | GET_REG(cur_op, 0).o = MVM_args_slurpy_positional(tc, &tc->cur_frame->params, GET_UI16(cur_op, 2)); |
1076 | 351k | cur_op += 4; |
1077 | 351k | goto NEXT; |
1078 | 275k | OP(param_sn): |
1079 | 275k | GET_REG(cur_op, 0).o = MVM_args_slurpy_named(tc, &tc->cur_frame->params); |
1080 | 275k | cur_op += 2; |
1081 | 275k | goto NEXT; |
1082 | 844k | OP(getcode): |
1083 | 844k | GET_REG(cur_op, 0).o = cu->body.coderefs[GET_UI16(cur_op, 2)]; |
1084 | 844k | cur_op += 4; |
1085 | 844k | goto NEXT; |
1086 | 0 | OP(caller): { |
1087 | 0 | MVMFrame *caller = tc->cur_frame; |
1088 | 0 | MVMint64 depth = GET_REG(cur_op, 2).i64; |
1089 | 0 |
|
1090 | 0 | while (caller && depth-- > 0) /* keep the > 0. */ |
1091 | 0 | caller = caller->caller; |
1092 | 0 |
|
1093 | 0 | GET_REG(cur_op, 0).o = caller ? caller->code_ref : tc->instance->VMNull; |
1094 | 0 |
|
1095 | 0 | cur_op += 4; |
1096 | 0 | goto NEXT; |
1097 | 0 | } |
1098 | 191k | OP(capturelex): |
1099 | 191k | MVM_frame_capturelex(tc, GET_REG(cur_op, 0).o); |
1100 | 191k | cur_op += 2; |
1101 | 191k | goto NEXT; |
1102 | 245k | OP(takeclosure): |
1103 | 245k | GET_REG(cur_op, 0).o = MVM_frame_takeclosure(tc, GET_REG(cur_op, 2).o); |
1104 | 245k | cur_op += 4; |
1105 | 245k | goto NEXT; |
1106 | 474 | OP(exception): |
1107 | 474 | GET_REG(cur_op, 0).o = tc->active_handlers |
1108 | 474 | ? tc->active_handlers->ex_obj |
1109 | 0 | : tc->instance->VMNull; |
1110 | 474 | cur_op += 2; |
1111 | 474 | goto NEXT; |
1112 | 8 | OP(bindexmessage): { |
1113 | 8 | MVMObject *ex = GET_REG(cur_op, 0).o; |
1114 | 8 | if (IS_CONCRETE(ex) && REPR(ex)->ID == MVM_REPR_ID_MVMException) { |
1115 | 8 | MVM_ASSIGN_REF(tc, &(ex->header), ((MVMException *)ex)->body.message, |
1116 | 8 | GET_REG(cur_op, 2).s); |
1117 | 8 | } |
1118 | 0 | else { |
1119 | 0 | MVM_exception_throw_adhoc(tc, "bindexmessage needs a VMException, got %s (%s)", REPR(ex)->name, STABLE(ex)->debug_name); |
1120 | 0 | } |
1121 | 8 | cur_op += 4; |
1122 | 8 | goto NEXT; |
1123 | 8 | } |
1124 | 35 | OP(bindexpayload): { |
1125 | 35 | MVMObject *ex = GET_REG(cur_op, 0).o; |
1126 | 35 | if (IS_CONCRETE(ex) && REPR(ex)->ID == MVM_REPR_ID_MVMException) { |
1127 | 35 | MVM_ASSIGN_REF(tc, &(ex->header), ((MVMException *)ex)->body.payload, |
1128 | 35 | GET_REG(cur_op, 2).o); |
1129 | 35 | } |
1130 | 0 | else { |
1131 | 0 | MVM_exception_throw_adhoc(tc, "bindexpayload needs a VMException, got %s (%s)", REPR(ex)->name, STABLE(ex)->debug_name); |
1132 | 0 | } |
1133 | 35 | cur_op += 4; |
1134 | 35 | goto NEXT; |
1135 | 35 | } |
1136 | 27 | OP(bindexcategory): { |
1137 | 27 | MVMObject *ex = GET_REG(cur_op, 0).o; |
1138 | 27 | if (IS_CONCRETE(ex) && REPR(ex)->ID == MVM_REPR_ID_MVMException) |
1139 | 27 | ((MVMException *)ex)->body.category = GET_REG(cur_op, 2).i64; |
1140 | 27 | else |
1141 | 0 | MVM_exception_throw_adhoc(tc, "bindexcategory needs a VMException, got %s (%s)", REPR(ex)->name, STABLE(ex)->debug_name); |
1142 | 27 | cur_op += 4; |
1143 | 27 | goto NEXT; |
1144 | 27 | } |
1145 | 89 | OP(getexmessage): { |
1146 | 89 | MVMObject *ex = GET_REG(cur_op, 2).o; |
1147 | 89 | if (IS_CONCRETE(ex) && REPR(ex)->ID == MVM_REPR_ID_MVMException) |
1148 | 89 | GET_REG(cur_op, 0).s = ((MVMException *)ex)->body.message; |
1149 | 89 | else |
1150 | 0 | MVM_exception_throw_adhoc(tc, "getexmessage needs a VMException, got %s (%s)", REPR(ex)->name, STABLE(ex)->debug_name); |
1151 | 89 | cur_op += 4; |
1152 | 89 | goto NEXT; |
1153 | 89 | } |
1154 | 17 | OP(getexpayload): { |
1155 | 17 | MVMObject *ex = GET_REG(cur_op, 2).o; |
1156 | 17 | if (IS_CONCRETE(ex) && REPR(ex)->ID == MVM_REPR_ID_MVMException) |
1157 | 17 | GET_REG(cur_op, 0).o = ((MVMException *)ex)->body.payload; |
1158 | 17 | else |
1159 | 0 | MVM_exception_throw_adhoc(tc, "getexpayload needs a VMException, got %s (%s)", REPR(ex)->name, STABLE(ex)->debug_name); |
1160 | 17 | if (!GET_REG(cur_op, 0).o) |
1161 | 1 | GET_REG(cur_op, 0).o = tc->instance->VMNull; |
1162 | 17 | cur_op += 4; |
1163 | 17 | goto NEXT; |
1164 | 17 | } |
1165 | 289 | OP(getexcategory): { |
1166 | 289 | MVMObject *ex = GET_REG(cur_op, 2).o; |
1167 | 289 | if (IS_CONCRETE(ex) && REPR(ex)->ID == MVM_REPR_ID_MVMException) |
1168 | 289 | GET_REG(cur_op, 0).i64 = ((MVMException *)ex)->body.category; |
1169 | 289 | else |
1170 | 0 | MVM_exception_throw_adhoc(tc, "getexcategory needs a VMException, got %s (%s)", REPR(ex)->name, STABLE(ex)->debug_name); |
1171 | 289 | cur_op += 4; |
1172 | 289 | goto NEXT; |
1173 | 289 | } |
1174 | 36 | OP(throwdyn): { |
1175 | 36 | MVMRegister *rr = &GET_REG(cur_op, 0); |
1176 | 36 | MVMObject *ex_obj = GET_REG(cur_op, 2).o; |
1177 | 36 | cur_op += 4; |
1178 | 36 | MVM_exception_throwobj(tc, MVM_EX_THROW_DYN, ex_obj, rr); |
1179 | 36 | goto NEXT; |
1180 | 36 | } |
1181 | 0 | OP(throwlex): { |
1182 | 0 | MVMRegister *rr = &GET_REG(cur_op, 0); |
1183 | 0 | MVMObject *ex_obj = GET_REG(cur_op, 2).o; |
1184 | 0 | cur_op += 4; |
1185 | 0 | MVM_exception_throwobj(tc, MVM_EX_THROW_LEX, ex_obj, rr); |
1186 | 0 | goto NEXT; |
1187 | 0 | } |
1188 | 0 | OP(throwlexotic): { |
1189 | 0 | MVMRegister *rr = &GET_REG(cur_op, 0); |
1190 | 0 | MVMObject *ex_obj = GET_REG(cur_op, 2).o; |
1191 | 0 | cur_op += 4; |
1192 | 0 | MVM_exception_throwobj(tc, MVM_EX_THROW_LEXOTIC, ex_obj, rr); |
1193 | 0 | goto NEXT; |
1194 | 0 | } |
1195 | 140k | OP(throwcatdyn): { |
1196 | 140k | MVMRegister *rr = &GET_REG(cur_op, 0); |
1197 | 140k | MVMuint32 cat = (MVMuint32)MVM_BC_get_I64(cur_op, 2); |
1198 | 140k | cur_op += 4; |
1199 | 140k | MVM_exception_throwcat(tc, MVM_EX_THROW_DYN, cat, rr); |
1200 | 140k | goto NEXT; |
1201 | 140k | } |
1202 | 0 | OP(throwcatlex): { |
1203 | 0 | MVMRegister *rr = &GET_REG(cur_op, 0); |
1204 | 0 | MVMuint32 cat = (MVMuint32)MVM_BC_get_I64(cur_op, 2); |
1205 | 0 | cur_op += 4; |
1206 | 0 | MVM_exception_throwcat(tc, MVM_EX_THROW_LEX, cat, rr); |
1207 | 0 | goto NEXT; |
1208 | 0 | } |
1209 | 0 | OP(throwcatlexotic): { |
1210 | 0 | MVMRegister *rr = &GET_REG(cur_op, 0); |
1211 | 0 | MVMuint32 cat = (MVMuint32)MVM_BC_get_I64(cur_op, 2); |
1212 | 0 | cur_op += 4; |
1213 | 0 | MVM_exception_throwcat(tc, MVM_EX_THROW_LEXOTIC, cat, rr); |
1214 | 0 | goto NEXT; |
1215 | 0 | } |
1216 | 154 | OP(die): { |
1217 | 154 | MVMRegister *rr = &GET_REG(cur_op, 0); |
1218 | 154 | MVMString *str = GET_REG(cur_op, 2).s; |
1219 | 154 | cur_op += 4; |
1220 | 154 | MVM_exception_die(tc, str, rr); |
1221 | 154 | goto NEXT; |
1222 | 154 | } |
1223 | 5 | OP(rethrow): { |
1224 | 5 | MVM_exception_throwobj(tc, MVM_EX_THROW_DYN, GET_REG(cur_op, 0).o, NULL); |
1225 | 5 | goto NEXT; |
1226 | 5 | } |
1227 | 9 | OP(resume): |
1228 | 9 | /* Expect that resume will set the PC, so don't update cur_op |
1229 | 9 | * here. */ |
1230 | 9 | MVM_exception_resume(tc, GET_REG(cur_op, 0).o); |
1231 | 9 | goto NEXT; |
1232 | 276 | OP(takehandlerresult): { |
1233 | 276 | GET_REG(cur_op, 0).o = tc->last_handler_result |
1234 | 276 | ? tc->last_handler_result |
1235 | 0 | : tc->instance->VMNull; |
1236 | 276 | tc->last_handler_result = NULL; |
1237 | 276 | cur_op += 2; |
1238 | 276 | goto NEXT; |
1239 | 276 | } |
1240 | 0 | OP(newlexotic): { |
1241 | 0 | GET_REG(cur_op, 0).o = MVM_exception_newlexotic(tc, |
1242 | 0 | GET_UI32(cur_op, 2)); |
1243 | 0 | cur_op += 6; |
1244 | 0 | goto NEXT; |
1245 | 0 | } |
1246 | 0 | OP(lexoticresult): { |
1247 | 0 | MVMObject *lex = GET_REG(cur_op, 2).o; |
1248 | 0 | if (IS_CONCRETE(lex) && REPR(lex)->ID == MVM_REPR_ID_Lexotic) |
1249 | 0 | GET_REG(cur_op, 0).o = ((MVMLexotic *)lex)->body.result; |
1250 | 0 | else |
1251 | 0 | MVM_exception_throw_adhoc(tc, "lexoticresult needs a Lexotic"); |
1252 | 0 | cur_op += 4; |
1253 | 0 | goto NEXT; |
1254 | 0 | } |
1255 | 0 | OP(backtracestrings): |
1256 | 0 | GET_REG(cur_op, 0).o = MVM_exception_backtrace_strings(tc, GET_REG(cur_op, 2).o); |
1257 | 0 | cur_op += 4; |
1258 | 0 | goto NEXT; |
1259 | 7.75k | OP(usecapture): |
1260 | 7.75k | GET_REG(cur_op, 0).o = MVM_args_use_capture(tc, tc->cur_frame); |
1261 | 7.75k | cur_op += 2; |
1262 | 7.75k | goto NEXT; |
1263 | 7.74k | OP(savecapture): { |
1264 | 7.74k | /* Create a new call capture object. */ |
1265 | 7.74k | GET_REG(cur_op, 0).o = MVM_args_save_capture(tc, tc->cur_frame); |
1266 | 7.74k | cur_op += 2; |
1267 | 7.74k | goto NEXT; |
1268 | 7.74k | } |
1269 | 3.87k | OP(captureposelems): { |
1270 | 3.87k | MVMObject *obj = GET_REG(cur_op, 2).o; |
1271 | 3.87k | if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { |
1272 | 3.87k | MVMCallCapture *cc = (MVMCallCapture *)obj; |
1273 | 3.87k | GET_REG(cur_op, 0).i64 = cc->body.apc->num_pos; |
1274 | 3.87k | } |
1275 | 0 | else { |
1276 | 0 | MVM_exception_throw_adhoc(tc, "captureposelems needs a MVMCallCapture"); |
1277 | 0 | } |
1278 | 3.87k | cur_op += 4; |
1279 | 3.87k | goto NEXT; |
1280 | 3.87k | } |
1281 | 105k | OP(captureposarg): { |
1282 | 105k | MVMObject *obj = GET_REG(cur_op, 2).o; |
1283 | 105k | if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { |
1284 | 105k | MVMCallCapture *cc = (MVMCallCapture *)obj; |
1285 | 105k | GET_REG(cur_op, 0).o = MVM_args_get_pos_obj(tc, cc->body.apc, |
1286 | 105k | (MVMuint32)GET_REG(cur_op, 4).i64, MVM_ARG_REQUIRED).arg.o; |
1287 | 105k | } |
1288 | 0 | else { |
1289 | 0 | MVM_exception_throw_adhoc(tc, "captureposarg needs a MVMCallCapture"); |
1290 | 0 | } |
1291 | 105k | cur_op += 6; |
1292 | 105k | goto NEXT; |
1293 | 105k | } |
1294 | 0 | OP(captureposarg_i): { |
1295 | 0 | MVMObject *obj = GET_REG(cur_op, 2).o; |
1296 | 0 | if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { |
1297 | 0 | MVMCallCapture *cc = (MVMCallCapture *)obj; |
1298 | 0 | GET_REG(cur_op, 0).i64 = MVM_args_get_pos_int(tc, cc->body.apc, |
1299 | 0 | (MVMuint32)GET_REG(cur_op, 4).i64, MVM_ARG_REQUIRED).arg.i64; |
1300 | 0 | } |
1301 | 0 | else { |
1302 | 0 | MVM_exception_throw_adhoc(tc, "captureposarg_i needs a MVMCallCapture"); |
1303 | 0 | } |
1304 | 0 | cur_op += 6; |
1305 | 0 | goto NEXT; |
1306 | 0 | } |
1307 | 0 | OP(captureposarg_n): { |
1308 | 0 | MVMObject *obj = GET_REG(cur_op, 2).o; |
1309 | 0 | if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { |
1310 | 0 | MVMCallCapture *cc = (MVMCallCapture *)obj; |
1311 | 0 | GET_REG(cur_op, 0).n64 = MVM_args_get_pos_num(tc, cc->body.apc, |
1312 | 0 | (MVMuint32)GET_REG(cur_op, 4).i64, MVM_ARG_REQUIRED).arg.n64; |
1313 | 0 | } |
1314 | 0 | else { |
1315 | 0 | MVM_exception_throw_adhoc(tc, "captureposarg_n needs a MVMCallCapture"); |
1316 | 0 | } |
1317 | 0 | cur_op += 6; |
1318 | 0 | goto NEXT; |
1319 | 0 | } |
1320 | 0 | OP(captureposarg_s): { |
1321 | 0 | MVMObject *obj = GET_REG(cur_op, 2).o; |
1322 | 0 | if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { |
1323 | 0 | MVMCallCapture *cc = (MVMCallCapture *)obj; |
1324 | 0 | GET_REG(cur_op, 0).s = MVM_args_get_pos_str(tc, cc->body.apc, |
1325 | 0 | (MVMuint32)GET_REG(cur_op, 4).i64, MVM_ARG_REQUIRED).arg.s; |
1326 | 0 | } |
1327 | 0 | else { |
1328 | 0 | MVM_exception_throw_adhoc(tc, "captureposarg_s needs a MVMCallCapture"); |
1329 | 0 | } |
1330 | 0 | cur_op += 6; |
1331 | 0 | goto NEXT; |
1332 | 0 | } |
1333 | 0 | OP(captureposprimspec): { |
1334 | 0 | MVMObject *obj = GET_REG(cur_op, 2).o; |
1335 | 0 | MVMint64 i = GET_REG(cur_op, 4).i64; |
1336 | 0 | if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { |
1337 | 0 | MVMCallCapture *cc = (MVMCallCapture *)obj; |
1338 | 0 | if (i >= 0 && i < cc->body.apc->num_pos) { |
1339 | 0 | MVMCallsiteEntry *arg_flags = cc->body.apc->arg_flags |
1340 | 0 | ? cc->body.apc->arg_flags |
1341 | 0 | : cc->body.apc->callsite->arg_flags; |
1342 | 0 | switch (arg_flags[i] & MVM_CALLSITE_ARG_MASK) { |
1343 | 0 | case MVM_CALLSITE_ARG_INT: |
1344 | 0 | GET_REG(cur_op, 0).i64 = MVM_STORAGE_SPEC_BP_INT; |
1345 | 0 | break; |
1346 | 0 | case MVM_CALLSITE_ARG_NUM: |
1347 | 0 | GET_REG(cur_op, 0).i64 = MVM_STORAGE_SPEC_BP_NUM; |
1348 | 0 | break; |
1349 | 0 | case MVM_CALLSITE_ARG_STR: |
1350 | 0 | GET_REG(cur_op, 0).i64 = MVM_STORAGE_SPEC_BP_STR; |
1351 | 0 | break; |
1352 | 0 | default: |
1353 | 0 | GET_REG(cur_op, 0).i64 = MVM_STORAGE_SPEC_BP_NONE; |
1354 | 0 | break; |
1355 | 0 | } |
1356 | 0 | } |
1357 | 0 | else { |
1358 | 0 | MVM_exception_throw_adhoc(tc, |
1359 | 0 | "Bad argument index given to captureposprimspec"); |
1360 | 0 | } |
1361 | 0 | } |
1362 | 0 | else { |
1363 | 0 | MVM_exception_throw_adhoc(tc, "captureposprimspec needs a MVMCallCapture"); |
1364 | 0 | } |
1365 | 0 | cur_op += 6; |
1366 | 0 | goto NEXT; |
1367 | 0 | } |
1368 | 2 | OP(captureexistsnamed): { |
1369 | 2 | MVMObject *obj = GET_REG(cur_op, 2).o; |
1370 | 2 | if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { |
1371 | 2 | MVMCallCapture *cc = (MVMCallCapture *)obj; |
1372 | 2 | GET_REG(cur_op, 0).i64 = MVM_args_has_named(tc, cc->body.apc, |
1373 | 2 | GET_REG(cur_op, 4).s); |
1374 | 2 | } |
1375 | 0 | else { |
1376 | 0 | MVM_exception_throw_adhoc(tc, "captureexistsnamed needs a MVMCallCapture"); |
1377 | 0 | } |
1378 | 2 | cur_op += 6; |
1379 | 2 | goto NEXT; |
1380 | 2 | } |
1381 | 3 | OP(capturehasnameds): { |
1382 | 3 | MVMObject *obj = GET_REG(cur_op, 2).o; |
1383 | 3 | if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { |
1384 | 3 | /* If positionals count doesn't match arg count, we must |
1385 | 3 | * have some named args. */ |
1386 | 3 | MVMCallCapture *cc = (MVMCallCapture *)obj; |
1387 | 3 | GET_REG(cur_op, 0).i64 = cc->body.apc->arg_count != cc->body.apc->num_pos; |
1388 | 3 | } |
1389 | 0 | else { |
1390 | 0 | MVM_exception_throw_adhoc(tc, "capturehasnameds needs a MVMCallCapture"); |
1391 | 0 | } |
1392 | 3 | cur_op += 4; |
1393 | 3 | goto NEXT; |
1394 | 3 | } |
1395 | 3.87k | OP(invokewithcapture): { |
1396 | 3.87k | MVMObject *cobj = GET_REG(cur_op, 4).o; |
1397 | 3.87k | if (IS_CONCRETE(cobj) && REPR(cobj)->ID == MVM_REPR_ID_MVMCallCapture) { |
1398 | 3.87k | MVMObject *code = GET_REG(cur_op, 2).o; |
1399 | 3.87k | MVMCallCapture *cc = (MVMCallCapture *)cobj; |
1400 | 3.87k | code = MVM_frame_find_invokee(tc, code, NULL); |
1401 | 3.87k | tc->cur_frame->return_value = &GET_REG(cur_op, 0); |
1402 | 3.87k | tc->cur_frame->return_type = MVM_RETURN_OBJ; |
1403 | 3.87k | cur_op += 6; |
1404 | 3.87k | tc->cur_frame->return_address = cur_op; |
1405 | 3.87k | STABLE(code)->invoke(tc, code, cc->body.effective_callsite, |
1406 | 3.87k | cc->body.apc->args); |
1407 | 3.87k | goto NEXT; |
1408 | 3.87k | } |
1409 | 0 | else { |
1410 | 0 | MVM_exception_throw_adhoc(tc, "invokewithcapture needs a MVMCallCapture"); |
1411 | 0 | } |
1412 | 3.87k | } |
1413 | 3.87k | OP(multicacheadd): |
1414 | 3.87k | GET_REG(cur_op, 0).o = MVM_multi_cache_add(tc, GET_REG(cur_op, 2).o, |
1415 | 3.87k | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).o); |
1416 | 3.87k | cur_op += 8; |
1417 | 3.87k | goto NEXT; |
1418 | 3.88k | OP(multicachefind): |
1419 | 3.88k | GET_REG(cur_op, 0).o = MVM_multi_cache_find(tc, GET_REG(cur_op, 2).o, |
1420 | 3.88k | GET_REG(cur_op, 4).o); |
1421 | 3.88k | cur_op += 6; |
1422 | 3.88k | goto NEXT; |
1423 | 1.44k | OP(null_s): |
1424 | 1.44k | GET_REG(cur_op, 0).s = NULL; |
1425 | 1.44k | cur_op += 2; |
1426 | 1.44k | goto NEXT; |
1427 | 250k | OP(isnull_s): |
1428 | 250k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).s ? 0 : 1; |
1429 | 250k | cur_op += 4; |
1430 | 250k | goto NEXT; |
1431 | 531k | OP(eq_s): |
1432 | 531k | GET_REG(cur_op, 0).i64 = MVM_string_equal(tc, |
1433 | 531k | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s); |
1434 | 531k | cur_op += 6; |
1435 | 531k | goto NEXT; |
1436 | 86.6k | OP(ne_s): |
1437 | 86.6k | GET_REG(cur_op, 0).i64 = (MVMint64)(MVM_string_equal(tc, |
1438 | 86.6k | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s)? 0 : 1); |
1439 | 86.6k | cur_op += 6; |
1440 | 86.6k | goto NEXT; |
1441 | 11.4k | OP(gt_s): |
1442 | 11.4k | GET_REG(cur_op, 0).i64 = MVM_string_compare(tc, |
1443 | 11.4k | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s) == 1; |
1444 | 11.4k | cur_op += 6; |
1445 | 11.4k | goto NEXT; |
1446 | 5 | OP(ge_s): |
1447 | 5 | GET_REG(cur_op, 0).i64 = MVM_string_compare(tc, |
1448 | 5 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s) >= 0; |
1449 | 5 | cur_op += 6; |
1450 | 5 | goto NEXT; |
1451 | 5 | OP(lt_s): |
1452 | 5 | GET_REG(cur_op, 0).i64 = MVM_string_compare(tc, |
1453 | 5 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s) == -1; |
1454 | 5 | cur_op += 6; |
1455 | 5 | goto NEXT; |
1456 | 11.5k | OP(le_s): |
1457 | 11.5k | GET_REG(cur_op, 0).i64 = MVM_string_compare(tc, |
1458 | 11.5k | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s) <= 0; |
1459 | 11.5k | cur_op += 6; |
1460 | 11.5k | goto NEXT; |
1461 | 3 | OP(cmp_s): |
1462 | 3 | GET_REG(cur_op, 0).i64 = MVM_string_compare(tc, |
1463 | 3 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s); |
1464 | 3 | cur_op += 6; |
1465 | 3 | goto NEXT; |
1466 | 0 | OP(unicmp_s): |
1467 | 0 | GET_REG(cur_op, 0).i64 = MVM_unicode_string_compare(tc, |
1468 | 0 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s, |
1469 | 0 | GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).i64, |
1470 | 0 | GET_REG(cur_op, 10).i64); |
1471 | 0 | cur_op += 12; |
1472 | 0 | goto NEXT; |
1473 | 93.6k | OP(eqat_s): |
1474 | 93.6k | GET_REG(cur_op, 0).i64 = MVM_string_equal_at(tc, |
1475 | 93.6k | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s, |
1476 | 93.6k | GET_REG(cur_op, 6).i64); |
1477 | 93.6k | cur_op += 8; |
1478 | 93.6k | goto NEXT; |
1479 | 215 | OP(eqatic_s): |
1480 | 215 | GET_REG(cur_op, 0).i64 = MVM_string_equal_at_ignore_case(tc, |
1481 | 215 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s, |
1482 | 215 | GET_REG(cur_op, 6).i64); |
1483 | 215 | cur_op += 8; |
1484 | 215 | goto NEXT; |
1485 | 0 | OP(haveat_s): |
1486 | 0 | GET_REG(cur_op, 0).i64 = MVM_string_have_at(tc, |
1487 | 0 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64, |
1488 | 0 | GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).s, |
1489 | 0 | GET_REG(cur_op, 10).i64); |
1490 | 0 | cur_op += 12; |
1491 | 0 | goto NEXT; |
1492 | 157k | OP(concat_s): |
1493 | 157k | GET_REG(cur_op, 0).s = MVM_string_concatenate(tc, |
1494 | 157k | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s); |
1495 | 157k | cur_op += 6; |
1496 | 157k | goto NEXT; |
1497 | 304 | OP(repeat_s): |
1498 | 304 | GET_REG(cur_op, 0).s = MVM_string_repeat(tc, |
1499 | 304 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64); |
1500 | 304 | cur_op += 6; |
1501 | 304 | goto NEXT; |
1502 | 126k | OP(substr_s): |
1503 | 126k | GET_REG(cur_op, 0).s = MVM_string_substring(tc, |
1504 | 126k | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64, |
1505 | 126k | GET_REG(cur_op, 6).i64); |
1506 | 126k | cur_op += 8; |
1507 | 126k | goto NEXT; |
1508 | 87.0k | OP(index_s): |
1509 | 87.0k | GET_REG(cur_op, 0).i64 = MVM_string_index(tc, |
1510 | 87.0k | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s, GET_REG(cur_op, 6).i64); |
1511 | 87.0k | cur_op += 8; |
1512 | 87.0k | goto NEXT; |
1513 | 123 | OP(indexic_s): |
1514 | 123 | GET_REG(cur_op, 0).i64 = MVM_string_index_ignore_case(tc, |
1515 | 123 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s, GET_REG(cur_op, 6).i64); |
1516 | 123 | cur_op += 8; |
1517 | 123 | goto NEXT; |
1518 | 0 | OP(graphs_s): |
1519 | 0 | GET_REG(cur_op, 0).i64 = MVM_string_graphs(tc, GET_REG(cur_op, 2).s); |
1520 | 0 | cur_op += 4; |
1521 | 0 | goto NEXT; |
1522 | 0 | OP(codes_s): |
1523 | 0 | GET_REG(cur_op, 0).i64 = MVM_string_codes(tc, GET_REG(cur_op, 2).s); |
1524 | 0 | cur_op += 4; |
1525 | 0 | goto NEXT; |
1526 | 553 | OP(getcp_s): |
1527 | 553 | GET_REG(cur_op, 0).i64 = MVM_string_get_grapheme_at(tc, |
1528 | 553 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64); |
1529 | 553 | cur_op += 6; |
1530 | 553 | goto NEXT; |
1531 | 0 | OP(indexcp_s): |
1532 | 0 | GET_REG(cur_op, 0).i64 = MVM_string_index_of_grapheme(tc, |
1533 | 0 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64); |
1534 | 0 | cur_op += 6; |
1535 | 0 | goto NEXT; |
1536 | 96 | OP(uc): |
1537 | 96 | GET_REG(cur_op, 0).s = MVM_string_uc(tc, |
1538 | 96 | GET_REG(cur_op, 2).s); |
1539 | 96 | cur_op += 4; |
1540 | 96 | goto NEXT; |
1541 | 10.4k | OP(lc): |
1542 | 10.4k | GET_REG(cur_op, 0).s = MVM_string_lc(tc, |
1543 | 10.4k | GET_REG(cur_op, 2).s); |
1544 | 10.4k | cur_op += 4; |
1545 | 10.4k | goto NEXT; |
1546 | 12 | OP(tc): |
1547 | 12 | GET_REG(cur_op, 0).s = MVM_string_tc(tc, |
1548 | 12 | GET_REG(cur_op, 2).s); |
1549 | 12 | cur_op += 4; |
1550 | 12 | goto NEXT; |
1551 | 18.3k | OP(split): |
1552 | 18.3k | GET_REG(cur_op, 0).o = MVM_string_split(tc, |
1553 | 18.3k | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s); |
1554 | 18.3k | cur_op += 6; |
1555 | 18.3k | goto NEXT; |
1556 | 8.51k | OP(join): |
1557 | 8.51k | GET_REG(cur_op, 0).s = MVM_string_join(tc, |
1558 | 8.51k | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).o); |
1559 | 8.51k | cur_op += 6; |
1560 | 8.51k | goto NEXT; |
1561 | 1 | OP(getcpbyname): |
1562 | 1 | GET_REG(cur_op, 0).i64 = MVM_unicode_lookup_by_name(tc, |
1563 | 1 | GET_REG(cur_op, 2).s); |
1564 | 1 | cur_op += 4; |
1565 | 1 | goto NEXT; |
1566 | 5 | OP(getstrfromname): |
1567 | 5 | GET_REG(cur_op, 0).s = MVM_unicode_string_from_name(tc, |
1568 | 5 | GET_REG(cur_op, 2).s); |
1569 | 5 | cur_op += 4; |
1570 | 5 | goto NEXT; |
1571 | 95.1k | OP(indexat): |
1572 | 95.1k | /* branches on *failure* to match in the constant string, to save an instruction in regexes */ |
1573 | 95.1k | if (MVM_string_char_at_in_string(tc, GET_REG(cur_op, 0).s, |
1574 | 95.1k | GET_REG(cur_op, 2).i64, |
1575 | 95.1k | MVM_cu_string(tc, cu, GET_UI32(cur_op, 4))) >= 0) |
1576 | 42.2k | cur_op += 12; |
1577 | 95.1k | else |
1578 | 52.8k | cur_op = bytecode_start + GET_UI32(cur_op, 8); |
1579 | 95.1k | GC_SYNC_POINT(tc); |
1580 | 95.1k | goto NEXT; |
1581 | 8.53k | OP(indexnat): |
1582 | 8.53k | /* branches on *failure* to match in the constant string, to save an instruction in regexes */ |
1583 | 8.53k | if (MVM_string_char_at_in_string(tc, GET_REG(cur_op, 0).s, |
1584 | 8.53k | GET_REG(cur_op, 2).i64, |
1585 | 8.53k | MVM_cu_string(tc, cu, GET_UI32(cur_op, 4))) == -1) |
1586 | 7.05k | cur_op += 12; |
1587 | 8.53k | else |
1588 | 1.48k | cur_op = bytecode_start + GET_UI32(cur_op, 8); |
1589 | 8.53k | GC_SYNC_POINT(tc); |
1590 | 8.53k | goto NEXT; |
1591 | 0 | OP(unipropcode): |
1592 | 0 | GET_REG(cur_op, 0).i64 = (MVMint64)MVM_unicode_name_to_property_code(tc, |
1593 | 0 | GET_REG(cur_op, 2).s); |
1594 | 0 | cur_op += 4; |
1595 | 0 | goto NEXT; |
1596 | 0 | OP(unipvalcode): |
1597 | 0 | GET_REG(cur_op, 0).i64 = (MVMint64)MVM_unicode_name_to_property_value_code(tc, |
1598 | 0 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).s); |
1599 | 0 | cur_op += 6; |
1600 | 0 | goto NEXT; |
1601 | 0 | OP(hasuniprop): |
1602 | 0 | GET_REG(cur_op, 0).i64 = MVM_string_offset_has_unicode_property_value(tc, |
1603 | 0 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64, GET_REG(cur_op, 6).i64, |
1604 | 0 | GET_REG(cur_op, 8).i64); |
1605 | 0 | cur_op += 10; |
1606 | 0 | goto NEXT; |
1607 | 0 | OP(hasunipropc): |
1608 | 0 | GET_REG(cur_op, 0).i64 = MVM_string_offset_has_unicode_property_value(tc, |
1609 | 0 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64, (MVMint64)GET_UI16(cur_op, 6), |
1610 | 0 | (MVMint64)GET_UI16(cur_op, 8)); |
1611 | 0 | cur_op += 10; |
1612 | 0 | goto NEXT; |
1613 | 608k | OP(chars): |
1614 | 608k | GET_REG(cur_op, 0).i64 = MVM_string_graphs(tc, GET_REG(cur_op, 2).s); |
1615 | 608k | cur_op += 4; |
1616 | 608k | goto NEXT; |
1617 | 8.42k | OP(chr): |
1618 | 8.42k | GET_REG(cur_op, 0).s = MVM_string_chr(tc, (MVMCodepoint)GET_REG(cur_op, 2).i64); |
1619 | 8.42k | cur_op += 4; |
1620 | 8.42k | goto NEXT; |
1621 | 123k | OP(ordfirst): { |
1622 | 123k | GET_REG(cur_op, 0).i64 = MVM_string_ord_at(tc, GET_REG(cur_op, 2).s, 0); |
1623 | 123k | cur_op += 4; |
1624 | 123k | goto NEXT; |
1625 | 123k | } |
1626 | 32.4k | OP(ordat): { |
1627 | 32.4k | GET_REG(cur_op, 0).i64 = MVM_string_ord_at(tc, GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64); |
1628 | 32.4k | cur_op += 6; |
1629 | 32.4k | goto NEXT; |
1630 | 32.4k | } |
1631 | 12 | OP(rindexfrom): |
1632 | 12 | GET_REG(cur_op, 0).i64 = MVM_string_index_from_end(tc, |
1633 | 12 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s, GET_REG(cur_op, 6).i64); |
1634 | 12 | cur_op += 8; |
1635 | 12 | goto NEXT; |
1636 | 440 | OP(escape): |
1637 | 440 | GET_REG(cur_op, 0).s = MVM_string_escape(tc, |
1638 | 440 | GET_REG(cur_op, 2).s); |
1639 | 440 | cur_op += 4; |
1640 | 440 | goto NEXT; |
1641 | 1 | OP(flip): |
1642 | 1 | GET_REG(cur_op, 0).s = MVM_string_flip(tc, |
1643 | 1 | GET_REG(cur_op, 2).s); |
1644 | 1 | cur_op += 4; |
1645 | 1 | goto NEXT; |
1646 | 0 | OP(DEPRECATED_1): |
1647 | 0 | MVM_exception_throw_adhoc(tc, "The flattenropes op was removed in MoarVM 2016.11."); |
1648 | 130k | OP(iscclass): |
1649 | 130k | GET_REG(cur_op, 0).i64 = MVM_string_is_cclass(tc, |
1650 | 130k | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).s, |
1651 | 130k | GET_REG(cur_op, 6).i64); |
1652 | 130k | cur_op += 8; |
1653 | 130k | goto NEXT; |
1654 | 9.67k | OP(findcclass): |
1655 | 9.67k | GET_REG(cur_op, 0).i64 = MVM_string_find_cclass(tc, |
1656 | 9.67k | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).s, |
1657 | 9.67k | GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).i64); |
1658 | 9.67k | cur_op += 10; |
1659 | 9.67k | goto NEXT; |
1660 | 19.4k | OP(findnotcclass): |
1661 | 19.4k | GET_REG(cur_op, 0).i64 = MVM_string_find_not_cclass(tc, |
1662 | 19.4k | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).s, |
1663 | 19.4k | GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).i64); |
1664 | 19.4k | cur_op += 10; |
1665 | 19.4k | goto NEXT; |
1666 | 4.50k | OP(nfafromstatelist): |
1667 | 4.50k | GET_REG(cur_op, 0).o = MVM_nfa_from_statelist(tc, |
1668 | 4.50k | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
1669 | 4.50k | cur_op += 6; |
1670 | 4.50k | goto NEXT; |
1671 | 25.0k | OP(nfarunproto): |
1672 | 25.0k | GET_REG(cur_op, 0).o = MVM_nfa_run_proto(tc, |
1673 | 25.0k | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).s, |
1674 | 25.0k | GET_REG(cur_op, 6).i64); |
1675 | 25.0k | cur_op += 8; |
1676 | 25.0k | goto NEXT; |
1677 | 80.8k | OP(nfarunalt): |
1678 | 80.8k | MVM_nfa_run_alt(tc, GET_REG(cur_op, 0).o, |
1679 | 80.8k | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64, |
1680 | 80.8k | GET_REG(cur_op, 6).o, GET_REG(cur_op, 8).o, |
1681 | 80.8k | GET_REG(cur_op, 10).o); |
1682 | 80.8k | cur_op += 12; |
1683 | 80.8k | goto NEXT; |
1684 | 4.22k | OP(radix): |
1685 | 4.22k | GET_REG(cur_op, 0).o = MVM_radix(tc, |
1686 | 4.22k | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).s, |
1687 | 4.22k | GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).i64); |
1688 | 4.22k | cur_op += 10; |
1689 | 4.22k | goto NEXT; |
1690 | 14 | OP(encode): |
1691 | 14 | MVM_string_encode_to_buf(tc, GET_REG(cur_op, 2).s, |
1692 | 14 | GET_REG(cur_op, 4).s, GET_REG(cur_op, 6).o, NULL); |
1693 | 14 | GET_REG(cur_op, 0).o = GET_REG(cur_op, 6).o; |
1694 | 14 | cur_op += 8; |
1695 | 14 | goto NEXT; |
1696 | 5 | OP(decode): |
1697 | 5 | GET_REG(cur_op, 0).s = MVM_string_decode_from_buf(tc, |
1698 | 5 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).s); |
1699 | 5 | cur_op += 6; |
1700 | 5 | goto NEXT; |
1701 | 0 | OP(istrue_s): |
1702 | 0 | GET_REG(cur_op, 0).i64 = MVM_coerce_istrue_s(tc, GET_REG(cur_op, 2).s); |
1703 | 0 | cur_op += 4; |
1704 | 0 | goto NEXT; |
1705 | 0 | OP(isfalse_s): |
1706 | 0 | GET_REG(cur_op, 0).i64 = MVM_coerce_istrue_s(tc, GET_REG(cur_op, 2).s) ? 0 : 1; |
1707 | 0 | cur_op += 4; |
1708 | 0 | goto NEXT; |
1709 | 7.42M | OP(null): |
1710 | 7.42M | GET_REG(cur_op, 0).o = tc->instance->VMNull; |
1711 | 7.42M | cur_op += 2; |
1712 | 7.42M | goto NEXT; |
1713 | 2.80M | OP(isnull): { |
1714 | 2.80M | MVMObject *obj = GET_REG(cur_op, 2).o; |
1715 | 2.80M | GET_REG(cur_op, 0).i64 = MVM_is_null(tc, obj); |
1716 | 2.80M | cur_op += 4; |
1717 | 2.80M | goto NEXT; |
1718 | 2.80M | } |
1719 | 4.32M | OP(ifnonnull): |
1720 | 4.32M | if (MVM_is_null(tc, GET_REG(cur_op, 0).o)) |
1721 | 283k | cur_op += 6; |
1722 | 4.32M | else |
1723 | 4.04M | cur_op = bytecode_start + GET_UI32(cur_op, 2); |
1724 | 4.32M | GC_SYNC_POINT(tc); |
1725 | 4.32M | goto NEXT; |
1726 | 5.64M | OP(findmeth): { |
1727 | 5.64M | /* Increment PC first, as we may make a method call. */ |
1728 | 5.64M | MVMRegister *res = &GET_REG(cur_op, 0); |
1729 | 5.64M | MVMObject *obj = GET_REG(cur_op, 2).o; |
1730 | 5.64M | MVMString *name = MVM_cu_string(tc, cu, GET_UI32(cur_op, 4)); |
1731 | 5.64M | cur_op += 8; |
1732 | 5.64M | MVM_6model_find_method(tc, obj, name, res); |
1733 | 5.64M | goto NEXT; |
1734 | 5.64M | } |
1735 | 453k | OP(findmeth_s): { |
1736 | 453k | /* Increment PC first, as we may make a method call. */ |
1737 | 453k | MVMRegister *res = &GET_REG(cur_op, 0); |
1738 | 453k | MVMObject *obj = GET_REG(cur_op, 2).o; |
1739 | 453k | MVMString *name = GET_REG(cur_op, 4).s; |
1740 | 453k | cur_op += 6; |
1741 | 453k | MVM_6model_find_method(tc, obj, name, res); |
1742 | 453k | goto NEXT; |
1743 | 453k | } |
1744 | 3.36k | OP(can): { |
1745 | 3.36k | /* Increment PC first, as we may make a method call. */ |
1746 | 3.36k | MVMRegister *res = &GET_REG(cur_op, 0); |
1747 | 3.36k | MVMObject *obj = GET_REG(cur_op, 2).o; |
1748 | 3.36k | MVMString *name = MVM_cu_string(tc, cu, GET_UI32(cur_op, 4)); |
1749 | 3.36k | cur_op += 8; |
1750 | 3.36k | MVM_6model_can_method(tc, obj, name, res); |
1751 | 3.36k | goto NEXT; |
1752 | 3.36k | } |
1753 | 244k | OP(can_s): { |
1754 | 244k | /* Increment PC first, as we may make a method call. */ |
1755 | 244k | MVMRegister *res = &GET_REG(cur_op, 0); |
1756 | 244k | MVMObject *obj = GET_REG(cur_op, 2).o; |
1757 | 244k | MVMString *name = GET_REG(cur_op, 4).s; |
1758 | 244k | cur_op += 6; |
1759 | 244k | MVM_6model_can_method(tc, obj, name, res); |
1760 | 244k | goto NEXT; |
1761 | 244k | } |
1762 | 1.12M | OP(create): { |
1763 | 1.12M | /* Ordering here matters. We write the object into the |
1764 | 1.12M | * register before calling initialize. This is because |
1765 | 1.12M | * if initialize allocates, obj may have moved after |
1766 | 1.12M | * we called it. Note that type is never used after |
1767 | 1.12M | * the initial allocate call also. This saves us having |
1768 | 1.12M | * to put things on the temporary stack. The GC will |
1769 | 1.12M | * know to update it in the register if it moved. */ |
1770 | 1.12M | MVMObject *type = GET_REG(cur_op, 2).o; |
1771 | 1.12M | MVMObject *obj = REPR(type)->allocate(tc, STABLE(type)); |
1772 | 1.12M | GET_REG(cur_op, 0).o = obj; |
1773 | 1.12M | if (REPR(obj)->initialize) |
1774 | 375k | REPR(obj)->initialize(tc, STABLE(obj), obj, OBJECT_BODY(obj)); |
1775 | 1.12M | cur_op += 4; |
1776 | 1.12M | goto NEXT; |
1777 | 1.12M | } |
1778 | 7.13k | OP(clone): { |
1779 | 7.13k | MVMObject *value = GET_REG(cur_op, 2).o; |
1780 | 7.13k | if (IS_CONCRETE(value)) { |
1781 | 7.13k | MVMROOT(tc, value, { |
1782 | 7.13k | MVMObject *cloned = REPR(value)->allocate(tc, STABLE(value)); |
1783 | 7.13k | /* Ordering here matters. We write the object into the |
1784 | 7.13k | * register before calling copy_to. This is because |
1785 | 7.13k | * if copy_to allocates, obj may have moved after |
1786 | 7.13k | * we called it. This saves us having to put things on |
1787 | 7.13k | * the temporary stack. The GC will know to update it |
1788 | 7.13k | * in the register if it moved. */ |
1789 | 7.13k | GET_REG(cur_op, 0).o = cloned; |
1790 | 7.13k | REPR(value)->copy_to(tc, STABLE(value), OBJECT_BODY(value), cloned, OBJECT_BODY(cloned)); |
1791 | 7.13k | }); |
1792 | 7.13k | } |
1793 | 1 | else { |
1794 | 1 | GET_REG(cur_op, 0).o = value; |
1795 | 1 | } |
1796 | 7.13k | cur_op += 4; |
1797 | 7.13k | goto NEXT; |
1798 | 7.13k | } |
1799 | 1.66M | OP(isconcrete): { |
1800 | 1.66M | MVMObject *obj = GET_REG(cur_op, 2).o; |
1801 | 1.66M | GET_REG(cur_op, 0).i64 = obj && IS_CONCRETE(obj) ? 1 : 0; |
1802 | 1.66M | cur_op += 4; |
1803 | 1.66M | goto NEXT; |
1804 | 1.66M | } |
1805 | 2.11k | OP(rebless): |
1806 | 2.11k | if (!REPR(GET_REG(cur_op, 2).o)->change_type) { |
1807 | 0 | MVM_exception_throw_adhoc(tc, "This REPR cannot change type"); |
1808 | 0 | } |
1809 | 2.11k | REPR(GET_REG(cur_op, 2).o)->change_type(tc, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
1810 | 2.11k | GET_REG(cur_op, 0).o = GET_REG(cur_op, 2).o; |
1811 | 2.11k | MVM_SC_WB_OBJ(tc, GET_REG(cur_op, 0).o); |
1812 | 2.11k | cur_op += 6; |
1813 | 2.11k | MVM_spesh_deopt_all(tc); |
1814 | 2.11k | goto NEXT; |
1815 | 574k | OP(istype): { |
1816 | 574k | /* Increment PC first, as we may make a method call. */ |
1817 | 574k | MVMRegister *res = &GET_REG(cur_op, 0); |
1818 | 574k | MVMObject *obj = GET_REG(cur_op, 2).o; |
1819 | 574k | MVMObject *type = GET_REG(cur_op, 4).o; |
1820 | 574k | cur_op += 6; |
1821 | 574k | MVM_6model_istype(tc, obj, type, res); |
1822 | 574k | goto NEXT; |
1823 | 574k | } |
1824 | 13.5k | OP(objprimspec): { |
1825 | 13.5k | MVMObject *type = GET_REG(cur_op, 2).o; |
1826 | 13.5k | if (type) { |
1827 | 13.5k | const MVMStorageSpec *ss = REPR(type)->get_storage_spec(tc, STABLE(type)); |
1828 | 13.5k | GET_REG(cur_op, 0).i64 = ss->boxed_primitive; |
1829 | 13.5k | } |
1830 | 0 | else { |
1831 | 0 | GET_REG(cur_op, 0).i64 = 0; |
1832 | 0 | } |
1833 | 13.5k | cur_op += 4; |
1834 | 13.5k | goto NEXT; |
1835 | 13.5k | } |
1836 | 189k | OP(gethow): |
1837 | 189k | GET_REG(cur_op, 0).o = MVM_6model_get_how(tc, |
1838 | 189k | STABLE(GET_REG(cur_op, 2).o)); |
1839 | 189k | cur_op += 4; |
1840 | 189k | goto NEXT; |
1841 | 134k | OP(getwhat): |
1842 | 134k | GET_REG(cur_op, 0).o = STABLE(GET_REG(cur_op, 2).o)->WHAT; |
1843 | 134k | cur_op += 4; |
1844 | 134k | goto NEXT; |
1845 | 141k | OP(getwho): { |
1846 | 141k | MVMObject *who = STABLE(GET_REG(cur_op, 2).o)->WHO; |
1847 | 141k | GET_REG(cur_op, 0).o = who ? who : tc->instance->VMNull; |
1848 | 141k | cur_op += 4; |
1849 | 141k | goto NEXT; |
1850 | 141k | } |
1851 | 960 | OP(setwho): { |
1852 | 960 | MVMSTable *st = STABLE(GET_REG(cur_op, 2).o); |
1853 | 960 | MVM_ASSIGN_REF(tc, &(st->header), st->WHO, GET_REG(cur_op, 4).o); |
1854 | 960 | GET_REG(cur_op, 0).o = GET_REG(cur_op, 2).o; |
1855 | 960 | cur_op += 6; |
1856 | 960 | goto NEXT; |
1857 | 960 | } |
1858 | 332 | OP(reprname): { |
1859 | 332 | const MVMREPROps *repr = REPR(GET_REG(cur_op, 2).o); |
1860 | 332 | GET_REG(cur_op, 0).s = tc->instance->repr_list[repr->ID]->name; |
1861 | 332 | cur_op += 4; |
1862 | 332 | goto NEXT; |
1863 | 332 | } |
1864 | 4 | OP(getwhere): |
1865 | 4 | GET_REG(cur_op, 0).i64 = (MVMint64)GET_REG(cur_op, 2).o; |
1866 | 4 | cur_op += 4; |
1867 | 4 | goto NEXT; |
1868 | 514k | OP(eqaddr): |
1869 | 514k | GET_REG(cur_op, 0).i64 = GET_REG(cur_op, 2).o == GET_REG(cur_op, 4).o ? 1 : 0; |
1870 | 514k | cur_op += 6; |
1871 | 514k | goto NEXT; |
1872 | 1.77M | OP(bindattr_i): { |
1873 | 1.77M | MVMObject *obj = GET_REG(cur_op, 0).o; |
1874 | 1.77M | if (!IS_CONCRETE(obj)) |
1875 | 0 | MVM_exception_throw_adhoc(tc, "Cannot bind attributes in a %s type object", STABLE(obj)->debug_name); |
1876 | 1.77M | REPR(obj)->attr_funcs.bind_attribute(tc, |
1877 | 1.77M | STABLE(obj), obj, OBJECT_BODY(obj), |
1878 | 1.77M | GET_REG(cur_op, 2).o, MVM_cu_string(tc, cu, GET_UI32(cur_op, 4)), |
1879 | 1.77M | GET_I16(cur_op, 10), GET_REG(cur_op, 8), MVM_reg_int64); |
1880 | 1.77M | MVM_SC_WB_OBJ(tc, obj); |
1881 | 1.77M | cur_op += 12; |
1882 | 1.77M | goto NEXT; |
1883 | 1.77M | } |
1884 | 785 | OP(bindattr_n): { |
1885 | 785 | MVMObject *obj = GET_REG(cur_op, 0).o; |
1886 | 785 | if (!IS_CONCRETE(obj)) |
1887 | 0 | MVM_exception_throw_adhoc(tc, "Cannot bind attributes in a %s type object", STABLE(obj)->debug_name); |
1888 | 785 | REPR(obj)->attr_funcs.bind_attribute(tc, |
1889 | 785 | STABLE(obj), obj, OBJECT_BODY(obj), |
1890 | 785 | GET_REG(cur_op, 2).o, MVM_cu_string(tc, cu, GET_UI32(cur_op, 4)), |
1891 | 785 | GET_I16(cur_op, 10), GET_REG(cur_op, 8), MVM_reg_num64); |
1892 | 785 | MVM_SC_WB_OBJ(tc, obj); |
1893 | 785 | cur_op += 12; |
1894 | 785 | goto NEXT; |
1895 | 785 | } |
1896 | 213k | OP(bindattr_s): { |
1897 | 213k | MVMObject *obj = GET_REG(cur_op, 0).o; |
1898 | 213k | if (!IS_CONCRETE(obj)) |
1899 | 0 | MVM_exception_throw_adhoc(tc, "Cannot bind attributes in a %s type object", STABLE(obj)->debug_name); |
1900 | 213k | REPR(obj)->attr_funcs.bind_attribute(tc, |
1901 | 213k | STABLE(obj), obj, OBJECT_BODY(obj), |
1902 | 213k | GET_REG(cur_op, 2).o, MVM_cu_string(tc, cu, GET_UI32(cur_op, 4)), |
1903 | 213k | GET_I16(cur_op, 10), GET_REG(cur_op, 8), MVM_reg_str); |
1904 | 213k | MVM_SC_WB_OBJ(tc, obj); |
1905 | 213k | cur_op += 12; |
1906 | 213k | goto NEXT; |
1907 | 213k | } |
1908 | 1.86M | OP(bindattr_o): { |
1909 | 1.86M | MVMObject *obj = GET_REG(cur_op, 0).o; |
1910 | 1.86M | if (!IS_CONCRETE(obj)) |
1911 | 0 | MVM_exception_throw_adhoc(tc, "Cannot bind attributes in a %s type object", STABLE(obj)->debug_name); |
1912 | 1.86M | REPR(obj)->attr_funcs.bind_attribute(tc, |
1913 | 1.86M | STABLE(obj), obj, OBJECT_BODY(obj), |
1914 | 1.86M | GET_REG(cur_op, 2).o, MVM_cu_string(tc, cu, GET_UI32(cur_op, 4)), |
1915 | 1.86M | GET_I16(cur_op, 10), GET_REG(cur_op, 8), MVM_reg_obj); |
1916 | 1.86M | MVM_SC_WB_OBJ(tc, obj); |
1917 | 1.86M | cur_op += 12; |
1918 | 1.86M | goto NEXT; |
1919 | 1.86M | } |
1920 | 8 | OP(bindattrs_i): { |
1921 | 8 | MVMObject *obj = GET_REG(cur_op, 0).o; |
1922 | 8 | if (!IS_CONCRETE(obj)) |
1923 | 0 | MVM_exception_throw_adhoc(tc, "Cannot bind attributes in a %s type object", STABLE(obj)->debug_name); |
1924 | 8 | REPR(obj)->attr_funcs.bind_attribute(tc, |
1925 | 8 | STABLE(obj), obj, OBJECT_BODY(obj), |
1926 | 8 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).s, |
1927 | 8 | -1, GET_REG(cur_op, 6), MVM_reg_int64); |
1928 | 8 | MVM_SC_WB_OBJ(tc, obj); |
1929 | 8 | cur_op += 8; |
1930 | 8 | goto NEXT; |
1931 | 8 | } |
1932 | 0 | OP(bindattrs_n): { |
1933 | 0 | MVMObject *obj = GET_REG(cur_op, 0).o; |
1934 | 0 | if (!IS_CONCRETE(obj)) |
1935 | 0 | MVM_exception_throw_adhoc(tc, "Cannot bind attributes in a %s type object", STABLE(obj)->debug_name); |
1936 | 0 | REPR(obj)->attr_funcs.bind_attribute(tc, |
1937 | 0 | STABLE(obj), obj, OBJECT_BODY(obj), |
1938 | 0 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).s, |
1939 | 0 | -1, GET_REG(cur_op, 6), MVM_reg_num64); |
1940 | 0 | MVM_SC_WB_OBJ(tc, obj); |
1941 | 0 | cur_op += 8; |
1942 | 0 | goto NEXT; |
1943 | 0 | } |
1944 | 0 | OP(bindattrs_s): { |
1945 | 0 | MVMObject *obj = GET_REG(cur_op, 0).o; |
1946 | 0 | if (!IS_CONCRETE(obj)) |
1947 | 0 | MVM_exception_throw_adhoc(tc, "Cannot bind attributes in a %s type object", STABLE(obj)->debug_name); |
1948 | 0 | REPR(obj)->attr_funcs.bind_attribute(tc, |
1949 | 0 | STABLE(obj), obj, OBJECT_BODY(obj), |
1950 | 0 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).s, |
1951 | 0 | -1, GET_REG(cur_op, 6), MVM_reg_str); |
1952 | 0 | MVM_SC_WB_OBJ(tc, obj); |
1953 | 0 | cur_op += 8; |
1954 | 0 | goto NEXT; |
1955 | 0 | } |
1956 | 33.2k | OP(bindattrs_o): { |
1957 | 33.2k | MVMObject *obj = GET_REG(cur_op, 0).o; |
1958 | 33.2k | if (!IS_CONCRETE(obj)) |
1959 | 0 | MVM_exception_throw_adhoc(tc, "Cannot bind attributes in a %s type object", STABLE(obj)->debug_name); |
1960 | 33.2k | REPR(obj)->attr_funcs.bind_attribute(tc, |
1961 | 33.2k | STABLE(obj), obj, OBJECT_BODY(obj), |
1962 | 33.2k | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).s, |
1963 | 33.2k | -1, GET_REG(cur_op, 6), MVM_reg_obj); |
1964 | 33.2k | MVM_SC_WB_OBJ(tc, obj); |
1965 | 33.2k | cur_op += 8; |
1966 | 33.2k | goto NEXT; |
1967 | 33.2k | } |
1968 | 2.69M | OP(getattr_i): { |
1969 | 2.69M | MVMObject *obj = GET_REG(cur_op, 2).o; |
1970 | 2.69M | if (!IS_CONCRETE(obj)) |
1971 | 0 | MVM_exception_throw_adhoc(tc, "Cannot look up attributes in a %s type object", STABLE(obj)->debug_name); |
1972 | 2.69M | REPR(obj)->attr_funcs.get_attribute(tc, |
1973 | 2.69M | STABLE(obj), obj, OBJECT_BODY(obj), |
1974 | 2.69M | GET_REG(cur_op, 4).o, MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), |
1975 | 2.69M | GET_I16(cur_op, 10), &GET_REG(cur_op, 0), MVM_reg_int64); |
1976 | 2.69M | cur_op += 12; |
1977 | 2.69M | goto NEXT; |
1978 | 2.69M | } |
1979 | 383 | OP(getattr_n): { |
1980 | 383 | MVMObject *obj = GET_REG(cur_op, 2).o; |
1981 | 383 | if (!IS_CONCRETE(obj)) |
1982 | 0 | MVM_exception_throw_adhoc(tc, "Cannot look up attributes in a %s type object", STABLE(obj)->debug_name); |
1983 | 383 | REPR(obj)->attr_funcs.get_attribute(tc, |
1984 | 383 | STABLE(obj), obj, OBJECT_BODY(obj), |
1985 | 383 | GET_REG(cur_op, 4).o, MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), |
1986 | 383 | GET_I16(cur_op, 10), &GET_REG(cur_op, 0), MVM_reg_num64); |
1987 | 383 | cur_op += 12; |
1988 | 383 | goto NEXT; |
1989 | 383 | } |
1990 | 976k | OP(getattr_s): { |
1991 | 976k | MVMObject *obj = GET_REG(cur_op, 2).o; |
1992 | 976k | if (!IS_CONCRETE(obj)) |
1993 | 0 | MVM_exception_throw_adhoc(tc, "Cannot look up attributes in a %s type object", STABLE(obj)->debug_name); |
1994 | 976k | REPR(obj)->attr_funcs.get_attribute(tc, |
1995 | 976k | STABLE(obj), obj, OBJECT_BODY(obj), |
1996 | 976k | GET_REG(cur_op, 4).o, MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), |
1997 | 976k | GET_I16(cur_op, 10), &GET_REG(cur_op, 0), MVM_reg_str); |
1998 | 976k | cur_op += 12; |
1999 | 976k | goto NEXT; |
2000 | 976k | } |
2001 | 4.09M | OP(getattr_o): { |
2002 | 4.09M | MVMObject *obj = GET_REG(cur_op, 2).o; |
2003 | 4.09M | if (!IS_CONCRETE(obj)) |
2004 | 0 | MVM_exception_throw_adhoc(tc, "Cannot look up attributes in a %s type object", STABLE(obj)->debug_name); |
2005 | 4.09M | REPR(obj)->attr_funcs.get_attribute(tc, |
2006 | 4.09M | STABLE(obj), obj, OBJECT_BODY(obj), |
2007 | 4.09M | GET_REG(cur_op, 4).o, MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), |
2008 | 4.09M | GET_I16(cur_op, 10), &GET_REG(cur_op, 0), MVM_reg_obj); |
2009 | 4.09M | cur_op += 12; |
2010 | 4.09M | goto NEXT; |
2011 | 4.09M | } |
2012 | 0 | OP(getattrs_i): { |
2013 | 0 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2014 | 0 | if (!IS_CONCRETE(obj)) |
2015 | 0 | MVM_exception_throw_adhoc(tc, "Cannot look up attributes in a %s type object", STABLE(obj)->debug_name); |
2016 | 0 | REPR(obj)->attr_funcs.get_attribute(tc, |
2017 | 0 | STABLE(obj), obj, OBJECT_BODY(obj), |
2018 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).s, |
2019 | 0 | -1, &GET_REG(cur_op, 0), MVM_reg_int64); |
2020 | 0 | cur_op += 8; |
2021 | 0 | goto NEXT; |
2022 | 0 | } |
2023 | 0 | OP(getattrs_n): { |
2024 | 0 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2025 | 0 | if (!IS_CONCRETE(obj)) |
2026 | 0 | MVM_exception_throw_adhoc(tc, "Cannot look up attributes in a %s type object", STABLE(obj)->debug_name); |
2027 | 0 | REPR(obj)->attr_funcs.get_attribute(tc, |
2028 | 0 | STABLE(obj), obj, OBJECT_BODY(obj), |
2029 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).s, |
2030 | 0 | -1, &GET_REG(cur_op, 0), MVM_reg_num64); |
2031 | 0 | cur_op += 8; |
2032 | 0 | goto NEXT; |
2033 | 0 | } |
2034 | 0 | OP(getattrs_s): { |
2035 | 0 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2036 | 0 | if (!IS_CONCRETE(obj)) |
2037 | 0 | MVM_exception_throw_adhoc(tc, "Cannot look up attributes in a %s type object", STABLE(obj)->debug_name); |
2038 | 0 | REPR(obj)->attr_funcs.get_attribute(tc, |
2039 | 0 | STABLE(obj), obj, OBJECT_BODY(obj), |
2040 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).s, |
2041 | 0 | -1, &GET_REG(cur_op, 0), MVM_reg_str); |
2042 | 0 | cur_op += 8; |
2043 | 0 | goto NEXT; |
2044 | 0 | } |
2045 | 0 | OP(getattrs_o): { |
2046 | 0 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2047 | 0 | if (!IS_CONCRETE(obj)) |
2048 | 0 | MVM_exception_throw_adhoc(tc, "Cannot look up attributes in a %s type object", STABLE(obj)->debug_name); |
2049 | 0 | REPR(obj)->attr_funcs.get_attribute(tc, |
2050 | 0 | STABLE(obj), obj, OBJECT_BODY(obj), |
2051 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).s, |
2052 | 0 | -1, &GET_REG(cur_op, 0), MVM_reg_obj); |
2053 | 0 | cur_op += 8; |
2054 | 0 | goto NEXT; |
2055 | 0 | } |
2056 | 7 | OP(attrinited): { |
2057 | 7 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2058 | 7 | if (!IS_CONCRETE(obj)) |
2059 | 0 | MVM_exception_throw_adhoc(tc, "Cannot look up attributes in a %s type object", STABLE(obj)->debug_name); |
2060 | 7 | GET_REG(cur_op, 0).i64 = REPR(obj)->attr_funcs.is_attribute_initialized(tc, |
2061 | 7 | STABLE(obj), OBJECT_BODY(obj), |
2062 | 7 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).s, MVM_NO_HINT); |
2063 | 7 | cur_op += 8; |
2064 | 7 | goto NEXT; |
2065 | 7 | } |
2066 | 1.86M | OP(box_i): { |
2067 | 1.86M | MVM_box_int(tc, GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).o, |
2068 | 1.86M | &GET_REG(cur_op, 0)); |
2069 | 1.86M | cur_op += 6; |
2070 | 1.86M | goto NEXT; |
2071 | 1.86M | } |
2072 | 106k | OP(box_n): { |
2073 | 106k | MVM_box_num(tc, GET_REG(cur_op, 2).n64, GET_REG(cur_op, 4).o, |
2074 | 106k | &GET_REG(cur_op, 0)); |
2075 | 106k | cur_op += 6; |
2076 | 106k | goto NEXT; |
2077 | 106k | } |
2078 | 531k | OP(box_s): { |
2079 | 531k | MVM_box_str(tc, GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).o, &GET_REG(cur_op, 0)); |
2080 | 531k | cur_op += 6; |
2081 | 531k | goto NEXT; |
2082 | 531k | } |
2083 | 274k | OP(unbox_i): { |
2084 | 274k | MVMObject *obj = GET_REG(cur_op, 2).o; |
2085 | 274k | if (!IS_CONCRETE(obj)) |
2086 | 0 | MVM_exception_throw_adhoc(tc, "Cannot unbox a type object (%s) to an int.", STABLE(obj)->debug_name); |
2087 | 274k | GET_REG(cur_op, 0).i64 = REPR(obj)->box_funcs.get_int(tc, |
2088 | 274k | STABLE(obj), obj, OBJECT_BODY(obj)); |
2089 | 274k | cur_op += 4; |
2090 | 274k | goto NEXT; |
2091 | 274k | } |
2092 | 4 | OP(unbox_n): { |
2093 | 4 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2094 | 4 | if (!IS_CONCRETE(obj)) |
2095 | 0 | MVM_exception_throw_adhoc(tc, "Cannot unbox a type object (%s) to a num.", STABLE(obj)->debug_name); |
2096 | 4 | GET_REG(cur_op, 0).n64 = REPR(obj)->box_funcs.get_num(tc, |
2097 | 4 | STABLE(obj), obj, OBJECT_BODY(obj)); |
2098 | 4 | cur_op += 4; |
2099 | 4 | goto NEXT; |
2100 | 4 | } |
2101 | 97.2k | OP(unbox_s): { |
2102 | 97.2k | MVMObject *obj = GET_REG(cur_op, 2).o; |
2103 | 97.2k | if (!IS_CONCRETE(obj)) |
2104 | 0 | MVM_exception_throw_adhoc(tc, "Cannot unbox a type object (%s) to a str.", STABLE(obj)->debug_name); |
2105 | 97.2k | GET_REG(cur_op, 0).s = REPR(obj)->box_funcs.get_str(tc, |
2106 | 97.2k | STABLE(obj), obj, OBJECT_BODY(obj)); |
2107 | 97.2k | cur_op += 4; |
2108 | 97.2k | goto NEXT; |
2109 | 97.2k | } |
2110 | 4.52M | OP(atpos_i): { |
2111 | 4.52M | MVMObject *obj = GET_REG(cur_op, 2).o; |
2112 | 4.52M | REPR(obj)->pos_funcs.at_pos(tc, STABLE(obj), obj, |
2113 | 4.52M | OBJECT_BODY(obj), GET_REG(cur_op, 4).i64, |
2114 | 4.52M | &GET_REG(cur_op, 0), MVM_reg_int64); |
2115 | 4.52M | cur_op += 6; |
2116 | 4.52M | goto NEXT; |
2117 | 4.52M | } |
2118 | 7 | OP(atpos_n): { |
2119 | 7 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2120 | 7 | REPR(obj)->pos_funcs.at_pos(tc, STABLE(obj), obj, |
2121 | 7 | OBJECT_BODY(obj), GET_REG(cur_op, 4).i64, |
2122 | 7 | &GET_REG(cur_op, 0), MVM_reg_num64); |
2123 | 7 | cur_op += 6; |
2124 | 7 | goto NEXT; |
2125 | 7 | } |
2126 | 9 | OP(atpos_s): { |
2127 | 9 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2128 | 9 | REPR(obj)->pos_funcs.at_pos(tc, STABLE(obj), obj, |
2129 | 9 | OBJECT_BODY(obj), GET_REG(cur_op, 4).i64, |
2130 | 9 | &GET_REG(cur_op, 0), MVM_reg_str); |
2131 | 9 | cur_op += 6; |
2132 | 9 | goto NEXT; |
2133 | 9 | } |
2134 | 1.61M | OP(atpos_o): { |
2135 | 1.61M | MVMObject *obj = GET_REG(cur_op, 2).o; |
2136 | 1.61M | if (IS_CONCRETE(obj)) |
2137 | 1.61M | REPR(obj)->pos_funcs.at_pos(tc, STABLE(obj), obj, |
2138 | 1.61M | OBJECT_BODY(obj), GET_REG(cur_op, 4).i64, |
2139 | 1.61M | &GET_REG(cur_op, 0), MVM_reg_obj); |
2140 | 1.61M | else |
2141 | 0 | GET_REG(cur_op, 0).o = tc->instance->VMNull; |
2142 | 1.61M | cur_op += 6; |
2143 | 1.61M | goto NEXT; |
2144 | 1.61M | } |
2145 | 4.69k | OP(bindpos_i): { |
2146 | 4.69k | MVMObject *obj = GET_REG(cur_op, 0).o; |
2147 | 4.69k | REPR(obj)->pos_funcs.bind_pos(tc, STABLE(obj), obj, |
2148 | 4.69k | OBJECT_BODY(obj), GET_REG(cur_op, 2).i64, |
2149 | 4.69k | GET_REG(cur_op, 4), MVM_reg_int64); |
2150 | 4.69k | MVM_SC_WB_OBJ(tc, obj); |
2151 | 4.69k | cur_op += 6; |
2152 | 4.69k | goto NEXT; |
2153 | 4.69k | } |
2154 | 4 | OP(bindpos_n): { |
2155 | 4 | MVMObject *obj = GET_REG(cur_op, 0).o; |
2156 | 4 | REPR(obj)->pos_funcs.bind_pos(tc, STABLE(obj), obj, |
2157 | 4 | OBJECT_BODY(obj), GET_REG(cur_op, 2).i64, |
2158 | 4 | GET_REG(cur_op, 4), MVM_reg_num64); |
2159 | 4 | MVM_SC_WB_OBJ(tc, obj); |
2160 | 4 | cur_op += 6; |
2161 | 4 | goto NEXT; |
2162 | 4 | } |
2163 | 5 | OP(bindpos_s): { |
2164 | 5 | MVMObject *obj = GET_REG(cur_op, 0).o; |
2165 | 5 | REPR(obj)->pos_funcs.bind_pos(tc, STABLE(obj), obj, |
2166 | 5 | OBJECT_BODY(obj), GET_REG(cur_op, 2).i64, |
2167 | 5 | GET_REG(cur_op, 4), MVM_reg_str); |
2168 | 5 | MVM_SC_WB_OBJ(tc, obj); |
2169 | 5 | cur_op += 6; |
2170 | 5 | goto NEXT; |
2171 | 5 | } |
2172 | 75.8k | OP(bindpos_o): { |
2173 | 75.8k | MVMObject *obj = GET_REG(cur_op, 0).o; |
2174 | 75.8k | REPR(obj)->pos_funcs.bind_pos(tc, STABLE(obj), obj, |
2175 | 75.8k | OBJECT_BODY(obj), GET_REG(cur_op, 2).i64, |
2176 | 75.8k | GET_REG(cur_op, 4), MVM_reg_obj); |
2177 | 75.8k | MVM_SC_WB_OBJ(tc, obj); |
2178 | 75.8k | cur_op += 6; |
2179 | 75.8k | goto NEXT; |
2180 | 75.8k | } |
2181 | 6.19M | OP(push_i): { |
2182 | 6.19M | MVMObject *obj = GET_REG(cur_op, 0).o; |
2183 | 6.19M | REPR(obj)->pos_funcs.push(tc, STABLE(obj), obj, |
2184 | 6.19M | OBJECT_BODY(obj), GET_REG(cur_op, 2), MVM_reg_int64); |
2185 | 6.19M | MVM_SC_WB_OBJ(tc, GET_REG(cur_op, 0).o); |
2186 | 6.19M | cur_op += 4; |
2187 | 6.19M | goto NEXT; |
2188 | 6.19M | } |
2189 | 8 | OP(push_n): { |
2190 | 8 | MVMObject *obj = GET_REG(cur_op, 0).o; |
2191 | 8 | REPR(obj)->pos_funcs.push(tc, STABLE(obj), obj, |
2192 | 8 | OBJECT_BODY(obj), GET_REG(cur_op, 2), MVM_reg_num64); |
2193 | 8 | MVM_SC_WB_OBJ(tc, GET_REG(cur_op, 0).o); |
2194 | 8 | cur_op += 4; |
2195 | 8 | goto NEXT; |
2196 | 8 | } |
2197 | 10.5k | OP(push_s): { |
2198 | 10.5k | MVMObject *obj = GET_REG(cur_op, 0).o; |
2199 | 10.5k | REPR(obj)->pos_funcs.push(tc, STABLE(obj), obj, |
2200 | 10.5k | OBJECT_BODY(obj), GET_REG(cur_op, 2), MVM_reg_str); |
2201 | 10.5k | MVM_SC_WB_OBJ(tc, GET_REG(cur_op, 0).o); |
2202 | 10.5k | cur_op += 4; |
2203 | 10.5k | goto NEXT; |
2204 | 10.5k | } |
2205 | 908k | OP(push_o): { |
2206 | 908k | MVMObject *obj = GET_REG(cur_op, 0).o; |
2207 | 908k | REPR(obj)->pos_funcs.push(tc, STABLE(obj), obj, |
2208 | 908k | OBJECT_BODY(obj), GET_REG(cur_op, 2), MVM_reg_obj); |
2209 | 908k | MVM_SC_WB_OBJ(tc, GET_REG(cur_op, 0).o); |
2210 | 908k | cur_op += 4; |
2211 | 908k | goto NEXT; |
2212 | 908k | } |
2213 | 2.03M | OP(pop_i): { |
2214 | 2.03M | MVMObject *obj = GET_REG(cur_op, 2).o; |
2215 | 2.03M | REPR(obj)->pos_funcs.pop(tc, STABLE(obj), obj, |
2216 | 2.03M | OBJECT_BODY(obj), &GET_REG(cur_op, 0), MVM_reg_int64); |
2217 | 2.03M | cur_op += 4; |
2218 | 2.03M | goto NEXT; |
2219 | 2.03M | } |
2220 | 1 | OP(pop_n): { |
2221 | 1 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2222 | 1 | REPR(obj)->pos_funcs.pop(tc, STABLE(obj), obj, |
2223 | 1 | OBJECT_BODY(obj), &GET_REG(cur_op, 0), MVM_reg_num64); |
2224 | 1 | cur_op += 4; |
2225 | 1 | goto NEXT; |
2226 | 1 | } |
2227 | 1 | OP(pop_s): { |
2228 | 1 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2229 | 1 | REPR(obj)->pos_funcs.pop(tc, STABLE(obj), obj, |
2230 | 1 | OBJECT_BODY(obj), &GET_REG(cur_op, 0), MVM_reg_str); |
2231 | 1 | cur_op += 4; |
2232 | 1 | goto NEXT; |
2233 | 1 | } |
2234 | 97.6k | OP(pop_o): { |
2235 | 97.6k | MVMObject *obj = GET_REG(cur_op, 2).o; |
2236 | 97.6k | REPR(obj)->pos_funcs.pop(tc, STABLE(obj), obj, |
2237 | 97.6k | OBJECT_BODY(obj), &GET_REG(cur_op, 0), MVM_reg_obj); |
2238 | 97.6k | cur_op += 4; |
2239 | 97.6k | goto NEXT; |
2240 | 97.6k | } |
2241 | 2 | OP(shift_i): { |
2242 | 2 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2243 | 2 | REPR(obj)->pos_funcs.shift(tc, STABLE(obj), obj, |
2244 | 2 | OBJECT_BODY(obj), &GET_REG(cur_op, 0), MVM_reg_int64); |
2245 | 2 | cur_op += 4; |
2246 | 2 | goto NEXT; |
2247 | 2 | } |
2248 | 0 | OP(shift_n): { |
2249 | 0 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2250 | 0 | REPR(obj)->pos_funcs.shift(tc, STABLE(obj), obj, |
2251 | 0 | OBJECT_BODY(obj), &GET_REG(cur_op, 0), MVM_reg_num64); |
2252 | 0 | cur_op += 4; |
2253 | 0 | goto NEXT; |
2254 | 0 | } |
2255 | 2 | OP(shift_s): { |
2256 | 2 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2257 | 2 | REPR(obj)->pos_funcs.shift(tc, STABLE(obj), obj, |
2258 | 2 | OBJECT_BODY(obj), &GET_REG(cur_op, 0), MVM_reg_str); |
2259 | 2 | cur_op += 4; |
2260 | 2 | goto NEXT; |
2261 | 2 | } |
2262 | 472k | OP(shift_o): { |
2263 | 472k | MVMObject *obj = GET_REG(cur_op, 2).o; |
2264 | 472k | REPR(obj)->pos_funcs.shift(tc, STABLE(obj), obj, |
2265 | 472k | OBJECT_BODY(obj), &GET_REG(cur_op, 0), MVM_reg_obj); |
2266 | 472k | cur_op += 4; |
2267 | 472k | goto NEXT; |
2268 | 472k | } |
2269 | 1 | OP(unshift_i): { |
2270 | 1 | MVMObject *obj = GET_REG(cur_op, 0).o; |
2271 | 1 | REPR(obj)->pos_funcs.unshift(tc, STABLE(obj), obj, |
2272 | 1 | OBJECT_BODY(obj), GET_REG(cur_op, 2), MVM_reg_int64); |
2273 | 1 | cur_op += 4; |
2274 | 1 | goto NEXT; |
2275 | 1 | } |
2276 | 0 | OP(unshift_n): { |
2277 | 0 | MVMObject *obj = GET_REG(cur_op, 0).o; |
2278 | 0 | REPR(obj)->pos_funcs.unshift(tc, STABLE(obj), obj, |
2279 | 0 | OBJECT_BODY(obj), GET_REG(cur_op, 2), MVM_reg_num64); |
2280 | 0 | cur_op += 4; |
2281 | 0 | goto NEXT; |
2282 | 0 | } |
2283 | 1 | OP(unshift_s): { |
2284 | 1 | MVMObject *obj = GET_REG(cur_op, 0).o; |
2285 | 1 | REPR(obj)->pos_funcs.unshift(tc, STABLE(obj), obj, |
2286 | 1 | OBJECT_BODY(obj), GET_REG(cur_op, 2), MVM_reg_str); |
2287 | 1 | cur_op += 4; |
2288 | 1 | goto NEXT; |
2289 | 1 | } |
2290 | 21.5k | OP(unshift_o): { |
2291 | 21.5k | MVMObject *obj = GET_REG(cur_op, 0).o; |
2292 | 21.5k | REPR(obj)->pos_funcs.unshift(tc, STABLE(obj), obj, |
2293 | 21.5k | OBJECT_BODY(obj), GET_REG(cur_op, 2), MVM_reg_obj); |
2294 | 21.5k | cur_op += 4; |
2295 | 21.5k | goto NEXT; |
2296 | 21.5k | } |
2297 | 56.1k | OP(splice): { |
2298 | 56.1k | MVMObject *obj = GET_REG(cur_op, 0).o; |
2299 | 56.1k | REPR(obj)->pos_funcs.splice(tc, STABLE(obj), obj, |
2300 | 56.1k | OBJECT_BODY(obj), GET_REG(cur_op, 2).o, |
2301 | 56.1k | GET_REG(cur_op, 4).i64, GET_REG(cur_op, 6).i64); |
2302 | 56.1k | cur_op += 8; |
2303 | 56.1k | goto NEXT; |
2304 | 56.1k | } |
2305 | 502k | OP(setelemspos): { |
2306 | 502k | MVMObject *obj = GET_REG(cur_op, 0).o; |
2307 | 502k | REPR(obj)->pos_funcs.set_elems(tc, STABLE(obj), obj, |
2308 | 502k | OBJECT_BODY(obj), GET_REG(cur_op, 2).i64); |
2309 | 502k | cur_op += 4; |
2310 | 502k | goto NEXT; |
2311 | 502k | } |
2312 | 7 | OP(existspos): |
2313 | 7 | GET_REG(cur_op, 0).i64 = MVM_repr_exists_pos(tc, |
2314 | 7 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).i64); |
2315 | 7 | cur_op += 6; |
2316 | 7 | goto NEXT; |
2317 | 1 | OP(atkey_i): { |
2318 | 1 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2319 | 1 | REPR(obj)->ass_funcs.at_key(tc, STABLE(obj), obj, OBJECT_BODY(obj), |
2320 | 1 | (MVMObject *)GET_REG(cur_op, 4).s, &GET_REG(cur_op, 0), MVM_reg_int64); |
2321 | 1 | cur_op += 6; |
2322 | 1 | goto NEXT; |
2323 | 1 | } |
2324 | 1 | OP(atkey_n): { |
2325 | 1 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2326 | 1 | REPR(obj)->ass_funcs.at_key(tc, STABLE(obj), obj, OBJECT_BODY(obj), |
2327 | 1 | (MVMObject *)GET_REG(cur_op, 4).s, &GET_REG(cur_op, 0), MVM_reg_num64); |
2328 | 1 | cur_op += 6; |
2329 | 1 | goto NEXT; |
2330 | 1 | } |
2331 | 1 | OP(atkey_s): { |
2332 | 1 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2333 | 1 | REPR(obj)->ass_funcs.at_key(tc, STABLE(obj), obj, OBJECT_BODY(obj), |
2334 | 1 | (MVMObject *)GET_REG(cur_op, 4).s, &GET_REG(cur_op, 0), MVM_reg_str); |
2335 | 1 | cur_op += 6; |
2336 | 1 | goto NEXT; |
2337 | 1 | } |
2338 | 2.35M | OP(atkey_o): { |
2339 | 2.35M | MVMObject *obj = GET_REG(cur_op, 2).o; |
2340 | 2.35M | if (IS_CONCRETE(obj)) |
2341 | 2.35M | REPR(obj)->ass_funcs.at_key(tc, STABLE(obj), obj, OBJECT_BODY(obj), |
2342 | 2.35M | (MVMObject *)GET_REG(cur_op, 4).s, &GET_REG(cur_op, 0), MVM_reg_obj); |
2343 | 2.35M | else |
2344 | 3.37k | GET_REG(cur_op, 0).o = tc->instance->VMNull; |
2345 | 2.35M | cur_op += 6; |
2346 | 2.35M | goto NEXT; |
2347 | 2.35M | } |
2348 | 1 | OP(bindkey_i): { |
2349 | 1 | MVMObject *obj = GET_REG(cur_op, 0).o; |
2350 | 1 | REPR(obj)->ass_funcs.bind_key(tc, STABLE(obj), obj, |
2351 | 1 | OBJECT_BODY(obj), (MVMObject *)GET_REG(cur_op, 2).s, |
2352 | 1 | GET_REG(cur_op, 4), MVM_reg_int64); |
2353 | 1 | MVM_SC_WB_OBJ(tc, obj); |
2354 | 1 | cur_op += 6; |
2355 | 1 | goto NEXT; |
2356 | 1 | } |
2357 | 1 | OP(bindkey_n): { |
2358 | 1 | MVMObject *obj = GET_REG(cur_op, 0).o; |
2359 | 1 | REPR(obj)->ass_funcs.bind_key(tc, STABLE(obj), obj, |
2360 | 1 | OBJECT_BODY(obj), (MVMObject *)GET_REG(cur_op, 2).s, |
2361 | 1 | GET_REG(cur_op, 4), MVM_reg_num64); |
2362 | 1 | MVM_SC_WB_OBJ(tc, obj); |
2363 | 1 | cur_op += 6; |
2364 | 1 | goto NEXT; |
2365 | 1 | } |
2366 | 1 | OP(bindkey_s): { |
2367 | 1 | MVMObject *obj = GET_REG(cur_op, 0).o; |
2368 | 1 | REPR(obj)->ass_funcs.bind_key(tc, STABLE(obj), obj, |
2369 | 1 | OBJECT_BODY(obj), (MVMObject *)GET_REG(cur_op, 2).s, |
2370 | 1 | GET_REG(cur_op, 4), MVM_reg_str); |
2371 | 1 | MVM_SC_WB_OBJ(tc, obj); |
2372 | 1 | cur_op += 6; |
2373 | 1 | goto NEXT; |
2374 | 1 | } |
2375 | 460k | OP(bindkey_o): { |
2376 | 460k | MVMObject *obj = GET_REG(cur_op, 0).o; |
2377 | 460k | REPR(obj)->ass_funcs.bind_key(tc, STABLE(obj), obj, |
2378 | 460k | OBJECT_BODY(obj), (MVMObject *)GET_REG(cur_op, 2).s, |
2379 | 460k | GET_REG(cur_op, 4), MVM_reg_obj); |
2380 | 460k | MVM_SC_WB_OBJ(tc, obj); |
2381 | 460k | cur_op += 6; |
2382 | 460k | goto NEXT; |
2383 | 460k | } |
2384 | 340k | OP(existskey): { |
2385 | 340k | MVMObject *obj = GET_REG(cur_op, 2).o; |
2386 | 340k | GET_REG(cur_op, 0).i64 = REPR(obj)->ass_funcs.exists_key(tc, |
2387 | 340k | STABLE(obj), obj, OBJECT_BODY(obj), |
2388 | 340k | (MVMObject *)GET_REG(cur_op, 4).s); |
2389 | 340k | cur_op += 6; |
2390 | 340k | goto NEXT; |
2391 | 340k | } |
2392 | 104k | OP(deletekey): { |
2393 | 104k | MVMObject *obj = GET_REG(cur_op, 0).o; |
2394 | 104k | REPR(obj)->ass_funcs.delete_key(tc, STABLE(obj), obj, |
2395 | 104k | OBJECT_BODY(obj), (MVMObject *)GET_REG(cur_op, 2).s); |
2396 | 104k | MVM_SC_WB_OBJ(tc, obj); |
2397 | 104k | cur_op += 4; |
2398 | 104k | goto NEXT; |
2399 | 104k | } |
2400 | 3.32M | OP(elems): { |
2401 | 3.32M | MVMObject *obj = GET_REG(cur_op, 2).o; |
2402 | 3.32M | GET_REG(cur_op, 0).i64 = (MVMint64)REPR(obj)->elems(tc, STABLE(obj), obj, OBJECT_BODY(obj)); |
2403 | 3.32M | cur_op += 4; |
2404 | 3.32M | goto NEXT; |
2405 | 3.32M | } |
2406 | 281 | OP(knowhow): |
2407 | 281 | GET_REG(cur_op, 0).o = tc->instance->KnowHOW; |
2408 | 281 | cur_op += 2; |
2409 | 281 | goto NEXT; |
2410 | 132 | OP(knowhowattr): |
2411 | 132 | GET_REG(cur_op, 0).o = tc->instance->KnowHOWAttribute; |
2412 | 132 | cur_op += 2; |
2413 | 132 | goto NEXT; |
2414 | 749 | OP(newtype): { |
2415 | 749 | MVMObject *how = GET_REG(cur_op, 2).o; |
2416 | 749 | MVMString *repr_name = GET_REG(cur_op, 4).s; |
2417 | 749 | const MVMREPROps *repr = MVM_repr_get_by_name(tc, repr_name); |
2418 | 749 | GET_REG(cur_op, 0).o = repr->type_object_for(tc, how); |
2419 | 749 | cur_op += 6; |
2420 | 749 | goto NEXT; |
2421 | 749 | } |
2422 | 456 | OP(composetype): { |
2423 | 456 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2424 | 456 | REPR(obj)->compose(tc, STABLE(obj), GET_REG(cur_op, 4).o); |
2425 | 456 | GET_REG(cur_op, 0).o = GET_REG(cur_op, 2).o; |
2426 | 456 | cur_op += 6; |
2427 | 456 | goto NEXT; |
2428 | 456 | } |
2429 | 703 | OP(setmethcache): { |
2430 | 703 | MVMObject *iter = MVM_iter(tc, GET_REG(cur_op, 2).o); |
2431 | 703 | MVMObject *cache; |
2432 | 703 | MVMSTable *stable; |
2433 | 703 | MVMROOT(tc, iter, { |
2434 | 703 | cache = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTHash); |
2435 | 703 | }); |
2436 | 703 | |
2437 | 14.4k | while (MVM_iter_istrue(tc, (MVMIter *)iter)) { |
2438 | 13.7k | MVMRegister result; |
2439 | 13.7k | REPR(iter)->pos_funcs.shift(tc, STABLE(iter), iter, |
2440 | 13.7k | OBJECT_BODY(iter), &result, MVM_reg_obj); |
2441 | 13.7k | MVM_repr_bind_key_o(tc, cache, MVM_iterkey_s(tc, (MVMIter *)iter), |
2442 | 13.7k | MVM_iterval(tc, (MVMIter *)iter)); |
2443 | 13.7k | } |
2444 | 703 | |
2445 | 703 | stable = STABLE(GET_REG(cur_op, 0).o); |
2446 | 703 | MVM_ASSIGN_REF(tc, &(stable->header), stable->method_cache, cache); |
2447 | 703 | stable->method_cache_sc = NULL; |
2448 | 703 | MVM_SC_WB_ST(tc, stable); |
2449 | 703 | |
2450 | 703 | cur_op += 4; |
2451 | 703 | goto NEXT; |
2452 | 703 | } |
2453 | 1.68k | OP(setmethcacheauth): { |
2454 | 1.68k | MVMObject *obj = GET_REG(cur_op, 0).o; |
2455 | 1.68k | MVMint64 new_flags = STABLE(obj)->mode_flags & (~MVM_METHOD_CACHE_AUTHORITATIVE); |
2456 | 1.68k | MVMint64 flag = GET_REG(cur_op, 2).i64; |
2457 | 1.68k | if (flag != 0) |
2458 | 692 | new_flags |= MVM_METHOD_CACHE_AUTHORITATIVE; |
2459 | 1.68k | STABLE(obj)->mode_flags = new_flags; |
2460 | 1.68k | MVM_SC_WB_ST(tc, STABLE(obj)); |
2461 | 1.68k | cur_op += 4; |
2462 | 1.68k | goto NEXT; |
2463 | 1.68k | } |
2464 | 692 | OP(settypecache): { |
2465 | 692 | MVMObject *obj = GET_REG(cur_op, 0).o; |
2466 | 692 | MVMObject *types = GET_REG(cur_op, 2).o; |
2467 | 692 | MVMSTable *st = STABLE(obj); |
2468 | 692 | MVMint64 i, elems = REPR(types)->elems(tc, STABLE(types), types, OBJECT_BODY(types)); |
2469 | 692 | MVMObject **cache = MVM_malloc(sizeof(MVMObject *) * elems); |
2470 | 3.16k | for (i = 0; i < elems; i++) { |
2471 | 2.47k | MVM_ASSIGN_REF(tc, &(st->header), cache[i], MVM_repr_at_pos_o(tc, types, i)); |
2472 | 2.47k | } |
2473 | 692 | /* technically this free isn't thread safe */ |
2474 | 692 | if (st->type_check_cache) |
2475 | 1 | MVM_free(st->type_check_cache); |
2476 | 692 | st->type_check_cache = cache; |
2477 | 692 | st->type_check_cache_length = (MVMuint16)elems; |
2478 | 692 | MVM_SC_WB_ST(tc, st); |
2479 | 692 | cur_op += 4; |
2480 | 692 | goto NEXT; |
2481 | 692 | } |
2482 | 6 | OP(settypecheckmode): { |
2483 | 6 | MVMSTable *st = STABLE(GET_REG(cur_op, 0).o); |
2484 | 6 | st->mode_flags = GET_REG(cur_op, 2).i64 | |
2485 | 6 | (st->mode_flags & (~MVM_TYPE_CHECK_CACHE_FLAG_MASK)); |
2486 | 6 | MVM_SC_WB_ST(tc, st); |
2487 | 6 | cur_op += 4; |
2488 | 6 | goto NEXT; |
2489 | 6 | } |
2490 | 1.08k | OP(setboolspec): { |
2491 | 1.08k | MVMSTable *st = GET_REG(cur_op, 0).o->st; |
2492 | 1.08k | MVMBoolificationSpec *bs = MVM_malloc(sizeof(MVMBoolificationSpec)); |
2493 | 1.08k | MVMBoolificationSpec *orig_bs = st->boolification_spec; |
2494 | 1.08k | bs->mode = (MVMuint32)GET_REG(cur_op, 2).i64; |
2495 | 1.08k | MVM_ASSIGN_REF(tc, &(st->header), bs->method, GET_REG(cur_op, 4).o); |
2496 | 1.08k | st->boolification_spec = bs; |
2497 | 1.08k | MVM_free(orig_bs); |
2498 | 1.08k | cur_op += 6; |
2499 | 1.08k | goto NEXT; |
2500 | 1.08k | } |
2501 | 173k | OP(istrue): { |
2502 | 173k | /* Increment PC first then call coerce, since it may want to |
2503 | 173k | * do an invocation. */ |
2504 | 173k | MVMObject *obj = GET_REG(cur_op, 2).o; |
2505 | 173k | MVMRegister *res = &GET_REG(cur_op, 0); |
2506 | 173k | cur_op += 4; |
2507 | 173k | MVM_coerce_istrue(tc, obj, res, NULL, NULL, 0); |
2508 | 173k | goto NEXT; |
2509 | 173k | } |
2510 | 122k | OP(isfalse): { |
2511 | 122k | /* Increment PC first then call coerce, since it may want to |
2512 | 122k | * do an invocation. */ |
2513 | 122k | MVMObject *obj = GET_REG(cur_op, 2).o; |
2514 | 122k | MVMRegister *res = &GET_REG(cur_op, 0); |
2515 | 122k | cur_op += 4; |
2516 | 122k | MVM_coerce_istrue(tc, obj, res, NULL, NULL, 1); |
2517 | 122k | goto NEXT; |
2518 | 122k | } |
2519 | 0 | OP(bootint): |
2520 | 0 | GET_REG(cur_op, 0).o = tc->instance->boot_types.BOOTInt; |
2521 | 0 | cur_op += 2; |
2522 | 0 | goto NEXT; |
2523 | 0 | OP(bootnum): |
2524 | 0 | GET_REG(cur_op, 0).o = tc->instance->boot_types.BOOTNum; |
2525 | 0 | cur_op += 2; |
2526 | 0 | goto NEXT; |
2527 | 0 | OP(bootstr): |
2528 | 0 | GET_REG(cur_op, 0).o = tc->instance->boot_types.BOOTStr; |
2529 | 0 | cur_op += 2; |
2530 | 0 | goto NEXT; |
2531 | 1.45k | OP(bootarray): |
2532 | 1.45k | GET_REG(cur_op, 0).o = tc->instance->boot_types.BOOTArray; |
2533 | 1.45k | cur_op += 2; |
2534 | 1.45k | goto NEXT; |
2535 | 68.9k | OP(bootintarray): |
2536 | 68.9k | GET_REG(cur_op, 0).o = tc->instance->boot_types.BOOTIntArray; |
2537 | 68.9k | cur_op += 2; |
2538 | 68.9k | goto NEXT; |
2539 | 10 | OP(bootnumarray): |
2540 | 10 | GET_REG(cur_op, 0).o = tc->instance->boot_types.BOOTNumArray; |
2541 | 10 | cur_op += 2; |
2542 | 10 | goto NEXT; |
2543 | 31.9k | OP(bootstrarray): |
2544 | 31.9k | GET_REG(cur_op, 0).o = tc->instance->boot_types.BOOTStrArray; |
2545 | 31.9k | cur_op += 2; |
2546 | 31.9k | goto NEXT; |
2547 | 0 | OP(boothash): |
2548 | 0 | GET_REG(cur_op, 0).o = tc->instance->boot_types.BOOTHash; |
2549 | 0 | cur_op += 2; |
2550 | 0 | goto NEXT; |
2551 | 90 | OP(isint): { |
2552 | 90 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2553 | 90 | GET_REG(cur_op, 0).i64 = obj && REPR(obj)->ID == MVM_REPR_ID_P6int ? 1 : 0; |
2554 | 90 | cur_op += 4; |
2555 | 90 | goto NEXT; |
2556 | 90 | } |
2557 | 26 | OP(isnum): { |
2558 | 26 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2559 | 26 | GET_REG(cur_op, 0).i64 = obj && REPR(obj)->ID == MVM_REPR_ID_P6num ? 1 : 0; |
2560 | 26 | cur_op += 4; |
2561 | 26 | goto NEXT; |
2562 | 26 | } |
2563 | 26.8k | OP(isstr): { |
2564 | 26.8k | MVMObject *obj = GET_REG(cur_op, 2).o; |
2565 | 26.8k | GET_REG(cur_op, 0).i64 = obj && REPR(obj)->ID == MVM_REPR_ID_P6str ? 1 : 0; |
2566 | 26.8k | cur_op += 4; |
2567 | 26.8k | goto NEXT; |
2568 | 26.8k | } |
2569 | 527k | OP(islist): { |
2570 | 527k | MVMObject *obj = GET_REG(cur_op, 2).o; |
2571 | 527k | GET_REG(cur_op, 0).i64 = obj && REPR(obj)->ID == MVM_REPR_ID_VMArray ? 1 : 0; |
2572 | 527k | cur_op += 4; |
2573 | 527k | goto NEXT; |
2574 | 527k | } |
2575 | 189k | OP(ishash): { |
2576 | 189k | MVMObject *obj = GET_REG(cur_op, 2).o; |
2577 | 189k | GET_REG(cur_op, 0).i64 = obj && REPR(obj)->ID == MVM_REPR_ID_MVMHash ? 1 : 0; |
2578 | 189k | cur_op += 4; |
2579 | 189k | goto NEXT; |
2580 | 189k | } |
2581 | 145 | OP(sethllconfig): |
2582 | 145 | MVM_hll_set_config(tc, GET_REG(cur_op, 0).s, GET_REG(cur_op, 2).o); |
2583 | 145 | cur_op += 4; |
2584 | 145 | goto NEXT; |
2585 | 1.86M | OP(hllboxtype_i): |
2586 | 1.86M | GET_REG(cur_op, 0).o = cu->body.hll_config->int_box_type; |
2587 | 1.86M | cur_op += 2; |
2588 | 1.86M | goto NEXT; |
2589 | 106k | OP(hllboxtype_n): |
2590 | 106k | GET_REG(cur_op, 0).o = cu->body.hll_config->num_box_type; |
2591 | 106k | cur_op += 2; |
2592 | 106k | goto NEXT; |
2593 | 531k | OP(hllboxtype_s): |
2594 | 531k | GET_REG(cur_op, 0).o = cu->body.hll_config->str_box_type; |
2595 | 531k | cur_op += 2; |
2596 | 531k | goto NEXT; |
2597 | 486k | OP(hlllist): |
2598 | 486k | GET_REG(cur_op, 0).o = cu->body.hll_config->slurpy_array_type; |
2599 | 486k | cur_op += 2; |
2600 | 486k | goto NEXT; |
2601 | 159k | OP(hllhash): |
2602 | 159k | GET_REG(cur_op, 0).o = cu->body.hll_config->slurpy_hash_type; |
2603 | 159k | cur_op += 2; |
2604 | 159k | goto NEXT; |
2605 | 3.78k | OP(getcomp): { |
2606 | 3.78k | MVMObject *obj = tc->instance->compiler_registry; |
2607 | 3.78k | uv_mutex_lock(&tc->instance->mutex_compiler_registry); |
2608 | 3.78k | GET_REG(cur_op, 0).o = MVM_repr_at_key_o(tc, obj, GET_REG(cur_op, 2).s); |
2609 | 3.78k | uv_mutex_unlock(&tc->instance->mutex_compiler_registry); |
2610 | 3.78k | cur_op += 4; |
2611 | 3.78k | goto NEXT; |
2612 | 3.78k | } |
2613 | 653 | OP(bindcomp): { |
2614 | 653 | MVMObject *obj = tc->instance->compiler_registry; |
2615 | 653 | uv_mutex_lock(&tc->instance->mutex_compiler_registry); |
2616 | 653 | REPR(obj)->ass_funcs.bind_key(tc, STABLE(obj), obj, OBJECT_BODY(obj), |
2617 | 653 | (MVMObject *)GET_REG(cur_op, 2).s, GET_REG(cur_op, 4), MVM_reg_obj); |
2618 | 653 | uv_mutex_unlock(&tc->instance->mutex_compiler_registry); |
2619 | 653 | GET_REG(cur_op, 0).o = GET_REG(cur_op, 4).o; |
2620 | 653 | cur_op += 6; |
2621 | 653 | goto NEXT; |
2622 | 653 | } |
2623 | 4.56k | OP(getcurhllsym): { |
2624 | 4.56k | MVMString *hll_name = tc->cur_frame->static_info->body.cu->body.hll_name; |
2625 | 4.56k | GET_REG(cur_op, 0).o = MVM_hll_sym_get(tc, hll_name, GET_REG(cur_op, 2).s); |
2626 | 4.56k | cur_op += 4; |
2627 | 4.56k | goto NEXT; |
2628 | 4.56k | } |
2629 | 1.69k | OP(bindcurhllsym): { |
2630 | 1.69k | MVMObject *syms = tc->instance->hll_syms, *hash; |
2631 | 1.69k | MVMString *hll_name = tc->cur_frame->static_info->body.cu->body.hll_name; |
2632 | 1.69k | uv_mutex_lock(&tc->instance->mutex_hll_syms); |
2633 | 1.69k | hash = MVM_repr_at_key_o(tc, syms, hll_name); |
2634 | 1.69k | if (MVM_is_null(tc, hash)) { |
2635 | 131 | hash = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTHash); |
2636 | 131 | /* must re-get syms in case it moved */ |
2637 | 131 | syms = tc->instance->hll_syms; |
2638 | 131 | hll_name = tc->cur_frame->static_info->body.cu->body.hll_name; |
2639 | 131 | MVM_repr_bind_key_o(tc, syms, hll_name, hash); |
2640 | 131 | } |
2641 | 1.69k | MVM_repr_bind_key_o(tc, hash, GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).o); |
2642 | 1.69k | GET_REG(cur_op, 0).o = GET_REG(cur_op, 4).o; |
2643 | 1.69k | uv_mutex_unlock(&tc->instance->mutex_hll_syms); |
2644 | 1.69k | cur_op += 6; |
2645 | 1.69k | goto NEXT; |
2646 | 1.69k | } |
2647 | 288 | OP(gethllsym): |
2648 | 288 | GET_REG(cur_op, 0).o = MVM_hll_sym_get(tc, |
2649 | 288 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s); |
2650 | 288 | cur_op += 6; |
2651 | 288 | goto NEXT; |
2652 | 6 | OP(bindhllsym): { |
2653 | 6 | MVMObject *syms = tc->instance->hll_syms; |
2654 | 6 | MVMString *hll_name = GET_REG(cur_op, 0).s; |
2655 | 6 | MVMObject *hash; |
2656 | 6 | uv_mutex_lock(&tc->instance->mutex_hll_syms); |
2657 | 6 | hash = MVM_repr_at_key_o(tc, syms, hll_name); |
2658 | 6 | if (MVM_is_null(tc, hash)) { |
2659 | 3 | hash = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTHash); |
2660 | 3 | /* must re-get syms and HLL name in case it moved */ |
2661 | 3 | syms = tc->instance->hll_syms; |
2662 | 3 | hll_name = GET_REG(cur_op, 0).s; |
2663 | 3 | MVM_repr_bind_key_o(tc, syms, hll_name, hash); |
2664 | 3 | } |
2665 | 6 | MVM_repr_bind_key_o(tc, hash, GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).o); |
2666 | 6 | uv_mutex_unlock(&tc->instance->mutex_hll_syms); |
2667 | 6 | cur_op += 6; |
2668 | 6 | goto NEXT; |
2669 | 6 | } |
2670 | 6 | OP(settypehll): |
2671 | 6 | STABLE(GET_REG(cur_op, 0).o)->hll_owner = MVM_hll_get_config_for(tc, |
2672 | 6 | GET_REG(cur_op, 2).s); |
2673 | 6 | cur_op += 4; |
2674 | 6 | goto NEXT; |
2675 | 135 | OP(settypehllrole): |
2676 | 135 | STABLE(GET_REG(cur_op, 0).o)->hll_role = GET_REG(cur_op, 2).i64; |
2677 | 135 | cur_op += 4; |
2678 | 135 | goto NEXT; |
2679 | 1 | OP(hllize): { |
2680 | 1 | /* Increment PC before mapping, as it may invoke. */ |
2681 | 1 | MVMRegister *res_reg = &GET_REG(cur_op, 0); |
2682 | 1 | MVMObject *mapee = GET_REG(cur_op, 2).o; |
2683 | 1 | cur_op += 4; |
2684 | 1 | MVM_hll_map(tc, mapee, MVM_hll_current(tc), res_reg); |
2685 | 1 | goto NEXT; |
2686 | 1 | } |
2687 | 22 | OP(hllizefor): { |
2688 | 22 | /* Increment PC before mapping, as it may invoke. */ |
2689 | 22 | MVMRegister *res_reg = &GET_REG(cur_op, 0); |
2690 | 22 | MVMObject *mapee = GET_REG(cur_op, 2).o; |
2691 | 22 | MVMString *hll = GET_REG(cur_op, 4).s; |
2692 | 22 | cur_op += 6; |
2693 | 22 | MVM_hll_map(tc, mapee, MVM_hll_get_config_for(tc, hll), res_reg); |
2694 | 22 | goto NEXT; |
2695 | 22 | } |
2696 | 0 | OP(usecompileehllconfig): |
2697 | 0 | MVM_hll_enter_compilee_mode(tc); |
2698 | 0 | goto NEXT; |
2699 | 0 | OP(usecompilerhllconfig): |
2700 | 0 | MVM_hll_leave_compilee_mode(tc); |
2701 | 0 | goto NEXT; |
2702 | 249k | OP(iter): { |
2703 | 249k | GET_REG(cur_op, 0).o = MVM_iter(tc, GET_REG(cur_op, 2).o); |
2704 | 249k | cur_op += 4; |
2705 | 249k | goto NEXT; |
2706 | 249k | } |
2707 | 191k | OP(iterkey_s): { |
2708 | 191k | GET_REG(cur_op, 0).s = MVM_iterkey_s(tc, (MVMIter *)GET_REG(cur_op, 2).o); |
2709 | 191k | cur_op += 4; |
2710 | 191k | goto NEXT; |
2711 | 191k | } |
2712 | 185k | OP(iterval): { |
2713 | 185k | GET_REG(cur_op, 0).o = MVM_iterval(tc, (MVMIter *)GET_REG(cur_op, 2).o); |
2714 | 185k | cur_op += 4; |
2715 | 185k | goto NEXT; |
2716 | 185k | } |
2717 | 2.02k | OP(getcodename): { |
2718 | 2.02k | MVMObject *co = GET_REG(cur_op, 2).o; |
2719 | 2.02k | if (REPR(co)->ID != MVM_REPR_ID_MVMCode || !IS_CONCRETE(co)) |
2720 | 0 | MVM_exception_throw_adhoc(tc, "getcodename requires a concrete code object"); |
2721 | 2.02k | GET_REG(cur_op, 0).s = ((MVMCode *)co)->body.name; |
2722 | 2.02k | cur_op += 4; |
2723 | 2.02k | goto NEXT; |
2724 | 2.02k | } |
2725 | 0 | OP(iscoderef): |
2726 | 0 | GET_REG(cur_op, 0).i64 = !GET_REG(cur_op, 2).o || |
2727 | 0 | STABLE(GET_REG(cur_op, 2).o)->invoke == MVM_6model_invoke_default ? 0 : 1; |
2728 | 0 | cur_op += 4; |
2729 | 0 | goto NEXT; |
2730 | 353k | OP(getcodeobj): { |
2731 | 353k | MVMObject *obj = GET_REG(cur_op, 2).o; |
2732 | 353k | GET_REG(cur_op, 0).o = MVM_frame_get_code_object(tc, (MVMCode *)obj); |
2733 | 353k | cur_op += 4; |
2734 | 353k | goto NEXT; |
2735 | 353k | } |
2736 | 1.85k | OP(setcodeobj): { |
2737 | 1.85k | MVMObject *obj = GET_REG(cur_op, 0).o; |
2738 | 1.85k | if (REPR(obj)->ID == MVM_REPR_ID_MVMCode) { |
2739 | 1.85k | MVM_ASSIGN_REF(tc, &(obj->header), ((MVMCode *)obj)->body.code_object, |
2740 | 1.85k | GET_REG(cur_op, 2).o); |
2741 | 1.85k | } |
2742 | 0 | else { |
2743 | 0 | MVM_exception_throw_adhoc(tc, "setcodeobj needs a code ref"); |
2744 | 0 | } |
2745 | 1.85k | cur_op += 4; |
2746 | 1.85k | goto NEXT; |
2747 | 1.85k | } |
2748 | 1.50k | OP(setcodename): { |
2749 | 1.50k | MVMObject *obj = GET_REG(cur_op, 0).o; |
2750 | 1.50k | if (REPR(obj)->ID == MVM_REPR_ID_MVMCode) { |
2751 | 1.50k | MVM_ASSIGN_REF(tc, &(obj->header), ((MVMCode *)obj)->body.name, |
2752 | 1.50k | GET_REG(cur_op, 2).s); |
2753 | 1.50k | } |
2754 | 0 | else { |
2755 | 0 | MVM_exception_throw_adhoc(tc, "setcodename needs a code ref"); |
2756 | 0 | } |
2757 | 1.50k | cur_op += 4; |
2758 | 1.50k | goto NEXT; |
2759 | 1.50k | } |
2760 | 1.17k | OP(forceouterctx): { |
2761 | 1.17k | MVMObject *obj = GET_REG(cur_op, 0).o, *ctx = GET_REG(cur_op, 2).o; |
2762 | 1.17k | MVMFrame *orig; |
2763 | 1.17k | MVMFrame *context; |
2764 | 1.17k | MVMStaticFrame *sf; |
2765 | 1.17k | if (REPR(obj)->ID != MVM_REPR_ID_MVMCode || !IS_CONCRETE(obj)) { |
2766 | 0 | MVM_exception_throw_adhoc(tc, "forceouterctx needs a code ref"); |
2767 | 0 | } |
2768 | 1.17k | if (REPR(ctx)->ID != MVM_REPR_ID_MVMContext || !IS_CONCRETE(ctx)) { |
2769 | 0 | MVM_exception_throw_adhoc(tc, "forceouterctx needs a context"); |
2770 | 0 | } |
2771 | 1.17k | |
2772 | 1.17k | orig = ((MVMCode *)obj)->body.outer; |
2773 | 1.17k | sf = ((MVMCode *)obj)->body.sf; |
2774 | 1.17k | context = ((MVMContext *)ctx)->body.context; |
2775 | 1.17k | |
2776 | 1.17k | MVM_ASSIGN_REF(tc, &(((MVMObject *)sf)->header), sf->body.outer, context->static_info); |
2777 | 1.17k | if (orig != context) |
2778 | 1.17k | MVM_ASSIGN_REF(tc, &(obj->header), ((MVMCode *)obj)->body.outer, context); |
2779 | 1.17k | |
2780 | 1.17k | cur_op += 4; |
2781 | 1.17k | goto NEXT; |
2782 | 1.17k | } |
2783 | 525 | OP(setinvokespec): { |
2784 | 525 | MVMObject *obj = GET_REG(cur_op, 0).o, *ch = GET_REG(cur_op, 2).o, |
2785 | 525 | *invocation_handler = GET_REG(cur_op, 6).o; |
2786 | 525 | MVMString *name = GET_REG(cur_op, 4).s; |
2787 | 525 | MVMInvocationSpec *is = MVM_calloc(1, sizeof(MVMInvocationSpec)); |
2788 | 525 | MVMSTable *st = STABLE(obj); |
2789 | 525 | MVM_ASSIGN_REF(tc, &(st->header), is->class_handle, ch); |
2790 | 525 | MVM_ASSIGN_REF(tc, &(st->header), is->attr_name, name); |
2791 | 525 | if (ch && name) |
2792 | 523 | is->hint = REPR(ch)->attr_funcs.hint_for(tc, STABLE(ch), ch, name); |
2793 | 525 | MVM_ASSIGN_REF(tc, &(st->header), is->invocation_handler, invocation_handler); |
2794 | 525 | /* XXX not thread safe, but this should occur on non-shared objects anyway... */ |
2795 | 525 | if (st->invocation_spec) |
2796 | 0 | MVM_free(st->invocation_spec); |
2797 | 525 | st->invocation_spec = is; |
2798 | 525 | cur_op += 8; |
2799 | 525 | goto NEXT; |
2800 | 525 | } |
2801 | 21.7k | OP(isinvokable): { |
2802 | 21.7k | MVMSTable *st = STABLE(GET_REG(cur_op, 2).o); |
2803 | 21.7k | GET_REG(cur_op, 0).i64 = st->invoke == MVM_6model_invoke_default |
2804 | 19.8k | ? (st->invocation_spec ? 1 : 0) |
2805 | 1.94k | : 1; |
2806 | 21.7k | cur_op += 4; |
2807 | 21.7k | goto NEXT; |
2808 | 21.7k | } |
2809 | 1.50k | OP(freshcoderef): { |
2810 | 1.50k | MVMObject * const cr = GET_REG(cur_op, 2).o; |
2811 | 1.50k | MVMCode *ncr; |
2812 | 1.50k | if (REPR(cr)->ID != MVM_REPR_ID_MVMCode) |
2813 | 0 | MVM_exception_throw_adhoc(tc, "freshcoderef requires a coderef"); |
2814 | 1.50k | ncr = (MVMCode *)(GET_REG(cur_op, 0).o = MVM_repr_clone(tc, cr)); |
2815 | 1.50k | MVMROOT(tc, ncr, { |
2816 | 1.50k | MVMStaticFrame *nsf; |
2817 | 1.50k | if (!ncr->body.sf->body.fully_deserialized) |
2818 | 1.50k | MVM_bytecode_finish_frame(tc, ncr->body.sf->body.cu, ncr->body.sf, 0); |
2819 | 1.50k | nsf = (MVMStaticFrame *)MVM_repr_clone(tc, |
2820 | 1.50k | (MVMObject *)ncr->body.sf); |
2821 | 1.50k | MVM_ASSIGN_REF(tc, &(ncr->common.header), ncr->body.sf, nsf); |
2822 | 1.50k | MVM_ASSIGN_REF(tc, &(ncr->common.header), ncr->body.sf->body.static_code, ncr); |
2823 | 1.50k | }); |
2824 | 1.50k | cur_op += 4; |
2825 | 1.50k | goto NEXT; |
2826 | 1.50k | } |
2827 | 1.52k | OP(markcodestatic): { |
2828 | 1.52k | MVMObject * const cr = GET_REG(cur_op, 0).o; |
2829 | 1.52k | if (REPR(cr)->ID != MVM_REPR_ID_MVMCode) |
2830 | 0 | MVM_exception_throw_adhoc(tc, "markcodestatic requires a coderef"); |
2831 | 1.52k | ((MVMCode *)cr)->body.is_static = 1; |
2832 | 1.52k | cur_op += 2; |
2833 | 1.52k | goto NEXT; |
2834 | 1.52k | } |
2835 | 395 | OP(markcodestub): { |
2836 | 395 | MVMObject * const cr = GET_REG(cur_op, 0).o; |
2837 | 395 | if (REPR(cr)->ID != MVM_REPR_ID_MVMCode) |
2838 | 0 | MVM_exception_throw_adhoc(tc, "markcodestub requires a coderef"); |
2839 | 395 | ((MVMCode *)cr)->body.is_compiler_stub = 1; |
2840 | 395 | cur_op += 2; |
2841 | 395 | goto NEXT; |
2842 | 395 | } |
2843 | 11 | OP(getstaticcode): { |
2844 | 11 | MVMObject * const cr = GET_REG(cur_op, 2).o; |
2845 | 11 | if (REPR(cr)->ID != MVM_REPR_ID_MVMCode) |
2846 | 0 | MVM_exception_throw_adhoc(tc, "getstaticcode requires a static coderef"); |
2847 | 11 | GET_REG(cur_op, 0).o = (MVMObject *)((MVMCode *)cr)->body.sf->body.static_code; |
2848 | 11 | cur_op += 4; |
2849 | 11 | goto NEXT; |
2850 | 11 | } |
2851 | 14 | OP(getcodecuid): { |
2852 | 14 | MVMObject * const cr = GET_REG(cur_op, 2).o; |
2853 | 14 | if (REPR(cr)->ID != MVM_REPR_ID_MVMCode || !IS_CONCRETE(cr)) |
2854 | 0 | MVM_exception_throw_adhoc(tc, "getcodecuid requires a static coderef"); |
2855 | 14 | GET_REG(cur_op, 0).s = ((MVMCode *)cr)->body.sf->body.cuuid; |
2856 | 14 | cur_op += 4; |
2857 | 14 | goto NEXT; |
2858 | 14 | } |
2859 | 2 | OP(setdispatcher): |
2860 | 2 | tc->cur_dispatcher = GET_REG(cur_op, 0).o; |
2861 | 2 | tc->cur_dispatcher_for = NULL; |
2862 | 2 | cur_op += 2; |
2863 | 2 | goto NEXT; |
2864 | 4 | OP(takedispatcher): { |
2865 | 4 | MVMObject *disp = tc->cur_dispatcher; |
2866 | 4 | MVMObject *disp_for = tc->cur_dispatcher_for; |
2867 | 4 | MVMObject *cur_code = tc->cur_frame->code_ref; |
2868 | 4 | if (disp && (!disp_for || disp_for == cur_code)) { |
2869 | 2 | GET_REG(cur_op, 0).o = disp; |
2870 | 2 | tc->cur_dispatcher = NULL; |
2871 | 2 | } |
2872 | 2 | else { |
2873 | 2 | GET_REG(cur_op, 0).o = tc->instance->VMNull; |
2874 | 2 | } |
2875 | 4 | cur_op += 2; |
2876 | 4 | goto NEXT; |
2877 | 4 | } |
2878 | 14 | OP(assign): { |
2879 | 14 | MVMObject *cont = GET_REG(cur_op, 0).o; |
2880 | 14 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2881 | 14 | const MVMContainerSpec *spec = STABLE(cont)->container_spec; |
2882 | 14 | cur_op += 4; |
2883 | 14 | if (spec) { |
2884 | 14 | spec->store(tc, cont, obj); |
2885 | 0 | } else { |
2886 | 0 | MVM_exception_throw_adhoc(tc, "Cannot assign to an immutable value"); |
2887 | 0 | } |
2888 | 14 | goto NEXT; |
2889 | 14 | } |
2890 | 1 | OP(assignunchecked): { |
2891 | 1 | MVMObject *cont = GET_REG(cur_op, 0).o; |
2892 | 1 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2893 | 1 | const MVMContainerSpec *spec = STABLE(cont)->container_spec; |
2894 | 1 | cur_op += 4; |
2895 | 1 | if (spec) { |
2896 | 1 | spec->store_unchecked(tc, cont, obj); |
2897 | 0 | } else { |
2898 | 0 | MVM_exception_throw_adhoc(tc, "Cannot assign to an immutable value"); |
2899 | 0 | } |
2900 | 1 | goto NEXT; |
2901 | 1 | } |
2902 | 204 | OP(iscont): { |
2903 | 204 | MVMObject *obj = GET_REG(cur_op, 2).o; |
2904 | 204 | GET_REG(cur_op, 0).i64 = MVM_is_null(tc, obj) || STABLE(obj)->container_spec == NULL ? 0 : 1; |
2905 | 204 | cur_op += 4; |
2906 | 204 | goto NEXT; |
2907 | 204 | } |
2908 | 24.9M | OP(decont): { |
2909 | 24.9M | MVMObject *obj = GET_REG(cur_op, 2).o; |
2910 | 24.9M | MVMRegister *r = &GET_REG(cur_op, 0); |
2911 | 24.9M | cur_op += 4; |
2912 | 24.9M | if (obj && IS_CONCRETE(obj) && STABLE(obj)->container_spec) |
2913 | 27 | STABLE(obj)->container_spec->fetch(tc, obj, r); |
2914 | 24.9M | else |
2915 | 24.9M | r->o = obj; |
2916 | 24.9M | goto NEXT; |
2917 | 24.9M | } |
2918 | 19 | OP(setcontspec): { |
2919 | 19 | MVMSTable *st = STABLE(GET_REG(cur_op, 0).o); |
2920 | 19 | MVMString *name = GET_REG(cur_op, 2).s; |
2921 | 19 | const MVMContainerConfigurer *cc = MVM_6model_get_container_config(tc, name); |
2922 | 19 | if (cc == NULL) { |
2923 | 0 | char *c_name = MVM_string_utf8_encode_C_string(tc, name); |
2924 | 0 | char *waste[] = { c_name, NULL }; |
2925 | 0 | MVM_exception_throw_adhoc_free(tc, waste, "Cannot use unknown container spec %s", |
2926 | 0 | c_name); |
2927 | 0 | } |
2928 | 19 | if (st->container_spec) |
2929 | 0 | MVM_exception_throw_adhoc(tc, |
2930 | 0 | "Cannot change a type's container specification"); |
2931 | 19 | |
2932 | 19 | cc->set_container_spec(tc, st); |
2933 | 19 | cc->configure_container_spec(tc, st, GET_REG(cur_op, 4).o); |
2934 | 19 | cur_op += 6; |
2935 | 19 | goto NEXT; |
2936 | 19 | } |
2937 | 132 | OP(sha1): |
2938 | 132 | GET_REG(cur_op, 0).s = MVM_sha1(tc, |
2939 | 132 | GET_REG(cur_op, 2).s); |
2940 | 132 | cur_op += 4; |
2941 | 132 | goto NEXT; |
2942 | 2.75k | OP(createsc): |
2943 | 2.75k | GET_REG(cur_op, 0).o = MVM_sc_create(tc, |
2944 | 2.75k | GET_REG(cur_op, 2).s); |
2945 | 2.75k | cur_op += 4; |
2946 | 2.75k | goto NEXT; |
2947 | 2.22k | OP(scsetobj): { |
2948 | 2.22k | MVMObject *sc = GET_REG(cur_op, 0).o; |
2949 | 2.22k | MVMObject *obj = GET_REG(cur_op, 4).o; |
2950 | 2.22k | if (REPR(sc)->ID != MVM_REPR_ID_SCRef) |
2951 | 0 | MVM_exception_throw_adhoc(tc, |
2952 | 0 | "Must provide an SCRef operand to scsetobj"); |
2953 | 2.22k | MVM_sc_set_object(tc, (MVMSerializationContext *)sc, |
2954 | 2.22k | GET_REG(cur_op, 2).i64, obj); |
2955 | 2.22k | if (MVM_sc_get_stable_sc(tc, STABLE(obj)) == NULL) { |
2956 | 586 | /* Need to claim the SC also; typical case for new type objects. */ |
2957 | 586 | MVMSTable *st = STABLE(obj); |
2958 | 586 | MVM_sc_set_stable_sc(tc, st, (MVMSerializationContext *)sc); |
2959 | 586 | MVM_sc_push_stable(tc, (MVMSerializationContext *)sc, st); |
2960 | 586 | } |
2961 | 2.22k | cur_op += 6; |
2962 | 2.22k | goto NEXT; |
2963 | 2.22k | } |
2964 | 1.52k | OP(scsetcode): { |
2965 | 1.52k | MVMObject *sc = GET_REG(cur_op, 0).o; |
2966 | 1.52k | MVMObject *code = GET_REG(cur_op, 4).o; |
2967 | 1.52k | if (REPR(sc)->ID != MVM_REPR_ID_SCRef) |
2968 | 0 | MVM_exception_throw_adhoc(tc, |
2969 | 0 | "Must provide an SCRef operand to scsetcode"); |
2970 | 1.52k | MVM_sc_set_code(tc, (MVMSerializationContext *)sc, |
2971 | 1.52k | GET_REG(cur_op, 2).i64, code); |
2972 | 1.52k | MVM_sc_set_obj_sc(tc, code, (MVMSerializationContext *)sc); |
2973 | 1.52k | cur_op += 6; |
2974 | 1.52k | goto NEXT; |
2975 | 1.52k | } |
2976 | 263 | OP(scgetobj): { |
2977 | 263 | MVMObject *sc = GET_REG(cur_op, 2).o; |
2978 | 263 | if (REPR(sc)->ID != MVM_REPR_ID_SCRef) |
2979 | 0 | MVM_exception_throw_adhoc(tc, |
2980 | 0 | "Must provide an SCRef operand to scgetobj"); |
2981 | 263 | GET_REG(cur_op, 0).o = MVM_sc_get_object(tc, |
2982 | 263 | (MVMSerializationContext *)sc, GET_REG(cur_op, 4).i64); |
2983 | 263 | cur_op += 6; |
2984 | 263 | goto NEXT; |
2985 | 263 | } |
2986 | 8.11k | OP(scgethandle): { |
2987 | 8.11k | MVMObject *sc = GET_REG(cur_op, 2).o; |
2988 | 8.11k | if (REPR(sc)->ID != MVM_REPR_ID_SCRef) |
2989 | 0 | MVM_exception_throw_adhoc(tc, |
2990 | 0 | "Must provide an SCRef operand to scgethandle"); |
2991 | 8.11k | GET_REG(cur_op, 0).s = MVM_sc_get_handle(tc, |
2992 | 8.11k | (MVMSerializationContext *)sc); |
2993 | 8.11k | cur_op += 4; |
2994 | 8.11k | goto NEXT; |
2995 | 8.11k | } |
2996 | 4.50k | OP(scgetobjidx): { |
2997 | 4.50k | MVMObject *sc = GET_REG(cur_op, 2).o; |
2998 | 4.50k | if (REPR(sc)->ID != MVM_REPR_ID_SCRef) |
2999 | 0 | MVM_exception_throw_adhoc(tc, |
3000 | 0 | "Must provide an SCRef operand to scgetobjidx"); |
3001 | 4.50k | GET_REG(cur_op, 0).i64 = MVM_sc_find_object_idx(tc, |
3002 | 4.50k | (MVMSerializationContext *)sc, GET_REG(cur_op, 4).o); |
3003 | 4.50k | cur_op += 6; |
3004 | 4.50k | goto NEXT; |
3005 | 4.50k | } |
3006 | 2.54k | OP(scsetdesc): { |
3007 | 2.54k | MVMObject *sc = GET_REG(cur_op, 0).o; |
3008 | 2.54k | MVMString *desc = GET_REG(cur_op, 2).s; |
3009 | 2.54k | if (REPR(sc)->ID != MVM_REPR_ID_SCRef) |
3010 | 0 | MVM_exception_throw_adhoc(tc, |
3011 | 0 | "Must provide an SCRef operand to scsetdesc"); |
3012 | 2.54k | MVM_sc_set_description(tc, (MVMSerializationContext *)sc, desc); |
3013 | 2.54k | cur_op += 4; |
3014 | 2.54k | goto NEXT; |
3015 | 2.54k | } |
3016 | 2.12k | OP(scobjcount): { |
3017 | 2.12k | MVMObject *sc = GET_REG(cur_op, 2).o; |
3018 | 2.12k | if (REPR(sc)->ID != MVM_REPR_ID_SCRef) |
3019 | 0 | MVM_exception_throw_adhoc(tc, |
3020 | 0 | "Must provide an SCRef operand to scobjcount"); |
3021 | 2.12k | GET_REG(cur_op, 0).i64 = MVM_sc_get_object_count(tc, |
3022 | 2.12k | (MVMSerializationContext *)sc); |
3023 | 2.12k | cur_op += 4; |
3024 | 2.12k | goto NEXT; |
3025 | 2.12k | } |
3026 | 2.22k | OP(setobjsc): { |
3027 | 2.22k | MVMObject *obj = GET_REG(cur_op, 0).o; |
3028 | 2.22k | MVMObject *sc = GET_REG(cur_op, 2).o; |
3029 | 2.22k | if (REPR(sc)->ID != MVM_REPR_ID_SCRef) |
3030 | 0 | MVM_exception_throw_adhoc(tc, |
3031 | 0 | "Must provide an SCRef operand to setobjsc"); |
3032 | 2.22k | MVM_sc_set_obj_sc(tc, obj, (MVMSerializationContext *)sc); |
3033 | 2.22k | cur_op += 4; |
3034 | 2.22k | goto NEXT; |
3035 | 2.22k | } |
3036 | 5.66k | OP(getobjsc): |
3037 | 5.66k | GET_REG(cur_op, 0).o = (MVMObject *)MVM_sc_get_obj_sc(tc, GET_REG(cur_op, 2).o); |
3038 | 5.66k | cur_op += 4; |
3039 | 5.66k | goto NEXT; |
3040 | 100 | OP(serialize): { |
3041 | 100 | MVMObject *sc = GET_REG(cur_op, 2).o; |
3042 | 100 | MVMObject *obj = GET_REG(cur_op, 4).o; |
3043 | 100 | if (REPR(sc)->ID != MVM_REPR_ID_SCRef) |
3044 | 0 | MVM_exception_throw_adhoc(tc, |
3045 | 0 | "Must provide an SCRef operand to serialize"); |
3046 | 100 | GET_REG(cur_op, 0).s = MVM_serialization_serialize(tc, (MVMSerializationContext *)sc, obj); |
3047 | 100 | cur_op += 6; |
3048 | 100 | goto NEXT; |
3049 | 100 | } |
3050 | 1.53k | OP(deserialize): { |
3051 | 1.53k | MVMString *blob = GET_REG(cur_op, 0).s; |
3052 | 1.53k | MVMObject *sc = GET_REG(cur_op, 2).o; |
3053 | 1.53k | MVMObject *sh = GET_REG(cur_op, 4).o; |
3054 | 1.53k | MVMObject *cr = GET_REG(cur_op, 6).o; |
3055 | 1.53k | MVMObject *conf = GET_REG(cur_op, 8).o; |
3056 | 1.53k | if (REPR(sc)->ID != MVM_REPR_ID_SCRef) |
3057 | 0 | MVM_exception_throw_adhoc(tc, |
3058 | 0 | "Must provide an SCRef operand to deserialize"); |
3059 | 1.53k | MVM_serialization_deserialize(tc, (MVMSerializationContext *)sc, |
3060 | 1.53k | sh, cr, conf, blob); |
3061 | 1.53k | cur_op += 10; |
3062 | 1.53k | goto NEXT; |
3063 | 1.53k | } |
3064 | 9.31M | OP(wval): { |
3065 | 9.31M | MVMint16 dep = GET_I16(cur_op, 2); |
3066 | 9.31M | MVMint16 idx = GET_I16(cur_op, 4); |
3067 | 9.31M | GET_REG(cur_op, 0).o = MVM_sc_get_sc_object(tc, cu, dep, idx); |
3068 | 9.31M | cur_op += 6; |
3069 | 9.31M | goto NEXT; |
3070 | 9.31M | } |
3071 | 0 | OP(wval_wide): { |
3072 | 0 | MVMint16 dep = GET_I16(cur_op, 2); |
3073 | 0 | MVMint64 idx = MVM_BC_get_I64(cur_op, 4); |
3074 | 0 | GET_REG(cur_op, 0).o = MVM_sc_get_sc_object(tc, cu, dep, idx); |
3075 | 0 | cur_op += 12; |
3076 | 0 | goto NEXT; |
3077 | 0 | } |
3078 | 9.58k | OP(scwbdisable): |
3079 | 9.58k | GET_REG(cur_op, 0).i64 = ++tc->sc_wb_disable_depth; |
3080 | 9.58k | cur_op += 2; |
3081 | 9.58k | goto NEXT; |
3082 | 9.58k | OP(scwbenable): |
3083 | 9.58k | GET_REG(cur_op, 0).i64 = --tc->sc_wb_disable_depth; |
3084 | 9.58k | cur_op += 2; |
3085 | 9.58k | goto NEXT; |
3086 | 1.12k | OP(pushcompsc): { |
3087 | 1.12k | MVMObject * const sc = GET_REG(cur_op, 0).o; |
3088 | 1.12k | if (REPR(sc)->ID != MVM_REPR_ID_SCRef) |
3089 | 0 | MVM_exception_throw_adhoc(tc, "Can only push an SCRef with pushcompsc"); |
3090 | 1.12k | if (MVM_is_null(tc, tc->compiling_scs)) { |
3091 | 130 | MVMROOT(tc, sc, { |
3092 | 130 | tc->compiling_scs = MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTArray); |
3093 | 130 | }); |
3094 | 130 | } |
3095 | 1.12k | MVM_repr_unshift_o(tc, tc->compiling_scs, sc); |
3096 | 1.12k | cur_op += 2; |
3097 | 1.12k | goto NEXT; |
3098 | 1.12k | } |
3099 | 1.07k | OP(popcompsc): { |
3100 | 1.07k | MVMObject * const scs = tc->compiling_scs; |
3101 | 1.07k | if (MVM_is_null(tc, scs) || MVM_repr_elems(tc, scs) == 0) |
3102 | 0 | MVM_exception_throw_adhoc(tc, "No current compiling SC"); |
3103 | 1.07k | GET_REG(cur_op, 0).o = MVM_repr_shift_o(tc, tc->compiling_scs); |
3104 | 1.07k | cur_op += 2; |
3105 | 1.07k | goto NEXT; |
3106 | 1.07k | } |
3107 | 1 | OP(scgetdesc): { |
3108 | 1 | MVMObject *sc = GET_REG(cur_op, 2).o; |
3109 | 1 | if (REPR(sc)->ID != MVM_REPR_ID_SCRef) |
3110 | 0 | MVM_exception_throw_adhoc(tc, |
3111 | 0 | "Must provide an SCRef operand to scgetdesc"); |
3112 | 1 | GET_REG(cur_op, 0).s = MVM_sc_get_description(tc, |
3113 | 1 | (MVMSerializationContext *)sc); |
3114 | 1 | cur_op += 4; |
3115 | 1 | goto NEXT; |
3116 | 1 | } |
3117 | 4.29k | OP(loadbytecode): { |
3118 | 4.29k | /* This op will end up returning into the runloop to run |
3119 | 4.29k | * deserialization and load code, so make sure we're done |
3120 | 4.29k | * processing this op really. */ |
3121 | 4.29k | MVMString *filename = GET_REG(cur_op, 2).s; |
3122 | 4.29k | GET_REG(cur_op, 0).s = filename; |
3123 | 4.29k | cur_op += 4; |
3124 | 4.29k | |
3125 | 4.29k | /* Set up return (really continuation after load) address |
3126 | 4.29k | * and enter bytecode loading process. */ |
3127 | 4.29k | tc->cur_frame->return_address = cur_op; |
3128 | 4.29k | MVM_load_bytecode(tc, filename); |
3129 | 4.29k | goto NEXT; |
3130 | 4.29k | } |
3131 | 0 | OP(loadbytecodebuffer): { |
3132 | 0 | /* This op will end up returning into the runloop to run |
3133 | 0 | * deserialization and load code, so make sure we're done |
3134 | 0 | * processing this op really. */ |
3135 | 0 | MVMObject *buffer = GET_REG(cur_op, 0).o; |
3136 | 0 | cur_op += 2; |
3137 | 0 |
|
3138 | 0 | /* Set up return (really continuation after load) address |
3139 | 0 | * and enter bytecode loading process. */ |
3140 | 0 | tc->cur_frame->return_address = cur_op; |
3141 | 0 | MVM_load_bytecode_buffer(tc, buffer); |
3142 | 0 | goto NEXT; |
3143 | 0 | } |
3144 | 0 | OP(loadbytecodefh): { |
3145 | 0 | /* This op will end up returning into the runloop to run |
3146 | 0 | * deserialization and load code, so make sure we're done |
3147 | 0 | * processing this op really. */ |
3148 | 0 | MVMObject *file = GET_REG(cur_op, 0).o; |
3149 | 0 | MVMString *filename = GET_REG(cur_op, 2).s; |
3150 | 0 | cur_op += 4; |
3151 | 0 |
|
3152 | 0 | /* Set up return (really continuation after load) address |
3153 | 0 | * and enter bytecode loading process. */ |
3154 | 0 | tc->cur_frame->return_address = cur_op; |
3155 | 0 | MVM_load_bytecode_fh(tc, file, filename); |
3156 | 0 | goto NEXT; |
3157 | 0 | } |
3158 | 0 | OP(masttofile): |
3159 | 0 | MVM_mast_to_file(tc, GET_REG(cur_op, 0).o, |
3160 | 0 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).s); |
3161 | 0 | cur_op += 6; |
3162 | 0 | goto NEXT; |
3163 | 1.18k | OP(masttocu): { |
3164 | 1.18k | /* This op will end up returning into the runloop to run |
3165 | 1.18k | * deserialization and load code, so make sure we're done |
3166 | 1.18k | * processing this op really. */ |
3167 | 1.18k | MVMObject *node = GET_REG(cur_op, 2).o; |
3168 | 1.18k | MVMObject *types = GET_REG(cur_op, 4).o; |
3169 | 1.18k | MVMRegister *result_reg = &GET_REG(cur_op, 0); |
3170 | 1.18k | cur_op += 6; |
3171 | 1.18k | |
3172 | 1.18k | /* Set up return (really continuation after load) address |
3173 | 1.18k | * and enter bytecode loading process. */ |
3174 | 1.18k | tc->cur_frame->return_address = cur_op; |
3175 | 1.18k | MVM_mast_to_cu(tc, node, types, result_reg); |
3176 | 1.18k | goto NEXT; |
3177 | 1.18k | } |
3178 | 130 | OP(iscompunit): { |
3179 | 130 | MVMObject *maybe_cu = GET_REG(cur_op, 2).o; |
3180 | 130 | GET_REG(cur_op, 0).i64 = REPR(maybe_cu)->ID == MVM_REPR_ID_MVMCompUnit; |
3181 | 130 | cur_op += 4; |
3182 | 130 | goto NEXT; |
3183 | 130 | } |
3184 | 1.18k | OP(compunitmainline): { |
3185 | 1.18k | MVMObject *maybe_cu = GET_REG(cur_op, 2).o; |
3186 | 1.18k | if (REPR(maybe_cu)->ID == MVM_REPR_ID_MVMCompUnit) { |
3187 | 1.18k | MVMCompUnit *cu = (MVMCompUnit *)maybe_cu; |
3188 | 1.18k | GET_REG(cur_op, 0).o = cu->body.coderefs[0]; |
3189 | 1.18k | } |
3190 | 0 | else { |
3191 | 0 | MVM_exception_throw_adhoc(tc, "compunitmainline requires an MVMCompUnit"); |
3192 | 0 | } |
3193 | 1.18k | cur_op += 4; |
3194 | 1.18k | goto NEXT; |
3195 | 1.18k | } |
3196 | 5 | OP(compunitcodes): { |
3197 | 5 | MVMObject * const result = MVM_repr_alloc_init(tc, MVM_hll_current(tc)->slurpy_array_type); |
3198 | 5 | MVMCompUnit * const maybe_cu = (MVMCompUnit *)GET_REG(cur_op, 2).o; |
3199 | 5 | if (REPR(maybe_cu)->ID == MVM_REPR_ID_MVMCompUnit) { |
3200 | 5 | const MVMuint32 num_frames = maybe_cu->body.num_frames; |
3201 | 5 | MVMObject ** const coderefs = maybe_cu->body.coderefs; |
3202 | 5 | MVMuint32 i; |
3203 | 5 | |
3204 | 19 | for (i = 0; i < num_frames; i++) { |
3205 | 14 | MVM_repr_push_o(tc, result, coderefs[i]); |
3206 | 14 | } |
3207 | 5 | |
3208 | 5 | GET_REG(cur_op, 0).o = result; |
3209 | 5 | } |
3210 | 0 | else { |
3211 | 0 | MVM_exception_throw_adhoc(tc, "compunitcodes requires an MVMCompUnit"); |
3212 | 0 | } |
3213 | 5 | cur_op += 4; |
3214 | 5 | goto NEXT; |
3215 | 5 | } |
3216 | 1.43k | OP(ctx): { |
3217 | 1.43k | GET_REG(cur_op, 0).o = MVM_frame_context_wrapper(tc, tc->cur_frame); |
3218 | 1.43k | cur_op += 2; |
3219 | 1.43k | goto NEXT; |
3220 | 1.43k | } |
3221 | 133 | OP(ctxouter): { |
3222 | 133 | MVMObject *this_ctx = GET_REG(cur_op, 2).o; |
3223 | 133 | MVMFrame *frame; |
3224 | 133 | if (!IS_CONCRETE(this_ctx) || REPR(this_ctx)->ID != MVM_REPR_ID_MVMContext) { |
3225 | 0 | MVM_exception_throw_adhoc(tc, "ctxouter needs an MVMContext"); |
3226 | 0 | } |
3227 | 133 | if ((frame = ((MVMContext *)this_ctx)->body.context->outer)) |
3228 | 3 | GET_REG(cur_op, 0).o = MVM_frame_context_wrapper(tc, frame); |
3229 | 133 | else |
3230 | 130 | GET_REG(cur_op, 0).o = tc->instance->VMNull; |
3231 | 133 | cur_op += 4; |
3232 | 133 | goto NEXT; |
3233 | 133 | } |
3234 | 1.17k | OP(ctxcaller): { |
3235 | 1.17k | MVMObject *this_ctx = GET_REG(cur_op, 2).o, *ctx = NULL; |
3236 | 1.17k | MVMFrame *frame; |
3237 | 1.17k | if (!IS_CONCRETE(this_ctx) || REPR(this_ctx)->ID != MVM_REPR_ID_MVMContext) { |
3238 | 0 | MVM_exception_throw_adhoc(tc, "ctxcaller needs an MVMContext"); |
3239 | 0 | } |
3240 | 1.17k | if ((frame = ((MVMContext *)this_ctx)->body.context->caller)) |
3241 | 1.17k | ctx = MVM_frame_context_wrapper(tc, frame); |
3242 | 1.17k | GET_REG(cur_op, 0).o = ctx ? ctx : tc->instance->VMNull; |
3243 | 1.17k | cur_op += 4; |
3244 | 1.17k | goto NEXT; |
3245 | 1.17k | } |
3246 | 2.63k | OP(ctxlexpad): { |
3247 | 2.63k | MVMObject *this_ctx = GET_REG(cur_op, 2).o; |
3248 | 2.63k | if (!IS_CONCRETE(this_ctx) || REPR(this_ctx)->ID != MVM_REPR_ID_MVMContext) { |
3249 | 0 | MVM_exception_throw_adhoc(tc, "ctxlexpad needs an MVMContext"); |
3250 | 0 | } |
3251 | 2.63k | GET_REG(cur_op, 0).o = this_ctx; |
3252 | 2.63k | cur_op += 4; |
3253 | 2.63k | goto NEXT; |
3254 | 2.63k | } |
3255 | 11.6k | OP(curcode): |
3256 | 11.6k | GET_REG(cur_op, 0).o = tc->cur_frame->code_ref; |
3257 | 11.6k | cur_op += 2; |
3258 | 11.6k | goto NEXT; |
3259 | 342k | OP(callercode): { |
3260 | 342k | GET_REG(cur_op, 0).o = tc->cur_frame->caller |
3261 | 342k | ? tc->cur_frame->caller->code_ref |
3262 | 0 | : tc->instance->VMNull; |
3263 | 342k | cur_op += 2; |
3264 | 342k | goto NEXT; |
3265 | 342k | } |
3266 | 103 | OP(add_I): |
3267 | 103 | GET_REG(cur_op, 0).o = MVM_bigint_add(tc, GET_REG(cur_op, 6).o, |
3268 | 103 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
3269 | 103 | cur_op += 8; |
3270 | 103 | goto NEXT; |
3271 | 1 | OP(sub_I): |
3272 | 1 | GET_REG(cur_op, 0).o = MVM_bigint_sub(tc, GET_REG(cur_op, 6).o, |
3273 | 1 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
3274 | 1 | cur_op += 8; |
3275 | 1 | goto NEXT; |
3276 | 101 | OP(mul_I): |
3277 | 101 | GET_REG(cur_op, 0).o = MVM_bigint_mul(tc, GET_REG(cur_op, 6).o, |
3278 | 101 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
3279 | 101 | cur_op += 8; |
3280 | 101 | goto NEXT; |
3281 | 4 | OP(div_I): { |
3282 | 4 | MVMObject * const type = GET_REG(cur_op, 6).o; |
3283 | 4 | GET_REG(cur_op, 0).o = MVM_bigint_div(tc, type, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
3284 | 4 | cur_op += 8; |
3285 | 4 | goto NEXT; |
3286 | 4 | } |
3287 | 6 | OP(mod_I): { |
3288 | 6 | MVMObject * const type = GET_REG(cur_op, 6).o; |
3289 | 6 | GET_REG(cur_op, 0).o = MVM_bigint_mod(tc, type, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
3290 | 6 | cur_op += 8; |
3291 | 6 | goto NEXT; |
3292 | 6 | } |
3293 | 2 | OP(neg_I): { |
3294 | 2 | MVMObject * const type = GET_REG(cur_op, 4).o; |
3295 | 2 | MVMObject * const result = MVM_repr_alloc_init(tc, type); |
3296 | 2 | MVM_bigint_neg(tc, result, GET_REG(cur_op, 2).o); |
3297 | 2 | GET_REG(cur_op, 0).o = result; |
3298 | 2 | cur_op += 6; |
3299 | 2 | goto NEXT; |
3300 | 2 | } |
3301 | 27 | OP(abs_I): { |
3302 | 27 | MVMObject * const type = GET_REG(cur_op, 4).o; |
3303 | 27 | MVMObject * const result = MVM_repr_alloc_init(tc, type); |
3304 | 27 | MVM_bigint_abs(tc, result, GET_REG(cur_op, 2).o); |
3305 | 27 | GET_REG(cur_op, 0).o = result; |
3306 | 27 | cur_op += 6; |
3307 | 27 | goto NEXT; |
3308 | 27 | } |
3309 | 3 | OP(cmp_I): { |
3310 | 3 | MVMObject *a = GET_REG(cur_op, 2).o, *b = GET_REG(cur_op, 4).o; |
3311 | 3 | GET_REG(cur_op, 0).i64 = MVM_bigint_cmp(tc, a, b); |
3312 | 3 | cur_op += 6; |
3313 | 3 | goto NEXT; |
3314 | 3 | } |
3315 | 34 | OP(eq_I): { |
3316 | 34 | MVMObject *a = GET_REG(cur_op, 2).o, *b = GET_REG(cur_op, 4).o; |
3317 | 34 | GET_REG(cur_op, 0).i64 = MP_EQ == MVM_bigint_cmp(tc, a, b); |
3318 | 34 | cur_op += 6; |
3319 | 34 | goto NEXT; |
3320 | 34 | } |
3321 | 2 | OP(ne_I): { |
3322 | 2 | MVMObject *a = GET_REG(cur_op, 2).o, *b = GET_REG(cur_op, 4).o; |
3323 | 2 | GET_REG(cur_op, 0).i64 = MP_EQ != MVM_bigint_cmp(tc, a, b); |
3324 | 2 | cur_op += 6; |
3325 | 2 | goto NEXT; |
3326 | 2 | } |
3327 | 32 | OP(lt_I): { |
3328 | 32 | MVMObject *a = GET_REG(cur_op, 2).o, *b = GET_REG(cur_op, 4).o; |
3329 | 32 | GET_REG(cur_op, 0).i64 = MP_LT == MVM_bigint_cmp(tc, a, b); |
3330 | 32 | cur_op += 6; |
3331 | 32 | goto NEXT; |
3332 | 32 | } |
3333 | 4 | OP(le_I): { |
3334 | 4 | MVMObject *a = GET_REG(cur_op, 2).o, *b = GET_REG(cur_op, 4).o; |
3335 | 4 | GET_REG(cur_op, 0).i64 = MP_GT != MVM_bigint_cmp(tc, a, b); |
3336 | 4 | cur_op += 6; |
3337 | 4 | goto NEXT; |
3338 | 4 | } |
3339 | 3 | OP(gt_I): { |
3340 | 3 | MVMObject *a = GET_REG(cur_op, 2).o, *b = GET_REG(cur_op, 4).o; |
3341 | 3 | GET_REG(cur_op, 0).i64 = MP_GT == MVM_bigint_cmp(tc, a, b); |
3342 | 3 | cur_op += 6; |
3343 | 3 | goto NEXT; |
3344 | 3 | } |
3345 | 3 | OP(ge_I): { |
3346 | 3 | MVMObject *a = GET_REG(cur_op, 2).o, *b = GET_REG(cur_op, 4).o; |
3347 | 3 | GET_REG(cur_op, 0).i64 = MP_LT != MVM_bigint_cmp(tc, a, b); |
3348 | 3 | cur_op += 6; |
3349 | 3 | goto NEXT; |
3350 | 3 | } |
3351 | 1 | OP(bor_I): { |
3352 | 1 | MVMObject * const type = GET_REG(cur_op, 6).o; |
3353 | 1 | GET_REG(cur_op, 0).o = MVM_bigint_or(tc, type, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
3354 | 1 | cur_op += 8; |
3355 | 1 | goto NEXT; |
3356 | 1 | } |
3357 | 1 | OP(bxor_I): { |
3358 | 1 | MVMObject * const type = GET_REG(cur_op, 6).o; |
3359 | 1 | GET_REG(cur_op, 0).o = MVM_bigint_xor(tc, type, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
3360 | 1 | cur_op += 8; |
3361 | 1 | goto NEXT; |
3362 | 1 | } |
3363 | 2 | OP(band_I): { |
3364 | 2 | MVMObject * const type = GET_REG(cur_op, 6).o; |
3365 | 2 | GET_REG(cur_op, 0).o = MVM_bigint_and(tc, type, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
3366 | 2 | cur_op += 8; |
3367 | 2 | goto NEXT; |
3368 | 2 | } |
3369 | 1 | OP(bnot_I): { |
3370 | 1 | MVMObject * const type = GET_REG(cur_op, 4).o; |
3371 | 1 | GET_REG(cur_op, 0).o = MVM_bigint_not(tc, type, GET_REG(cur_op, 2).o); |
3372 | 1 | cur_op += 6; |
3373 | 1 | goto NEXT; |
3374 | 1 | } |
3375 | 4 | OP(blshift_I): { |
3376 | 4 | MVMObject * const type = GET_REG(cur_op, 6).o; |
3377 | 4 | GET_REG(cur_op, 0).o = MVM_bigint_shl(tc, type, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).i64); |
3378 | 4 | cur_op += 8; |
3379 | 4 | goto NEXT; |
3380 | 4 | } |
3381 | 4 | OP(brshift_I): { |
3382 | 4 | MVMObject * const type = GET_REG(cur_op, 6).o; |
3383 | 4 | GET_REG(cur_op, 0).o = MVM_bigint_shr(tc, type, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).i64); |
3384 | 4 | cur_op += 8; |
3385 | 4 | goto NEXT; |
3386 | 4 | } |
3387 | 115 | OP(pow_I): |
3388 | 115 | GET_REG(cur_op, 0).o = MVM_bigint_pow(tc, GET_REG(cur_op, 2).o, |
3389 | 115 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).o, GET_REG(cur_op, 8).o); |
3390 | 115 | cur_op += 10; |
3391 | 115 | goto NEXT; |
3392 | 1 | OP(gcd_I): { |
3393 | 1 | GET_REG(cur_op, 0).o = MVM_bigint_gcd(tc, GET_REG(cur_op, 6).o, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
3394 | 1 | cur_op += 8; |
3395 | 1 | goto NEXT; |
3396 | 1 | } |
3397 | 1 | OP(lcm_I): |
3398 | 1 | GET_REG(cur_op, 0).o = MVM_bigint_lcm(tc, GET_REG(cur_op, 6).o, |
3399 | 1 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
3400 | 1 | cur_op += 8; |
3401 | 1 | goto NEXT; |
3402 | 1 | OP(expmod_I): { |
3403 | 1 | MVMObject * const type = GET_REG(cur_op, 8).o; |
3404 | 1 | MVMObject * const result = MVM_repr_alloc_init(tc, type); |
3405 | 1 | MVM_bigint_expmod(tc, result, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).o); |
3406 | 1 | GET_REG(cur_op, 0).o = result; |
3407 | 1 | cur_op += 10; |
3408 | 1 | goto NEXT; |
3409 | 1 | } |
3410 | 6 | OP(isprime_I): { |
3411 | 6 | MVMObject *a = GET_REG(cur_op, 2).o; |
3412 | 6 | MVMint64 b = GET_REG(cur_op, 4).i64; |
3413 | 6 | GET_REG(cur_op, 0).i64 = MVM_bigint_is_prime(tc, a, b); |
3414 | 6 | cur_op += 6; |
3415 | 6 | goto NEXT; |
3416 | 6 | } |
3417 | 1 | OP(rand_I): { |
3418 | 1 | MVMObject * const type = GET_REG(cur_op, 4).o; |
3419 | 1 | MVMObject * const rnd = MVM_repr_alloc_init(tc, type); |
3420 | 1 | MVM_bigint_rand(tc, rnd, GET_REG(cur_op, 2).o); |
3421 | 1 | GET_REG(cur_op, 0).o = rnd; |
3422 | 1 | cur_op += 6; |
3423 | 1 | goto NEXT; |
3424 | 1 | } |
3425 | 8 | OP(coerce_In): { |
3426 | 8 | MVMObject *a = GET_REG(cur_op, 2).o; |
3427 | 8 | GET_REG(cur_op, 0).n64 = MVM_bigint_to_num(tc, a); |
3428 | 8 | cur_op += 4; |
3429 | 8 | goto NEXT; |
3430 | 8 | } |
3431 | 380 | OP(coerce_Is): { |
3432 | 380 | GET_REG(cur_op, 0).s = MVM_bigint_to_str(tc, GET_REG(cur_op, 2).o, 10); |
3433 | 380 | cur_op += 4; |
3434 | 380 | goto NEXT; |
3435 | 380 | } |
3436 | 320 | OP(coerce_nI): { |
3437 | 320 | MVMObject * const type = GET_REG(cur_op, 4).o; |
3438 | 320 | GET_REG(cur_op, 0).o = MVM_bigint_from_num(tc, type, GET_REG(cur_op, 2).n64); |
3439 | 320 | cur_op += 6; |
3440 | 320 | goto NEXT; |
3441 | 320 | } |
3442 | 225 | OP(coerce_sI): { |
3443 | 225 | MVMString *s = GET_REG(cur_op, 2).s; |
3444 | 225 | MVMObject *type = GET_REG(cur_op, 4).o; |
3445 | 225 | char *buf = MVM_string_ascii_encode(tc, s, NULL, 0); |
3446 | 225 | MVMObject *a = MVM_repr_alloc_init(tc, type); |
3447 | 225 | MVM_bigint_from_str(tc, a, buf); |
3448 | 225 | MVM_free(buf); |
3449 | 225 | GET_REG(cur_op, 0).o = a; |
3450 | 225 | cur_op += 6; |
3451 | 225 | goto NEXT; |
3452 | 225 | } |
3453 | 6 | OP(isbig_I): { |
3454 | 6 | GET_REG(cur_op, 0).i64 = MVM_bigint_is_big(tc, GET_REG(cur_op, 2).o); |
3455 | 6 | cur_op += 4; |
3456 | 6 | goto NEXT; |
3457 | 6 | } |
3458 | 2 | OP(bool_I): |
3459 | 2 | GET_REG(cur_op, 0).i64 = MVM_bigint_bool(tc, GET_REG(cur_op, 2).o); |
3460 | 2 | cur_op += 4; |
3461 | 2 | goto NEXT; |
3462 | 62 | OP(base_I): { |
3463 | 62 | GET_REG(cur_op, 0).s = MVM_bigint_to_str(tc, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).i64); |
3464 | 62 | cur_op += 6; |
3465 | 62 | goto NEXT; |
3466 | 62 | } |
3467 | 21 | OP(radix_I): |
3468 | 21 | GET_REG(cur_op, 0).o = MVM_bigint_radix(tc, |
3469 | 21 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).s, |
3470 | 21 | GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).i64, GET_REG(cur_op, 10).o); |
3471 | 21 | cur_op += 12; |
3472 | 21 | goto NEXT; |
3473 | 7 | OP(div_In): { |
3474 | 7 | MVMObject *a = GET_REG(cur_op, 2).o, *b = GET_REG(cur_op, 4).o; |
3475 | 7 | GET_REG(cur_op, 0).n64 = MVM_bigint_div_num(tc, a, b); |
3476 | 7 | cur_op += 6; |
3477 | 7 | goto NEXT; |
3478 | 7 | } |
3479 | 2 | OP(copy_f): |
3480 | 2 | MVM_file_copy(tc, GET_REG(cur_op, 0).s, GET_REG(cur_op, 2).s); |
3481 | 2 | cur_op += 4; |
3482 | 2 | goto NEXT; |
3483 | 0 | OP(append_f): |
3484 | 0 | MVM_exception_throw_adhoc(tc, "append is not supported"); |
3485 | 0 | goto NEXT; |
3486 | 2 | OP(rename_f): |
3487 | 2 | MVM_file_rename(tc, GET_REG(cur_op, 0).s, GET_REG(cur_op, 2).s); |
3488 | 2 | cur_op += 4; |
3489 | 2 | goto NEXT; |
3490 | 18 | OP(delete_f): |
3491 | 18 | MVM_file_delete(tc, GET_REG(cur_op, 0).s); |
3492 | 18 | cur_op += 2; |
3493 | 18 | goto NEXT; |
3494 | 0 | OP(chmod_f): |
3495 | 0 | MVM_file_chmod(tc, GET_REG(cur_op, 0).s, GET_REG(cur_op, 2).i64); |
3496 | 0 | cur_op += 4; |
3497 | 0 | goto NEXT; |
3498 | 0 | OP(exists_f): |
3499 | 0 | GET_REG(cur_op, 0).i64 = MVM_file_exists(tc, GET_REG(cur_op, 2).s, 0); |
3500 | 0 | cur_op += 4; |
3501 | 0 | goto NEXT; |
3502 | 1 | OP(mkdir): |
3503 | 1 | MVM_dir_mkdir(tc, GET_REG(cur_op, 0).s, GET_REG(cur_op, 2).i64); |
3504 | 1 | cur_op += 4; |
3505 | 1 | goto NEXT; |
3506 | 1 | OP(rmdir): |
3507 | 1 | MVM_dir_rmdir(tc, GET_REG(cur_op, 0).s); |
3508 | 1 | cur_op += 2; |
3509 | 1 | goto NEXT; |
3510 | 0 | OP(open_dir): |
3511 | 0 | GET_REG(cur_op, 0).o = MVM_dir_open(tc, GET_REG(cur_op, 2).s); |
3512 | 0 | cur_op += 4; |
3513 | 0 | goto NEXT; |
3514 | 0 | OP(read_dir): |
3515 | 0 | GET_REG(cur_op, 0).s = MVM_dir_read(tc, GET_REG(cur_op, 2).o); |
3516 | 0 | cur_op += 4; |
3517 | 0 | goto NEXT; |
3518 | 0 | OP(close_dir): |
3519 | 0 | MVM_dir_close(tc, GET_REG(cur_op, 0).o); |
3520 | 0 | cur_op += 2; |
3521 | 0 | goto NEXT; |
3522 | 196 | OP(open_fh): |
3523 | 196 | GET_REG(cur_op, 0).o = MVM_file_open_fh(tc, GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s); |
3524 | 196 | cur_op += 6; |
3525 | 196 | goto NEXT; |
3526 | 198 | OP(close_fh): |
3527 | 198 | MVM_io_close(tc, GET_REG(cur_op, 0).o); |
3528 | 198 | cur_op += 2; |
3529 | 198 | goto NEXT; |
3530 | 4 | OP(read_fhs): |
3531 | 4 | GET_REG(cur_op, 0).s = MVM_io_read_string(tc, GET_REG(cur_op, 2).o, |
3532 | 4 | GET_REG(cur_op, 4).i64); |
3533 | 4 | cur_op += 6; |
3534 | 4 | goto NEXT; |
3535 | 0 | OP(slurp): |
3536 | 0 | GET_REG(cur_op, 0).s = MVM_file_slurp(tc, |
3537 | 0 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s); |
3538 | 0 | cur_op += 6; |
3539 | 0 | goto NEXT; |
3540 | 0 | OP(spew): |
3541 | 0 | MVM_file_spew(tc, GET_REG(cur_op, 0).s, GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s); |
3542 | 0 | cur_op += 6; |
3543 | 0 | goto NEXT; |
3544 | 19 | OP(write_fhs): |
3545 | 19 | GET_REG(cur_op, 0).i64 = MVM_io_write_string(tc, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).s, 0); |
3546 | 19 | cur_op += 6; |
3547 | 19 | goto NEXT; |
3548 | 6 | OP(seek_fh): |
3549 | 6 | MVM_io_seek(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).i64, |
3550 | 6 | GET_REG(cur_op, 4).i64); |
3551 | 6 | cur_op += 6; |
3552 | 6 | goto NEXT; |
3553 | 0 | OP(lock_fh): |
3554 | 0 | GET_REG(cur_op, 0).i64 = MVM_io_lock(tc, GET_REG(cur_op, 2).o, |
3555 | 0 | GET_REG(cur_op, 4).i64); |
3556 | 0 | cur_op += 6; |
3557 | 0 | goto NEXT; |
3558 | 0 | OP(unlock_fh): |
3559 | 0 | MVM_io_unlock(tc, GET_REG(cur_op, 0).o); |
3560 | 0 | cur_op += 2; |
3561 | 0 | goto NEXT; |
3562 | 0 | OP(sync_fh): |
3563 | 0 | MVM_io_flush(tc, GET_REG(cur_op, 0).o); |
3564 | 0 | cur_op += 2; |
3565 | 0 | goto NEXT; |
3566 | 0 | OP(trunc_fh): |
3567 | 0 | MVM_io_truncate(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).i64); |
3568 | 0 | cur_op += 4; |
3569 | 0 | goto NEXT; |
3570 | 3 | OP(eof_fh): |
3571 | 3 | GET_REG(cur_op, 0).i64 = MVM_io_eof(tc, GET_REG(cur_op, 2).o); |
3572 | 3 | cur_op += 4; |
3573 | 3 | goto NEXT; |
3574 | 1.22k | OP(getstdin): |
3575 | 1.22k | if (MVM_is_null(tc, tc->instance->stdin_handle)) |
3576 | 0 | MVM_exception_throw_adhoc(tc, "STDIN filehandle was never initialized"); |
3577 | 1.22k | GET_REG(cur_op, 0).o = tc->instance->stdin_handle; |
3578 | 1.22k | cur_op += 2; |
3579 | 1.22k | goto NEXT; |
3580 | 2 | OP(getstdout): |
3581 | 2 | if (MVM_is_null(tc, tc->instance->stdout_handle)) |
3582 | 0 | MVM_exception_throw_adhoc(tc, "STDOUT filehandle was never initialized"); |
3583 | 2 | GET_REG(cur_op, 0).o = tc->instance->stdout_handle; |
3584 | 2 | cur_op += 2; |
3585 | 2 | goto NEXT; |
3586 | 1.27k | OP(getstderr): |
3587 | 1.27k | if (MVM_is_null(tc, tc->instance->stderr_handle)) |
3588 | 0 | MVM_exception_throw_adhoc(tc, "STDERR filehandle was never initialized"); |
3589 | 1.27k | GET_REG(cur_op, 0).o = tc->instance->stderr_handle; |
3590 | 1.27k | cur_op += 2; |
3591 | 1.27k | goto NEXT; |
3592 | 0 | OP(connect_sk): |
3593 | 0 | MVM_io_connect(tc, GET_REG(cur_op, 0).o, |
3594 | 0 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64); |
3595 | 0 | cur_op += 6; |
3596 | 0 | goto NEXT; |
3597 | 0 | OP(socket): |
3598 | 0 | GET_REG(cur_op, 0).o = MVM_io_socket_create(tc, GET_REG(cur_op, 2).i64); |
3599 | 0 | cur_op += 4; |
3600 | 0 | goto NEXT; |
3601 | 0 | OP(bind_sk): |
3602 | 0 | MVM_io_bind(tc, GET_REG(cur_op, 0).o, |
3603 | 0 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64, (int)GET_REG(cur_op, 6).i64); |
3604 | 0 | cur_op += 8; |
3605 | 0 | goto NEXT; |
3606 | 7 | OP(setinputlinesep_fh): |
3607 | 7 | MVM_io_set_separator(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).s); |
3608 | 7 | cur_op += 4; |
3609 | 7 | goto NEXT; |
3610 | 0 | OP(accept_sk): |
3611 | 0 | GET_REG(cur_op, 0).o = MVM_io_accept(tc, GET_REG(cur_op, 2).o); |
3612 | 0 | cur_op += 4; |
3613 | 0 | goto NEXT; |
3614 | 0 | OP(decodetocodes): |
3615 | 0 | OP(encodefromcodes): |
3616 | 0 | MVM_exception_throw_adhoc(tc, "NYI"); |
3617 | 163 | OP(setencoding): |
3618 | 163 | MVM_io_set_encoding(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).s); |
3619 | 163 | cur_op += 4; |
3620 | 163 | goto NEXT; |
3621 | 47 | OP(print): |
3622 | 47 | MVM_string_print(tc, GET_REG(cur_op, 0).s); |
3623 | 47 | cur_op += 2; |
3624 | 47 | goto NEXT; |
3625 | 11.3k | OP(say): |
3626 | 11.3k | MVM_string_say(tc, GET_REG(cur_op, 0).s); |
3627 | 11.3k | cur_op += 2; |
3628 | 11.3k | goto NEXT; |
3629 | 176 | OP(readall_fh): |
3630 | 176 | GET_REG(cur_op, 0).s = MVM_io_slurp(tc, GET_REG(cur_op, 2).o); |
3631 | 176 | cur_op += 4; |
3632 | 176 | goto NEXT; |
3633 | 9 | OP(tell_fh): |
3634 | 9 | GET_REG(cur_op, 0).i64 = MVM_io_tell(tc, GET_REG(cur_op, 2).o); |
3635 | 9 | cur_op += 4; |
3636 | 9 | goto NEXT; |
3637 | 3.69k | OP(stat): |
3638 | 3.69k | GET_REG(cur_op, 0).i64 = MVM_file_stat(tc, GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64, 0); |
3639 | 3.69k | cur_op += 6; |
3640 | 3.69k | goto NEXT; |
3641 | 17 | OP(readline_fh): |
3642 | 17 | GET_REG(cur_op, 0).s = MVM_io_readline(tc, GET_REG(cur_op, 2).o, 0); |
3643 | 17 | cur_op += 4; |
3644 | 17 | goto NEXT; |
3645 | 0 | OP(readlineint_fh): |
3646 | 0 | cur_op += 6; |
3647 | 0 | goto NEXT; |
3648 | 4 | OP(chdir): |
3649 | 4 | MVM_dir_chdir(tc, GET_REG(cur_op, 0).s); |
3650 | 4 | cur_op += 2; |
3651 | 4 | goto NEXT; |
3652 | 2 | OP(srand): |
3653 | 2 | MVM_proc_seed(tc, GET_REG(cur_op, 0).i64); |
3654 | 2 | cur_op += 2; |
3655 | 2 | goto NEXT; |
3656 | 0 | OP(rand_i): |
3657 | 0 | GET_REG(cur_op, 0).i64 = MVM_proc_rand_i(tc); |
3658 | 0 | cur_op += 2; |
3659 | 0 | goto NEXT; |
3660 | 0 | OP(rand_n): |
3661 | 0 | GET_REG(cur_op, 0).n64 = MVM_proc_rand_n(tc); |
3662 | 0 | cur_op += 2; |
3663 | 0 | goto NEXT; |
3664 | 2 | OP(time_i): |
3665 | 2 | GET_REG(cur_op, 0).i64 = MVM_proc_time_i(tc); |
3666 | 2 | cur_op += 2; |
3667 | 2 | goto NEXT; |
3668 | 0 | OP(sleep): { |
3669 | 0 | MVM_gc_mark_thread_blocked(tc); |
3670 | 0 | MVM_platform_sleep(GET_REG(cur_op, 0).n64); |
3671 | 0 | MVM_gc_mark_thread_unblocked(tc); |
3672 | 0 | cur_op += 2; |
3673 | 0 | goto NEXT; |
3674 | 0 | } |
3675 | 0 | OP(newthread): |
3676 | 0 | GET_REG(cur_op, 0).o = MVM_thread_new(tc, GET_REG(cur_op, 2).o, |
3677 | 0 | GET_REG(cur_op, 4).i64); |
3678 | 0 | cur_op += 6; |
3679 | 0 | goto NEXT; |
3680 | 0 | OP(threadjoin): |
3681 | 0 | MVM_thread_join(tc, GET_REG(cur_op, 0).o); |
3682 | 0 | cur_op += 2; |
3683 | 0 | goto NEXT; |
3684 | 3.77k | OP(time_n): |
3685 | 3.77k | GET_REG(cur_op, 0).n64 = MVM_proc_time_n(tc); |
3686 | 3.77k | cur_op += 2; |
3687 | 3.77k | goto NEXT; |
3688 | 0 | OP(exit): { |
3689 | 0 | MVMint64 exit_code = GET_REG(cur_op, 0).i64; |
3690 | 0 | exit(exit_code); |
3691 | 0 | } |
3692 | 9 | OP(shell): |
3693 | 9 | GET_REG(cur_op, 0).i64 = MVM_proc_shell(tc, GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s, |
3694 | 9 | GET_REG(cur_op, 6).o, GET_REG(cur_op, 8).o, GET_REG(cur_op, 10).o, GET_REG(cur_op, 12).o, GET_REG(cur_op, 14).i64); |
3695 | 9 | cur_op += 16; |
3696 | 9 | goto NEXT; |
3697 | 9 | OP(cwd): |
3698 | 9 | GET_REG(cur_op, 0).s = MVM_dir_cwd(tc); |
3699 | 9 | cur_op += 2; |
3700 | 9 | goto NEXT; |
3701 | 130 | OP(clargs): |
3702 | 130 | GET_REG(cur_op, 0).o = MVM_proc_clargs(tc); |
3703 | 130 | cur_op += 2; |
3704 | 130 | goto NEXT; |
3705 | 141 | OP(getenvhash): |
3706 | 141 | GET_REG(cur_op, 0).o = MVM_proc_getenvhash(tc); |
3707 | 141 | cur_op += 2; |
3708 | 141 | goto NEXT; |
3709 | 0 | OP(loadlib): { |
3710 | 0 | MVMString *name = GET_REG(cur_op, 0).s; |
3711 | 0 | MVMString *path = GET_REG(cur_op, 2).s; |
3712 | 0 | MVM_dll_load(tc, name, path); |
3713 | 0 | cur_op += 4; |
3714 | 0 | goto NEXT; |
3715 | 0 | } |
3716 | 0 | OP(freelib): { |
3717 | 0 | MVMString *name = GET_REG(cur_op, 0).s; |
3718 | 0 | MVM_dll_free(tc, name); |
3719 | 0 | cur_op += 2; |
3720 | 0 | goto NEXT; |
3721 | 0 | } |
3722 | 0 | OP(findsym): { |
3723 | 0 | MVMString *lib = GET_REG(cur_op, 2).s; |
3724 | 0 | MVMString *sym = GET_REG(cur_op, 4).s; |
3725 | 0 | MVMObject *obj = MVM_dll_find_symbol(tc, lib, sym); |
3726 | 0 | if (MVM_is_null(tc, obj)) |
3727 | 0 | MVM_exception_throw_adhoc(tc, "symbol not found in DLL"); |
3728 | 0 |
|
3729 | 0 | GET_REG(cur_op, 0).o = obj; |
3730 | 0 | cur_op += 6; |
3731 | 0 | goto NEXT; |
3732 | 0 | } |
3733 | 0 | OP(dropsym): { |
3734 | 0 | MVM_dll_drop_symbol(tc, GET_REG(cur_op, 0).o); |
3735 | 0 | cur_op += 2; |
3736 | 0 | goto NEXT; |
3737 | 0 | } |
3738 | 0 | OP(loadext): { |
3739 | 0 | MVMString *lib = GET_REG(cur_op, 0).s; |
3740 | 0 | MVMString *ext = GET_REG(cur_op, 2).s; |
3741 | 0 | MVM_ext_load(tc, lib, ext); |
3742 | 0 | cur_op += 4; |
3743 | 0 | goto NEXT; |
3744 | 0 | } |
3745 | 131 | OP(backendconfig): |
3746 | 131 | GET_REG(cur_op, 0).o = MVM_backend_config(tc); |
3747 | 131 | cur_op += 2; |
3748 | 131 | goto NEXT; |
3749 | 4 | OP(getlexouter): { |
3750 | 4 | GET_REG(cur_op, 0).o = MVM_frame_find_lexical_by_name_outer(tc, |
3751 | 4 | GET_REG(cur_op, 2).s); |
3752 | 4 | cur_op += 4; |
3753 | 4 | goto NEXT; |
3754 | 4 | } |
3755 | 2 | OP(getlexrel): { |
3756 | 2 | MVMObject *ctx = GET_REG(cur_op, 2).o; |
3757 | 2 | MVMRegister *r; |
3758 | 2 | if (REPR(ctx)->ID != MVM_REPR_ID_MVMContext || !IS_CONCRETE(ctx)) |
3759 | 0 | MVM_exception_throw_adhoc(tc, "getlexrel needs a context"); |
3760 | 2 | r = MVM_frame_find_lexical_by_name_rel(tc, |
3761 | 2 | GET_REG(cur_op, 4).s, ((MVMContext *)ctx)->body.context); |
3762 | 2 | GET_REG(cur_op, 0).o = r ? r->o : NULL; |
3763 | 2 | cur_op += 6; |
3764 | 2 | goto NEXT; |
3765 | 2 | } |
3766 | 7 | OP(getlexreldyn): { |
3767 | 7 | MVMObject *ctx = GET_REG(cur_op, 2).o; |
3768 | 7 | if (REPR(ctx)->ID != MVM_REPR_ID_MVMContext || !IS_CONCRETE(ctx)) |
3769 | 0 | MVM_exception_throw_adhoc(tc, "getlexreldyn needs a context"); |
3770 | 7 | GET_REG(cur_op, 0).o = MVM_frame_getdynlex(tc, GET_REG(cur_op, 4).s, |
3771 | 7 | ((MVMContext *)ctx)->body.context); |
3772 | 7 | cur_op += 6; |
3773 | 7 | goto NEXT; |
3774 | 7 | } |
3775 | 7 | OP(getlexrelcaller): { |
3776 | 7 | MVMObject *ctx = GET_REG(cur_op, 2).o; |
3777 | 7 | MVMRegister *res; |
3778 | 7 | if (REPR(ctx)->ID != MVM_REPR_ID_MVMContext || !IS_CONCRETE(ctx)) |
3779 | 0 | MVM_exception_throw_adhoc(tc, "getlexrelcaller needs a context"); |
3780 | 7 | res = MVM_frame_find_lexical_by_name_rel_caller(tc, GET_REG(cur_op, 4).s, |
3781 | 7 | ((MVMContext *)ctx)->body.context); |
3782 | 7 | GET_REG(cur_op, 0).o = res ? res->o : tc->instance->VMNull; |
3783 | 7 | cur_op += 6; |
3784 | 7 | goto NEXT; |
3785 | 7 | } |
3786 | 3 | OP(getlexcaller): { |
3787 | 3 | MVMRegister *res = MVM_frame_find_lexical_by_name_rel_caller(tc, |
3788 | 3 | GET_REG(cur_op, 2).s, tc->cur_frame->caller); |
3789 | 3 | GET_REG(cur_op, 0).o = res ? res->o : tc->instance->VMNull; |
3790 | 3 | cur_op += 4; |
3791 | 3 | goto NEXT; |
3792 | 3 | } |
3793 | 1 | OP(bitand_s): |
3794 | 1 | GET_REG(cur_op, 0).s = MVM_string_bitand(tc, |
3795 | 1 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s); |
3796 | 1 | cur_op += 6; |
3797 | 1 | goto NEXT; |
3798 | 1 | OP(bitor_s): |
3799 | 1 | GET_REG(cur_op, 0).s = MVM_string_bitor(tc, |
3800 | 1 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s); |
3801 | 1 | cur_op += 6; |
3802 | 1 | goto NEXT; |
3803 | 1 | OP(bitxor_s): |
3804 | 1 | GET_REG(cur_op, 0).s = MVM_string_bitxor(tc, |
3805 | 1 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).s); |
3806 | 1 | cur_op += 6; |
3807 | 1 | goto NEXT; |
3808 | 186 | OP(isnanorinf): |
3809 | 186 | GET_REG(cur_op, 0).i64 = MVM_num_isnanorinf(tc, GET_REG(cur_op, 2).n64); |
3810 | 186 | cur_op += 4; |
3811 | 186 | goto NEXT; |
3812 | 13 | OP(inf): |
3813 | 13 | GET_REG(cur_op, 0).n64 = MVM_num_posinf(tc); |
3814 | 13 | cur_op += 2; |
3815 | 13 | goto NEXT; |
3816 | 9 | OP(neginf): |
3817 | 9 | GET_REG(cur_op, 0).n64 = MVM_num_neginf(tc); |
3818 | 9 | cur_op += 2; |
3819 | 9 | goto NEXT; |
3820 | 3 | OP(nan): |
3821 | 3 | GET_REG(cur_op, 0).n64 = MVM_num_nan(tc); |
3822 | 3 | cur_op += 2; |
3823 | 3 | goto NEXT; |
3824 | 0 | OP(getpid): |
3825 | 0 | GET_REG(cur_op, 0).i64 = MVM_proc_getpid(tc); |
3826 | 0 | cur_op += 2; |
3827 | 0 | goto NEXT; |
3828 | 0 | OP(spawn): |
3829 | 0 | GET_REG(cur_op, 0).i64 = MVM_proc_spawn(tc, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).s, |
3830 | 0 | GET_REG(cur_op, 6).o, GET_REG(cur_op, 8).o, GET_REG(cur_op, 10).o, GET_REG(cur_op, 12).o, GET_REG(cur_op, 14).i64); |
3831 | 0 | cur_op += 16; |
3832 | 0 | goto NEXT; |
3833 | 0 | OP(filereadable): |
3834 | 0 | GET_REG(cur_op, 0).i64 = MVM_file_isreadable(tc, GET_REG(cur_op, 2).s,0); |
3835 | 0 | cur_op += 4; |
3836 | 0 | goto NEXT; |
3837 | 0 | OP(filewritable): |
3838 | 0 | GET_REG(cur_op, 0).i64 = MVM_file_iswritable(tc, GET_REG(cur_op, 2).s,0); |
3839 | 0 | cur_op += 4; |
3840 | 0 | goto NEXT; |
3841 | 0 | OP(fileexecutable): |
3842 | 0 | GET_REG(cur_op, 0).i64 = MVM_file_isexecutable(tc, GET_REG(cur_op, 2).s,0); |
3843 | 0 | cur_op += 4; |
3844 | 0 | goto NEXT; |
3845 | 0 | OP(say_fhs): |
3846 | 0 | GET_REG(cur_op, 0).i64 = MVM_io_write_string(tc, GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).s, 1); |
3847 | 0 | cur_op += 6; |
3848 | 0 | goto NEXT; |
3849 | 2 | OP(capturenamedshash): { |
3850 | 2 | MVMObject *obj = GET_REG(cur_op, 2).o; |
3851 | 2 | if (IS_CONCRETE(obj) && REPR(obj)->ID == MVM_REPR_ID_MVMCallCapture) { |
3852 | 2 | MVMCallCapture *cc = (MVMCallCapture *)obj; |
3853 | 2 | GET_REG(cur_op, 0).o = MVM_args_slurpy_named(tc, cc->body.apc); |
3854 | 2 | } |
3855 | 0 | else { |
3856 | 0 | MVM_exception_throw_adhoc(tc, "capturehasnameds needs a MVMCallCapture"); |
3857 | 0 | } |
3858 | 2 | cur_op += 4; |
3859 | 2 | goto NEXT; |
3860 | 2 | } |
3861 | 4 | OP(read_fhb): |
3862 | 4 | MVM_io_read_bytes(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).o, |
3863 | 4 | GET_REG(cur_op, 4).i64); |
3864 | 4 | cur_op += 6; |
3865 | 4 | goto NEXT; |
3866 | 2 | OP(write_fhb): |
3867 | 2 | MVM_io_write_bytes(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).o); |
3868 | 2 | cur_op += 4; |
3869 | 2 | goto NEXT; |
3870 | 1 | OP(replace): |
3871 | 1 | GET_REG(cur_op, 0).s = MVM_string_replace(tc, |
3872 | 1 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64, GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).s); |
3873 | 1 | cur_op += 10; |
3874 | 1 | goto NEXT; |
3875 | 35 | OP(newexception): |
3876 | 35 | GET_REG(cur_op, 0).o = (MVMObject *)MVM_repr_alloc_init(tc, |
3877 | 35 | tc->instance->boot_types.BOOTException); |
3878 | 35 | cur_op += 2; |
3879 | 35 | goto NEXT; |
3880 | 0 | OP(DEPRECATED_0): |
3881 | 0 | cur_op += 2; |
3882 | 0 | goto NEXT; |
3883 | 0 | OP(backtrace): |
3884 | 0 | GET_REG(cur_op, 0).o = MVM_exception_backtrace(tc, GET_REG(cur_op, 2).o); |
3885 | 0 | cur_op += 4; |
3886 | 0 | goto NEXT; |
3887 | 3 | OP(symlink): |
3888 | 3 | MVM_file_symlink(tc, GET_REG(cur_op, 0).s, GET_REG(cur_op, 2).s); |
3889 | 3 | cur_op += 4; |
3890 | 3 | goto NEXT; |
3891 | 1 | OP(link): |
3892 | 1 | MVM_file_link(tc, GET_REG(cur_op, 0).s, GET_REG(cur_op, 2).s); |
3893 | 1 | cur_op += 4; |
3894 | 1 | goto NEXT; |
3895 | 0 | OP(gethostname): |
3896 | 0 | GET_REG(cur_op, 0).s = MVM_io_get_hostname(tc); |
3897 | 0 | cur_op += 2; |
3898 | 0 | goto NEXT; |
3899 | 0 | OP(exreturnafterunwind): { |
3900 | 0 | MVMObject *ex = GET_REG(cur_op, 0).o; |
3901 | 0 | if (IS_CONCRETE(ex) && REPR(ex)->ID == MVM_REPR_ID_MVMException) |
3902 | 0 | ((MVMException *)ex)->body.return_after_unwind = 1; |
3903 | 0 | else |
3904 | 0 | MVM_exception_throw_adhoc(tc, "exreturnafterunwind needs a VMException, got %s (%s)", REPR(ex)->name, STABLE(ex)->debug_name); |
3905 | 0 | cur_op += 2; |
3906 | 0 | goto NEXT; |
3907 | 0 | } |
3908 | 25 | OP(continuationreset): { |
3909 | 25 | MVMRegister *res = &GET_REG(cur_op, 0); |
3910 | 25 | MVMObject *tag = GET_REG(cur_op, 2).o; |
3911 | 25 | MVMObject *code = GET_REG(cur_op, 4).o; |
3912 | 25 | cur_op += 6; |
3913 | 25 | MVM_continuation_reset(tc, tag, code, res); |
3914 | 25 | goto NEXT; |
3915 | 25 | } |
3916 | 21 | OP(continuationcontrol): { |
3917 | 21 | MVMRegister *res = &GET_REG(cur_op, 0); |
3918 | 21 | MVMint64 protect = GET_REG(cur_op, 2).i64; |
3919 | 21 | MVMObject *tag = GET_REG(cur_op, 4).o; |
3920 | 21 | MVMObject *code = GET_REG(cur_op, 6).o; |
3921 | 21 | cur_op += 8; |
3922 | 21 | MVM_continuation_control(tc, protect, tag, code, res); |
3923 | 21 | goto NEXT; |
3924 | 21 | } |
3925 | 14 | OP(continuationinvoke): { |
3926 | 14 | MVMRegister *res = &GET_REG(cur_op, 0); |
3927 | 14 | MVMObject *cont = GET_REG(cur_op, 2).o; |
3928 | 14 | MVMObject *code = GET_REG(cur_op, 4).o; |
3929 | 14 | cur_op += 6; |
3930 | 14 | if (REPR(cont)->ID == MVM_REPR_ID_MVMContinuation) |
3931 | 14 | MVM_continuation_invoke(tc, (MVMContinuation *)cont, code, res); |
3932 | 14 | else |
3933 | 0 | MVM_exception_throw_adhoc(tc, "continuationinvoke expects an MVMContinuation"); |
3934 | 14 | goto NEXT; |
3935 | 14 | } |
3936 | 5 | OP(randscale_n): |
3937 | 5 | GET_REG(cur_op, 0).n64 = MVM_proc_rand_n(tc) * GET_REG(cur_op, 2).n64; |
3938 | 5 | cur_op += 4; |
3939 | 5 | goto NEXT; |
3940 | 0 | OP(uniisblock): |
3941 | 0 | GET_REG(cur_op, 0).i64 = (MVMint64)MVM_unicode_is_in_block(tc, |
3942 | 0 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64, GET_REG(cur_op, 6).s); |
3943 | 0 | cur_op += 8; |
3944 | 0 | goto NEXT; |
3945 | 3 | OP(assertparamcheck): { |
3946 | 3 | MVMint64 ok = GET_REG(cur_op, 0).i64; |
3947 | 3 | cur_op += 2; |
3948 | 3 | if (!ok) |
3949 | 2 | MVM_args_bind_failed(tc); |
3950 | 3 | goto NEXT; |
3951 | 3 | } |
3952 | 5.87k | OP(hintfor): { |
3953 | 5.87k | MVMObject *obj = GET_REG(cur_op, 2).o; |
3954 | 5.87k | GET_REG(cur_op, 0).i64 = REPR(obj)->attr_funcs.hint_for(tc, |
3955 | 5.87k | STABLE(obj), obj, |
3956 | 5.87k | GET_REG(cur_op, 4).s); |
3957 | 5.87k | cur_op += 6; |
3958 | 5.87k | goto NEXT; |
3959 | 5.87k | } |
3960 | 4.06M | OP(paramnamesused): { |
3961 | 4.06M | MVMArgProcContext *ctx = &tc->cur_frame->params; |
3962 | 4.06M | if (ctx->callsite->num_pos != ctx->callsite->arg_count) |
3963 | 293k | MVM_args_assert_nameds_used(tc, ctx); |
3964 | 4.06M | goto NEXT; |
3965 | 4.06M | } |
3966 | 0 | OP(getuniname): { |
3967 | 0 | GET_REG(cur_op, 0).s = MVM_unicode_get_name(tc, GET_REG(cur_op, 2).i64); |
3968 | 0 | cur_op += 4; |
3969 | 0 | goto NEXT; |
3970 | 0 | } |
3971 | 0 | OP(getuniprop_int): |
3972 | 0 | GET_REG(cur_op, 0).i64 = MVM_unicode_codepoint_get_property_int(tc, |
3973 | 0 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).i64); |
3974 | 0 | cur_op += 6; |
3975 | 0 | goto NEXT; |
3976 | 0 | OP(getuniprop_bool): |
3977 | 0 | GET_REG(cur_op, 0).i64 = MVM_unicode_codepoint_get_property_bool(tc, |
3978 | 0 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).i64); |
3979 | 0 | cur_op += 6; |
3980 | 0 | goto NEXT; |
3981 | 0 | OP(getuniprop_str): |
3982 | 0 | GET_REG(cur_op, 0).s = MVM_unicode_codepoint_get_property_str(tc, |
3983 | 0 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).i64); |
3984 | 0 | cur_op += 6; |
3985 | 0 | goto NEXT; |
3986 | 0 | OP(matchuniprop): |
3987 | 0 | GET_REG(cur_op, 0).i64 = MVM_unicode_codepoint_has_property_value(tc, |
3988 | 0 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).i64, |
3989 | 0 | GET_REG(cur_op, 6).i64); |
3990 | 0 | cur_op += 8; |
3991 | 0 | goto NEXT; |
3992 | 3 | OP(nativecallbuild): |
3993 | 3 | MVM_nativecall_build(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).s, |
3994 | 3 | GET_REG(cur_op, 4).s, GET_REG(cur_op, 6).s, |
3995 | 3 | GET_REG(cur_op, 8).o, GET_REG(cur_op, 10).o); |
3996 | 3 | cur_op += 12; |
3997 | 3 | goto NEXT; |
3998 | 3 | OP(nativecallinvoke): |
3999 | 3 | GET_REG(cur_op, 0).o = MVM_nativecall_invoke(tc, GET_REG(cur_op, 2).o, |
4000 | 3 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).o); |
4001 | 3 | cur_op += 8; |
4002 | 3 | goto NEXT; |
4003 | 0 | OP(nativecallrefresh): |
4004 | 0 | MVM_nativecall_refresh(tc, GET_REG(cur_op, 0).o); |
4005 | 0 | cur_op += 2; |
4006 | 0 | goto NEXT; |
4007 | 0 | OP(threadrun): |
4008 | 0 | MVM_thread_run(tc, GET_REG(cur_op, 0).o); |
4009 | 0 | cur_op += 2; |
4010 | 0 | goto NEXT; |
4011 | 0 | OP(threadid): |
4012 | 0 | GET_REG(cur_op, 0).i64 = MVM_thread_id(tc, GET_REG(cur_op, 2).o); |
4013 | 0 | cur_op += 4; |
4014 | 0 | goto NEXT; |
4015 | 0 | OP(threadyield): |
4016 | 0 | MVM_thread_yield(tc); |
4017 | 0 | goto NEXT; |
4018 | 0 | OP(currentthread): |
4019 | 0 | GET_REG(cur_op, 0).o = MVM_thread_current(tc); |
4020 | 0 | cur_op += 2; |
4021 | 0 | goto NEXT; |
4022 | 0 | OP(lock): { |
4023 | 0 | MVMObject *lock = GET_REG(cur_op, 0).o; |
4024 | 0 | if (REPR(lock)->ID == MVM_REPR_ID_ReentrantMutex && IS_CONCRETE(lock)) |
4025 | 0 | MVM_reentrantmutex_lock(tc, (MVMReentrantMutex *)lock); |
4026 | 0 | else |
4027 | 0 | MVM_exception_throw_adhoc(tc, |
4028 | 0 | "lock requires a concrete object with REPR ReentrantMutex"); |
4029 | 0 | cur_op += 2; |
4030 | 0 | goto NEXT; |
4031 | 0 | } |
4032 | 0 | OP(unlock): { |
4033 | 0 | MVMObject *lock = GET_REG(cur_op, 0).o; |
4034 | 0 | if (REPR(lock)->ID == MVM_REPR_ID_ReentrantMutex && IS_CONCRETE(lock)) |
4035 | 0 | MVM_reentrantmutex_unlock(tc, (MVMReentrantMutex *)lock); |
4036 | 0 | else |
4037 | 0 | MVM_exception_throw_adhoc(tc, |
4038 | 0 | "lock requires a concrete object with REPR ReentrantMutex"); |
4039 | 0 | cur_op += 2; |
4040 | 0 | goto NEXT; |
4041 | 0 | } |
4042 | 0 | OP(semacquire): { |
4043 | 0 | MVMObject *sem = GET_REG(cur_op, 0).o; |
4044 | 0 | if (REPR(sem)->ID == MVM_REPR_ID_Semaphore && IS_CONCRETE(sem)) |
4045 | 0 | MVM_semaphore_acquire(tc, (MVMSemaphore *)sem); |
4046 | 0 | else |
4047 | 0 | MVM_exception_throw_adhoc(tc, |
4048 | 0 | "semacquire requires a concrete object with REPR Semaphore"); |
4049 | 0 | cur_op += 2; |
4050 | 0 | goto NEXT; |
4051 | 0 | } |
4052 | 0 | OP(semtryacquire): { |
4053 | 0 | MVMObject *sem = GET_REG(cur_op, 2).o; |
4054 | 0 | if (REPR(sem)->ID == MVM_REPR_ID_Semaphore && IS_CONCRETE(sem)) |
4055 | 0 | GET_REG(cur_op, 0).i64 = MVM_semaphore_tryacquire(tc, |
4056 | 0 | (MVMSemaphore *)sem); |
4057 | 0 | else |
4058 | 0 | MVM_exception_throw_adhoc(tc, |
4059 | 0 | "semtryacquire requires a concrete object with REPR Semaphore"); |
4060 | 0 | cur_op += 4; |
4061 | 0 | goto NEXT; |
4062 | 0 | } |
4063 | 0 | OP(semrelease): { |
4064 | 0 | MVMObject *sem = GET_REG(cur_op, 0).o; |
4065 | 0 | if (REPR(sem)->ID == MVM_REPR_ID_Semaphore && IS_CONCRETE(sem)) |
4066 | 0 | MVM_semaphore_release(tc, (MVMSemaphore *)sem); |
4067 | 0 | else |
4068 | 0 | MVM_exception_throw_adhoc(tc, |
4069 | 0 | "semrelease requires a concrete object with REPR Semaphore"); |
4070 | 0 | cur_op += 2; |
4071 | 0 | goto NEXT; |
4072 | 0 | } |
4073 | 0 | OP(getlockcondvar): { |
4074 | 0 | MVMObject *lock = GET_REG(cur_op, 2).o; |
4075 | 0 | if (REPR(lock)->ID == MVM_REPR_ID_ReentrantMutex && IS_CONCRETE(lock)) |
4076 | 0 | GET_REG(cur_op, 0).o = MVM_conditionvariable_from_lock(tc, |
4077 | 0 | (MVMReentrantMutex *)lock, GET_REG(cur_op, 4).o); |
4078 | 0 | else |
4079 | 0 | MVM_exception_throw_adhoc(tc, |
4080 | 0 | "getlockcondvar requires a concrete object with REPR ReentrantMutex"); |
4081 | 0 | cur_op += 6; |
4082 | 0 | goto NEXT; |
4083 | 0 | } |
4084 | 0 | OP(condwait): { |
4085 | 0 | MVMObject *cv = GET_REG(cur_op, 0).o; |
4086 | 0 | if (REPR(cv)->ID == MVM_REPR_ID_ConditionVariable && IS_CONCRETE(cv)) |
4087 | 0 | MVM_conditionvariable_wait(tc, (MVMConditionVariable *)cv); |
4088 | 0 | else |
4089 | 0 | MVM_exception_throw_adhoc(tc, |
4090 | 0 | "condwait requires a concrete object with REPR ConditionVariable"); |
4091 | 0 | cur_op += 2; |
4092 | 0 | goto NEXT; |
4093 | 0 | } |
4094 | 0 | OP(condsignalone): { |
4095 | 0 | MVMObject *cv = GET_REG(cur_op, 0).o; |
4096 | 0 | if (REPR(cv)->ID == MVM_REPR_ID_ConditionVariable && IS_CONCRETE(cv)) |
4097 | 0 | MVM_conditionvariable_signal_one(tc, (MVMConditionVariable *)cv); |
4098 | 0 | else |
4099 | 0 | MVM_exception_throw_adhoc(tc, |
4100 | 0 | "condsignalone requires a concrete object with REPR ConditionVariable"); |
4101 | 0 | cur_op += 2; |
4102 | 0 | goto NEXT; |
4103 | 0 | } |
4104 | 0 | OP(condsignalall): { |
4105 | 0 | MVMObject *cv = GET_REG(cur_op, 0).o; |
4106 | 0 | if (REPR(cv)->ID == MVM_REPR_ID_ConditionVariable && IS_CONCRETE(cv)) |
4107 | 0 | MVM_conditionvariable_signal_all(tc, (MVMConditionVariable *)cv); |
4108 | 0 | else |
4109 | 0 | MVM_exception_throw_adhoc(tc, |
4110 | 0 | "condsignalall requires a concrete object with REPR ConditionVariable"); |
4111 | 0 | cur_op += 2; |
4112 | 0 | goto NEXT; |
4113 | 0 | } |
4114 | 0 | OP(queuepoll): { |
4115 | 0 | MVMObject *queue = GET_REG(cur_op, 2).o; |
4116 | 0 | if (REPR(queue)->ID == MVM_REPR_ID_ConcBlockingQueue && IS_CONCRETE(queue)) |
4117 | 0 | GET_REG(cur_op, 0).o = MVM_concblockingqueue_poll(tc, |
4118 | 0 | (MVMConcBlockingQueue *)queue); |
4119 | 0 | else |
4120 | 0 | MVM_exception_throw_adhoc(tc, |
4121 | 0 | "queuepoll requires a concrete object with REPR ConcBlockingQueue"); |
4122 | 0 | cur_op += 4; |
4123 | 0 | goto NEXT; |
4124 | 0 | } |
4125 | 130 | OP(setmultispec): { |
4126 | 130 | MVMObject *obj = GET_REG(cur_op, 0).o; |
4127 | 130 | MVMObject *ch = GET_REG(cur_op, 2).o; |
4128 | 130 | MVMString *valid_attr = GET_REG(cur_op, 4).s; |
4129 | 130 | MVMString *cache_attr = GET_REG(cur_op, 6).s; |
4130 | 130 | MVMSTable *st = STABLE(obj); |
4131 | 130 | MVMInvocationSpec *is = st->invocation_spec; |
4132 | 130 | if (!is) |
4133 | 0 | MVM_exception_throw_adhoc(tc, |
4134 | 0 | "Can only use setmultispec after setinvokespec"); |
4135 | 130 | MVM_ASSIGN_REF(tc, &(st->header), is->md_class_handle, ch); |
4136 | 130 | MVM_ASSIGN_REF(tc, &(st->header), is->md_valid_attr_name, valid_attr); |
4137 | 130 | MVM_ASSIGN_REF(tc, &(st->header), is->md_cache_attr_name, cache_attr); |
4138 | 130 | is->md_valid_hint = REPR(ch)->attr_funcs.hint_for(tc, STABLE(ch), ch, |
4139 | 130 | valid_attr); |
4140 | 130 | is->md_cache_hint = REPR(ch)->attr_funcs.hint_for(tc, STABLE(ch), ch, |
4141 | 130 | cache_attr); |
4142 | 130 | cur_op += 8; |
4143 | 130 | goto NEXT; |
4144 | 130 | } |
4145 | 1 | OP(ctxouterskipthunks): { |
4146 | 1 | MVMObject *this_ctx = GET_REG(cur_op, 2).o; |
4147 | 1 | MVMFrame *frame; |
4148 | 1 | if (!IS_CONCRETE(this_ctx) || REPR(this_ctx)->ID != MVM_REPR_ID_MVMContext) { |
4149 | 0 | MVM_exception_throw_adhoc(tc, "ctxouter needs an MVMContext"); |
4150 | 0 | } |
4151 | 1 | frame = ((MVMContext *)this_ctx)->body.context->outer; |
4152 | 3 | while (frame && frame->static_info->body.is_thunk) |
4153 | 2 | frame = frame->caller; |
4154 | 1 | if (frame) |
4155 | 1 | GET_REG(cur_op, 0).o = MVM_frame_context_wrapper(tc, frame); |
4156 | 1 | else |
4157 | 0 | GET_REG(cur_op, 0).o = tc->instance->VMNull; |
4158 | 1 | cur_op += 4; |
4159 | 1 | goto NEXT; |
4160 | 1 | } |
4161 | 1 | OP(ctxcallerskipthunks): { |
4162 | 1 | MVMObject *this_ctx = GET_REG(cur_op, 2).o, *ctx = NULL; |
4163 | 1 | MVMFrame *frame; |
4164 | 1 | if (!IS_CONCRETE(this_ctx) || REPR(this_ctx)->ID != MVM_REPR_ID_MVMContext) { |
4165 | 0 | MVM_exception_throw_adhoc(tc, "ctxcaller needs an MVMContext"); |
4166 | 0 | } |
4167 | 1 | frame = ((MVMContext *)this_ctx)->body.context->caller; |
4168 | 3 | while (frame && frame->static_info->body.is_thunk) |
4169 | 2 | frame = frame->caller; |
4170 | 1 | if (frame) |
4171 | 1 | ctx = MVM_frame_context_wrapper(tc, frame); |
4172 | 1 | GET_REG(cur_op, 0).o = ctx ? ctx : tc->instance->VMNull; |
4173 | 1 | cur_op += 4; |
4174 | 1 | goto NEXT; |
4175 | 1 | } |
4176 | 0 | OP(timer): |
4177 | 0 | GET_REG(cur_op, 0).o = MVM_io_timer_create(tc, GET_REG(cur_op, 2).o, |
4178 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).i64, |
4179 | 0 | GET_REG(cur_op, 8).i64, GET_REG(cur_op, 10).o); |
4180 | 0 | cur_op += 12; |
4181 | 0 | goto NEXT; |
4182 | 0 | OP(cancel): |
4183 | 0 | MVM_io_eventloop_cancel_work(tc, GET_REG(cur_op, 0).o, NULL, NULL); |
4184 | 0 | cur_op += 2; |
4185 | 0 | goto NEXT; |
4186 | 0 | OP(signal): |
4187 | 0 | GET_REG(cur_op, 0).o = MVM_io_signal_handle(tc, GET_REG(cur_op, 2).o, |
4188 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).o); |
4189 | 0 | cur_op += 10; |
4190 | 0 | goto NEXT; |
4191 | 0 | OP(watchfile): |
4192 | 0 | GET_REG(cur_op, 0).o = MVM_io_file_watch(tc, GET_REG(cur_op, 2).o, |
4193 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).s, GET_REG(cur_op, 8).o); |
4194 | 0 | cur_op += 10; |
4195 | 0 | goto NEXT; |
4196 | 0 | OP(asyncconnect): |
4197 | 0 | GET_REG(cur_op, 0).o = MVM_io_socket_connect_async(tc, |
4198 | 0 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).s, |
4199 | 0 | GET_REG(cur_op, 8).i64, GET_REG(cur_op, 10).o); |
4200 | 0 | cur_op += 12; |
4201 | 0 | goto NEXT; |
4202 | 0 | OP(asynclisten): |
4203 | 0 | GET_REG(cur_op, 0).o = MVM_io_socket_listen_async(tc, |
4204 | 0 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).s, |
4205 | 0 | GET_REG(cur_op, 8).i64, (int)GET_REG(cur_op, 10).i64, GET_REG(cur_op, 12).o); |
4206 | 0 | cur_op += 14; |
4207 | 0 | goto NEXT; |
4208 | 0 | OP(asyncwritestr): |
4209 | 0 | GET_REG(cur_op, 0).o = MVM_io_write_string_async(tc, GET_REG(cur_op, 2).o, |
4210 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).o, GET_REG(cur_op, 8).s, |
4211 | 0 | GET_REG(cur_op, 10).o); |
4212 | 0 | cur_op += 12; |
4213 | 0 | goto NEXT; |
4214 | 0 | OP(asyncwritebytes): |
4215 | 0 | GET_REG(cur_op, 0).o = MVM_io_write_bytes_async(tc, GET_REG(cur_op, 2).o, |
4216 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).o, GET_REG(cur_op, 8).o, |
4217 | 0 | GET_REG(cur_op, 10).o); |
4218 | 0 | cur_op += 12; |
4219 | 0 | goto NEXT; |
4220 | 0 | OP(asyncreadchars): |
4221 | 0 | GET_REG(cur_op, 0).o = MVM_io_read_chars_async(tc, GET_REG(cur_op, 2).o, |
4222 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).o, GET_REG(cur_op, 8).o); |
4223 | 0 | cur_op += 10; |
4224 | 0 | goto NEXT; |
4225 | 0 | OP(asyncreadbytes): |
4226 | 0 | GET_REG(cur_op, 0).o = MVM_io_read_bytes_async(tc, GET_REG(cur_op, 2).o, |
4227 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).o, GET_REG(cur_op, 8).o, |
4228 | 0 | GET_REG(cur_op, 10).o); |
4229 | 0 | cur_op += 12; |
4230 | 0 | goto NEXT; |
4231 | 117k | OP(getlexstatic_o): |
4232 | 2.92M | OP(getlexperinvtype_o): { |
4233 | 2.92M | MVMRegister *found = MVM_frame_find_lexical_by_name(tc, |
4234 | 2.92M | GET_REG(cur_op, 2).s, MVM_reg_obj); |
4235 | 2.92M | GET_REG(cur_op, 0).o = found ? found->o : tc->instance->VMNull; |
4236 | 2.92M | cur_op += 4; |
4237 | 2.92M | goto NEXT; |
4238 | 2.92M | } |
4239 | 0 | OP(execname): |
4240 | 0 | GET_REG(cur_op, 0).s = MVM_executable_name(tc); |
4241 | 0 | cur_op += 2; |
4242 | 0 | goto NEXT; |
4243 | 11.3M | OP(const_i64_16): |
4244 | 11.3M | GET_REG(cur_op, 0).i64 = GET_I16(cur_op, 2); |
4245 | 11.3M | cur_op += 4; |
4246 | 11.3M | goto NEXT; |
4247 | 4.53k | OP(const_i64_32): |
4248 | 4.53k | GET_REG(cur_op, 0).i64 = GET_I32(cur_op, 2); |
4249 | 4.53k | cur_op += 6; |
4250 | 4.53k | goto NEXT; |
4251 | 0 | OP(isnonnull): { |
4252 | 0 | MVMObject *obj = GET_REG(cur_op, 2).o; |
4253 | 0 | GET_REG(cur_op, 0).i64 = !MVM_is_null(tc, obj); |
4254 | 0 | cur_op += 4; |
4255 | 0 | goto NEXT; |
4256 | 0 | } |
4257 | 0 | OP(param_rn2_i): { |
4258 | 0 | MVMArgInfo param = MVM_args_get_named_int(tc, &tc->cur_frame->params, |
4259 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
4260 | 0 | if (param.exists) |
4261 | 0 | GET_REG(cur_op, 0).i64 = param.arg.i64; |
4262 | 0 | else |
4263 | 0 | GET_REG(cur_op, 0).i64 = MVM_args_get_named_int(tc, &tc->cur_frame->params, |
4264 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), MVM_ARG_REQUIRED).arg.i64; |
4265 | 0 | cur_op += 10; |
4266 | 0 | goto NEXT; |
4267 | 0 | } |
4268 | 0 | OP(param_rn2_n): { |
4269 | 0 | MVMArgInfo param = MVM_args_get_named_num(tc, &tc->cur_frame->params, |
4270 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
4271 | 0 | if (param.exists) |
4272 | 0 | GET_REG(cur_op, 0).n64 = param.arg.n64; |
4273 | 0 | else |
4274 | 0 | GET_REG(cur_op, 0).n64 = MVM_args_get_named_num(tc, &tc->cur_frame->params, |
4275 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), MVM_ARG_REQUIRED).arg.n64; |
4276 | 0 | cur_op += 10; |
4277 | 0 | goto NEXT; |
4278 | 0 | } |
4279 | 2 | OP(param_rn2_s): { |
4280 | 2 | MVMArgInfo param = MVM_args_get_named_str(tc, &tc->cur_frame->params, |
4281 | 2 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
4282 | 2 | if (param.exists) |
4283 | 1 | GET_REG(cur_op, 0).s = param.arg.s; |
4284 | 2 | else |
4285 | 1 | GET_REG(cur_op, 0).s = MVM_args_get_named_str(tc, &tc->cur_frame->params, |
4286 | 1 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), MVM_ARG_REQUIRED).arg.s; |
4287 | 2 | cur_op += 10; |
4288 | 2 | goto NEXT; |
4289 | 2 | } |
4290 | 0 | OP(param_rn2_o): { |
4291 | 0 | MVMArgInfo param = MVM_args_get_named_obj(tc, &tc->cur_frame->params, |
4292 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
4293 | 0 | if (param.exists) |
4294 | 0 | GET_REG(cur_op, 0).o = param.arg.o; |
4295 | 0 | else |
4296 | 0 | GET_REG(cur_op, 0).o = MVM_args_get_named_obj(tc, &tc->cur_frame->params, |
4297 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), MVM_ARG_REQUIRED).arg.o; |
4298 | 0 | cur_op += 10; |
4299 | 0 | goto NEXT; |
4300 | 0 | } |
4301 | 0 | OP(param_on2_i): { |
4302 | 0 | MVMArgInfo param = MVM_args_get_named_int(tc, &tc->cur_frame->params, |
4303 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
4304 | 0 | if (!param.exists) |
4305 | 0 | param = MVM_args_get_named_int(tc, &tc->cur_frame->params, |
4306 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), MVM_ARG_OPTIONAL); |
4307 | 0 | if (param.exists) { |
4308 | 0 | GET_REG(cur_op, 0).i64 = param.arg.i64; |
4309 | 0 | cur_op = bytecode_start + GET_UI32(cur_op, 10); |
4310 | 0 | } |
4311 | 0 | else { |
4312 | 0 | cur_op += 14; |
4313 | 0 | } |
4314 | 0 | goto NEXT; |
4315 | 0 | } |
4316 | 0 | OP(param_on2_n): { |
4317 | 0 | MVMArgInfo param = MVM_args_get_named_num(tc, &tc->cur_frame->params, |
4318 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
4319 | 0 | if (!param.exists) |
4320 | 0 | param = MVM_args_get_named_num(tc, &tc->cur_frame->params, |
4321 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), MVM_ARG_OPTIONAL); |
4322 | 0 | if (param.exists) { |
4323 | 0 | GET_REG(cur_op, 0).n64 = param.arg.n64; |
4324 | 0 | cur_op = bytecode_start + GET_UI32(cur_op, 10); |
4325 | 0 | } |
4326 | 0 | else { |
4327 | 0 | cur_op += 14; |
4328 | 0 | } |
4329 | 0 | goto NEXT; |
4330 | 0 | } |
4331 | 0 | OP(param_on2_s): { |
4332 | 0 | MVMArgInfo param = MVM_args_get_named_str(tc, &tc->cur_frame->params, |
4333 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
4334 | 0 | if (!param.exists) |
4335 | 0 | param = MVM_args_get_named_str(tc, &tc->cur_frame->params, |
4336 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), MVM_ARG_OPTIONAL); |
4337 | 0 | if (param.exists) { |
4338 | 0 | GET_REG(cur_op, 0).s = param.arg.s; |
4339 | 0 | cur_op = bytecode_start + GET_UI32(cur_op, 10); |
4340 | 0 | } |
4341 | 0 | else { |
4342 | 0 | cur_op += 14; |
4343 | 0 | } |
4344 | 0 | goto NEXT; |
4345 | 0 | } |
4346 | 0 | OP(param_on2_o): { |
4347 | 0 | MVMArgInfo param = MVM_args_get_named_obj(tc, &tc->cur_frame->params, |
4348 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
4349 | 0 | if (!param.exists) |
4350 | 0 | param = MVM_args_get_named_obj(tc, &tc->cur_frame->params, |
4351 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), MVM_ARG_OPTIONAL); |
4352 | 0 | if (param.exists) { |
4353 | 0 | GET_REG(cur_op, 0).o = param.arg.o; |
4354 | 0 | cur_op = bytecode_start + GET_UI32(cur_op, 10); |
4355 | 0 | } |
4356 | 0 | else { |
4357 | 0 | cur_op += 14; |
4358 | 0 | } |
4359 | 0 | goto NEXT; |
4360 | 0 | } |
4361 | 861k | OP(osrpoint): |
4362 | 861k | if (++(tc->cur_frame->osr_counter) == MVM_OSR_THRESHOLD) |
4363 | 161 | MVM_spesh_osr(tc); |
4364 | 861k | goto NEXT; |
4365 | 0 | OP(nativecallcast): |
4366 | 0 | GET_REG(cur_op, 0).o = MVM_nativecall_cast(tc, GET_REG(cur_op, 2).o, |
4367 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).o); |
4368 | 0 | cur_op += 8; |
4369 | 0 | goto NEXT; |
4370 | 0 | OP(spawnprocasync): |
4371 | 0 | GET_REG(cur_op, 0).o = MVM_proc_spawn_async(tc, GET_REG(cur_op, 2).o, |
4372 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).s, |
4373 | 0 | GET_REG(cur_op, 8).o, GET_REG(cur_op, 10).o); |
4374 | 0 | cur_op += 12; |
4375 | 0 | goto NEXT; |
4376 | 0 | OP(killprocasync): |
4377 | 0 | MVM_proc_kill_async(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).i64); |
4378 | 0 | cur_op += 4; |
4379 | 0 | goto NEXT; |
4380 | 0 | OP(startprofile): |
4381 | 0 | MVM_profile_start(tc, GET_REG(cur_op, 0).o); |
4382 | 0 | cur_op += 2; |
4383 | 0 | goto NEXT; |
4384 | 0 | OP(endprofile): |
4385 | 0 | GET_REG(cur_op, 0).o = MVM_profile_end(tc); |
4386 | 0 | cur_op += 2; |
4387 | 0 | goto NEXT; |
4388 | 3.67k | OP(objectid): |
4389 | 3.67k | GET_REG(cur_op, 0).i64 = (MVMint64)MVM_gc_object_id(tc, GET_REG(cur_op, 2).o); |
4390 | 3.67k | cur_op += 4; |
4391 | 3.67k | goto NEXT; |
4392 | 0 | OP(settypefinalize): |
4393 | 0 | MVM_gc_finalize_set(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).i64); |
4394 | 0 | cur_op += 4; |
4395 | 0 | goto NEXT; |
4396 | 0 | OP(force_gc): |
4397 | 0 | MVM_gc_enter_from_allocator(tc); |
4398 | 0 | goto NEXT; |
4399 | 0 | OP(nativecallglobal): |
4400 | 0 | GET_REG(cur_op, 0).o = MVM_nativecall_global(tc, GET_REG(cur_op, 2).s, |
4401 | 0 | GET_REG(cur_op, 4).s, GET_REG(cur_op, 6).o, GET_REG(cur_op, 8).o); |
4402 | 0 | cur_op += 10; |
4403 | 0 | goto NEXT; |
4404 | 3 | OP(close_fhi): |
4405 | 3 | GET_REG(cur_op, 0).i64 = MVM_io_close(tc, GET_REG(cur_op, 2).o); |
4406 | 3 | cur_op += 4; |
4407 | 3 | goto NEXT; |
4408 | 3 | OP(setparameterizer): |
4409 | 3 | MVM_6model_parametric_setup(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).o); |
4410 | 3 | cur_op += 4; |
4411 | 3 | goto NEXT; |
4412 | 8 | OP(parameterizetype): { |
4413 | 8 | MVMObject *type = GET_REG(cur_op, 2).o; |
4414 | 8 | MVMObject *params = GET_REG(cur_op, 4).o; |
4415 | 8 | MVMRegister *result = &(GET_REG(cur_op, 0)); |
4416 | 8 | cur_op += 6; |
4417 | 8 | MVM_6model_parametric_parameterize(tc, type, params, result); |
4418 | 8 | goto NEXT; |
4419 | 8 | } |
4420 | 4 | OP(typeparameterized): |
4421 | 4 | GET_REG(cur_op, 0).o = MVM_6model_parametric_type_parameterized(tc, GET_REG(cur_op, 2).o); |
4422 | 4 | cur_op += 4; |
4423 | 4 | goto NEXT; |
4424 | 4 | OP(typeparameters): |
4425 | 4 | GET_REG(cur_op, 0).o = MVM_6model_parametric_type_parameters(tc, GET_REG(cur_op, 2).o); |
4426 | 4 | cur_op += 4; |
4427 | 4 | goto NEXT; |
4428 | 5 | OP(typeparameterat): |
4429 | 5 | GET_REG(cur_op, 0).o = MVM_6model_parametric_type_parameter_at(tc, |
4430 | 5 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).i64); |
4431 | 5 | cur_op += 6; |
4432 | 5 | goto NEXT; |
4433 | 1 | OP(readlink): |
4434 | 1 | GET_REG(cur_op, 0).s = MVM_file_readlink(tc, GET_REG(cur_op, 2).s); |
4435 | 1 | cur_op += 4; |
4436 | 1 | goto NEXT; |
4437 | 7 | OP(lstat): |
4438 | 7 | GET_REG(cur_op, 0).i64 = MVM_file_stat(tc, GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64, 1); |
4439 | 7 | cur_op += 6; |
4440 | 7 | goto NEXT; |
4441 | 9 | OP(iscont_i): |
4442 | 9 | GET_REG(cur_op, 0).i64 = MVM_6model_container_iscont_i(tc, |
4443 | 9 | GET_REG(cur_op, 2).o); |
4444 | 9 | cur_op += 4; |
4445 | 9 | goto NEXT; |
4446 | 9 | OP(iscont_n): |
4447 | 9 | GET_REG(cur_op, 0).i64 = MVM_6model_container_iscont_n(tc, |
4448 | 9 | GET_REG(cur_op, 2).o); |
4449 | 9 | cur_op += 4; |
4450 | 9 | goto NEXT; |
4451 | 9 | OP(iscont_s): |
4452 | 9 | GET_REG(cur_op, 0).i64 = MVM_6model_container_iscont_s(tc, |
4453 | 9 | GET_REG(cur_op, 2).o); |
4454 | 9 | cur_op += 4; |
4455 | 9 | goto NEXT; |
4456 | 4 | OP(assign_i): { |
4457 | 4 | MVMObject *cont = GET_REG(cur_op, 0).o; |
4458 | 4 | MVMint64 value = GET_REG(cur_op, 2).i64; |
4459 | 4 | cur_op += 4; |
4460 | 4 | MVM_6model_container_assign_i(tc, cont, value); |
4461 | 4 | goto NEXT; |
4462 | 4 | } |
4463 | 4 | OP(assign_n): { |
4464 | 4 | MVMObject *cont = GET_REG(cur_op, 0).o; |
4465 | 4 | MVMnum64 value = GET_REG(cur_op, 2).n64; |
4466 | 4 | cur_op += 4; |
4467 | 4 | MVM_6model_container_assign_n(tc, cont, value); |
4468 | 4 | goto NEXT; |
4469 | 4 | } |
4470 | 4 | OP(assign_s): { |
4471 | 4 | MVMObject *cont = GET_REG(cur_op, 0).o; |
4472 | 4 | MVMString *value = GET_REG(cur_op, 2).s; |
4473 | 4 | cur_op += 4; |
4474 | 4 | MVM_6model_container_assign_s(tc, cont, value); |
4475 | 4 | goto NEXT; |
4476 | 4 | } |
4477 | 7 | OP(decont_i): { |
4478 | 7 | MVMObject *obj = GET_REG(cur_op, 2).o; |
4479 | 7 | MVMRegister *r = &GET_REG(cur_op, 0); |
4480 | 7 | cur_op += 4; |
4481 | 7 | MVM_6model_container_decont_i(tc, obj, r); |
4482 | 7 | goto NEXT; |
4483 | 7 | } |
4484 | 5 | OP(decont_n): { |
4485 | 5 | MVMObject *obj = GET_REG(cur_op, 2).o; |
4486 | 5 | MVMRegister *r = &GET_REG(cur_op, 0); |
4487 | 5 | cur_op += 4; |
4488 | 5 | MVM_6model_container_decont_n(tc, obj, r); |
4489 | 5 | goto NEXT; |
4490 | 5 | } |
4491 | 5 | OP(decont_s): { |
4492 | 5 | MVMObject *obj = GET_REG(cur_op, 2).o; |
4493 | 5 | MVMRegister *r = &GET_REG(cur_op, 0); |
4494 | 5 | cur_op += 4; |
4495 | 5 | MVM_6model_container_decont_s(tc, obj, r); |
4496 | 5 | goto NEXT; |
4497 | 5 | } |
4498 | 5 | OP(getlexref_i): |
4499 | 5 | GET_REG(cur_op, 0).o = MVM_nativeref_lex_i(tc, |
4500 | 5 | GET_UI16(cur_op, 4), GET_UI16(cur_op, 2)); |
4501 | 5 | cur_op += 6; |
4502 | 5 | goto NEXT; |
4503 | 5 | OP(getlexref_n): |
4504 | 5 | GET_REG(cur_op, 0).o = MVM_nativeref_lex_n(tc, |
4505 | 5 | GET_UI16(cur_op, 4), GET_UI16(cur_op, 2)); |
4506 | 5 | cur_op += 6; |
4507 | 5 | goto NEXT; |
4508 | 5 | OP(getlexref_s): |
4509 | 5 | GET_REG(cur_op, 0).o = MVM_nativeref_lex_s(tc, |
4510 | 5 | GET_UI16(cur_op, 4), GET_UI16(cur_op, 2)); |
4511 | 5 | cur_op += 6; |
4512 | 5 | goto NEXT; |
4513 | 0 | OP(getlexref_ni): |
4514 | 0 | GET_REG(cur_op, 0).o = MVM_nativeref_lex_name_i(tc, |
4515 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2))); |
4516 | 0 | cur_op += 6; |
4517 | 0 | goto NEXT; |
4518 | 0 | OP(getlexref_nn): |
4519 | 0 | GET_REG(cur_op, 0).o = MVM_nativeref_lex_name_n(tc, |
4520 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2))); |
4521 | 0 | cur_op += 6; |
4522 | 0 | goto NEXT; |
4523 | 0 | OP(getlexref_ns): |
4524 | 0 | GET_REG(cur_op, 0).o = MVM_nativeref_lex_name_s(tc, |
4525 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2))); |
4526 | 0 | cur_op += 6; |
4527 | 0 | goto NEXT; |
4528 | 1 | OP(atposref_i): |
4529 | 1 | GET_REG(cur_op, 0).o = MVM_nativeref_pos_i(tc, |
4530 | 1 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).i64); |
4531 | 1 | cur_op += 6; |
4532 | 1 | goto NEXT; |
4533 | 1 | OP(atposref_n): |
4534 | 1 | GET_REG(cur_op, 0).o = MVM_nativeref_pos_n(tc, |
4535 | 1 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).i64); |
4536 | 1 | cur_op += 6; |
4537 | 1 | goto NEXT; |
4538 | 1 | OP(atposref_s): |
4539 | 1 | GET_REG(cur_op, 0).o = MVM_nativeref_pos_s(tc, |
4540 | 1 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).i64); |
4541 | 1 | cur_op += 6; |
4542 | 1 | goto NEXT; |
4543 | 2 | OP(getattrref_i): |
4544 | 2 | GET_REG(cur_op, 0).o = MVM_nativeref_attr_i(tc, |
4545 | 2 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o, |
4546 | 2 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 6))); |
4547 | 2 | cur_op += 12; |
4548 | 2 | goto NEXT; |
4549 | 2 | OP(getattrref_n): |
4550 | 2 | GET_REG(cur_op, 0).o = MVM_nativeref_attr_n(tc, |
4551 | 2 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o, |
4552 | 2 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 6))); |
4553 | 2 | cur_op += 12; |
4554 | 2 | goto NEXT; |
4555 | 2 | OP(getattrref_s): |
4556 | 2 | GET_REG(cur_op, 0).o = MVM_nativeref_attr_s(tc, |
4557 | 2 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o, |
4558 | 2 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 6))); |
4559 | 2 | cur_op += 12; |
4560 | 2 | goto NEXT; |
4561 | 0 | OP(getattrsref_i): |
4562 | 0 | GET_REG(cur_op, 0).o = MVM_nativeref_attr_i(tc, |
4563 | 0 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o, |
4564 | 0 | GET_REG(cur_op, 6).s); |
4565 | 0 | cur_op += 8; |
4566 | 0 | goto NEXT; |
4567 | 0 | OP(getattrsref_n): |
4568 | 0 | GET_REG(cur_op, 0).o = MVM_nativeref_attr_n(tc, |
4569 | 0 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o, |
4570 | 0 | GET_REG(cur_op, 6).s); |
4571 | 0 | cur_op += 8; |
4572 | 0 | goto NEXT; |
4573 | 0 | OP(getattrsref_s): |
4574 | 0 | GET_REG(cur_op, 0).o = MVM_nativeref_attr_s(tc, |
4575 | 0 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o, |
4576 | 0 | GET_REG(cur_op, 6).s); |
4577 | 0 | cur_op += 8; |
4578 | 0 | goto NEXT; |
4579 | 0 | OP(nativecallsizeof): |
4580 | 0 | GET_REG(cur_op, 0).i64 = MVM_nativecall_sizeof(tc, GET_REG(cur_op, 2).o); |
4581 | 0 | cur_op += 4; |
4582 | 0 | goto NEXT; |
4583 | 0 | OP(encodenorm): |
4584 | 0 | MVM_exception_throw_adhoc(tc, "NYI"); |
4585 | 0 | OP(normalizecodes): |
4586 | 0 | MVM_unicode_normalize_codepoints(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 4).o, |
4587 | 0 | MVM_unicode_normalizer_form(tc, GET_REG(cur_op, 2).i64)); |
4588 | 0 | cur_op += 6; |
4589 | 0 | goto NEXT; |
4590 | 0 | OP(strfromcodes): |
4591 | 0 | GET_REG(cur_op, 0).s = MVM_unicode_codepoints_to_nfg_string(tc, |
4592 | 0 | GET_REG(cur_op, 2).o); |
4593 | 0 | cur_op += 4; |
4594 | 0 | goto NEXT; |
4595 | 0 | OP(strtocodes): |
4596 | 0 | MVM_unicode_string_to_codepoints(tc, GET_REG(cur_op, 0).s, |
4597 | 0 | MVM_unicode_normalizer_form(tc, GET_REG(cur_op, 2).i64), |
4598 | 0 | GET_REG(cur_op, 4).o); |
4599 | 0 | cur_op += 6; |
4600 | 0 | goto NEXT; |
4601 | 0 | OP(getcodelocation): |
4602 | 0 | GET_REG(cur_op, 0).o = MVM_code_location(tc, GET_REG(cur_op, 2).o); |
4603 | 0 | cur_op += 4; |
4604 | 0 | goto NEXT; |
4605 | 0 | OP(eqatim_s): |
4606 | 0 | if (MVM_string_graphs(tc, GET_REG(cur_op, 2).s) <= GET_REG(cur_op, 6).i64) |
4607 | 0 | GET_REG(cur_op, 0).i64 = 0; |
4608 | 0 | else |
4609 | 0 | GET_REG(cur_op, 0).i64 = MVM_string_ord_basechar_at(tc, GET_REG(cur_op, 2).s, GET_REG(cur_op, 6).i64) |
4610 | 0 | == MVM_string_ord_basechar_at(tc, GET_REG(cur_op, 4).s, 0) |
4611 | 0 | ? 1 : 0; |
4612 | 0 | cur_op += 8; |
4613 | 0 | goto NEXT; |
4614 | 0 | OP(ordbaseat): |
4615 | 0 | GET_REG(cur_op, 0).i64 = MVM_string_ord_basechar_at(tc, GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64); |
4616 | 0 | cur_op += 6; |
4617 | 0 | goto NEXT; |
4618 | 1 | OP(neverrepossess): |
4619 | 1 | MVM_6model_never_repossess(tc, GET_REG(cur_op, 0).o); |
4620 | 1 | cur_op += 2; |
4621 | 1 | goto NEXT; |
4622 | 0 | OP(scdisclaim): |
4623 | 0 | MVM_sc_disclaim(tc, (MVMSerializationContext *)GET_REG(cur_op, 0).o); |
4624 | 0 | cur_op += 2; |
4625 | 0 | goto NEXT; |
4626 | 6 | OP(syncpipe): |
4627 | 6 | GET_REG(cur_op, 0).o = MVM_io_syncpipe(tc); |
4628 | 6 | cur_op += 2; |
4629 | 6 | goto NEXT; |
4630 | 1 | OP(atpos2d_i): |
4631 | 1 | GET_REG(cur_op, 0).i64 = MVM_repr_at_pos_2d_i(tc, GET_REG(cur_op, 2).o, |
4632 | 1 | GET_REG(cur_op, 4).i64, GET_REG(cur_op, 6).i64); |
4633 | 1 | cur_op += 8; |
4634 | 1 | goto NEXT; |
4635 | 1 | OP(atpos2d_n): |
4636 | 1 | GET_REG(cur_op, 0).n64 = MVM_repr_at_pos_2d_n(tc, GET_REG(cur_op, 2).o, |
4637 | 1 | GET_REG(cur_op, 4).i64, GET_REG(cur_op, 6).i64); |
4638 | 1 | cur_op += 8; |
4639 | 1 | goto NEXT; |
4640 | 1 | OP(atpos2d_s): |
4641 | 1 | GET_REG(cur_op, 0).s = MVM_repr_at_pos_2d_s(tc, GET_REG(cur_op, 2).o, |
4642 | 1 | GET_REG(cur_op, 4).i64, GET_REG(cur_op, 6).i64); |
4643 | 1 | cur_op += 8; |
4644 | 1 | goto NEXT; |
4645 | 11 | OP(atpos2d_o): |
4646 | 11 | GET_REG(cur_op, 0).o = MVM_repr_at_pos_2d_o(tc, GET_REG(cur_op, 2).o, |
4647 | 11 | GET_REG(cur_op, 4).i64, GET_REG(cur_op, 6).i64); |
4648 | 11 | cur_op += 8; |
4649 | 11 | goto NEXT; |
4650 | 9 | OP(atpos3d_i): |
4651 | 9 | GET_REG(cur_op, 0).i64 = MVM_repr_at_pos_3d_i(tc, GET_REG(cur_op, 2).o, |
4652 | 9 | GET_REG(cur_op, 4).i64, GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).i64); |
4653 | 9 | cur_op += 10; |
4654 | 9 | goto NEXT; |
4655 | 2 | OP(atpos3d_n): |
4656 | 2 | GET_REG(cur_op, 0).n64 = MVM_repr_at_pos_3d_n(tc, GET_REG(cur_op, 2).o, |
4657 | 2 | GET_REG(cur_op, 4).i64, GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).i64); |
4658 | 2 | cur_op += 10; |
4659 | 2 | goto NEXT; |
4660 | 2 | OP(atpos3d_s): |
4661 | 2 | GET_REG(cur_op, 0).s = MVM_repr_at_pos_3d_s(tc, GET_REG(cur_op, 2).o, |
4662 | 2 | GET_REG(cur_op, 4).i64, GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).i64); |
4663 | 2 | cur_op += 10; |
4664 | 2 | goto NEXT; |
4665 | 2 | OP(atpos3d_o): |
4666 | 2 | GET_REG(cur_op, 0).o = MVM_repr_at_pos_3d_o(tc, GET_REG(cur_op, 2).o, |
4667 | 2 | GET_REG(cur_op, 4).i64, GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).i64); |
4668 | 2 | cur_op += 10; |
4669 | 2 | goto NEXT; |
4670 | 10 | OP(atposnd_i): |
4671 | 10 | GET_REG(cur_op, 0).i64 = MVM_repr_at_pos_multidim_i(tc, |
4672 | 10 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
4673 | 10 | cur_op += 6; |
4674 | 10 | goto NEXT; |
4675 | 3 | OP(atposnd_n): |
4676 | 3 | GET_REG(cur_op, 0).n64 = MVM_repr_at_pos_multidim_n(tc, |
4677 | 3 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
4678 | 3 | cur_op += 6; |
4679 | 3 | goto NEXT; |
4680 | 3 | OP(atposnd_s): |
4681 | 3 | GET_REG(cur_op, 0).s = MVM_repr_at_pos_multidim_s(tc, |
4682 | 3 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
4683 | 3 | cur_op += 6; |
4684 | 3 | goto NEXT; |
4685 | 37 | OP(atposnd_o): |
4686 | 37 | GET_REG(cur_op, 0).o = MVM_repr_at_pos_multidim_o(tc, |
4687 | 37 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
4688 | 37 | cur_op += 6; |
4689 | 37 | goto NEXT; |
4690 | 1 | OP(bindpos2d_i): |
4691 | 1 | MVM_repr_bind_pos_2d_i(tc, GET_REG(cur_op, 0).o, |
4692 | 1 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).i64, |
4693 | 1 | GET_REG(cur_op, 6).i64); |
4694 | 1 | cur_op += 8; |
4695 | 1 | goto NEXT; |
4696 | 1 | OP(bindpos2d_n): |
4697 | 1 | MVM_repr_bind_pos_2d_n(tc, GET_REG(cur_op, 0).o, |
4698 | 1 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).i64, |
4699 | 1 | GET_REG(cur_op, 6).n64); |
4700 | 1 | cur_op += 8; |
4701 | 1 | goto NEXT; |
4702 | 1 | OP(bindpos2d_s): |
4703 | 1 | MVM_repr_bind_pos_2d_s(tc, GET_REG(cur_op, 0).o, |
4704 | 1 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).i64, |
4705 | 1 | GET_REG(cur_op, 6).s); |
4706 | 1 | cur_op += 8; |
4707 | 1 | goto NEXT; |
4708 | 11 | OP(bindpos2d_o): |
4709 | 11 | MVM_repr_bind_pos_2d_o(tc, GET_REG(cur_op, 0).o, |
4710 | 11 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).i64, |
4711 | 11 | GET_REG(cur_op, 6).o); |
4712 | 11 | cur_op += 8; |
4713 | 11 | goto NEXT; |
4714 | 9 | OP(bindpos3d_i): |
4715 | 9 | MVM_repr_bind_pos_3d_i(tc, GET_REG(cur_op, 0).o, |
4716 | 9 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).i64, |
4717 | 9 | GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).i64); |
4718 | 9 | cur_op += 10; |
4719 | 9 | goto NEXT; |
4720 | 1 | OP(bindpos3d_n): |
4721 | 1 | MVM_repr_bind_pos_3d_n(tc, GET_REG(cur_op, 0).o, |
4722 | 1 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).i64, |
4723 | 1 | GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).n64); |
4724 | 1 | cur_op += 10; |
4725 | 1 | goto NEXT; |
4726 | 1 | OP(bindpos3d_s): |
4727 | 1 | MVM_repr_bind_pos_3d_s(tc, GET_REG(cur_op, 0).o, |
4728 | 1 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).i64, |
4729 | 1 | GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).s); |
4730 | 1 | cur_op += 10; |
4731 | 1 | goto NEXT; |
4732 | 1 | OP(bindpos3d_o): |
4733 | 1 | MVM_repr_bind_pos_3d_o(tc, GET_REG(cur_op, 0).o, |
4734 | 1 | GET_REG(cur_op, 2).i64, GET_REG(cur_op, 4).i64, |
4735 | 1 | GET_REG(cur_op, 6).i64, GET_REG(cur_op, 8).o); |
4736 | 1 | cur_op += 10; |
4737 | 1 | goto NEXT; |
4738 | 10 | OP(bindposnd_i): |
4739 | 10 | MVM_repr_bind_pos_multidim_i(tc, GET_REG(cur_op, 0).o, |
4740 | 10 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).i64); |
4741 | 10 | cur_op += 6; |
4742 | 10 | goto NEXT; |
4743 | 2 | OP(bindposnd_n): |
4744 | 2 | MVM_repr_bind_pos_multidim_n(tc, GET_REG(cur_op, 0).o, |
4745 | 2 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).n64); |
4746 | 2 | cur_op += 6; |
4747 | 2 | goto NEXT; |
4748 | 2 | OP(bindposnd_s): |
4749 | 2 | MVM_repr_bind_pos_multidim_s(tc, GET_REG(cur_op, 0).o, |
4750 | 2 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).s); |
4751 | 2 | cur_op += 6; |
4752 | 2 | goto NEXT; |
4753 | 36 | OP(bindposnd_o): |
4754 | 36 | MVM_repr_bind_pos_multidim_o(tc, GET_REG(cur_op, 0).o, |
4755 | 36 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
4756 | 36 | cur_op += 6; |
4757 | 36 | goto NEXT; |
4758 | 10 | OP(dimensions): |
4759 | 10 | GET_REG(cur_op, 0).o = MVM_repr_dimensions(tc, GET_REG(cur_op, 2).o); |
4760 | 10 | cur_op += 4; |
4761 | 10 | goto NEXT; |
4762 | 28 | OP(setdimensions): |
4763 | 28 | MVM_repr_set_dimensions(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).o); |
4764 | 28 | cur_op += 4; |
4765 | 28 | goto NEXT; |
4766 | 9 | OP(numdimensions): |
4767 | 9 | GET_REG(cur_op, 0).i64 = MVM_repr_num_dimensions(tc, GET_REG(cur_op, 2).o); |
4768 | 9 | cur_op += 4; |
4769 | 9 | goto NEXT; |
4770 | 3 | OP(ctxcode): { |
4771 | 3 | MVMObject *this_ctx = GET_REG(cur_op, 2).o; |
4772 | 3 | if (!IS_CONCRETE(this_ctx) || REPR(this_ctx)->ID != MVM_REPR_ID_MVMContext) |
4773 | 0 | MVM_exception_throw_adhoc(tc, "ctxcode needs an MVMContext"); |
4774 | 3 | GET_REG(cur_op, 0).o = ((MVMContext *)this_ctx)->body.context->code_ref; |
4775 | 3 | cur_op += 4; |
4776 | 3 | goto NEXT; |
4777 | 3 | } |
4778 | 2 | OP(isrwcont): { |
4779 | 2 | MVMObject *obj = GET_REG(cur_op, 2).o; |
4780 | 2 | MVMint64 is_rw = 0; |
4781 | 2 | if (!MVM_is_null(tc, obj)) { |
4782 | 2 | const MVMContainerSpec *cs = STABLE(obj)->container_spec; |
4783 | 1 | is_rw = cs && cs->can_store(tc, obj); |
4784 | 2 | } |
4785 | 2 | GET_REG(cur_op, 0).i64 = is_rw; |
4786 | 2 | cur_op += 4; |
4787 | 2 | goto NEXT; |
4788 | 2 | } |
4789 | 0 | OP(fc): |
4790 | 0 | GET_REG(cur_op, 0).s = MVM_string_fc(tc, GET_REG(cur_op, 2).s); |
4791 | 0 | cur_op += 4; |
4792 | 0 | goto NEXT; |
4793 | 6 | OP(setinputlineseps_fh): |
4794 | 6 | MVM_io_set_separators(tc, GET_REG(cur_op, 0).o, GET_REG(cur_op, 2).o); |
4795 | 6 | cur_op += 4; |
4796 | 6 | goto NEXT; |
4797 | 9 | OP(readlinechomp_fh): |
4798 | 9 | GET_REG(cur_op, 0).s = MVM_io_readline(tc, GET_REG(cur_op, 2).o, 1); |
4799 | 9 | cur_op += 4; |
4800 | 9 | goto NEXT; |
4801 | 0 | OP(encoderep): |
4802 | 0 | MVM_string_encode_to_buf(tc, GET_REG(cur_op, 2).s, |
4803 | 0 | GET_REG(cur_op, 4).s, GET_REG(cur_op, 8).o, GET_REG(cur_op, 6).s); |
4804 | 0 | GET_REG(cur_op, 0).o = GET_REG(cur_op, 8).o; |
4805 | 0 | cur_op += 10; |
4806 | 0 | goto NEXT; |
4807 | 1 | OP(istty_fh): |
4808 | 1 | GET_REG(cur_op, 0).i64 = MVM_io_is_tty(tc, GET_REG(cur_op, 2).o); |
4809 | 1 | cur_op += 4; |
4810 | 1 | goto NEXT; |
4811 | 0 | OP(multidimref_i): |
4812 | 0 | GET_REG(cur_op, 0).o = MVM_nativeref_multidim_i(tc, |
4813 | 0 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
4814 | 0 | cur_op += 6; |
4815 | 0 | goto NEXT; |
4816 | 0 | OP(multidimref_n): |
4817 | 0 | GET_REG(cur_op, 0).o = MVM_nativeref_multidim_n(tc, |
4818 | 0 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
4819 | 0 | cur_op += 6; |
4820 | 0 | goto NEXT; |
4821 | 0 | OP(multidimref_s): |
4822 | 0 | GET_REG(cur_op, 0).o = MVM_nativeref_multidim_s(tc, |
4823 | 0 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
4824 | 0 | cur_op += 6; |
4825 | 0 | goto NEXT; |
4826 | 0 | OP(fileno_fh): |
4827 | 0 | GET_REG(cur_op, 0).i64 = MVM_io_fileno(tc, GET_REG(cur_op, 2).o); |
4828 | 0 | cur_op += 4; |
4829 | 0 | goto NEXT; |
4830 | 0 | OP(asyncudp): |
4831 | 0 | GET_REG(cur_op, 0).o = MVM_io_socket_udp_async(tc, |
4832 | 0 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).s, |
4833 | 0 | GET_REG(cur_op, 8).i64, GET_REG(cur_op, 10).i64, |
4834 | 0 | GET_REG(cur_op, 12).o); |
4835 | 0 | cur_op += 14; |
4836 | 0 | goto NEXT; |
4837 | 0 | OP(asyncwritestrto): |
4838 | 0 | GET_REG(cur_op, 0).o = MVM_io_write_string_to_async(tc, GET_REG(cur_op, 2).o, |
4839 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).o, GET_REG(cur_op, 8).s, |
4840 | 0 | GET_REG(cur_op, 10).o, GET_REG(cur_op, 12).s, GET_REG(cur_op, 14).i64); |
4841 | 0 | cur_op += 16; |
4842 | 0 | goto NEXT; |
4843 | 0 | OP(asyncwritebytesto): |
4844 | 0 | GET_REG(cur_op, 0).o = MVM_io_write_bytes_to_async(tc, GET_REG(cur_op, 2).o, |
4845 | 0 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).o, GET_REG(cur_op, 8).o, |
4846 | 0 | GET_REG(cur_op, 10).o, GET_REG(cur_op, 12).s, GET_REG(cur_op, 14).i64); |
4847 | 0 | cur_op += 16; |
4848 | 0 | goto NEXT; |
4849 | 202 | OP(objprimbits): { |
4850 | 202 | MVMObject *type = GET_REG(cur_op, 2).o; |
4851 | 202 | if (type) { |
4852 | 202 | const MVMStorageSpec *ss = REPR(type)->get_storage_spec(tc, STABLE(type)); |
4853 | 202 | GET_REG(cur_op, 0).i64 = ss->boxed_primitive ? ss->bits : 0; |
4854 | 202 | } |
4855 | 0 | else { |
4856 | 0 | GET_REG(cur_op, 0).i64 = 0; |
4857 | 0 | } |
4858 | 202 | cur_op += 4; |
4859 | 202 | goto NEXT; |
4860 | 202 | } |
4861 | 179 | OP(objprimunsigned): { |
4862 | 179 | MVMObject *type = GET_REG(cur_op, 2).o; |
4863 | 179 | if (type) { |
4864 | 179 | const MVMStorageSpec *ss = REPR(type)->get_storage_spec(tc, STABLE(type)); |
4865 | 179 | GET_REG(cur_op, 0).i64 = ss->boxed_primitive == 1 ? ss->is_unsigned : 0; |
4866 | 179 | } |
4867 | 0 | else { |
4868 | 0 | GET_REG(cur_op, 0).i64 = 0; |
4869 | 0 | } |
4870 | 179 | cur_op += 4; |
4871 | 179 | goto NEXT; |
4872 | 179 | } |
4873 | 0 | OP(getlexref_i32): |
4874 | 0 | OP(getlexref_i16): |
4875 | 0 | OP(getlexref_i8): |
4876 | 0 | GET_REG(cur_op, 0).o = MVM_nativeref_lex_i(tc, |
4877 | 0 | GET_UI16(cur_op, 4), GET_UI16(cur_op, 2)); |
4878 | 0 | cur_op += 6; |
4879 | 0 | goto NEXT; |
4880 | 0 | OP(getlexref_n32): |
4881 | 0 | GET_REG(cur_op, 0).o = MVM_nativeref_lex_n(tc, |
4882 | 0 | GET_UI16(cur_op, 4), GET_UI16(cur_op, 2)); |
4883 | 0 | cur_op += 6; |
4884 | 0 | goto NEXT; |
4885 | 0 | OP(box_u): { |
4886 | 0 | MVM_box_uint(tc, GET_REG(cur_op, 2).u64, GET_REG(cur_op, 4).o, |
4887 | 0 | &GET_REG(cur_op, 0)); |
4888 | 0 | cur_op += 6; |
4889 | 0 | goto NEXT; |
4890 | 0 | } |
4891 | 0 | OP(unbox_u): { |
4892 | 0 | MVMObject *obj = GET_REG(cur_op, 2).o; |
4893 | 0 | if (!IS_CONCRETE(obj)) |
4894 | 0 | MVM_exception_throw_adhoc(tc, "Cannot unbox a type object"); |
4895 | 0 | GET_REG(cur_op, 0).u64 = REPR(obj)->box_funcs.get_uint(tc, |
4896 | 0 | STABLE(obj), obj, OBJECT_BODY(obj)); |
4897 | 0 | cur_op += 4; |
4898 | 0 | goto NEXT; |
4899 | 0 | } |
4900 | 0 | OP(coerce_iu): |
4901 | 0 | GET_REG(cur_op, 0).u64 = (MVMuint64)GET_REG(cur_op, 2).i64; |
4902 | 0 | cur_op += 4; |
4903 | 0 | goto NEXT; |
4904 | 0 | OP(coerce_ui): |
4905 | 0 | GET_REG(cur_op, 0).i64 = (MVMint64)GET_REG(cur_op, 2).u64; |
4906 | 0 | cur_op += 4; |
4907 | 0 | goto NEXT; |
4908 | 0 | OP(coerce_nu): |
4909 | 0 | GET_REG(cur_op, 0).u64 = (MVMuint64)GET_REG(cur_op, 2).n64; |
4910 | 0 | cur_op += 4; |
4911 | 0 | goto NEXT; |
4912 | 0 | OP(coerce_un): |
4913 | 0 | GET_REG(cur_op, 0).n64 = (MVMnum64)GET_REG(cur_op, 2).u64; |
4914 | 0 | cur_op += 4; |
4915 | 0 | goto NEXT; |
4916 | 0 | OP(decont_u): { |
4917 | 0 | MVMObject *obj = GET_REG(cur_op, 2).o; |
4918 | 0 | MVMRegister *r = &GET_REG(cur_op, 0); |
4919 | 0 | cur_op += 4; |
4920 | 0 | MVM_6model_container_decont_u(tc, obj, r); |
4921 | 0 | goto NEXT; |
4922 | 0 | } |
4923 | 0 | OP(getlexref_u): |
4924 | 0 | OP(getlexref_u32): |
4925 | 0 | OP(getlexref_u16): |
4926 | 0 | OP(getlexref_u8): |
4927 | 0 | /* XXX Cheat should have a _u here. */ |
4928 | 0 | GET_REG(cur_op, 0).o = MVM_nativeref_lex_i(tc, |
4929 | 0 | GET_UI16(cur_op, 4), GET_UI16(cur_op, 2)); |
4930 | 0 | cur_op += 6; |
4931 | 0 | goto NEXT; |
4932 | 0 | OP(param_rp_u): |
4933 | 0 | GET_REG(cur_op, 0).u64 = MVM_args_get_pos_uint(tc, &tc->cur_frame->params, |
4934 | 0 | GET_UI16(cur_op, 2), MVM_ARG_REQUIRED).arg.u64; |
4935 | 0 | cur_op += 4; |
4936 | 0 | goto NEXT; |
4937 | 0 | OP(param_op_u): { |
4938 | 0 | MVMArgInfo param = MVM_args_get_pos_uint(tc, &tc->cur_frame->params, |
4939 | 0 | GET_UI16(cur_op, 2), MVM_ARG_OPTIONAL); |
4940 | 0 | if (param.exists) { |
4941 | 0 | GET_REG(cur_op, 0).u64 = param.arg.u64; |
4942 | 0 | cur_op = bytecode_start + GET_UI32(cur_op, 4); |
4943 | 0 | } |
4944 | 0 | else { |
4945 | 0 | cur_op += 8; |
4946 | 0 | } |
4947 | 0 | goto NEXT; |
4948 | 0 | } |
4949 | 0 | OP(param_rn_u): |
4950 | 0 | GET_REG(cur_op, 0).u64 = MVM_args_get_named_uint(tc, &tc->cur_frame->params, |
4951 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_REQUIRED).arg.u64; |
4952 | 0 | cur_op += 6; |
4953 | 0 | goto NEXT; |
4954 | 0 | OP(param_on_u):{ |
4955 | 0 | MVMArgInfo param = MVM_args_get_named_uint(tc, &tc->cur_frame->params, |
4956 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
4957 | 0 | if (param.exists) { |
4958 | 0 | GET_REG(cur_op, 0).u64 = param.arg.u64; |
4959 | 0 | cur_op = bytecode_start + GET_UI32(cur_op, 6); |
4960 | 0 | } |
4961 | 0 | else { |
4962 | 0 | cur_op += 10; |
4963 | 0 | } |
4964 | 0 | goto NEXT; |
4965 | 0 | } |
4966 | 0 | OP(param_rn2_u): { |
4967 | 0 | MVMArgInfo param = MVM_args_get_named_uint(tc, &tc->cur_frame->params, |
4968 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
4969 | 0 | if (param.exists) |
4970 | 0 | GET_REG(cur_op, 0).u64 = param.arg.u64; |
4971 | 0 | else |
4972 | 0 | GET_REG(cur_op, 0).u64 = MVM_args_get_named_uint(tc, &tc->cur_frame->params, |
4973 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), MVM_ARG_REQUIRED).arg.u64; |
4974 | 0 | cur_op += 10; |
4975 | 0 | goto NEXT; |
4976 | 0 | } |
4977 | 0 | OP(param_on2_u): { |
4978 | 0 | MVMArgInfo param = MVM_args_get_named_uint(tc, &tc->cur_frame->params, |
4979 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 2)), MVM_ARG_OPTIONAL); |
4980 | 0 | if (!param.exists) |
4981 | 0 | param = MVM_args_get_named_uint(tc, &tc->cur_frame->params, |
4982 | 0 | MVM_cu_string(tc, cu, GET_UI32(cur_op, 6)), MVM_ARG_OPTIONAL); |
4983 | 0 | if (param.exists) { |
4984 | 0 | GET_REG(cur_op, 0).u64 = param.arg.u64; |
4985 | 0 | cur_op = bytecode_start + GET_UI32(cur_op, 10); |
4986 | 0 | } |
4987 | 0 | else { |
4988 | 0 | cur_op += 14; |
4989 | 0 | } |
4990 | 0 | goto NEXT; |
4991 | 0 | } |
4992 | 9 | OP(stat_time): |
4993 | 9 | GET_REG(cur_op, 0).n64 = MVM_file_time(tc, GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64, 0); |
4994 | 9 | cur_op += 6; |
4995 | 9 | goto NEXT; |
4996 | 6 | OP(lstat_time): |
4997 | 6 | GET_REG(cur_op, 0).n64 = MVM_file_time(tc, GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).i64, 1); |
4998 | 6 | cur_op += 6; |
4999 | 6 | goto NEXT; |
5000 | 691 | OP(setdebugtypename): { |
5001 | 691 | MVMObject *obj = GET_REG(cur_op, 0).o; |
5002 | 691 | if (MVM_string_graphs(tc, GET_REG(cur_op, 2).s)) { |
5003 | 691 | char *debugname = MVM_string_utf8_encode_C_string(tc, GET_REG(cur_op, 2).s); |
5004 | 691 | if (STABLE(obj)->debug_name) { |
5005 | 0 | MVM_free(STABLE(obj)->debug_name); |
5006 | 0 | } |
5007 | 691 | STABLE(obj)->debug_name = debugname; |
5008 | 0 | } else { |
5009 | 0 | STABLE(obj)->debug_name = NULL; |
5010 | 0 | } |
5011 | 691 | cur_op += 4; |
5012 | 691 | goto NEXT; |
5013 | 691 | } |
5014 | 273k | OP(throwpayloadlex): { |
5015 | 273k | MVMRegister *rr = &GET_REG(cur_op, 0); |
5016 | 273k | MVMuint32 cat = (MVMuint32)MVM_BC_get_I64(cur_op, 2); |
5017 | 273k | MVMObject *payload = GET_REG(cur_op, 10).o; |
5018 | 273k | cur_op += 12; |
5019 | 273k | MVM_exception_throwpayload(tc, MVM_EX_THROW_LEX, cat, payload, rr); |
5020 | 273k | goto NEXT; |
5021 | 273k | } |
5022 | 0 | OP(throwpayloadlexcaller): { |
5023 | 0 | MVMRegister *rr = &GET_REG(cur_op, 0); |
5024 | 0 | MVMuint32 cat = (MVMuint32)MVM_BC_get_I64(cur_op, 2); |
5025 | 0 | MVMObject *payload = GET_REG(cur_op, 10).o; |
5026 | 0 | cur_op += 12; |
5027 | 0 | MVM_exception_throwpayload(tc, MVM_EX_THROW_LEX_CALLER, cat, payload, rr); |
5028 | 0 | goto NEXT; |
5029 | 0 | } |
5030 | 273k | OP(lastexpayload): |
5031 | 273k | GET_REG(cur_op, 0).o = tc->last_payload; |
5032 | 273k | cur_op += 2; |
5033 | 273k | goto NEXT; |
5034 | 0 | OP(cancelnotify): |
5035 | 0 | MVM_io_eventloop_cancel_work(tc, GET_REG(cur_op, 0).o, |
5036 | 0 | GET_REG(cur_op, 2).o, GET_REG(cur_op, 4).o); |
5037 | 0 | cur_op += 6; |
5038 | 0 | goto NEXT; |
5039 | 8 | OP(decoderconfigure): { |
5040 | 8 | MVMObject *decoder = GET_REG(cur_op, 0).o; |
5041 | 8 | MVM_decoder_ensure_decoder(tc, decoder, "decoderconfigure"); |
5042 | 8 | MVM_decoder_configure(tc, (MVMDecoder *)decoder, |
5043 | 8 | GET_REG(cur_op, 2).s, GET_REG(cur_op, 4).o); |
5044 | 8 | cur_op += 6; |
5045 | 8 | goto NEXT; |
5046 | 8 | } |
5047 | 2 | OP(decodersetlineseps): { |
5048 | 2 | MVMObject *decoder = GET_REG(cur_op, 0).o; |
5049 | 2 | MVM_decoder_ensure_decoder(tc, decoder, "decoderaddbytes"); |
5050 | 2 | MVM_decoder_set_separators(tc, (MVMDecoder *)decoder, GET_REG(cur_op, 2).o); |
5051 | 2 | cur_op += 4; |
5052 | 2 | goto NEXT; |
5053 | 2 | } |
5054 | 11 | OP(decoderaddbytes): { |
5055 | 11 | MVMObject *decoder = GET_REG(cur_op, 0).o; |
5056 | 11 | MVM_decoder_ensure_decoder(tc, decoder, "decoderaddbytes"); |
5057 | 11 | MVM_decoder_add_bytes(tc, (MVMDecoder *)decoder, GET_REG(cur_op, 2).o); |
5058 | 11 | cur_op += 4; |
5059 | 11 | goto NEXT; |
5060 | 11 | } |
5061 | 4 | OP(decodertakechars): { |
5062 | 4 | MVMObject *decoder = GET_REG(cur_op, 2).o; |
5063 | 4 | MVM_decoder_ensure_decoder(tc, decoder, "decodertakechars"); |
5064 | 4 | GET_REG(cur_op, 0).s = MVM_decoder_take_chars(tc, (MVMDecoder *)decoder, |
5065 | 4 | GET_REG(cur_op, 4).i64); |
5066 | 4 | cur_op += 6; |
5067 | 4 | goto NEXT; |
5068 | 4 | } |
5069 | 3 | OP(decodertakeallchars): { |
5070 | 3 | MVMObject *decoder = GET_REG(cur_op, 2).o; |
5071 | 3 | MVM_decoder_ensure_decoder(tc, decoder, "decodertakeallchars"); |
5072 | 3 | GET_REG(cur_op, 0).s = MVM_decoder_take_all_chars(tc, (MVMDecoder *)decoder); |
5073 | 3 | cur_op += 4; |
5074 | 3 | goto NEXT; |
5075 | 3 | } |
5076 | 1 | OP(decodertakeavailablechars): { |
5077 | 1 | MVMObject *decoder = GET_REG(cur_op, 2).o; |
5078 | 1 | MVM_decoder_ensure_decoder(tc, decoder, "decodertakeavailablechars"); |
5079 | 1 | GET_REG(cur_op, 0).s = MVM_decoder_take_available_chars(tc, (MVMDecoder *)decoder); |
5080 | 1 | cur_op += 4; |
5081 | 1 | goto NEXT; |
5082 | 1 | } |
5083 | 11 | OP(decodertakeline): { |
5084 | 11 | MVMObject *decoder = GET_REG(cur_op, 2).o; |
5085 | 11 | MVM_decoder_ensure_decoder(tc, decoder, "decodertakeline"); |
5086 | 11 | GET_REG(cur_op, 0).s = MVM_decoder_take_line(tc, (MVMDecoder *)decoder, |
5087 | 11 | GET_REG(cur_op, 4).i64, GET_REG(cur_op, 6).i64); |
5088 | 11 | cur_op += 8; |
5089 | 11 | goto NEXT; |
5090 | 11 | } |
5091 | 5 | OP(decoderbytesavailable): { |
5092 | 5 | MVMObject *decoder = GET_REG(cur_op, 2).o; |
5093 | 5 | MVM_decoder_ensure_decoder(tc, decoder, "decoderbytesavailable"); |
5094 | 5 | GET_REG(cur_op, 0).i64 = MVM_decoder_bytes_available(tc, (MVMDecoder *)decoder); |
5095 | 5 | cur_op += 4; |
5096 | 5 | goto NEXT; |
5097 | 5 | } |
5098 | 2 | OP(decodertakebytes): { |
5099 | 2 | MVMObject *decoder = GET_REG(cur_op, 2).o; |
5100 | 2 | MVM_decoder_ensure_decoder(tc, decoder, "decodertakebytes"); |
5101 | 2 | GET_REG(cur_op, 0).o = MVM_decoder_take_bytes(tc, (MVMDecoder *)decoder, |
5102 | 2 | GET_REG(cur_op, 4).o, GET_REG(cur_op, 6).i64); |
5103 | 2 | cur_op += 8; |
5104 | 2 | goto NEXT; |
5105 | 2 | } |
5106 | 8 | OP(decoderempty): { |
5107 | 8 | MVMObject *decoder = GET_REG(cur_op, 2).o; |
5108 | 8 | MVM_decoder_ensure_decoder(tc, decoder, "decoderempty"); |
5109 | 8 | GET_REG(cur_op, 0).i64 = MVM_decoder_empty(tc, (MVMDecoder *)decoder); |
5110 | 8 | cur_op += 4; |
5111 | 8 | goto NEXT; |
5112 | 8 | } |
5113 | 20.5k | OP(indexingoptimized): |
5114 | 20.5k | GET_REG(cur_op, 0).s = MVM_string_indexing_optimized(tc, GET_REG(cur_op, 2).s); |
5115 | 20.5k | cur_op += 4; |
5116 | 20.5k | goto NEXT; |
5117 | 0 | OP(captureinnerlex): |
5118 | 0 | MVM_frame_capture_inner(tc, GET_REG(cur_op, 0).o); |
5119 | 0 | cur_op += 2; |
5120 | 0 | goto NEXT; |
5121 | 0 | OP(setdispatcherfor): { |
5122 | 0 | MVMObject *disp_for = GET_REG(cur_op, 2).o; |
5123 | 0 | tc->cur_dispatcher = GET_REG(cur_op, 0).o; |
5124 | 0 | tc->cur_dispatcher_for = REPR(disp_for)->ID == MVM_REPR_ID_MVMCode |
5125 | 0 | ? disp_for |
5126 | 0 | : MVM_frame_find_invokee(tc, disp_for, NULL); |
5127 | 0 | cur_op += 4; |
5128 | 0 | goto NEXT; |
5129 | 0 | } |
5130 | 361k | OP(sp_log): |
5131 | 361k | if (tc->cur_frame->spesh_log_idx >= 0) { |
5132 | 361k | MVM_ASSIGN_REF(tc, &(tc->cur_frame->static_info->common.header), |
5133 | 361k | tc->cur_frame->spesh_log_slots[ |
5134 | 361k | GET_UI16(cur_op, 2) * MVM_SPESH_LOG_RUNS + tc->cur_frame->spesh_log_idx |
5135 | 361k | ], |
5136 | 361k | GET_REG(cur_op, 0).o); |
5137 | 361k | } |
5138 | 361k | cur_op += 4; |
5139 | 361k | goto NEXT; |
5140 | 1.03k | OP(sp_osrfinalize): { |
5141 | 1.03k | MVMSpeshCandidate *cand = tc->cur_frame->spesh_cand; |
5142 | 1.03k | if (cand) { |
5143 | 1.03k | tc->cur_frame->spesh_log_idx = cand->log_enter_idx; |
5144 | 1.03k | cand->log_enter_idx++; |
5145 | 1.03k | if (cand->log_enter_idx >= MVM_SPESH_LOG_RUNS) |
5146 | 148 | MVM_spesh_osr_finalize(tc); |
5147 | 1.03k | } |
5148 | 1.03k | goto NEXT; |
5149 | 1.03k | } |
5150 | 2.87M | OP(sp_guardconc): { |
5151 | 2.87M | MVMObject *check = GET_REG(cur_op, 0).o; |
5152 | 2.87M | MVMSTable *want = (MVMSTable *)tc->cur_frame |
5153 | 2.87M | ->effective_spesh_slots[GET_UI16(cur_op, 2)]; |
5154 | 2.87M | cur_op += 4; |
5155 | 2.87M | if (!check || !IS_CONCRETE(check) || STABLE(check) != want) |
5156 | 283 | MVM_spesh_deopt_one(tc); |
5157 | 2.87M | goto NEXT; |
5158 | 2.87M | } |
5159 | 586k | OP(sp_guardtype): { |
5160 | 586k | MVMObject *check = GET_REG(cur_op, 0).o; |
5161 | 586k | MVMSTable *want = (MVMSTable *)tc->cur_frame |
5162 | 586k | ->effective_spesh_slots[GET_UI16(cur_op, 2)]; |
5163 | 586k | cur_op += 4; |
5164 | 586k | if (!check || IS_CONCRETE(check) || STABLE(check) != want) |
5165 | 6.99k | MVM_spesh_deopt_one(tc); |
5166 | 586k | goto NEXT; |
5167 | 586k | } |
5168 | 0 | OP(sp_guardcontconc): { |
5169 | 0 | MVMint32 ok = 0; |
5170 | 0 | MVMObject *check = GET_REG(cur_op, 0).o; |
5171 | 0 | MVMSTable *want_c = (MVMSTable *)tc->cur_frame |
5172 | 0 | ->effective_spesh_slots[GET_UI16(cur_op, 2)]; |
5173 | 0 | MVMSTable *want_v = (MVMSTable *)tc->cur_frame |
5174 | 0 | ->effective_spesh_slots[GET_UI16(cur_op, 4)]; |
5175 | 0 | cur_op += 6; |
5176 | 0 | if (check && IS_CONCRETE(check) && STABLE(check) == want_c) { |
5177 | 0 | MVMContainerSpec const *contspec = STABLE(check)->container_spec; |
5178 | 0 | MVMRegister r; |
5179 | 0 | contspec->fetch(tc, check, &r); |
5180 | 0 | if (r.o && IS_CONCRETE(r.o) && STABLE(r.o) == want_v) |
5181 | 0 | ok = 1; |
5182 | 0 | } |
5183 | 0 | if (!ok) |
5184 | 0 | MVM_spesh_deopt_one(tc); |
5185 | 0 | goto NEXT; |
5186 | 0 | } |
5187 | 0 | OP(sp_guardconttype): { |
5188 | 0 | MVMint32 ok = 0; |
5189 | 0 | MVMObject *check = GET_REG(cur_op, 0).o; |
5190 | 0 | MVMSTable *want_c = (MVMSTable *)tc->cur_frame |
5191 | 0 | ->effective_spesh_slots[GET_UI16(cur_op, 2)]; |
5192 | 0 | MVMSTable *want_v = (MVMSTable *)tc->cur_frame |
5193 | 0 | ->effective_spesh_slots[GET_UI16(cur_op, 4)]; |
5194 | 0 | cur_op += 6; |
5195 | 0 | if (check && IS_CONCRETE(check) && STABLE(check) == want_c) { |
5196 | 0 | MVMContainerSpec const *contspec = STABLE(check)->container_spec; |
5197 | 0 | MVMRegister r; |
5198 | 0 | contspec->fetch(tc, check, &r); |
5199 | 0 | if (r.o && !IS_CONCRETE(r.o) && STABLE(r.o) == want_v) |
5200 | 0 | ok = 1; |
5201 | 0 | } |
5202 | 0 | if (!ok) |
5203 | 0 | MVM_spesh_deopt_one(tc); |
5204 | 0 | goto NEXT; |
5205 | 0 | } |
5206 | 0 |
|
5207 | 0 | OP(sp_guardrwconc): { |
5208 | 0 | MVMint32 ok = 0; |
5209 | 0 | MVMObject *check = GET_REG(cur_op, 0).o; |
5210 | 0 | MVMSTable *want_c = (MVMSTable *)tc->cur_frame |
5211 | 0 | ->effective_spesh_slots[GET_UI16(cur_op, 2)]; |
5212 | 0 | MVMSTable *want_v = (MVMSTable *)tc->cur_frame |
5213 | 0 | ->effective_spesh_slots[GET_UI16(cur_op, 4)]; |
5214 | 0 | cur_op += 6; |
5215 | 0 | if (check && IS_CONCRETE(check) && STABLE(check) == want_c) { |
5216 | 0 | MVMContainerSpec const *contspec = STABLE(check)->container_spec; |
5217 | 0 | if (contspec->can_store(tc, check)) { |
5218 | 0 | MVMRegister r; |
5219 | 0 | contspec->fetch(tc, check, &r); |
5220 | 0 | if (r.o && IS_CONCRETE(r.o) && STABLE(r.o) == want_v) |
5221 | 0 | ok = 1; |
5222 | 0 | } |
5223 | 0 | } |
5224 | 0 | if (!ok) |
5225 | 0 | MVM_spesh_deopt_one(tc); |
5226 | 0 | goto NEXT; |
5227 | 0 | } |
5228 | 0 | OP(sp_guardrwtype): { |
5229 | 0 | MVMint32 ok = 0; |
5230 | 0 | MVMObject *check = GET_REG(cur_op, 0).o; |
5231 | 0 | MVMSTable *want_c = (MVMSTable *)tc->cur_frame |
5232 | 0 | ->effective_spesh_slots[GET_UI16(cur_op, 2)]; |
5233 | 0 | MVMSTable *want_v = (MVMSTable *)tc->cur_frame |
5234 | 0 | ->effective_spesh_slots[GET_UI16(cur_op, 4)]; |
5235 | 0 | cur_op += 6; |
5236 | 0 | if (check && IS_CONCRETE(check) && STABLE(check) == want_c) { |
5237 | 0 | MVMContainerSpec const *contspec = STABLE(check)->container_spec; |
5238 | 0 | if (contspec->can_store(tc, check)) { |
5239 | 0 | MVMRegister r; |
5240 | 0 | contspec->fetch(tc, check, &r); |
5241 | 0 | if (r.o && !IS_CONCRETE(r.o) && STABLE(r.o) == want_v) |
5242 | 0 | ok = 1; |
5243 | 0 | } |
5244 | 0 | } |
5245 | 0 | if (!ok) |
5246 | 0 | MVM_spesh_deopt_one(tc); |
5247 | 0 | goto NEXT; |
5248 | 0 | } |
5249 | 0 |
|
5250 | 0 |
|
5251 | 2.18M | OP(sp_getarg_o): |
5252 | 2.18M | GET_REG(cur_op, 0).o = tc->cur_frame->params.args[GET_UI16(cur_op, 2)].o; |
5253 | 2.18M | cur_op += 4; |
5254 | 2.18M | goto NEXT; |
5255 | 421k | OP(sp_getarg_i): |
5256 | 421k | GET_REG(cur_op, 0).i64 = tc->cur_frame->params.args[GET_UI16(cur_op, 2)].i64; |
5257 | 421k | cur_op += 4; |
5258 | 421k | goto NEXT; |
5259 | 518 | OP(sp_getarg_n): |
5260 | 518 | GET_REG(cur_op, 0).n64 = tc->cur_frame->params.args[GET_UI16(cur_op, 2)].n64; |
5261 | 518 | cur_op += 4; |
5262 | 518 | goto NEXT; |
5263 | 688k | OP(sp_getarg_s): |
5264 | 688k | GET_REG(cur_op, 0).s = tc->cur_frame->params.args[GET_UI16(cur_op, 2)].s; |
5265 | 688k | cur_op += 4; |
5266 | 688k | goto NEXT; |
5267 | 42.5k | OP(sp_fastinvoke_v): { |
5268 | 42.5k | MVMCode *code = (MVMCode *)GET_REG(cur_op, 0).o; |
5269 | 42.5k | MVMRegister *args = tc->cur_frame->args; |
5270 | 42.5k | MVMint32 spesh_cand = GET_UI16(cur_op, 2); |
5271 | 42.5k | tc->cur_frame->return_value = NULL; |
5272 | 42.5k | tc->cur_frame->return_type = MVM_RETURN_VOID; |
5273 | 42.5k | cur_op += 4; |
5274 | 42.5k | tc->cur_frame->return_address = cur_op; |
5275 | 42.5k | MVM_frame_invoke(tc, code->body.sf, cur_callsite, args, |
5276 | 42.5k | code->body.outer, (MVMObject *)code, spesh_cand); |
5277 | 42.5k | goto NEXT; |
5278 | 42.5k | } |
5279 | 0 | OP(sp_fastinvoke_i): { |
5280 | 0 | MVMCode *code = (MVMCode *)GET_REG(cur_op, 2).o; |
5281 | 0 | MVMRegister *args = tc->cur_frame->args; |
5282 | 0 | MVMint32 spesh_cand = GET_UI16(cur_op, 4); |
5283 | 0 | tc->cur_frame->return_value = &GET_REG(cur_op, 0); |
5284 | 0 | tc->cur_frame->return_type = MVM_RETURN_INT; |
5285 | 0 | cur_op += 6; |
5286 | 0 | tc->cur_frame->return_address = cur_op; |
5287 | 0 | MVM_frame_invoke(tc, code->body.sf, cur_callsite, args, |
5288 | 0 | code->body.outer, (MVMObject *)code, spesh_cand); |
5289 | 0 | goto NEXT; |
5290 | 0 | } |
5291 | 0 | OP(sp_fastinvoke_n): { |
5292 | 0 | MVMCode *code = (MVMCode *)GET_REG(cur_op, 2).o; |
5293 | 0 | MVMRegister *args = tc->cur_frame->args; |
5294 | 0 | MVMint32 spesh_cand = GET_UI16(cur_op, 4); |
5295 | 0 | tc->cur_frame->return_value = &GET_REG(cur_op, 0); |
5296 | 0 | tc->cur_frame->return_type = MVM_RETURN_NUM; |
5297 | 0 | cur_op += 6; |
5298 | 0 | tc->cur_frame->return_address = cur_op; |
5299 | 0 | MVM_frame_invoke(tc, code->body.sf, cur_callsite, args, |
5300 | 0 | code->body.outer, (MVMObject *)code, spesh_cand); |
5301 | 0 | goto NEXT; |
5302 | 0 | } |
5303 | 0 | OP(sp_fastinvoke_s): { |
5304 | 0 | MVMCode *code = (MVMCode *)GET_REG(cur_op, 2).o; |
5305 | 0 | MVMRegister *args = tc->cur_frame->args; |
5306 | 0 | MVMint32 spesh_cand = GET_UI16(cur_op, 4); |
5307 | 0 | tc->cur_frame->return_value = &GET_REG(cur_op, 0); |
5308 | 0 | tc->cur_frame->return_type = MVM_RETURN_STR; |
5309 | 0 | cur_op += 6; |
5310 | 0 | tc->cur_frame->return_address = cur_op; |
5311 | 0 | MVM_frame_invoke(tc, code->body.sf, cur_callsite, args, |
5312 | 0 | code->body.outer, (MVMObject *)code, spesh_cand); |
5313 | 0 | goto NEXT; |
5314 | 0 | } |
5315 | 424k | OP(sp_fastinvoke_o): { |
5316 | 424k | MVMCode *code = (MVMCode *)GET_REG(cur_op, 2).o; |
5317 | 424k | MVMRegister *args = tc->cur_frame->args; |
5318 | 424k | MVMint32 spesh_cand = GET_UI16(cur_op, 4); |
5319 | 424k | tc->cur_frame->return_value = &GET_REG(cur_op, 0); |
5320 | 424k | tc->cur_frame->return_type = MVM_RETURN_OBJ; |
5321 | 424k | cur_op += 6; |
5322 | 424k | tc->cur_frame->return_address = cur_op; |
5323 | 424k | MVM_frame_invoke(tc, code->body.sf, cur_callsite, args, |
5324 | 424k | code->body.outer, (MVMObject *)code, spesh_cand); |
5325 | 424k | goto NEXT; |
5326 | 424k | } |
5327 | 136k | OP(sp_namedarg_used): |
5328 | 136k | tc->cur_frame->params.named_used[GET_UI16(cur_op, 0)] = 1; |
5329 | 136k | cur_op += 2; |
5330 | 136k | goto NEXT; |
5331 | 7.29M | OP(sp_getspeshslot): |
5332 | 7.29M | GET_REG(cur_op, 0).o = (MVMObject *)tc->cur_frame |
5333 | 7.29M | ->effective_spesh_slots[GET_UI16(cur_op, 2)]; |
5334 | 7.29M | cur_op += 4; |
5335 | 7.29M | goto NEXT; |
5336 | 1.16M | OP(sp_findmeth): { |
5337 | 1.16M | /* Obtain object and cache index; see if we get a match. */ |
5338 | 1.16M | MVMObject *obj = GET_REG(cur_op, 2).o; |
5339 | 1.16M | MVMuint16 idx = GET_UI16(cur_op, 8); |
5340 | 1.16M | if ((MVMSTable *)tc->cur_frame->effective_spesh_slots[idx] == STABLE(obj)) { |
5341 | 1.16M | GET_REG(cur_op, 0).o = (MVMObject *)tc->cur_frame->effective_spesh_slots[idx + 1]; |
5342 | 1.16M | cur_op += 10; |
5343 | 1.16M | } |
5344 | 3.64k | else { |
5345 | 3.64k | /* May invoke, so pre-increment op counter */ |
5346 | 3.64k | MVMString *name = MVM_cu_string(tc, cu, GET_UI32(cur_op, 4)); |
5347 | 3.64k | MVMRegister *res = &GET_REG(cur_op, 0); |
5348 | 3.64k | cur_op += 10; |
5349 | 3.64k | MVM_6model_find_method_spesh(tc, obj, name, idx, res); |
5350 | 3.64k | |
5351 | 3.64k | } |
5352 | 1.16M | goto NEXT; |
5353 | 1.16M | } |
5354 | 952k | OP(sp_fastcreate): { |
5355 | 952k | /* Assume we're in normal code, so doing a nursery allocation. |
5356 | 952k | * Also, that there is no initialize. */ |
5357 | 952k | MVMuint16 size = GET_UI16(cur_op, 2); |
5358 | 952k | MVMObject *obj = MVM_gc_allocate_zeroed(tc, size); |
5359 | 952k | obj->st = (MVMSTable *)tc->cur_frame->effective_spesh_slots[GET_UI16(cur_op, 4)]; |
5360 | 952k | obj->header.size = size; |
5361 | 952k | obj->header.owner = tc->thread_id; |
5362 | 952k | GET_REG(cur_op, 0).o = obj; |
5363 | 952k | cur_op += 6; |
5364 | 952k | goto NEXT; |
5365 | 952k | } |
5366 | 0 | OP(sp_get_o): { |
5367 | 0 | MVMObject *val = ((MVMObject *)((char *)GET_REG(cur_op, 2).o + GET_UI16(cur_op, 4))); |
5368 | 0 | GET_REG(cur_op, 0).o = val ? val : tc->instance->VMNull; |
5369 | 0 | cur_op += 6; |
5370 | 0 | goto NEXT; |
5371 | 0 | } |
5372 | 0 | OP(sp_get_i64): |
5373 | 0 | GET_REG(cur_op, 0).i64 = *((MVMint64 *)((char *)GET_REG(cur_op, 2).o + GET_UI16(cur_op, 4))); |
5374 | 0 | cur_op += 6; |
5375 | 0 | goto NEXT; |
5376 | 0 | OP(sp_get_i32): |
5377 | 0 | GET_REG(cur_op, 0).i64 = *((MVMint32 *)((char *)GET_REG(cur_op, 2).o + GET_UI16(cur_op, 4))); |
5378 | 0 | cur_op += 6; |
5379 | 0 | goto NEXT; |
5380 | 0 | OP(sp_get_i16): |
5381 | 0 | GET_REG(cur_op, 0).i64 = *((MVMint16 *)((char *)GET_REG(cur_op, 2).o + GET_UI16(cur_op, 4))); |
5382 | 0 | cur_op += 6; |
5383 | 0 | goto NEXT; |
5384 | 0 | OP(sp_get_i8): |
5385 | 0 | GET_REG(cur_op, 0).i64 = *((MVMint8 *)((char *)GET_REG(cur_op, 2).o + GET_UI16(cur_op, 4))); |
5386 | 0 | cur_op += 6; |
5387 | 0 | goto NEXT; |
5388 | 0 | OP(sp_get_n): |
5389 | 0 | GET_REG(cur_op, 0).n64 = *((MVMnum64 *)((char *)GET_REG(cur_op, 2).o + GET_UI16(cur_op, 4))); |
5390 | 0 | cur_op += 6; |
5391 | 0 | goto NEXT; |
5392 | 0 | OP(sp_get_s): |
5393 | 0 | GET_REG(cur_op, 0).s = ((MVMString *)((char *)GET_REG(cur_op, 2).o + GET_UI16(cur_op, 4))); |
5394 | 0 | cur_op += 6; |
5395 | 0 | goto NEXT; |
5396 | 0 | OP(sp_bind_o): { |
5397 | 0 | MVMObject *o = GET_REG(cur_op, 0).o; |
5398 | 0 | MVMObject *value = GET_REG(cur_op, 4).o; |
5399 | 0 | MVM_ASSIGN_REF(tc, &(o->header), *((MVMObject **)((char *)o + GET_UI16(cur_op, 2))), value); |
5400 | 0 | cur_op += 6; |
5401 | 0 | goto NEXT; |
5402 | 0 | } |
5403 | 0 | OP(sp_bind_i64): { |
5404 | 0 | MVMObject *o = GET_REG(cur_op, 0).o; |
5405 | 0 | *((MVMint64 *)((char *)o + GET_UI16(cur_op, 2))) = GET_REG(cur_op, 4).i64; |
5406 | 0 | cur_op += 6; |
5407 | 0 | goto NEXT; |
5408 | 0 | } |
5409 | 0 | OP(sp_bind_i32): { |
5410 | 0 | MVMObject *o = GET_REG(cur_op, 0).o; |
5411 | 0 | *((MVMint32 *)((char *)o + GET_UI16(cur_op, 2))) = GET_REG(cur_op, 4).i64; |
5412 | 0 | cur_op += 6; |
5413 | 0 | goto NEXT; |
5414 | 0 | } |
5415 | 0 | OP(sp_bind_i16): { |
5416 | 0 | MVMObject *o = GET_REG(cur_op, 0).o; |
5417 | 0 | *((MVMint16 *)((char *)o + GET_UI16(cur_op, 2))) = GET_REG(cur_op, 4).i64; |
5418 | 0 | cur_op += 6; |
5419 | 0 | goto NEXT; |
5420 | 0 | } |
5421 | 0 | OP(sp_bind_i8): { |
5422 | 0 | MVMObject *o = GET_REG(cur_op, 0).o; |
5423 | 0 | *((MVMint8 *)((char *)o + GET_UI16(cur_op, 2))) = GET_REG(cur_op, 4).i64; |
5424 | 0 | cur_op += 6; |
5425 | 0 | goto NEXT; |
5426 | 0 | } |
5427 | 0 | OP(sp_bind_n): { |
5428 | 0 | MVMObject *o = GET_REG(cur_op, 0).o; |
5429 | 0 | *((MVMnum64 *)((char *)o + GET_UI16(cur_op, 2))) = GET_REG(cur_op, 4).n64; |
5430 | 0 | cur_op += 6; |
5431 | 0 | goto NEXT; |
5432 | 0 | } |
5433 | 0 | OP(sp_bind_s): { |
5434 | 0 | MVMObject *o = GET_REG(cur_op, 0).o; |
5435 | 0 | MVMString *value = GET_REG(cur_op, 4).s; |
5436 | 0 | MVM_ASSIGN_REF(tc, &(o->header), *((MVMObject **)((char *)o + GET_UI16(cur_op, 2))), value); |
5437 | 0 | cur_op += 6; |
5438 | 0 | goto NEXT; |
5439 | 0 | } |
5440 | 88.4k | OP(sp_p6oget_o): { |
5441 | 88.4k | MVMObject *o = GET_REG(cur_op, 2).o; |
5442 | 88.4k | char *data = MVM_p6opaque_real_data(tc, OBJECT_BODY(o)); |
5443 | 88.4k | MVMObject *val = *((MVMObject **)(data + GET_UI16(cur_op, 4))); |
5444 | 88.4k | GET_REG(cur_op, 0).o = val ? val : tc->instance->VMNull; |
5445 | 88.4k | cur_op += 6; |
5446 | 88.4k | goto NEXT; |
5447 | 88.4k | } |
5448 | 3.01M | OP(sp_p6ogetvt_o): { |
5449 | 3.01M | MVMObject *o = GET_REG(cur_op, 2).o; |
5450 | 3.01M | char *data = MVM_p6opaque_real_data(tc, OBJECT_BODY(o)); |
5451 | 3.01M | MVMObject *val = *((MVMObject **)(data + GET_UI16(cur_op, 4))); |
5452 | 3.01M | if (!val) { |
5453 | 237k | val = (MVMObject *)tc->cur_frame->effective_spesh_slots[GET_UI16(cur_op, 6)]; |
5454 | 237k | MVM_ASSIGN_REF(tc, &(o->header), *((MVMObject **)(data + GET_UI16(cur_op, 4))), val); |
5455 | 237k | } |
5456 | 3.01M | GET_REG(cur_op, 0).o = val; |
5457 | 3.01M | cur_op += 8; |
5458 | 3.01M | goto NEXT; |
5459 | 3.01M | } |
5460 | 0 | OP(sp_p6ogetvc_o): { |
5461 | 0 | MVMObject *o = GET_REG(cur_op, 2).o; |
5462 | 0 | char *data = MVM_p6opaque_real_data(tc, OBJECT_BODY(o)); |
5463 | 0 | MVMObject *val = *((MVMObject **)(data + GET_UI16(cur_op, 4))); |
5464 | 0 | if (!val) { |
5465 | 0 | /* Clone might allocate, so re-fetch things after it. */ |
5466 | 0 | val = MVM_repr_clone(tc, (MVMObject *)tc->cur_frame->effective_spesh_slots[GET_UI16(cur_op, 6)]); |
5467 | 0 | o = GET_REG(cur_op, 2).o; |
5468 | 0 | data = MVM_p6opaque_real_data(tc, OBJECT_BODY(o)); |
5469 | 0 | MVM_ASSIGN_REF(tc, &(o->header), *((MVMObject **)(data + GET_UI16(cur_op, 4))), val); |
5470 | 0 | } |
5471 | 0 | GET_REG(cur_op, 0).o = val; |
5472 | 0 | cur_op += 8; |
5473 | 0 | goto NEXT; |
5474 | 0 | } |
5475 | 1.75M | OP(sp_p6oget_i): { |
5476 | 1.75M | MVMObject *o = GET_REG(cur_op, 2).o; |
5477 | 1.75M | char *data = MVM_p6opaque_real_data(tc, OBJECT_BODY(o)); |
5478 | 1.75M | GET_REG(cur_op, 0).i64 = *((MVMint64 *)(data + GET_UI16(cur_op, 4))); |
5479 | 1.75M | cur_op += 6; |
5480 | 1.75M | goto NEXT; |
5481 | 1.75M | } |
5482 | 0 | OP(sp_p6oget_n): { |
5483 | 0 | MVMObject *o = GET_REG(cur_op, 2).o; |
5484 | 0 | char *data = MVM_p6opaque_real_data(tc, OBJECT_BODY(o)); |
5485 | 0 | GET_REG(cur_op, 0).n64 = *((MVMnum64 *)(data + GET_UI16(cur_op, 4))); |
5486 | 0 | cur_op += 6; |
5487 | 0 | goto NEXT; |
5488 | 0 | } |
5489 | 414k | OP(sp_p6oget_s): { |
5490 | 414k | MVMObject *o = GET_REG(cur_op, 2).o; |
5491 | 414k | char *data = MVM_p6opaque_real_data(tc, OBJECT_BODY(o)); |
5492 | 414k | GET_REG(cur_op, 0).s = *((MVMString **)(data + GET_UI16(cur_op, 4))); |
5493 | 414k | cur_op += 6; |
5494 | 414k | goto NEXT; |
5495 | 414k | } |
5496 | 1.91M | OP(sp_p6obind_o): { |
5497 | 1.91M | MVMObject *o = GET_REG(cur_op, 0).o; |
5498 | 1.91M | MVMObject *value = GET_REG(cur_op, 4).o; |
5499 | 1.91M | char *data = MVM_p6opaque_real_data(tc, OBJECT_BODY(o)); |
5500 | 1.91M | MVM_ASSIGN_REF(tc, &(o->header), *((MVMObject **)(data + GET_UI16(cur_op, 2))), value); |
5501 | 1.91M | cur_op += 6; |
5502 | 1.91M | goto NEXT; |
5503 | 1.91M | } |
5504 | 1.39M | OP(sp_p6obind_i): { |
5505 | 1.39M | MVMObject *o = GET_REG(cur_op, 0).o; |
5506 | 1.39M | char *data = MVM_p6opaque_real_data(tc, OBJECT_BODY(o)); |
5507 | 1.39M | *((MVMint64 *)(data + GET_UI16(cur_op, 2))) = GET_REG(cur_op, 4).i64; |
5508 | 1.39M | cur_op += 6; |
5509 | 1.39M | goto NEXT; |
5510 | 1.39M | } |
5511 | 55 | OP(sp_p6obind_n): { |
5512 | 55 | MVMObject *o = GET_REG(cur_op, 0).o; |
5513 | 55 | char *data = MVM_p6opaque_real_data(tc, OBJECT_BODY(o)); |
5514 | 55 | *((MVMnum64 *)(data + GET_UI16(cur_op, 2))) = GET_REG(cur_op, 4).n64; |
5515 | 55 | cur_op += 6; |
5516 | 55 | goto NEXT; |
5517 | 55 | } |
5518 | 64.0k | OP(sp_p6obind_s): { |
5519 | 64.0k | MVMObject *o = GET_REG(cur_op, 0).o; |
5520 | 64.0k | char *data = MVM_p6opaque_real_data(tc, OBJECT_BODY(o)); |
5521 | 64.0k | MVM_ASSIGN_REF(tc, &(o->header), *((MVMString **)(data + GET_UI16(cur_op, 2))), |
5522 | 64.0k | GET_REG(cur_op, 4).s); |
5523 | 64.0k | cur_op += 6; |
5524 | 64.0k | goto NEXT; |
5525 | 64.0k | } |
5526 | 0 | OP(sp_deref_get_i64): { |
5527 | 0 | MVMObject *o = GET_REG(cur_op, 2).o; |
5528 | 0 | MVMint64 **target = ((MVMint64 **)((char *)o + GET_UI16(cur_op, 4))); |
5529 | 0 | GET_REG(cur_op, 0).i64 = **target; |
5530 | 0 | cur_op += 6; |
5531 | 0 | goto NEXT; |
5532 | 0 | } |
5533 | 0 | OP(sp_deref_get_n): { |
5534 | 0 | MVMObject *o = GET_REG(cur_op, 2).o; |
5535 | 0 | MVMnum64 **target = ((MVMnum64 **)((char *)o + GET_UI16(cur_op, 4))); |
5536 | 0 | GET_REG(cur_op, 0).n64 = **target; |
5537 | 0 | cur_op += 6; |
5538 | 0 | goto NEXT; |
5539 | 0 | } |
5540 | 0 | OP(sp_deref_bind_i64): { |
5541 | 0 | MVMObject *o = GET_REG(cur_op, 0).o; |
5542 | 0 | MVMint64 **target = ((MVMint64 **)((char *)o + GET_UI16(cur_op, 4))); |
5543 | 0 | **target = GET_REG(cur_op, 2).i64; |
5544 | 0 | cur_op += 6; |
5545 | 0 | goto NEXT; |
5546 | 0 | } |
5547 | 0 | OP(sp_deref_bind_n): { |
5548 | 0 | MVMObject *o = GET_REG(cur_op, 0).o; |
5549 | 0 | MVMnum64 **target = ((MVMnum64 **)((char *)o + GET_UI16(cur_op, 4))); |
5550 | 0 | **target = GET_REG(cur_op, 2).n64; |
5551 | 0 | cur_op += 6; |
5552 | 0 | goto NEXT; |
5553 | 0 | } |
5554 | 10.0M | OP(sp_jit_enter): { |
5555 | 10.0M | if (tc->cur_frame->spesh_cand->jitcode == NULL) { |
5556 | 0 | MVM_exception_throw_adhoc(tc, "Try to enter NULL jitcode"); |
5557 | 0 | } |
5558 | 10.0M | /* trampoline back to this opcode */ |
5559 | 10.0M | cur_op -= 2; |
5560 | 10.0M | if (MVM_jit_enter_code(tc, cu, tc->cur_frame->spesh_cand->jitcode)) { |
5561 | 6.58M | if (MVM_frame_try_return(tc) == 0) |
5562 | 0 | goto return_label; |
5563 | 6.58M | } |
5564 | 10.0M | goto NEXT; |
5565 | 10.0M | } |
5566 | 0 | OP(sp_boolify_iter): { |
5567 | 0 | GET_REG(cur_op, 0).i64 = MVM_iter_istrue(tc, (MVMIter*)GET_REG(cur_op, 2).o); |
5568 | 0 | cur_op += 4; |
5569 | 0 | goto NEXT; |
5570 | 0 | } |
5571 | 0 | OP(sp_boolify_iter_arr): { |
5572 | 0 | MVMIter *iter = (MVMIter *)GET_REG(cur_op, 2).o; |
5573 | 0 |
|
5574 | 0 | GET_REG(cur_op, 0).i64 = iter->body.array_state.index + 1 < iter->body.array_state.limit ? 1 : 0; |
5575 | 0 |
|
5576 | 0 | cur_op += 4; |
5577 | 0 | goto NEXT; |
5578 | 0 | } |
5579 | 0 | OP(sp_boolify_iter_hash): { |
5580 | 0 | MVMIter *iter = (MVMIter *)GET_REG(cur_op, 2).o; |
5581 | 0 |
|
5582 | 0 | GET_REG(cur_op, 0).i64 = iter->body.hash_state.next != NULL ? 1 : 0; |
5583 | 0 |
|
5584 | 0 | cur_op += 4; |
5585 | 0 | goto NEXT; |
5586 | 0 | } |
5587 | 0 | OP(prof_enter): |
5588 | 0 | MVM_profile_log_enter(tc, tc->cur_frame->static_info, |
5589 | 0 | MVM_PROFILE_ENTER_NORMAL); |
5590 | 0 | goto NEXT; |
5591 | 0 | OP(prof_enterspesh): |
5592 | 0 | MVM_profile_log_enter(tc, tc->cur_frame->static_info, |
5593 | 0 | MVM_PROFILE_ENTER_SPESH); |
5594 | 0 | goto NEXT; |
5595 | 0 | OP(prof_enterinline): |
5596 | 0 | MVM_profile_log_enter(tc, |
5597 | 0 | (MVMStaticFrame *)tc->cur_frame->effective_spesh_slots[GET_UI16(cur_op, 0)], |
5598 | 0 | MVM_PROFILE_ENTER_SPESH_INLINE); |
5599 | 0 | cur_op += 2; |
5600 | 0 | goto NEXT; |
5601 | 0 | OP(prof_enternative): |
5602 | 0 | MVM_profile_log_enter_native(tc, GET_REG(cur_op, 0).o); |
5603 | 0 | cur_op += 2; |
5604 | 0 | goto NEXT; |
5605 | 0 | OP(prof_exit): |
5606 | 0 | MVM_profile_log_exit(tc); |
5607 | 0 | goto NEXT; |
5608 | 0 | OP(prof_allocated): |
5609 | 0 | MVM_profile_log_allocated(tc, GET_REG(cur_op, 0).o); |
5610 | 0 | cur_op += 2; |
5611 | 0 | goto NEXT; |
5612 | 0 | OP(ctw_check): { |
5613 | 0 | MVMObject *obj = GET_REG(cur_op, 0).o; |
5614 | 0 | MVMint16 blame = GET_I16(cur_op, 2); |
5615 | 0 | cur_op += 4; |
5616 | 0 | MVM_cross_thread_write_check(tc, obj, blame); |
5617 | 0 | goto NEXT; |
5618 | 0 | } |
5619 | 0 | OP(DEPRECATED_2): |
5620 | 0 | OP(DEPRECATED_3): |
5621 | 0 | OP(DEPRECATED_4): |
5622 | 0 | OP(DEPRECATED_5): |
5623 | 0 | OP(DEPRECATED_6): |
5624 | 0 | OP(DEPRECATED_7): |
5625 | 0 | OP(DEPRECATED_8): |
5626 | 0 | OP(DEPRECATED_9): |
5627 | 0 | OP(DEPRECATED_10): |
5628 | 0 | OP(DEPRECATED_11): |
5629 | 0 | OP(DEPRECATED_12): |
5630 | 0 | MVM_exception_throw_adhoc(tc, "The getregref_* ops were removed in MoarVM 2017.01."); |
5631 | 0 | OP(DEPRECATED_13): |
5632 | 0 | MVM_exception_throw_adhoc(tc, "The continuationclone op was removed in MoarVM 2017.01."); |
5633 | 0 | OP(coverage_log): { |
5634 | 0 | MVMString *filename = MVM_cu_string(tc, cu, GET_UI32(cur_op, 0)); |
5635 | 0 | MVMuint32 lineno = GET_UI32(cur_op, 4); |
5636 | 0 | MVMuint32 cacheidx = GET_UI32(cur_op, 8); |
5637 | 0 | char *cache = (char *)MVM_BC_get_I64(cur_op, 12); |
5638 | 0 | MVM_line_coverage_report(tc, filename, lineno, cacheidx, cache); |
5639 | 0 | cur_op += 20; |
5640 | 0 | goto NEXT; |
5641 | 0 | } |
5642 | 0 | #if MVM_CGOTO |
5643 | 0 | OP_CALL_EXTOP: { |
5644 | 0 | /* Bounds checking? Never heard of that. */ |
5645 | 0 | MVMuint8 *op_before = cur_op; |
5646 | 0 | MVMExtOpRecord *record = &cu->body.extops[op - MVM_OP_EXT_BASE]; |
5647 | 0 | record->func(tc, cur_op); |
5648 | 0 | if (op_before == cur_op) |
5649 | 0 | cur_op += record->operand_bytes; |
5650 | 0 | goto NEXT; |
5651 | 0 | } |
5652 | 0 | #else |
5653 | | default: { |
5654 | | if (op >= MVM_OP_EXT_BASE |
5655 | | && (op - MVM_OP_EXT_BASE) < cu->body.num_extops) { |
5656 | | MVMuint8 *op_before = cur_op; |
5657 | | MVMExtOpRecord *record = |
5658 | | &cu->body.extops[op - MVM_OP_EXT_BASE]; |
5659 | | record->func(tc, cur_op); |
5660 | | if (op_before == cur_op) |
5661 | | cur_op += record->operand_bytes; |
5662 | | goto NEXT; |
5663 | | } |
5664 | | |
5665 | | MVM_panic(MVM_exitcode_invalidopcode, "Invalid opcode executed (corrupt bytecode stream?) opcode %u", op); |
5666 | | } |
5667 | | #endif |
5668 | 0 | } |
5669 | 0 | } |
5670 | 0 |
|
5671 | 260 | return_label: |
5672 | 260 | /* Need to clear these pointer pointers since they may be rooted |
5673 | 260 | * by some GC procedure. */ |
5674 | 260 | tc->interp_cur_op = NULL; |
5675 | 260 | tc->interp_bytecode_start = NULL; |
5676 | 260 | tc->interp_reg_base = NULL; |
5677 | 260 | tc->interp_cu = NULL; |
5678 | 260 | MVM_barrier(); |
5679 | 260 | } |
5680 | | |
5681 | 0 | void MVM_interp_enable_tracing() { |
5682 | 0 | tracing_enabled = 1; |
5683 | 0 | } |