diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-04-10 20:49:29 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-04-10 20:49:29 -0700 |
commit | e5a1211e3b7df6a04de134b60d2dc5cfca3490e5 (patch) | |
tree | 9b9d9847ba6fc60eadd1966ccb5de22d94ddcaea /txr.c | |
parent | 043fe2488a8256b1324526d19949dbb8042e30a1 (diff) | |
download | txr-e5a1211e3b7df6a04de134b60d2dc5cfca3490e5.tar.gz txr-e5a1211e3b7df6a04de134b60d2dc5cfca3490e5.tar.bz2 txr-e5a1211e3b7df6a04de134b60d2dc5cfca3490e5.zip |
load: fix vm gc issue.
This issue manifested itself as a segfault on Mac OS
while compiling a library file using the compiled
implementation (hash.tl -> hash.tlo2).
The problem is premature reclamation of a virtual machine
description.
While the asm.tlo module is loaded, suddenly a function table
goes corrupt.
When we execute machine using vm_execute_toplevel, the vm's
stack doesn't actually contain a reference to the description
object anywhere. It's passed in as a parameter, and right away
converted to the (struct vm_desc *) handle which is planted in
the struct vm representing the running instance, which lives
on the stack. That pointer isn't a reference traversed by the
garbage collector. If the original Lisp object is optimized
away and overwritten both in vm_execute_toplevel and in that
function's caller, then it can be reclaimed even as it
executes.
* parser.c (read_file_common): Add a gc_hint(desc) after the
vm_execute_toplevel so that the compiler thinks the value of
the variable is still needed after the call. That keeps it
around on the stack or in a register so that the garbage
collector can see it as a root pointer.
Diffstat (limited to 'txr.c')
0 files changed, 0 insertions, 0 deletions