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