Skip to main content

GPOP

Pop one or more garbage collector roots from the GP stack.

OpcodeBytesCyclesFormExample
$1F11GPOPGPOP
$3621GPOP {S_BYTE}GPOP 123

Notes

  • The GP stack is used by the Hybrix memory manager to track GC roots for the purpose of garbage collection (GC). Each GC root stores the memory address of a pointer variable that should be analyzed by the garbage collector.

  • The GP stack grows backwards (pushing decreases the GP register), whereas the SP stack grows forwards. (The "top" of the GP stack is actually the lowest memory address.)

  • GPOP undoes the action of GPUSH. The popped value is discarded because in practice it is not needed. (The GP stack contents are mainly inspected by the garbage collector, which will visit the stack using LOAD.)

  • Since the Hybrix hardware uses a 24-bit memory bus, Chombit's GP stack is configured to store 3-byte TRIO pointers.

  • The effect of GPOP is to add 3 to the GP register, because each stack record is a 3-byte pointer.

  • GPOP 123 is equivalent to 123 GPOP instructions. In other words, it adds 3 * 123 to the GP register.

  • This instruction does not affect the CPU condition flags.