Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
load_const.c File Reference

Implements the OP_LOAD_CONST opcode for loading constants in the VM. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 if (idx< 0||idx >=f->fn->const_count)
 push_value (vm, c)

Variables

case OP_LOAD_CONST
Value c = copy_value(&f->fn->constants[idx])
 break

Detailed Description

Implements the OP_LOAD_CONST opcode for loading constants in the VM.

This file handles the OP_LOAD_CONST instruction, which loads a constant value from the bytecode's constant pool onto the stack.

Behavior:

  • operand is index into constant pool
  • Pushes copy of constant onto stack

Error Handling:

  • Exits if invalid constant index

Definition in file load_const.c.

Function Documentation

◆ if()

if(idx< 0||idx > = f->fn->const_count)

Definition at line 27 of file load_const.c.

◆ push_value()

push_value(vm,
c )

Variable Documentation

◆ break

break

Definition at line 33 of file load_const.c.

◆ c

Value c = copy_value(&f->fn->constants[idx])

Definition at line 31 of file load_const.c.

◆ OP_LOAD_CONST

case OP_LOAD_CONST

Definition at line 25 of file load_const.c.