-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathInstructions.cpp
More file actions
515 lines (508 loc) · 19.7 KB
/
Copy pathInstructions.cpp
File metadata and controls
515 lines (508 loc) · 19.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
#include "Instructions.hpp"
#include "BinaryOperation.hpp"
#include "BinarySubscript.hpp"
#include "BuildDict.hpp"
#include "BuildList.hpp"
#include "BuildSet.hpp"
#include "BuildSlice.hpp"
#include "BuildString.hpp"
#include "BuildTuple.hpp"
#include "ClearExceptionState.hpp"
#include "ClearTopCleanup.hpp"
#include "CompareOperation.hpp"
#include "DeleteName.hpp"
#include "DeleteSubscript.hpp"
#include "DictMerge.hpp"
#include "DictUpdate.hpp"
#include "ForIter.hpp"
#include "FormatValue.hpp"
#include "FunctionCall.hpp"
#include "FunctionCallEx.hpp"
#include "FunctionCallWithKeywords.hpp"
#include "GetIter.hpp"
#include "GetYieldFromIter.hpp"
#include "ImportFrom.hpp"
#include "ImportName.hpp"
#include "InplaceOp.hpp"
#include "Jump.hpp"
#include "JumpForward.hpp"
#include "JumpIfExceptionMatch.hpp"
#include "JumpIfFalse.hpp"
#include "JumpIfFalseOrPop.hpp"
#include "JumpIfNotExceptionMatch.hpp"
#include "JumpIfTrue.hpp"
#include "JumpIfTrueOrPop.hpp"
#include "LeaveExceptionHandling.hpp"
#include "ListAppend.hpp"
#include "ListExtend.hpp"
#include "ListToTuple.hpp"
#include "LoadAssertionError.hpp"
#include "LoadAttr.hpp"
#include "LoadBuildClass.hpp"
#include "LoadClosure.hpp"
#include "LoadConst.hpp"
#include "LoadDeref.hpp"
#include "LoadException.hpp"
#include "LoadFast.hpp"
#include "LoadGlobal.hpp"
#include "LoadMethod.hpp"
#include "LoadName.hpp"
#include "MakeFunction.hpp"
#include "MethodCall.hpp"
#include "Move.hpp"
#include "Pop.hpp"
#include "Push.hpp"
#include "RaiseVarargs.hpp"
#include "ReRaise.hpp"
#include "ReturnValue.hpp"
#include "SetAdd.hpp"
#include "SetUpdate.hpp"
#include "SetupExceptionHandling.hpp"
#include "SetupWith.hpp"
#include "StoreAttr.hpp"
#include "StoreDeref.hpp"
#include "StoreFast.hpp"
#include "StoreGlobal.hpp"
#include "StoreName.hpp"
#include "StoreSubscript.hpp"
#include "ToBool.hpp"
#include "Unary.hpp"
#include "UnpackSequence.hpp"
#include "WithExceptStart.hpp"
#include "YieldLoad.hpp"
#include "YieldValue.hpp"
#include "../serialization/deserialize.hpp"
#include "vm/VM.hpp"
#include <optional>
using namespace py;
// GCC 16 inlines the std::variant copy-assignment behind py::Value and then
// attributes the std::vector destructor's operator delete to the stack slot
// holding the variant. Nothing is freed here; the diagnostic is a false positive.
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfree-nonheap-object"
#endif
Instruction::RAIIStoreNonCallInstructionData::RAIIStoreNonCallInstructionData()
{
reg0 = VirtualMachine::the().reg(0);
}
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic pop
#endif
Instruction::RAIIStoreNonCallInstructionData::~RAIIStoreNonCallInstructionData()
{
VirtualMachine::the().reg(0) = std::move(reg0);
}
std::unique_ptr<Instruction> deserialize(std::span<const uint8_t> &instruction_buffer)
{
const auto instruction_code = deserialize<uint8_t>(instruction_buffer);
switch (instruction_code) {
case LOAD_NAME: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto object_name = deserialize<std::string>(instruction_buffer);
return std::make_unique<LoadName>(dst, object_name);
} break;
case LOAD_CONST: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto static_value_index = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<LoadConst>(dst, static_value_index);
} break;
case FUNCTION_CALL: {
const auto function_name_reg = deserialize<uint8_t>(instruction_buffer);
const auto args_count = deserialize<uint8_t>(instruction_buffer);
const auto args_offset = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<FunctionCall>(function_name_reg, args_count, args_offset);
} break;
case RETURN_VALUE: {
const auto source = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<ReturnValue>(source);
} break;
case MOVE: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<Move>(dst, src);
} break;
case MAKE_FUNCTION: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto name = deserialize<uint8_t>(instruction_buffer);
const auto default_size = deserialize<uint8_t>(instruction_buffer);
const auto kw_default_size = deserialize<uint8_t>(instruction_buffer);
const auto has_captures_tuple = deserialize<uint8_t>(instruction_buffer);
const auto captures_tuple = [&]() -> std::optional<Register> {
const auto value = deserialize<uint8_t>(instruction_buffer);
if (has_captures_tuple) {
return value;
} else {
return std::nullopt;
}
}();
return std::make_unique<MakeFunction>(
dst, name, default_size, kw_default_size, captures_tuple);
} break;
case STORE_NAME: {
const auto src = deserialize<uint8_t>(instruction_buffer);
const auto name = deserialize<std::string>(instruction_buffer);
return std::make_unique<StoreName>(name, src);
} break;
case COMPARE_OP: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto lhs = deserialize<uint8_t>(instruction_buffer);
const auto rhs = deserialize<uint8_t>(instruction_buffer);
const auto comparisson =
static_cast<CompareOperation::Comparisson>(deserialize<uint8_t>(instruction_buffer));
return std::make_unique<CompareOperation>(dst, lhs, rhs, comparisson);
} break;
case JUMP_IF_TRUE: {
const auto test_register = deserialize<uint8_t>(instruction_buffer);
const auto offset = deserialize<int32_t>(instruction_buffer);
return std::make_unique<JumpIfTrue>(test_register, offset);
} break;
case RAISE_VARARGS: {
uint8_t count = deserialize<uint8_t>(instruction_buffer);
const auto exception = [&]() -> std::optional<Register> {
if (count > 0) { return deserialize<uint8_t>(instruction_buffer); }
return std::nullopt;
}();
const auto cause = [&]() -> std::optional<Register> {
if (count > 1) { return deserialize<uint8_t>(instruction_buffer); }
return std::nullopt;
}();
if (exception.has_value() && cause.has_value()) {
return std::make_unique<RaiseVarargs>(*exception, *cause);
} else if (exception.has_value()) {
return std::make_unique<RaiseVarargs>(*exception);
} else {
return std::make_unique<RaiseVarargs>();
}
} break;
case LOAD_ASSERTION_ERROR: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<LoadAssertionError>(dst);
} break;
case LOAD_EXCEPTION: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<LoadException>(dst);
} break;
case LOAD_FAST: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto idx = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<LoadFast>(dst, idx, "NOT_IMPLEMENTED");
} break;
case BINARY_OPERATION: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto lhs = deserialize<uint8_t>(instruction_buffer);
const auto rhs = deserialize<uint8_t>(instruction_buffer);
const auto operation =
static_cast<BinaryOperation::Operation>(deserialize<uint8_t>(instruction_buffer));
return std::make_unique<BinaryOperation>(dst, lhs, rhs, operation);
} break;
case LOAD_ATTR: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto value_source = deserialize<uint8_t>(instruction_buffer);
const auto attr_name = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<LoadAttr>(dst, value_source, attr_name);
}
case LOAD_GLOBAL: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto obj_name = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<LoadGlobal>(dst, obj_name);
}
case RERAISE: {
return std::make_unique<ReRaise>();
}
case LOAD_METHOD: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto value_source = deserialize<uint8_t>(instruction_buffer);
const auto method_name = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<LoadMethod>(dst, value_source, method_name);
}
case METHOD_CALL: {
const auto caller = deserialize<uint8_t>(instruction_buffer);
auto args = deserialize<std::vector<uint8_t>>(instruction_buffer);
return std::make_unique<MethodCall>(caller, std::move(args));
}
case STORE_ATTR: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
const auto attr_name = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<StoreAttr>(dst, src, attr_name);
}
case STORE_FAST: {
const auto stack_index = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<StoreFast>(stack_index, src);
}
case WITH_EXCEPT_START: {
const auto result = deserialize<uint8_t>(instruction_buffer);
const auto exit_method = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<WithExceptStart>(result, exit_method);
}
case LOAD_CLOSURE: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<LoadClosure>(dst, src);
}
case FUNCTION_CALL_WITH_KW: {
const auto func_name = deserialize<uint8_t>(instruction_buffer);
auto args = deserialize<std::vector<uint8_t>>(instruction_buffer);
auto kwargs = deserialize<std::vector<uint8_t>>(instruction_buffer);
auto keywords = deserialize<std::vector<uint8_t>>(instruction_buffer);
return std::make_unique<FunctionCallWithKeywords>(
func_name, std::move(args), std::move(kwargs), std::move(keywords));
}
case STORE_GLOBAL: {
const auto name = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<StoreGlobal>(name, src);
}
case IMPORT_NAME: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto name = deserialize<uint8_t>(instruction_buffer);
const auto from_list = deserialize<uint8_t>(instruction_buffer);
const auto level = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<ImportName>(dst, name, from_list, level);
}
case IMPORT_FROM: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto name = deserialize<uint8_t>(instruction_buffer);
const auto from = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<ImportFrom>(dst, name, from);
}
case BUILD_DICT: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto size = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<BuildDict>(dst, size);
}
case DICT_UPDATE: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto size = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<DictUpdate>(dst, size);
}
case BUILD_SLICE: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto argcount = deserialize<uint8_t>(instruction_buffer);
ASSERT(argcount <= 3);
ASSERT(argcount > 1);
if (argcount == 2) {
const auto start = deserialize<uint8_t>(instruction_buffer);
const auto end = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<BuildSlice>(dst, start, end);
} else {
const auto start = deserialize<uint8_t>(instruction_buffer);
const auto end = deserialize<uint8_t>(instruction_buffer);
const auto step = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<BuildSlice>(dst, start, end, step);
}
}
case CLEAR_EXCEPTION_STATE: {
return std::make_unique<ClearExceptionState>();
}
case DELETE_NAME: {
const auto name = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<DeleteName>(name);
}
case LIST_EXTEND: {
const auto list = deserialize<uint8_t>(instruction_buffer);
const auto value = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<ListExtend>(list, value);
}
case FOR_ITER: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
const auto offset = deserialize<int32_t>(instruction_buffer);
const auto body_offset = deserialize<int32_t>(instruction_buffer);
return std::make_unique<ForIter>(dst, src, offset, body_offset);
}
case GET_ITER: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<GetIter>(dst, src);
}
case LOAD_BUILD_CLASS: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<LoadBuildClass>(dst);
}
case BUILD_TUPLE: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto size = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<BuildTuple>(dst, size);
}
case BUILD_LIST: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto size = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<BuildList>(dst, size);
}
case SETUP_EXCEPTION_HANDLING: {
const auto offset = deserialize<uint32_t>(instruction_buffer);
return std::make_unique<SetupExceptionHandling>(offset);
}
case JUMP_FORWARD: {
const auto offset = deserialize<uint32_t>(instruction_buffer);
return std::make_unique<JumpForward>(offset);
}
case JUMP_IF_NOT_EXCEPTION_MATCH: {
const auto exception = deserialize<uint8_t>(instruction_buffer);
const auto offset = deserialize<uint32_t>(instruction_buffer);
return std::make_unique<JumpIfNotExceptionMatch>(exception, offset);
}
case JUMP_IF_FALSE: {
const auto test_register = deserialize<uint8_t>(instruction_buffer);
const auto offset = deserialize<int32_t>(instruction_buffer);
return std::make_unique<JumpIfFalse>(test_register, offset);
}
case JUMP: {
const auto offset = deserialize<int32_t>(instruction_buffer);
return std::make_unique<Jump>(offset);
}
case STORE_SUBSCRIPT: {
const auto obj = deserialize<uint8_t>(instruction_buffer);
const auto slice = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<StoreSubscript>(obj, slice, src);
}
case BINARY_SUBSCRIPT: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
const auto index = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<BinarySubscript>(dst, src, index);
}
case JUMP_IF_TRUE_OR_POP: {
const auto test_register = deserialize<uint8_t>(instruction_buffer);
const auto result_register = deserialize<uint8_t>(instruction_buffer);
const auto offset = deserialize<int32_t>(instruction_buffer);
return std::make_unique<JumpIfTrueOrPop>(test_register, result_register, offset);
}
case JUMP_IF_FALSE_OR_POP: {
const auto test_register = deserialize<uint8_t>(instruction_buffer);
const auto result_register = deserialize<uint8_t>(instruction_buffer);
const auto offset = deserialize<int32_t>(instruction_buffer);
return std::make_unique<JumpIfFalseOrPop>(test_register, result_register, offset);
}
case INPLACE_OP: {
const auto lhs = deserialize<uint8_t>(instruction_buffer);
const auto rhs = deserialize<uint8_t>(instruction_buffer);
const auto op = static_cast<InplaceOp::Operation>(deserialize<uint8_t>(instruction_buffer));
return std::make_unique<InplaceOp>(lhs, rhs, op);
}
case LIST_TO_TUPLE: {
const auto tuple = deserialize<uint8_t>(instruction_buffer);
const auto list = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<ListToTuple>(tuple, list);
}
case DICT_MERGE: {
const auto this_dict = deserialize<uint8_t>(instruction_buffer);
const auto other_dict = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<DictMerge>(this_dict, other_dict);
}
case FUNCTION_CALL_EX: {
const auto function = deserialize<uint8_t>(instruction_buffer);
const auto args = deserialize<uint8_t>(instruction_buffer);
const auto kwargs = deserialize<uint8_t>(instruction_buffer);
const auto expand_args = deserialize<bool>(instruction_buffer);
const auto expand_kwargs = deserialize<bool>(instruction_buffer);
return std::make_unique<FunctionCallEx>(function, args, kwargs, expand_args, expand_kwargs);
}
case UNARY: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
const auto op = deserialize<uint8_t>(instruction_buffer);
ASSERT(op < 4);
return std::make_unique<Unary>(dst, src, static_cast<Unary::Operation>(op));
}
case LOAD_DEREF: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<LoadDeref>(dst, src);
}
case LEAVE_EXCEPTION_HANDLING: {
return std::make_unique<LeaveExceptionHandling>();
}
case DELETE_SUBSCRIPT: {
const auto value = deserialize<uint8_t>(instruction_buffer);
const auto index = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<DeleteSubscript>(value, index);
}
case SETUP_WITH: {
const auto offset = deserialize<uint32_t>(instruction_buffer);
return std::make_unique<SetupWith>(offset);
}
case CLEAR_TOP_CLEANUP: {
return std::make_unique<ClearTopCleanup>();
}
case UNPACK_SEQUENCE: {
const auto dst = deserialize<std::vector<uint8_t>>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<UnpackSequence>(dst, src);
}
case LIST_APPEND: {
const auto list = deserialize<uint8_t>(instruction_buffer);
const auto value = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<ListAppend>(list, value);
}
case SET_ADD: {
const auto set = deserialize<uint8_t>(instruction_buffer);
const auto value = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<SetAdd>(set, value);
}
case BUILD_SET: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto size = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<BuildSet>(dst, size);
}
case STORE_DEREF: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<StoreDeref>(dst, src);
}
case YIELD_VALUE: {
const auto src = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<YieldValue>(src);
}
case YIELD_LOAD: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<YieldLoad>(dst);
}
case BUILD_STRING: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto size = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<BuildString>(dst, size);
}
case FORMAT_VALUE: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
const auto conversion = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<FormatValue>(dst, src, conversion);
}
case PUSH: {
const auto src = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<Push>(src);
}
case POP: {
const auto discard = deserialize<uint8_t>(instruction_buffer);
const auto dst = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<Pop>(dst, discard);
}
case GET_YIELD_FROM_ITER: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<GetYieldFromIter>(dst, src);
}
case JUMP_IF_EXCEPTION_MATCH: {
const auto exception_type_reg = deserialize<uint8_t>(instruction_buffer);
const auto offset = deserialize<uint32_t>(instruction_buffer);
return std::make_unique<JumpIfExceptionMatch>(exception_type_reg, offset);
}
case TO_BOOL: {
const auto dst = deserialize<uint8_t>(instruction_buffer);
const auto src = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<ToBool>(dst, src);
}
case SET_UPDATE: {
const auto set = deserialize<uint8_t>(instruction_buffer);
const auto iterable = deserialize<uint8_t>(instruction_buffer);
return std::make_unique<SetUpdate>(set, iterable);
}
}
spdlog::error("Missing opcode: {}", instruction_code);
return nullptr;
}