libera/#clasp - IRC Chatlog
Search
0:03:20
karlosz
drmeister: like Bike said, we do sort of want stack pointers in the VM instead of indices to keep things fast. for dynamically allocated stacks we could just create a new one twice as big and copy the whole thing and just updating the stack and frame pointer in the vm struct
0:04:25
drmeister
The side stack should be keeping things alive - I set the whole thing as a source of roots.
0:05:09
drmeister
It looks like we are writing garbage into the boehm memory. I see a tagged pointer being written into boehm memory.
0:07:24
drmeister
I'm using posix_memalign( &mem, pageSize, VirtualMachine::MaxStackWords*sizeof(T_O**) ); to allocate it
0:07:45
drmeister
And gctools::clasp_gc_registerRoots((this->_stackBottom),(this->_stackBytes-pageSize)/sizeof(T_O*)); to register the whole thing as a source of roots.
0:08:11
drmeister
I can't currently limit it just to the live stack. That's why I recommended that we stick NULL in each word as we pop words.
0:09:24
drmeister
Actually, there might be a way to limit what part of the side-stack is live. There are ways of making boehm just check a range of memory - but the last time I tried to use it it crashed.
0:09:59
karlosz
yeah... i guess that might potentially cause problems. i had thought that that would just mean keeping objects live at worst
0:10:04
drmeister
I think we need to add more checking to the VM. Check if writing to pointers are all aligned.
0:10:40
karlosz
but i suppose boehm won't like it if an object in the dead part of the stack gets overwritten by something else
0:19:33
karlosz
just fixed jump-if-supplied for variable length labels so lambda lists should work again
0:49:31
drmeister
I don't think garbage on the side-stack will hurt anything. Boehm is very, very tolerant
0:52:20
drmeister
I think it's more likely that we are writing into a tagged pointer or a tagged pointer when we should be writing an untagged one.
2:10:11
Bike
for the exit stuff i made a tiny little new structure VirtualMachineStackState that includes the frame pointer, and ENTRY uses it to restore the stack pointer after a nonlocal exit
2:10:29
Bike
could it like... get reclaimed wrongly by boehm somehow... i guess not, since fib doesn't even do nonlocal exits
2:15:38
Bike
maybe there's a size_t overflowing into a stupid high number, and that's ending up in push_frame or something
2:41:25
drmeister
I do say this though: static constexpr size_t MaxStackWords = 16384; // 16K words for now.
3:41:03
drmeister
I evaluate (fib 33) and print the stack for every instruction and there's no problem.
4:16:32
drmeister
I evaluate (fib 33) and the stack stays at 1000 bytes or so all the way except at the end it balloons.
5:28:33
drmeister
::notify Bike There is something deeply wrong. When I evaluate (fib 31) the evaluation goes off the rails at some point. So I'm trying to compile the following but the compiler isn't ready for it yet. I want to ID where it goes off the rails and then get udb in there to figure it out.
5:28:35
drmeister
(setf (fdefinition 'fib) (compile-to-vm::bcompile '(lambda (n cn) (setf (car cn) (+ (car cn) 1)) (format t "cn ~a~%" (car cn)) (if (eql n 1) 0 (if (eql n 2) 1 (+ (fib (- n 1) cn) (fib (- n 2) cn)))))))
9:23:38
karlosz
Bike, drmeister: i just implemented cell elision so now we don't make any unnecessary cells and no longer cons for stuff like fib. its pretty much as optimal as we can get for 1 pass at least (though the fixup logic may not be so good asymptotically speaking at the moment)
9:24:00
karlosz
also Bike i changed the order of CELL-SET's arguments in order to facilitate this, so the c++ vm will need to be modified.