v4 effect.c: stack effects derived from code (ADR step 3, task 2)
Walks a word's code, opcode by opcode with the engine's own counts, and gives what it takes and leaves on both stacks, or why it has none. Called and in-line words; recursion, computed jumps, paths that meet at different depths and loops that leave a count have none. Test first: 23 checks failed against a stub. SWAP', UM/MOD, C@, C! and ROUNDTRIP agree with their stack comments. On the nucleus: 214 of 315 headers fixed. v4 test, test-32 and ASan+UBSan pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
make: Entering directory '/home/user/LithosAnanke/v4'
|
||||
[V4_CELL_BITS=64 run-64-test_effect.c]
|
||||
v4 stack effects: V4_CELL_BITS=64
|
||||
34 checks, 0 failures
|
||||
[V4_CELL_BITS=32 run-32-test_effect.c]
|
||||
v4 stack effects: V4_CELL_BITS=32
|
||||
34 checks, 0 failures
|
||||
make: Leaving directory '/home/user/LithosAnanke/v4'
|
||||
@@ -0,0 +1,52 @@
|
||||
make: Entering directory '/home/user/LithosAnanke/v4'
|
||||
[V4_CELL_BITS=64 run-64-test_effect.c]
|
||||
v4 stack effects: V4_CELL_BITS=64
|
||||
D: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:119: dup: 1 -> 2
|
||||
X: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:120: drop: 1 -> 0
|
||||
K: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:121: a literal: 0 -> 1
|
||||
P: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:122: +: 2 -> 1
|
||||
O: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:123: over: 2 -> 3
|
||||
V: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:124: 2* inv: 1 -> 1
|
||||
S: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:125: a! @ !: 2 -> 0
|
||||
T: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:126: push and pop of its own: 1 -> 1, return stack 0 -> 0
|
||||
B: no fixed effect at 17: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:129: a call applies the callee's effect
|
||||
J: no fixed effect at 17: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:130: a jump to a word goes on there
|
||||
A: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:131: a word with no ; runs on into the next
|
||||
G: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:136: two paths that agree: if looks at T
|
||||
F: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:139: FOR ... NEXT that keeps the stacks: fixed
|
||||
U: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:141: FOR ... UNEXT: fixed
|
||||
PU: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:149: push in line: data 1 -> 0, return stack 0 -> 1
|
||||
PO: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:150: pop in line: data 0 -> 1, return stack 1 -> 0
|
||||
PL: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:151: + in line: as called
|
||||
XC: no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:155: a call outside the code: the effect it is given
|
||||
SWAP': no fixed effect at 16: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:159: SWAP' ( a b -- b a )
|
||||
UM/MOD: no fixed effect at 18: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:160: UM/MOD ( ulo uhi ud -- urem uquot )
|
||||
C@: no fixed effect at 44: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:161: C@ ( baddr -- c )
|
||||
C!: no fixed effect at 65: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:162: C! ( c baddr -- )
|
||||
ROUNDTRIP: no fixed effect at 92: not derived yet
|
||||
FAIL /home/user/LithosAnanke/v4/tests/test_effect.c:163: ROUNDTRIP ( c baddr -- c' )
|
||||
33 checks, 23 failures
|
||||
make: *** [Makefile:358: run-64-test_effect.c] Error 1
|
||||
make: Leaving directory '/home/user/LithosAnanke/v4'
|
||||
@@ -0,0 +1,7 @@
|
||||
The nucleus's dictionary, analysed by effect.c (a one-off measurement; the program is not kept).
|
||||
Each header's word, in line if its flag 8 is set, else as called; 64-bit cells.
|
||||
headers 315 (in line 65): fixed 214, none 101
|
||||
78 it calls a word with no fixed effect
|
||||
4 it touches its caller's return address
|
||||
8 two returns leave different depths
|
||||
11 ; to an address of its own: a computed jump
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user