Skip to main content

Module trap_handler

Module trap_handler 

Source
Expand description

SIGSEGV trap handler for concurrent relocation.

When the GC relocates objects, old regions are protected with PROT_NONE. If the mutator accesses a relocated object before pointer fixup completes, a SIGSEGV fires. The trap handler:

  1. Checks if the faulting address is in a protected (relocated) region.
  2. If yes: looks up the forwarding table, updates the pointer, resumes.
  3. If no: chains to the previous handler (real segfault).

Safety: This is the riskiest component. Initially, relocation is done stop-the-world with synchronous fixup (no trap handler needed). The trap handler is an opt-in feature for concurrent relocation.

Functions§

clear_active_forwarding
Clear the active forwarding table.
install_trap_handler
Install the SIGSEGV trap handler.
is_trap_handler_installed
Check if the trap handler is installed.
register_protected_range
Register a protected region range for the trap handler.
set_active_forwarding
Set the active forwarding table for the trap handler to use.
unregister_protected_range
Unregister a protected region range.