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

Implements the OP_TRY_PUSH opcode to begin a try/catch region. More...

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

Go to the source code of this file.

Functions

 exit (1)

Variables

case OP_TRY_PUSH
case Runtime error
f try_stack [++f->try_sp] = f->ip - 1
 break

Detailed Description

Implements the OP_TRY_PUSH opcode to begin a try/catch region.

This file handles the OP_TRY_PUSH instruction, which marks the start of a try/catch region in the current frame by pushing the index of the TRY instruction onto a small per-frame stack. The actual catch target IP is stored in the TRY instruction's operand and may be patched later by the compiler/linker.

Behavior:

  • Pushes the index of this TRY instruction (f->ip - 1) onto f->try_stack.
  • Does not modify the value stack.

Errors:

  • If the try depth exceeds the size of f->try_stack, prints a runtime error and terminates the process.

Definition in file try_push.c.

Function Documentation

◆ exit()

exit(1)

Variable Documentation

◆ break

break

Definition at line 36 of file try_push.c.

◆ error

case Runtime error

Definition at line 32 of file try_push.c.

◆ OP_TRY_PUSH

case OP_TRY_PUSH

Definition at line 29 of file try_push.c.

◆ try_stack

f try_stack[++f->try_sp] = f->ip - 1

Definition at line 35 of file try_push.c.