Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes for dsl2ml #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Bug fixes for dsl2ml #1

wants to merge 2 commits into from

Conversation

joshtch
Copy link

@joshtch joshtch commented Jun 15, 2019

I tracked down the reason why FDQ in Firefox doesn't work in certain cases where it does in Chrome, such as for puzzles 2 and 3 in the sudoku example. The reason was a bug in the ArrayBufferTransferPoly polyfill in dsl2ml.js, which in certain cases clobbers data in Firefox.

The first commit fixes that issue by copy & pasting the fixed implementation from the same place you copied the original. It looks like someone else noticed the bug in the MDN implementation and published the fix sometime after you grabbed it.

While I was debugging that issue, I noticed compileJump doesn't need to call grow here when the jump doesn't go past the end of mlBuffer. And in fact, this compileJump invocation (and supporting comments) doesn't(/don't) make sense if compileJump always allocates more memory unconditionally, as it currently does.

The second commit adds a check before compileJump calls grow so it only calls grow when necessary (and when it does call grow, it only over-provisions by 10%, instead of 100% like it does now).

The original polyfill had a bug that made the transfer happen
incorrectly in Firefox under certain circumstances. This is the
corrected polyfill.
@joshtch joshtch changed the title Bug fixes for mlBuffer allocations Bug fixes for FDP.js Jun 18, 2019
@joshtch
Copy link
Author

joshtch commented Jun 18, 2019

I added another commit, which fixes FDP so it correctly handles the case where FDO is given a value for max, and outputs an array of solutions instead of a single solution. FDP currently just ignores the solver output and outputs the domains it computed before calling the solver. The third commit fixes that by mapping createSolutions over the array of solutions.

Actually, I'll make this a separate PR.

@joshtch joshtch changed the title Bug fixes for FDP.js Bug fixes for FDP.js & dsl2ml.js Jun 18, 2019
This can avoid an unnecessary allocation, since grow() unconditionally
grows the buffer, and we don't need it to if the current buffer is
already big enough for the jump.

This is particularly relevant when freeDirective < 0, when the point of
the jump is just to skip the remaining free space. The extra space that
gets allocated in compileJump then gets immediately sliced out anyway,
so you get the same end result after doing a lot more work.
@joshtch joshtch changed the title Bug fixes for FDP.js & dsl2ml.js Bug fixes for dsl2ml Jun 18, 2019
@joshtch
Copy link
Author

joshtch commented Jun 18, 2019

Moved fix to separate PR: #2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant