Closed ZornsLemma closed 6 years ago
Many thanks, Steve. You are absolutely correct! This is what I get for editing code while watching Game of Thrones. It actually ran on the portable VM, but obviously the stack pointer is off. Thank heavens there are people like you to catch my blunders. I'm going to add some stack pointer tests in the portable VM because of this.
Dave...
Test cases fixed. Now for all the other modules...
Hi Dave,
I see you've been eating your vegetables/adding some # return value counts to the standard library. :-) Thanks, this is good stuff and will have a nice effect on code size in general I'm sure.
I've been porting these changes to my repository and I might have found a problem, but I'm not sure. I noticed this because I have some experimental ESTK under/overflow checking in my version of the VM, but I think I can illustrate the problem at the bytecode level.
Looking at the compiled version samplesrc/test.a, the line 'print:newln()' appear to be compiled as:
You can see there's a DROP after the ICAL; I think this is because there's no #0 on that 'print:newln()' line. inc/testlib.plh declares print to have 0 return values ('word print(s)#0') but I am not sure that actually has any effect. However, none of the puti/puth/putln/puts/putc functions in the print[] array actually return a value any more, so the DROP will remove a value when none was left on the stack by the called function.
Does this make sense or have I lost the plot?
I think the same problem affects three lines, as shown in this diff:
Cheers.
Steve