summaryrefslogtreecommitdiffstats
path: root/vm.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-06-21 06:29:32 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-06-21 06:29:32 -0700
commit1439785d5659936d0c22273a85a7c6594429649f (patch)
tree745ea327d90de07412432d16864c813cec3c8488 /vm.h
parent793a8bd3995c0ecc272e7dce16c9d7c6ec85e9bb (diff)
downloadtxr-1439785d5659936d0c22273a85a7c6594429649f.tar.gz
txr-1439785d5659936d0c22273a85a7c6594429649f.tar.bz2
txr-1439785d5659936d0c22273a85a7c6594429649f.zip
vm: release cached bindings that become unbound.
When a function binding is removed using fmakunbound, virtual machine descriptions hang on to the previously cached binding in the ftab. When the symbol is newly bound, virtual machine descriptions keep pointing to the old function. To solve this, we put the vm_desc structures into a global list and provide a function that fmakunbound calls to scrub all the VM descriptors of that binding. * eval.c (makunbound, fmakunbound): Call new vm_invalidate_binding function. * vm.c (struct vm_desc_links): New structure. (struct vm_desc): New member lnk, with links. (vmd_list): New static variable: circular list of all VM descriptors. (vm_make_desc): Insert new VM descriptor into list. (vm_desc_destroy): Remove VM descriptor from list. (vm_invalidate_binding): New function. * vm.h (vm_invalidate_binding): Declared.
Diffstat (limited to 'vm.h')
-rw-r--r--vm.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/vm.h b/vm.h
index da2fab08..30720d0d 100644
--- a/vm.h
+++ b/vm.h
@@ -31,4 +31,5 @@ val vm_make_desc(val nlevels, val nregs, val bytecode,
val datavec, val funvec);
val vm_execute_toplevel(val desc);
val vm_execute_closure(val fun, struct args *);
+void vm_invalidate_binding(val sym);
void vm_init(void);