![]() | Fun 0.41.5 The programming language that makes You have fun |
Implements the OP_DUP opcode for duplicating the top stack value in the VM. More...

Go to the source code of this file.
Functions | |
| exit (1) | |
| push_value (vm, copy_value(&top)) | |
Variables | |
| case | OP_DUP |
| case Runtime | error |
| Value | top = vm->stack[vm->sp] |
| break | |
Implements the OP_DUP opcode for duplicating the top stack value in the VM.
This file handles the OP_DUP instruction, which duplicates the top value on the stack. The duplicated value is pushed back onto the stack.
Behavior:
Error Handling:
Example: // Bytecode: OP_DUP // Stack before: [42] // Stack after: [42, 42]
Definition in file dup.c.
| exit | ( | 1 | ) |
| push_value | ( | vm | , |
| copy_value & | top ) |