Toy_VM and Toy_Stack are working and tested, read more

At this point, only a minimal number of operations are working, and
after running any kind of source code, the 'result' is simply left on
the VM's stack. Still, it's awesome to see it reach this point.
This commit is contained in:
2024-09-27 15:12:37 +10:00
parent 0504f4af8b
commit c518960171
11 changed files with 573 additions and 84 deletions

View File

@@ -40,7 +40,7 @@ void Toy_pushStack(Toy_Stack* stack, Toy_Value value) {
//expand the capacity if needed
if (stack->count + 1 > stack->capacity) {
int oldCapacity = stack->capacity;
stack->capacity = TOY_GROW_CAPACITY(stack->capacity);
stack->capacity = stack->capacity < MIN_SIZE ? MIN_SIZE : stack->capacity * 2; //similar to TOY_GROW_CAPACITY, with a bigger initial size
stack->ptr = TOY_GROW_ARRAY(Toy_Value, stack->ptr, oldCapacity, stack->capacity);
}