about summary refs log tree commit diff stats
path: root/112read-byte.subx
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-22 09:03:39 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-22 09:05:11 -0700
commitbd0410c9935174e48590c3eaa98e83464c7560a7 (patch)
tree619b127340dfc06adb5511462c6747d504e4382b /112read-byte.subx
parent4e70cac9984bf1731da052c1509ff16f0783c625 (diff)
downloadmu-bd0410c9935174e48590c3eaa98e83464c7560a7.tar.gz
snapshot
It took me _way_ too long to realize that I'm not checking for errors within
the loop, and that will cause it to manifest as an infinite loop as inner
evaluations fail to run.

Debugging notes, for posterity:
  printing one row of a chessboard pattern over fake screen (chessboard screen 4 0 0 15) gets stuck in an infinite loop halfway through
    debug pattern during infinite loop: VWEX. It's still in the loop but it's not executing the body
    raw (fill_rect screen 16 0 20 4 15) works fine
    same number of calls to fill_rect work fine
    replacing calls to fill_rect with pixel inside chessboard2 works fine
    at the point of the infinite loop it's repeatedly going through the hline loop
      -- BUT it never executes the check of the loop (< lo hi) with lo=20, hi=20. Something is returning 1, but it's not inside <
    stream optimization is not implicated

  simple test case with a single loop
    (
      (globals . (
        (foo . (fn () (screen i n)
                 (while (< i n)
                   (pixel screen 4 4 i)
                   (pixel screen 5 4 i)
                   (pixel screen 6 4 i)
                   (pixel screen 7 4 i)
                   (set i (+ i 1)))))
      ))
      (sandbox . (foo screen 0 100))
    )

  simpler (if you reset cursor position before every print):
    (
      (globals . (
        (foo . (fn () (screen i n)
                 (while (< i n)
                   (print screen i)
                   (set i (+ i 1)))))
      ))
      (sandbox . (foo screen 0 210))
    )

  I now believe it has nothing to do with the check. The check always works.
  Sometimes no body is evaluated. And so the set has no effect.
Diffstat (limited to '112read-byte.subx')
0 files changed, 0 insertions, 0 deletions
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196