diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-03-19 21:57:53 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-03-19 21:57:53 -0700 |
commit | fa4fda0e8af76ca3cdf435c0aa186210a4e18d03 (patch) | |
tree | f121fdd0e7ba3f11ec815c57a5ef3b69d5dc63d3 /vm.c | |
parent | 9bd2a1da83da21a8dea916d1916386058340ea33 (diff) | |
download | txr-fa4fda0e8af76ca3cdf435c0aa186210a4e18d03.tar.gz txr-fa4fda0e8af76ca3cdf435c0aa186210a4e18d03.tar.bz2 txr-fa4fda0e8af76ca3cdf435c0aa186210a4e18d03.zip |
vm: bug: vm-desc created with incorrect display depth.
* share/txr/stdlib/compiler.tl (sys:env :postinit): The call
to register the environment with the compiler must be outside
of the unless form. Otherwise it never takes place, and so the
compiler doesn't find the maximum number of environment
levels, keeping the value at 2. The executing vm then accesses
out of bounds memory when setting up display frames.
(usr:compile-toplevel): Give the root environment the
compiler. Not strictly necessary since we are constent in
doing this elsewhere, so we are not relying on inheritance
of the compiler from parent environment to child.
* vm.c (vm_make_closure): assert added for the environment
levels of the closure not exceeding the display depth given
in the machine description. This was added during debugging
and going off; I'm keeping it.
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -219,6 +219,8 @@ static val vm_make_closure(struct vm *vm, int frsz) vc->vd = vm->vd; vc->dspl = dspl; + assert (vc->nlvl <= vm->nlvl); + closure = cobj(coerce(mem_t *, vc), vm_closure_s, &vm_closure_ops); for (i = 2; i < vc->nlvl; i++) { |