Closed btzy closed 4 years ago
Steps to reproduce:
EXTEND()
M[CALL]
display(A, "env ext count:"); display(N, "OS size:");
Test case
initialize_machine(448); P = parse_and_compile(" \ function recurse(x, y, operation, initvalue) { \ return y === 0 \ ? initvalue \ : operation(x, recurse(x, y - 1, \ operation, initvalue)); \ } \ \ function f(x, z) { return x * z; } \ recurse(2, 2, f, 1); "); //print_program(P); run();
Actual output
Running VM with heap size: 448 env ext count: 5 OS size: 5 env ext count: 17 OS size: 7 env ext count: 17 OS size: 7 env ext count: 17 OS size: 7 env ext count: 17 OS size: 2 Flip! FREE: 220 env ext count: 314 OS size: 2 result: heap node of type = number, value = 4 "" undefined
Expected The env ext count in the output above should be much less than 314.
env ext count
The EXTEND macro expects the old environment (environment to be extended) in Register A. So 314 is the address of an environment.
Steps to reproduce:
EXTEND()
inM[CALL]
(line 1384 on GitHub / line 1379 in Source Academy):Test case
Actual output
Expected The
env ext count
in the output above should be much less than 314.