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] [QuickJS] Glitches and crashes #2268

Closed
scambier opened this issue Aug 19, 2023 · 6 comments
Closed

[Bug] [QuickJS] Glitches and crashes #2268

scambier opened this issue Aug 19, 2023 · 6 comments
Assignees

Comments

@scambier
Copy link

scambier commented Aug 19, 2023

I'm having several issues with JavaScript, maybe all related to 1bpp sprites:

  1. I draw 1bpp sprites that are supposed to have an opaque background, but are now transparent

image

  1. font() sometimes doesn't work correctly in html exports

In-editor:
image

HTML export:
image

  1. With the same HTML export, I have a crash at runtime with "memory access out of bounds".

Uncaught RuntimeError: memory access out of bounds
at tic80.wasm:0x8051
at tic80.wasm:0x2b2cba
at tic80.wasm:0xd8769
at tic80.wasm:0x1b26cc
at tic80.wasm:0x8926
at tic80.wasm:0x320d7
at tic80.wasm:0x64a0d
at tic80.wasm:0x29b47d
at tic80.wasm:0x2b6fe8
at tic80.wasm:0x2143f


I'm pretty sure those issues can be linked to QuickJS and 1bpp usage :/

Sorry I don't have much more details to give, due to the time it would take to update the code, export, and re-test. I also think TIC-80 would greatly benefit from an extensive suite of tests carts written in all supported languages.

@nesbox nesbox self-assigned this Aug 24, 2023
@nesbox
Copy link
Owner

nesbox commented Aug 24, 2023

@scambier could you pls provide the cart and we will try to reproduce it?

@scambier
Copy link
Author

👍 I'll make you a minimal reproducible cart (or at least remove as much noise as possible) asap

@nesbox
Copy link
Owner

nesbox commented Aug 24, 2023

thank you, waiting...

@scambier
Copy link
Author

scambier commented Aug 24, 2023

I tried to get a minimal cart for the following glitch:
image

And, there's probably something that goes very wrong during the wasm compilation, as the glitch was seemingly randomly disappearing when removing unrelated and unused classes and functions.

I managed to make 2 carts, one that works and another that doesn't, with a minimal diff. I hope it will be enough, as there's still a lot of useless code.

quickjs_not_glitchy.zip
quickjs_glitchy.zip
Each zip contains the original .js cart, and the exported html files

If you check the diff of both carts, you'll notice that the only difference is the presence of an unused class EventBus at line 1945. This class isn't called or referenced anywhere, but when I remove it, the glitch disappears.

A few other tests I tried:

  • If instead I remove the class BinaryHeap, the glitch also disappears
  • If instead I remove both classes Path and Astar, the glitch persists

So huh, good luck I guess 😅

@nesbox
Copy link
Owner

nesbox commented Aug 25, 2023

I can reproduce it on my local build and it looks even worse
image

@nesbox
Copy link
Owner

nesbox commented Aug 25, 2023

Fixed here 7ea81e2

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

No branches or pull requests

2 participants