vms: raise the step cap from 5M to 20M
5 million steps was picked when the worst macro (clb_add_ip with B=2047) sat just under a million, so it caught hangs quickly. The interactive programs changed the arithmetic: one printed line of the desk calculator costs about 225k steps (40k for clb_undigits, up to 32k for the operation, ~141k for clb_digits), which is only about twenty lines before the cap, and examples_test applies the same cap to every example. At roughly 2.3e8 steps per second a 20M cap costs 0.09 s when a program really does run away, and byte_op_test (the only place that runs 465k programs) is unchanged -- so the safety net stays cheap while a session gets four times the room. docs/calc.md, docs/divmod.md, docs/byte-ops.md and SPEC's "500 ?" mentions now say 2000 ?.
This commit is contained in:
1 parent
b83f3b1b06
commit
b2ba20b885
8 files changed
+16
-16
No files matched your search
+3
-3
@@ -84,7 +84,7 @@ raw_add A B Ci S Co tmp ; S = A + B,Co = 进位,A、B 保留
|
||||
while B != 0: A += 1 ; B -= 1
|
||||
|
||||
循环体在纸带里只出现一次,长度与 B 的大小无关;代价是运行 O(B)(B=255 时约 30 万步,
|
||||
上限 500 万)。`clb_nonzero B F T` 负责"B != 0"的判断(`biz` 只测最低位,得把 W 位都看
|
||||
上限 2000 万)。`clb_nonzero B F T` 负责"B != 0"的判断(`biz` 只测最低位,得把 W 位都看
|
||||
一遍、还不能把 B 吃掉):每位搬进工作位 T、若 T 是 1 就把 F **置一**并还原 B 的那一位。
|
||||
|
||||
**注意是 `set_1` 不是 `flb`** —— 这里踩过:`flb` 是翻转,偶数个 1 位会把标志翻回 0
|
||||
@@ -103,11 +103,11 @@ raw_add A B Ci S Co tmp ; S = A + B,Co = 进位,A、B 保留
|
||||
|
||||
**3977 字符、10 个 cell**,轮数 = 位宽、跟两个操作数的值都无关(11 位下封顶 26123 步)。
|
||||
旧的重复加法轮数 = `MUL` 的值,代价随乘数线性长大:`255 × 255` 是 73 万步,
|
||||
`2047 × 2047` 直接撞 500 万步上限(`HANG after 5000000 steps`)。
|
||||
`2047 × 2047` 直接撞 2000 万步上限(`HANG after 5000000 steps`)。
|
||||
|
||||
**设计上的教训**:上一轮把移位-加法否掉了,理由是「重复加法更短」。实测反了 ——
|
||||
移位-加法不但短 1000 字符(5007 → 3977),步数还少一到两个数量级,只有小乘数(0/1)
|
||||
比旧版慢一点点。先看目标函数再选算法没错,但目标函数里得把「运行步数有 500 万上限」
|
||||
比旧版慢一点点。先看目标函数再选算法没错,但目标函数里得把「运行步数有 2000 万上限」
|
||||
这一条写进去。
|
||||
|
||||
拼法上踩过两个坑(细节在 `asm/mul.r8asm` 注释里):跨格移位要按"低位那对先搬",
|
||||
|
||||
Reference in new issue
Block a user