rrthomas / mit

A simple stack-based VM
Other
10 stars 3 forks source link

Why does `mit -O` fall back so often? #315

Closed apt1002 closed 4 years ago

apt1002 commented 4 years ago

In version 49508aabbf I tried printing out ir whenever control flow reaches A_FALLBACK. Pre-guessing is enabled; all possible singleton labels were included; reject set was disabled. I ran make-base.fs and it made a 12M line file. In addition to the expected fallback cases (HALT, I/O) we are seeing large numbers of lines with the following ir values:

It's possible that the DUP has an argument > 3 which is therefore not handled by the specialized interpreter, but I can't see any reason why NOT NEGATE should not be executed.

apt1002 commented 4 years ago

We have rebased and cherry-picked the commit, such that it has become orphaned. We should give it a tag so that we don't lose it and so that other people can check it out.

rrthomas commented 4 years ago

Tagged mit-O-fallback-315.

apt1002 commented 4 years ago

Check again and then close.

apt1002 commented 4 years ago

The latest master, we observe 7.2M fallbacks for "4 DUP", and exactly one for "5 DUP". All the others are traps and extra instructions, as expected.

rrthomas commented 4 years ago

Looking at the root state (guesses made with an empty path), there are large numbers of correct guesses, but these are dwarfed by the much larger number made in other states.