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

[ports] upgrade SDL to 2.28.4 #20417

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

ericoporto
Copy link
Contributor

@ericoporto ericoporto commented Oct 8, 2023

This is just to update the SDL2 port, last time it was a long time in #18026 .

There are only two files added from what I can tell, events/SDL_keysym_to_scancode.c and events/SDL_scancode_tables.c, and no files removed, when comparing with the previous 2.24.2.

The removed TODO has been done in a PR on SDL2 by @sbc100 , and the commit is included from 2.28.4 and forward.

@ericoporto ericoporto changed the title Ports: upgrade SDL to 2.28.4 [ports] upgrade SDL to 2.28.4 Oct 8, 2023
@ericoporto ericoporto force-pushed the upgrade-sdl-2.28.4 branch 3 times, most recently from e85e920 to ff25ff5 Compare October 8, 2023 23:42
@ericoporto ericoporto marked this pull request as draft October 9, 2023 17:17
@sbc100
Copy link
Collaborator

sbc100 commented Oct 10, 2023

That is odd.. normally the circleci job run on the emscripten account when you send us a PR...

@ericoporto
Copy link
Contributor Author

ericoporto commented Oct 10, 2023

@sbc100 I don't know why it happens with me, but it happened the other time too, and when it happens the build-linux and test-mac-arm64 can't run because they use paid features. :/

Btw, I deleted my Emscripten fork and recreated, and the circle CI project too, before making this PR. (I thought this would make it work this time)

I also see a message "This branch is out-of-date with the base branch", but this is fairly isolated, just let me know if there's a need to rebase any time and I will adjust.

@ericoporto
Copy link
Contributor Author

Hey, it would be great to have this before we get to 3.1.48 release :)

@sbc100
Copy link
Collaborator

sbc100 commented Oct 18, 2023

I think the only thing missing is the CI.

Can you try delete the emscripten project from your personal circleci account and then rebasing this PR to trigger a re-run?

@sbc100
Copy link
Collaborator

sbc100 commented Oct 19, 2023

the browser test failure here look real. e.g. : test_sdl2_pumpevents

@ericoporto
Copy link
Contributor Author

Hi @sbc100 , turns out I can't recall how to use my fork locally, so I can actually try the tests (I thought I did, but turns out I was running the main from here and didn't pay attention). I opened an issue to document this emscripten-core/emsdk#1291

@ericoporto
Copy link
Contributor Author

I noticed a few sdl2 really old headers floating around

This header taken from SDL2

Doing a git grep will find more. Are these a typo or are these used in any way here?

@sbc100
Copy link
Collaborator

sbc100 commented Feb 21, 2024

I noticed a few sdl2 really old headers floating around

This header taken from SDL2

The headers in that directory are for SDL1, not SDL2. They should not effect the SDL2 port at all (I hope).

@sbc100
Copy link
Collaborator

sbc100 commented Feb 21, 2024

There has been some recent progress here. Last week I landed #21337 which updated SDL2 port to 2.26.0. As part of that I fixed a few issues related to scancodes and keycodes.

I have another PR up to bump the version further but its not currently passing all tests #20268. If you have time to continue working on this that would be most welcome. Otherwise I will probably pick up that change next week some time.

@ericoporto ericoporto force-pushed the upgrade-sdl-2.28.4 branch 3 times, most recently from 8b239f5 to d467342 Compare February 24, 2024 16:54
@ericoporto
Copy link
Contributor Author

Hey @sbc100 , all tests passed :)

@sbc100
Copy link
Collaborator

sbc100 commented Feb 24, 2024

When I was working on #20268 I noticed that some of the sdl audio or sdl mixer tests were failing locally for me. The audio tests don't run as part of the CI sadly so you have to run them locally. Can you try running them?

@ericoporto
Copy link
Contributor Author

ericoporto commented Feb 24, 2024

I can't, I still can't figure how to run my Emscripten fork with my own cloned Emsdk. The emsdk install will put a upstream/emscripten dir that contains something that was unzipped, and that is not a repository and it can't be checked as described here. Also it appears it requires to be able to build llvm from source (???).

I still find it weird that I can't just symlink and run something local instead of having to push things to a git repository somewhere...

@sbc100
Copy link
Collaborator

sbc100 commented Feb 24, 2024

I can't, I still can't figure how to run my Emscripten fork with my own cloned Emsdk.

The simplest way to do this is to export EM_CONFIG=/path/to/emsdk/.emscripten and then just run ./emcc to ./test/runner from your emscripten chekcout.

This will cause your emscripten checkout to use all the prebuilt tools from emsdk.

We should really document this better. I thought it was...

@sbc100
Copy link
Collaborator

sbc100 commented Feb 24, 2024

@ericoporto
Copy link
Contributor Author

ericoporto commented Feb 24, 2024

I am sorry, but I didn't fork the emsdk, I forked emscripten... Is this a typo in ALL the docs? When it writes

export EM_CONFIG=/path/to/emsdk/.emscripten

THIS REALLY should be export EM_CONFIG=/path/to/emscripten/.emscripten ??

Uhm. It appears it is, but then I get and error.

runner: error: BINARYEN_ROOT is set to empty value in C:\Users\user\git\ericoporto\emscripten\.emscripten

In the .emscripten file I see a part where it's like so

...
EMSCRIPTEN_ROOT = 'C:\\Users\\user\\git\\ericoporto\\emscripten' # directory

LLVM_ROOT = '/usr/bin' # directory
BINARYEN_ROOT = '' # directory
...

Retrying using the below with the env var set.

./emsdk install latest-upstream
./emsdk activate latest-upstream

well... Nope, still empty...

just run ./emcc to ./test/runner

both the left command and the right command will fail because binaryen root is empty. I tried running through all the issues and just found emscripten-core/emsdk#418 where reading the second comment feels like https://xkcd.com/979/ .

Well apparently after rebasing now something failed?? It was just one commit difference in the rebase...

@sbc100
Copy link
Collaborator

sbc100 commented Feb 25, 2024

Right, when you fork emscripten you can use the emsdk config file to easily get access the binaryen and llvm from emsdk while still using your fork of emscripten (that can be anywhere in the filesystem).

So export EM_CONFIG=/path/to/emsdk/.emscripten is correct. That is the file that emsdk creates when you run ./emsdk activate.

If you use the emsdk config file you don't need a .emscripten file in your emscripten checkout at all.

Then you can run tests in your emscripten checkout such as ./test/runner browser.test_sdl2_image. You can also use wildcards such as ./test/runner browser.test_sdl2_*.

@sbc100
Copy link
Collaborator

sbc100 commented Feb 25, 2024

That test failure looks like a flake. I re-ran it.

@ericoporto
Copy link
Contributor Author

So export EM_CONFIG=/path/to/emsdk/.emscripten is correct.

I don't understand this, why my emsdk needs an environment variable to find a file in it's own path?

Anyway, this means the truth is I should edit something in the file .emscripten where I cloned emsdk repo to point to where I cloned emscripten repo? Can you tell me what is the variable in this file that requires such value?

@sbc100
Copy link
Collaborator

sbc100 commented Feb 25, 2024

So export EM_CONFIG=/path/to/emsdk/.emscripten is correct.

I don't understand this, why my emsdk needs an environment variable to find a file in it's own path?

The purpose of the EM_CONFIG environment variable is to tell your fork of emscripten to use the emsdk-generated config file.

If you use emsdk normally you don't need to do this.

By setting this environment variable you are saying "no matter which version of emscripen I use, always use llvm and binaryen from emsdk".

Anyway, this means the truth is I should edit something in the file .emscripten where I cloned emsdk repo to point to where I cloned emscripten repo? Can you tell me what is the variable in this file that requires such value?

emsdk is in charge or creating its own config file. It does this when you run the activate command. You should never need to edit this.

Neither emsdk not its config file need to know how many different copies of emscripten your have or where they live.

You can just use your cloned copy of emscripten directly via ./emcc or via ./test/runner.py. When you run those commands with ./ (or the full path to them) they will (as you would imagine) run the the local version emscripten.. but when they need to use tools like LLVM they will look in the config file (which you specified by setting EM_CONFIG).

You can also put your cloned copy of emscripten first in your PATH if you want to have it run when you type just emcc (without the pathname). I tend not to do this myself and instead just run ./emcc or ./test/runner.py. This avoids having to worry about what is in PATH.

Apologies if this is non-intuitive. I've tried to make it better over time but perhaps there are more ways was can improve this. In any case this setup works well once you understand what is going on (I think).

@ericoporto
Copy link
Contributor Author

ericoporto commented Feb 25, 2024

ok, I think I understood now and did the following. First navigate to emsdk directory where I cloned it.

./emsdk install latest
./emsdk activate latest

Now I just go where I cloned emscripten using cd ../emscripten

export EM_CONFIG=../emsdk/.emscripten
./test/runner browser.test_sdl2_*

Now I finally get a different error

$ ./test/runner browser.test_sdl2_*
Test suites:
['test_browser']
Running test_browser: (48 tests)
(checking sanity from test runner)
shared:INFO: old sanity: 3.1.25-git|C:/Users/user/git/ericoporto/ags/Emscripten/emscripten/emsdk/upstream/bin|16.0|0x79932be2
shared:INFO: new sanity: 3.1.55-git|../emsdk/upstream/bin
shared:INFO: (Emscripten: config changed, clearing cache)
shared:INFO: (Emscripten: Running sanity checks)
[Browser harness server on process 15252]
common:INFO: No EMTEST_BROWSER set. Defaulting to `google-chrome`
common:INFO: Launching browser: ['google-chrome']
ERROR

======================================================================
ERROR: setUpClass (test_browser.browser)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\user\git\ericoporto\emscripten\test\test_browser.py", line 211, in setUpClass
    super().setUpClass()
  File "C:\Users\user\git\ericoporto\emscripten\test\common.py", line 1955, in setUpClass
    cls.browser_open(cls.harness_url)
  File "C:\Users\user\git\ericoporto\emscripten\test\common.py", line 1940, in browser_open
    cls.browser_proc = subprocess.Popen(browser_args + [url])
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

I do have google-chrome, and firefox, and microsoft edge installed.

I got an error when I tried to set my google chrome location, but also I can't tell if it understood where chrome was from the log - note the argument broken for whatever reason there. It did launch a tab with http://localhost:8888/run_harness but it stopped.

 EMTEST_BROWSER="/c/Program Files/Google/Chrome/Application/chrome.exe" ./test/runner browser.test_sdl2_*
Test suites:
['test_browser']
Running test_browser: (48 tests)
(checking sanity from test runner)
shared:INFO: (Emscripten: Running sanity checks)
[Browser harness server on process 15272]
common:INFO: Launching browser: ['C:/Program', 'Files/Google/Chrome/Application/chrome.exe']

Running the browser tests. Make sure the browser allows popups from localhost.

test_sdl2_canvas_blank (test_browser.browser) ... emcc: warning: config file not found: ../emsdk/.emscripten.  You can create one by hand or run `emcc --generate-config`
emcc: error: LLVM_ROOT not set in config (../emsdk/.emscripten), and `clang` not found in PATH

Using EMTEST_BROWSER='"/c/Program Files/Google/Chrome/Application/chrome.exe"' cause it to not find google chrome instead...

@ericoporto
Copy link
Contributor Author

ericoporto commented Feb 25, 2024

Ok, it appears the problem is everything here doesn't support using BASH in MSYS2 shell. I switched to using cmd.exe instead. Now all tests failed, it appears is some problem with npm packages?

https://gist.github.com/ericoporto/6ac10f72f8787439cde0c4482d8b5e84

Running .\bootstrap.... Ok, it appears it's working now.

@sbc100 I reproduced!!!

https://gist.github.com/ericoporto/437749961e72a477a6fb87643bb33162

The last test called test_sdl2_mixer_music_mod just stops working in the middle and doesn't produce any sound. Also the test_sdl2_mixer_music_mp3 doesn't work either. I can't find a file that has such name, not so sure what code is the test runner running exactly...

@sbc100
Copy link
Collaborator

sbc100 commented Feb 25, 2024

Great news that you got it working.

It would be good to know if these tests failures you are seeing are new or pre-existing. I suspect they are new since that is what I was seeing in my other PR but it would be good to verify that they work against main.

For tests that don't correspond to a specific filename just look for the test name in test_browser.py to see what it does. See

def test_sdl2_mixer_music(self, formats, flags, music_name):
shutil.copyfile(test_file('sounds', music_name), music_name)
args = [
'--preload-file', music_name,
'-DSOUND_PATH="%s"' % music_name,
'-DFLAGS=' + flags,
'-sUSE_SDL=2',
'-sUSE_SDL_MIXER=2',
'-sSDL2_MIXER_FORMATS=' + ','.join(formats),
]
# libmodplug is written in C++ so we need to link in C++
# libraries when using it.
if 'mod' in formats:
args += ['-lc++', '-lc++abi']
self.btest_exit('test_sdl2_mixer_music.c', args=args)

In this case this test has 4 different variants via @parameterize which give you the _wav, _ogg, _mp3 and _mod suffixes.

(Regarding windows + bash + msys2 .. its not suprising to me that stuff doesn't just work there/ (at least that has been our experience). Its pretty tricky to get right since you have to also worry about some folks using windows python and some folks using msys python. It gets really complicated really quickly, and we don't have any windows users on the core emscripten team sadly. So all that stuff with MSYS and cygwin is mostly best effort supported by users who use those environments).

@ericoporto
Copy link
Contributor Author

ericoporto commented Feb 25, 2024

The bash MSYS2 shell I use is the one that installs when you install git-bash in the git for Windows. I have python installed by running the installer (I am aware of the Windows Store python). My experience running this bash in Windows Terminal is that everything usually works.

Most of the problems in Emscripten is that the command line code is hand-rolled instead of using some standard command line handling like argparse and paths are not normalized with pathlib. This is usually simply a reflection of the machine of the developers that are mainly contributing to the repository and it's fine - probably people aren't using Windows machines and instead using macOS or Linux - or they learned to do it in Windows at some point but because they do it everyday there was no need to document. It's just there are lot of assumptions that the Windows user will be using cmd.exe, but at the same time the documentation is missing for it. Anyway, that's why I wrote every step I took so at least I can look into to reproduce it later for myself. :)

Anyway, I will take a look later more in depth to try to figure it out (today is Sunday!), my first approach will be just to cut the main.c test code to a new project and build this sdl2 release using Emscripten+CMake in CLion to verify that the issue is not something that works with sdl2 in upstream and doesn't here for some difference in the build process.

cd emsdk
.\emsdk install latest
.\emsdk activate latest
cd ..\emscripten
setx EM_CONFIG C:\Users\path\to\emsdk\.emscripten
set EM_CONFIG=C:\Users\path\to\emsdk\.emscripten
set EMTEST_BROWSER="C:\Program Files\Google\Chrome\Application\chrome.exe"

@ericoporto
Copy link
Contributor Author

ericoporto commented Feb 26, 2024

@sbc100 I figured! The problem is very erh, simple, if you click the black area in Emscripten, the sound plays and the test pass. I think it's just that the browser requires user input.

.\test\runner browser.test_sdl2_mixer_music_mp3
Test suites:
['test_browser']
Running test_browser: (1 tests)
(checking sanity from test runner)
shared:INFO: (Emscripten: Running sanity checks)
[Browser harness server on process 1468]
common:INFO: Launching browser: ['C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe']

Running the browser tests. Make sure the browser allows popups from localhost.

test_sdl2_mixer_music_mp3 (test_browser.browser) ... [unresponsive tests: 1]
common:INFO: Restarting browser process
common:INFO: Launching browser: ['C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe']
[test error (see below), automatically retrying]
Expected to find '/report_result?exit:0
' in '[no http server activity]
', diff:

--- expected
+++ actual
@@ -1 +1 @@
-/report_result?exit:0
+[no http server activity]


ok
[Browser harness server terminated]

----------------------------------------------------------------------
Ran 1 test in 71.359s

OK

Btw, this behavior is something I observed previous with the Emscripten OpenAL js implementation, it seems it magically works without clicking, but it requires clicking in macOS Safari before playing sound and on my iPhone, using Safari, I can't get sound from the Emscripten OpenAL js.

@ericoporto
Copy link
Contributor Author

OK, managed to reproduce with the current 2.26.0 in main. Here, the first run I accidentally clicked and then it run ok, lol.

.\test\runner browser.test_sdl2_mixer_music_mp3
Test suites:
['test_browser']
Running test_browser: (1 tests)
(checking sanity from test runner)
shared:INFO: (Emscripten: Running sanity checks)
[Browser harness server on process 20712]
common:INFO: Launching browser: ['C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe']

Running the browser tests. Make sure the browser allows popups from localhost.

test_sdl2_mixer_music_mp3 (test_browser.browser) ... ports:INFO: retrieving port: sdl2 from https://github.com/libsdl-org/SDL/archive/release-2.26.0.zip
ports:INFO: unpacking port: sdl2
cache:INFO: deleting cached file: C:\Users\user\git\ericoporto\emscripten\cache\sysroot\lib\wasm32-emscripten\libSDL2.a
cache:INFO: generating port: sysroot\lib\wasm32-emscripten\libSDL2.a... (this will be cached in "C:\Users\user\git\ericoporto\emscripten\cache\sysroot\lib\wasm32-emscripten\libSDL2.a" for subsequent builds)
system_libs:INFO: compiled 115 inputs in 4.59s
cache:INFO:  - ok
cache:INFO: generating system asset: symbol_lists/41d823f5b680041a7bf9eee4e174a9d89fa411fd.json... (this will be cached in "C:\Users\user\git\ericoporto\emscripten\cache\symbol_lists\41d823f5b680041a7bf9eee4e174a9d89fa411fd.json" for subsequent builds)
cache:INFO:  - ok
ok
[Browser harness server terminated]

----------------------------------------------------------------------
Ran 1 test in 40.254s

OK

But then, I reran and this time hold my mouse. Once it retries, then I click and managed to make the test pass.

.\test\runner browser.test_sdl2_mixer_music_mp3
Test suites:
['test_browser']
Running test_browser: (1 tests)
(checking sanity from test runner)
shared:INFO: (Emscripten: Running sanity checks)
[Browser harness server on process 14312]
common:INFO: Launching browser: ['C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe']

Running the browser tests. Make sure the browser allows popups from localhost.

test_sdl2_mixer_music_mp3 (test_browser.browser) ... [unresponsive tests: 1]
common:INFO: Restarting browser process
common:INFO: Launching browser: ['C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe']
[test error (see below), automatically retrying]
Expected to find '/report_result?exit:0
' in '[no http server activity]
', diff:

--- expected
+++ actual
@@ -1 +1 @@
-/report_result?exit:0
+[no http server activity]


ok
[Browser harness server terminated]

----------------------------------------------------------------------
Ran 1 test in 118.820s

OK

@sbc100
Copy link
Collaborator

sbc100 commented Feb 26, 2024

Do all test_sdl2_* test pass? I'm particularly interested in the ones that are tagged with @requires_sound_hardware which don't run in CI

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm assuming all the sound tests pass

@ericoporto
Copy link
Contributor Author

ericoporto commented Feb 26, 2024

Here are my logs for browser.test_sdl2_mixer_music_{mp3,mod,ogg,wavl}: https://gist.github.com/ericoporto/e02548f630f1142354021526e2173176

The standalong browser.test_sdl2_mixer_wav worked too

.\test\runner browser.test_sdl2_mixer_wav
Test suites:
['test_browser']
Running test_browser: (1 tests)
(checking sanity from test runner)
shared:INFO: (Emscripten: Running sanity checks)
[Browser harness server on process 20152]
common:INFO: Launching browser: ['C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe']

Running the browser tests. Make sure the browser allows popups from localhost.

test_sdl2_mixer_wav (test_browser.browser) ... ok
[Browser harness server terminated]

----------------------------------------------------------------------
Ran 1 test in 5.950s

OK

I also ran ok the browser.test_sdl_audio_beep_sleep (but I think this is sdl1?). This one you have to click the black rectangle right away or it fails.

.\test\runner browser.test_sdl_audio_beep_sleep
Test suites:
['test_browser']
Running test_browser: (1 tests)
(checking sanity from test runner)
shared:INFO: (Emscripten: Running sanity checks)
[Browser harness server on process 16240]
common:INFO: Launching browser: ['C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe']

Running the browser tests. Make sure the browser allows popups from localhost.

test_sdl_audio_beep_sleep (test_browser.browser) ... ok
[Browser harness server terminated]

----------------------------------------------------------------------
Ran 1 test in 57.522s

OK

I think these are all requires_sound_hardware.

You can try during the week too and see what you think, there is no rush.

@@ -1,12 +1,12 @@
# Copyright 2014 The Emscripten Authors. All rights reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you revert this line? (We don't update copyright years)

Copy link
Contributor Author

@ericoporto ericoporto Feb 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if it was something here too, so I had as a separate commit. I just dropped it!

Ah, if you guys ever want to upgrade, perhaps a script similar to this could be useful: https://github.com/adventuregamestudio/ags/blob/master/Script/push_codeheader.py

@sbc100 sbc100 merged commit b5b7fed into emscripten-core:main Feb 26, 2024
29 checks passed
@ericoporto ericoporto deleted the upgrade-sdl-2.28.4 branch February 26, 2024 04:03
sbc100 added a commit to sbc100/emscripten that referenced this pull request Mar 7, 2024
I think the recent SDL2 version bump must have fixed the issues we
were previously seeing.  See emscripten-core#21337 and emscripten-core#20417.
sbc100 added a commit to sbc100/emscripten that referenced this pull request Mar 7, 2024
I think the recent SDL2 version bump must have fixed the issues we
were previously seeing.  See emscripten-core#21337 and emscripten-core#20417.
sbc100 added a commit to sbc100/emscripten that referenced this pull request Mar 8, 2024
I think the recent SDL2 version bump must have fixed the issues we
were previously seeing.  See emscripten-core#21337 and emscripten-core#20417.
sbc100 added a commit to sbc100/emscripten that referenced this pull request Mar 8, 2024
I think the recent SDL2 version bump must have fixed the issues we
were previously seeing.  See emscripten-core#21337 and emscripten-core#20417.
sbc100 added a commit that referenced this pull request Mar 8, 2024
I think the recent SDL2 version bump must have fixed the issues we
were previously seeing.  See #21337 and #20417.
lewing pushed a commit to dotnet/emscripten that referenced this pull request Apr 12, 2024
* embind: Ensure embind works under c++11. (emscripten-core#21100)

We no longer need to test c++17 since that is the default used, but we
should ensure we maintain compatibility with c++11.

* Fix C++ function signatures in mimalloc (emscripten-core#21127)

The C++ functions that take `std::nothrow_t` all take a reference.
Without this change I'm seeing function signature mismatches because the
final argument is not pointer-width.  I'm guessing this simply went
unnoticed because most platforms don't do signature checking in the
linker and this just happens to work.

e.g.  `_ZnwjRKSt9nothrow_t` which demangles to `operator new(unsigned
int, std::nothrow_t const&)`

See upstream bug at microsoft/mimalloc#840.

* Bump github/codeql-action from 2.22.5 to 3.23.1 (emscripten-core#21134)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.22.5 to 3.23.1.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@74483a3...0b21cf2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [test] Pass filename explicitly to `compile_btest` helper. NFC (emscripten-core#21103)

This allows us to use `compiler_for` to determine whether to run
`EMCC` or `EMXX` appropriately.

* Remove some unnecessary complexity in `create_receiving`. NFC (emscripten-core#21131)

* Fix makeBlendState assert for non-existent nextInChain (emscripten-core#21119)

* Use single quotes in JS code where possible. NFC (emscripten-core#21133)

For some reason this actually saves on code size too.

* WebGPU: Fill out webgpu-externs.js (emscripten-core#21144)

Fixes test browser.test_webgpu_basic_rendering_closure by fixing
wgpuShaderModuleGetCompilationInfo (compilationInfo.messages.length).

Fixes: emscripten-core#20415

* Remove second argument to `ErrnoError`. NFC (emscripten-core#21136)

There was only one single place (out of hundreds) where this was set
and one single place in `doStat` where it was read.

I removed the `doStat` workaround by updating `mayLookup` instead.

* [Docs] Mention information that may exist in unoptimized builds (emscripten-core#21147)

Fixes emscripten-core#21084

* Convert test_stat_fail_alongtheway to a file based test (emscripten-core#21138)

Also remove the special logging and just use assert which fails
fast and gives a backtrace.

* Minor webidl binder fixes (emscripten-core#21152)

Split out from emscripten-core#21151.

The only semantic change here is the fix the type of second argument to
to the array member getter function (previously it was using
`m.type` which is the array type itself, but that second argument to the
setter function is actually the inner type `m.type.inner`.

This enables the type of this argument to be checked correctly, which in
turn required a minor fix to the test case.  This only effects
`IDL_CHECKS=all` builds.

* [ci] Pin firefix to dev-edition until the threading issue is resolved. NFC (emscripten-core#21164)

See emscripten-core#21163

* Bump expected LLVM version from 18 to 19. NFC (emscripten-core#21165)

* Add LLVM version bump to ChangeLog. NFC (emscripten-core#21166)

* Remove use of `demangleAll` helper function (emscripten-core#21156)

This was used to demangle C++ symbols JS stacktraces.  However for
a long time now native symbols in JS backtraces are already demanged
because names in the name section are in demangled form.  So this
function has not done anything for a very long time.

As a followup I think we can probably completely remove the
`DEMANGLE_SUPPORT` settings.

* Rebaseline codesize expectations. NFC

* Rebaseline codesize expectations. NFC

* Use JavaScript class for FS.ErrnoError. NFC (emscripten-core#21149)

* [wasm64] Update webidl to support wasm64 (emscripten-core#21151)

* Rebaseline codesize expectations. NFC

* Acorn optimizer: Allow top-level await expressions (emscripten-core#21117)

`-pthread` + `-sEXPORT_ES6` emits a top-level await expression
in the main worker file after commit 49ab23a. Ensure the Acorn
optimizer is aware of this.

* fix wgpu get dimension bug (emscripten-core#21173)

Co-authored-by: Jerry.Zhuang <[email protected]>

* Avoid unnecessary dependency on `SYSCALLS` object. NFC (emscripten-core#21170)

I noticed that `proc_exit` was depending on `SYSCALLS` even though
it wasn't actually using `SYSCALLS`.

* embind: Fix method pointers for AOT JS generation. (emscripten-core#21168)

Previously, AOT JS glue code for method pointers used the address of the
method pointer as a unique ID to match JS glue with the binding. However,
sometimes static initializers malloc different sizes when running
the AOT generation code versus when the code is run normally. This caused
the method pointer address to be different and the binding didn't match up.

Instead of using the function pointer or the method pointer address we now
use a generated signature for the invoker to match up the glue code. This
works for both types of pointers and also has the advantage that many
of the glue code functions are nearly identical and can be reusued (closure
arguments make them behave differently).

Fixes emscripten-core#20994

* [wasm64] Error on `-fsanitize=address` + wasm64 (emscripten-core#21180)

This chance also includes a couple of minor fixes to asan + memory64
that helped me to confirm that it really doesn't work yet.

See emscripten-core#21177

* [wasm64] Enable freetype test. NFC (emscripten-core#21179)

The poppler test also seesm to work fine under wasm64, just not the >4Gb
mode.

* [ci] Split browser64_4gb into its own runner (emscripten-core#21182)

Also add test_TextDecoder to the list of test.

* [wasm64] Fix glSharedSource in >4gb mode and enable test under wasm64 (emscripten-core#21184)

* Add profiling to `read_ports`. NFC (emscripten-core#21194)

See emscripten-core#21191

* Remove unused arguments from test_emmalloc_trim. NFC (emscripten-core#21181)

This test was originally added with these unused args. Perhaps while
it was being developed in was parameterized, but is not anymore.

* Fix GL.getSource bug introduced in emscripten-core#21184 (emscripten-core#21197)

This only seems to show up in `browser.test_sdl_ogl_regal`.

* Move emscripten_webgl_init_context_attributes to native code. NFC (emscripten-core#21189)

* Rebaseline codesize expectations. NFC

* Allow-list 7 more WebGL extensions (emscripten-core#21185)

These 6 extensions don't add any entry points, so shouldn't require any
Emscripten support (aside from having any enums present in gl2ext.h,
which they do):

- EXT_conservative_depth
- NV_shader_noperspective_interpolation
- EXT_depth_clamp
- WEBGL_blend_func_extended
- WEBGL_compressed_texture_etc
- WEBGL_compressed_texture_etc1

Finally:

- WEBGL_compressed_texture_astc does add an entry point
getSupportedProfiles() in WebGL. This is a WEBGL_ extension, so it is
still safe to allow-list without implementing a C version of that
function. There is no corresponding GLES entry point for this; instead,
profile support is indicated by the presence of
KHR_texture_compression_astc_{ldr,hdr}. Emscripten should emulate those
extensions by checking getSupportedProfiles(), but I haven't implemented
this. Applications can still use the WEBGL_ version directly.

  WEBGL_compressed_texture_astc guarantees support for the LDR profile
  (since HDR is a superset of LDR, and there are only two profiles), so
  applications that only need LDR don't need to call this function. It
  can also be easily called using EM_ASM in applications that do use the
  HDR profile.

Fixes emscripten-core#21183

* Run unsafe_optimizations.js again after closure (emscripten-core#21196)

This allows `unsafe_optimizations.js` to cleanup some thing that
closure compiler was able to remove usages of.

Split out from emscripten-core#21195

* Mark test_itimer_proxy_to_pthread as flaky. NFC (emscripten-core#21175)

This test recently flaked on window too.

* Cleanup formating in audio_worklet JS code. NFC (emscripten-core#21203)

* Mark 3.1.53 as released (emscripten-core#21211)

* Don't force the use of imported memory under WASM2JS (emscripten-core#21195)

Setting `IMPORTED_MEMORY` can have other implications and don't want t
by default just because we chose WASM2JS.

The there is a very minor code size regression here that only effects
WASM2JS, but when combined with emscripten-core#21196 the overall effect is still a
win.

See emscripten-core#21071

* Use arrow function in library_webgl.js. NFC (emscripten-core#21186)

* Handle `-Wl,--stack-first` being passed explicitly (emscripten-core#21216)

Fixes: emscripten-core#21215

* [debug] Use two digits for the temporary file counter. NFC (emscripten-core#21207)

This means that filenames will sort correctly under normal sorting rules.

* [wasm64] Fix fetch api under wasm64 (emscripten-core#21219)

See emscripten-core#21177

* Rename/cleanup fetch tests. NFC (emscripten-core#21218)

* Make use of `emscripten_supports_offscreencanvas`. NFC (emscripten-core#21204)

* Use JS naming convention for JS-only symbol. NFC (emscripten-core#21188)

The `emscripten_` naming convention is something we use for native
function and this symbol is not visible to native code.

* Run more of out tests with `-sNO_DEFAULT_TO_CXX` (emscripten-core#21096)

We were previously only applying this flag to tests that use
`self.build` (i.e. most test).  Now we apply it to and even larger set.

The code size changes here only occur in debug builds where we enumerate
all known JS symbols, and there are come JS symbols are the C++ only.

* Some fixes for library_webgl.js in CAN_ADDRESS_GB mode (emscripten-core#21220)

This is an overall size win too after compression.

* When parsing settings as JSON, check the types we get back (emscripten-core#21206)

* Rebaseline codesize expectations. NFC

* More use of expectToReceiveOnModule in library_browser.js. NFC (emscripten-core#21224)

* Fix emscripten_webgl_make_context_current under wasm64/CAN_ADDRESS_2GB (emscripten-core#21228)

The first problem here was that
emscripten_webgl_make_context_current_calling_thread had the
wrong signature.

The second issue was use of `>> 2` on a pointer in
`emscripten_webgl_do_create_context` which doesn't work under wasm64
or CAN_ADDRESS_2GB.

* [embuilder] Add support for '*' wildcard for matching library names (emscripten-core#21236)

This is very useful for doing things like `./embuild build libGL*` to
`./embuilder clean libc*`.

* [test] Remove also_wasm2js btest argument. NFC (emscripten-core#21232)

This only have one user, and we have a cleaner mechanism for doing
this these days in terms of the decorator.

* Add --use-port option (emscripten-core#21214)

* [wasm64] Fix glUniformMatrix4fv (emscripten-core#21235)

* embind - Fix reading various bindings types from val on wasm64. (emscripten-core#21225)

- The function simpleReadValueFromPointer was always reading pointers as
i32 numbers which was incorrect on wasm64.
- Decoding of std::wstring was using a right shift to read pointers. Right
  shift was truncating numbers larger than i32 and causing misreads.
- Added tests to execute readValueFromPointer on all the binding types
  to ensure these don't break on wasm64.

* Move internal webgl signatures to a separate file. NFC (emscripten-core#21239)

This is in preparation for enabling these functions under wasm64.

* Avoid redundant function declarations in gl.c. NFC (emscripten-core#21237)

* Use @parmeterize in more browser tests. NFC (emscripten-core#21230)

* embind: Use optional return type for vector and maps. (emscripten-core#21102)

This helps create better TypeScript definitions for what
is actually returned.

* [test] Make more use of `also_with_wasm2js`. NFC (emscripten-core#21242)

* Support WGPUPrimitiveDepthClipControl / unclippedDepth (emscripten-core#21231)

Co-authored-by: Kai Ninomiya <[email protected]>

* [wasm64] Fix library_glemu.js under wasm64 (emscripten-core#21241)

* Fix test_cubegeom_pre_relocatable (emscripten-core#21240)

This test was broken by emscripten-core#21103 but when unnoticed because we run our
browser tests with swiftshader enabled, which skips this test.

* Consistent use of ValueError when parsing settings. NFC (emscripten-core#21245)

This is in preparation for a change to avoid using json parsing for
settings by default.

It also adds more context to the errors since when the ValueError
is caught higher up we print nice error messages.

* [wasm64] Fix wasm64 memory read in Fetch.js (emscripten-core#21246)

This bug only showed up under wasm64 when the address of the fetch
object was between 2Gb and 4Gb.  This causes the JS ">> 2" operation to
generate a negative number becuase the high bit is set:

```
$ node
> a = 2**31 + 10
2147483658
> a >> 2
-536870910
>
```

In `browser64_4gb` mode this bug resulted in a read from the first 4gb
of memory somewhere, which results a in 0 whereas read from a negative
address yields `undefined`.

* Fix broken compilation of regal tests (emscripten-core#21248)

This should have been part of emscripten-core#21096.  These failures don't show up in
CI because they are disabled under swiftshader.

* Minor formatting cleanup in src/library_glemu.js. NFC (emscripten-core#21249)

* Fix glDrawElements under CAN_ADDRESS_2GB (emscripten-core#21247)

* Re-enable preprocessing of pre/post JS file. NFC (emscripten-core#21227)

This change got reverted in emscripten-core#19006 so this time we make the
preprocessing optional.

This is useful as it allows things like `{{{ POINTER_SIZE }}}`
and `{{{ makeGetValue(..) }}}` to be used in pre/post JS files, just
like they can be in JS library files.

This change allows threadprofiler.js to be fixed such that it works
under wasm64.

Fixes: emscripten-core#21226

* Fix glDrawElements under CAN_ADDRESS_2GB (emscripten-core#21251)

This is partially a workround for emscripten-core#21250

* Fix capitalization of "GitHub". (emscripten-core#21257)

* docs: Remove discussion of using Travis CI. (emscripten-core#21256)

These are outdated and the docker images mentioned here haven't
been updated in 4 years.

* [test] Simplify post_manual_reftest. NFC (emscripten-core#21243)

Rather than embedding `reftest.js` directly in the html, simply include
it via script src attribute.

* Add contrib ports mechanism (emscripten-core#21244)

* Simplify get_subresource_location. NFC (emscripten-core#21260)

This function only ever gets called with no arguments.

I also confirmed that when we use a memory init file, that file always
exists.

* Improve manual_wasm_instantiate.html (emscripten-core#21258)

Modernize this test a little by using fetch API and JS spread operator.

* [Docs] Mention emscripten_exit_with_live_runtime wrt pthreads (emscripten-core#8167)

* Cleanup test_async_compile. NFC (emscripten-core#21259)

* Fix glUniformMatrix4fv in CAN_ADDRESS_2GB mode (emscripten-core#21264)

* Fix "emscripten emit" typo in Optimizing Code - WebAssembly section (emscripten-core#21269)

* Use JS string templates in src/library_glemu.js. NFC (emscripten-core#21261)

* Use rest and spread operators in multi-threaded code. NFC (emscripten-core#21270)

These operators are available everywhere that we can run mutli-threaded
code.

* [Docs] Added note to clarify new glfw3 port (emscripten-core#21272)

* Support multiple argument in pthread err/dbg wrappers (emscripten-core#21266)

* Cleanup generate_traditional_runtime_html. NFC (emscripten-core#21267)

- Use fetch() over XHR.
- No need for tryParseAsDataURI. This code is already in a `not
  settings.SINGLE_FILE` block which means URL for the wasm binary
  will never be data URI.  See `get_subresource_location`.

* WebGPU: Swapchain getCurrentTexture (emscripten-core#21271)

* WebGPU: added GetCurrentTexture method to swapchain.

* WebGPU: fix for GetCurrentTexture signature.

* Revert "[ci] Pin firefix to dev-edition until the threading issue is resolved. NFC (emscripten-core#21164)" (emscripten-core#21282)

This reverts commit 0eb6567.

The upstream has been fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=1876355#c3

* [test] Use modern list format for `-s` setting. NFC (emscripten-core#21280)

* Fix `#preprocess` detection on windows (emscripten-core#21284)

Followup to emscripten-core#21227

* Update EMSCRIPTEN_WEBGL_CONTEXT_HANDLE to handle full pointer range (emscripten-core#21281)

In particular this changes the return type of
`emscripten_webgl_create_context` such that negative values can no
longer be returned.

This allows pointers (specifically 32-bit pointers over 2gb) to be
returned which is needed for pthread builds.

The only valid failure return code for `emscripten_webgl_create_context`
is now 0/NULL.  As it happens this function never fails with anything
except 0 so this should not be an impactful change.

Split out from emscripten-core#21268

Fixes: emscripten-core#21278

* [Docs] Document EXPORT_ES6 implicit behavior (emscripten-core#21274)

* It is implicitly enabled for .mjs output.
* MODULARIZE is implicitly enabled when EXPORT_ES6 is set.

* Remove redundant step in promise change. NFC (emscripten-core#21285)

This stop in the chain is only need if the offset converter is needed.

* Fix some typos [NFC] (emscripten-core#21275)

* Make use of JS rest and spread operators throughout the codebase. NFC (emscripten-core#21283)

Following up on emscripten-core#21270.  These operators were introduced way before
our current default set of browser versions.  Anyone targeting an
browser so old as to not support these will already be on the
transpilation path.

* [NFC] Assert we do not use --low-memory-unused when STACK_FIRST (emscripten-core#21291)

Assuming low memory was unused when the stack was first - which is where low
memory is - would be wrong. We never did that wrong thing as we only use that
optimization when not optimizing. Add an assertion + tests to prevent regressions.

* Cleanup some pthread tests. NFC (emscripten-core#21293)

* Refactor Emval implementation to avoid JS heap allocations. (emscripten-core#21205)

* Rebaseline codesize expectations. NFC

* Fix deadlock in test_pthread_run_on_main_thread (emscripten-core#21296)

Fixes: emscripten-core#18210

* [test] Remove some unneeded `-sINITIAL_MEMORY` settings. NFC (emscripten-core#21295)

I think the reason a lot of these are no longer needed is because
the default pthread stack size is less that it used to be.

* Fix broken JS glue for AUDIO_WORKLETS with EXPORT_ES6 (emscripten-core#21192)

WASM Audio Worklets with EXPORT_ES6 may break at runtime:

  test.js:989 Uncaught (in promise) TypeError: Cannot set property wasmTable of #<Object> which has only a getter
      at receiveInstance (test.js:989:25)
      at receiveInstantiationResult (test.js:1011:5)

The read-only getter at issue is created in ASSERTIONS-enabled
builds, and conflicts with the current way of exporting wasmTable
on the Module object.

Exporting wasmTable via EXPORTED_RUNTIME_METHODS prevents the getter
from being created in normal builds. In MINIMAL_RUNTIME builds, we
make sure to delete the getter before manually exporting as before.

We also prevent an ES6 Audio Worklet from loading the .wasm binary
via `new URL()`, as `URL` is unavailable in AudioWorkletGlobalScope.

* Disable tests that rely on changing output from size and llvm-objdump (emscripten-core#21298)

* Add options support to contrib ports (emscripten-core#21276)

* Fix MAIN_THREAD_EM_ASM_INT + CAN_ADDRESS_2GB (emscripten-core#21292)

We were using the sign bit of an integer to distinguish between data
pointers and fixed JS function indexes, but that doesn't work once
that data address can be larger than 2^31.

Technically this is very unlikely in practice since in order to get
an EM_ASM address over 2^31 you would either need 2Gb of static data
to be using `-sGLOBAL_BASE=2gb` like we do in the tests.

An alternative approach here would be assume we have fewer than
`GLOBAL_BASE` (1024 is most cases) proxied JS library functions and then
we could assume that small integers we JS library functions and larger
ones were data pointers (EM_ASM functions).  However that seems fragile
too.  Passing an extra argument around seems like a small cost here.

* WebGPU: Remove unused signalValue argument (emscripten-core#21299)

This was never implemented and was removed from Dawn and upstream webgpu.h a long time ago (and the JS API even longer ago).

(This will be a tiny breaking change for a few apps but we're not stable
and still need to do many more breaking changes.)

* Rebaseline codesize expectations. NFC

* Move __glGenObject to GL.genObject. NFC (emscripten-core#21302)

This function logically belongs alongside getNewId.

Split out from emscripten-core#18874

* Rebaseline codesize expectations. NFC

* [test] Fix test_pthread_run_on_main_thread under asan. NFC (emscripten-core#21301)

The output of this test is racey without this change and has been failing on the
emscripten-releases waterfall in the asan configuration.

We only just started caring about the precise output in emscripten-core#21296.

* [test] Remove some unnecessary usage of TOTAL_MEMORY and INITIAL_MEMORY. NFC (emscripten-core#21303)

* Fix remaining webgl + CAN_ADDRESS_2GB issues (emscripten-core#21306)

* Add --quiet option to file_packager (emscripten-core#21307)

This suppressed the `Remember to build the main file with ..` message
that is otherwise printed to stderr.

This also allows the tests to assert that no stderr is produced in
successful cases.

* [wasm64] Fix emscripten_get_preloaded_image_data (emscripten-core#21308)

Here we extract an inner JS function that take a JS string so that the
externally facing once can assume its being passed a pointer.

* Link to bug in test_webgl_multi_draw test. NFC (emscripten-core#21309)

* Add option to emit TypeScript definitions for Wasm module exports. (emscripten-core#21279)

The new flag `--emit-tsd <filename>` will generate a TypeScript defintion
file for any Wasm module exports. If embind is also used the definitions
for those types will also be included in the same file.

This still doesn't give the full picture of Wasm module e.g. missing
HEAP<N> and the various helper functions defined in JS.

* Fix wasm worker tests in high memory modes (emscripten-core#21319)

* Don't define JS versions of abort or __assert_fail in standalone mode (emscripten-core#21317)

In STANDALONE_WASM mode these functions are defined in libstandalonewasm
and not in JS.

The JS definitions meant they were not able to be added to
EXPORTED_FUNCTIONS.

Fixes: emscripten-core#21312

* embind- Fix tsgen failure from merge. (emscripten-core#21320)

Forgot to pull in the upstream branch before updating this test.

* Don't include `main.c` in libSDL_mixer (emscripten-core#21322)

This was broken when sdl2_mixer was updated recently in in emscripten-core#21013.

Fixes: emscripten-core#21321

* Run all browser tests in 2gb mode (emscripten-core#21268)

* Update emsymbolizer and emsize tests (emscripten-core#21305)

LLVM rev 8b0f47bfa updated section addresses to use binary offsets in linked
wasm files, which is reflected in the llvm-size (and thus emsize) tool. It
also made llvm-objdump display file offsets rather than section offsets when
disassembling binaries. Update the emsize and emsymbolizer tests accordingly
(expect section addresses in emsize, and use file rather than section offsets
in the emsymbolizer test, since the offsets are read from objdump output).

* [wasm64] Fix makeHEAPView for addresses over 4gb (emscripten-core#21324)

This enables all the cubegeom tests to pass

* Rebaseline codesize expectations. NFC

* Fix typo in dynamic linking debug prints (emscripten-core#21329)

* ChangeLog.md typo: INCOMING_MODULE_API should be INCOMING_MODULE_JS_API (emscripten-core#21314)

* embind - Disable wasm2js when emitting types. (emscripten-core#21333)

Fixes emscripten-core#21315

* Refactor `makeHEAPView` to use `getHeapOffset`. NFC (emscripten-core#21332)

The code for calculating the offsets was being duplicated here.

Also, optimize getHeapOffset to avoid any shifting when size is 1.

* Add suppport for external ports (emscripten-core#21316)

* [test] Improve test_sdl2_key and test_sdl2_mouse. NFC (emscripten-core#21336)

The TEST_EMSCRIPTEN_SDL_SETEVENTHANDLER macro is copied over from
`test_sdl_key.c` (the SDL1 version) but its not applicable with SDL2.

Remove the 3 second delay from test_sdl_mouse/test_sdl2_mouse.  I ran
these tests many times without any issues.  We can perhaps revive with
something less long but I can't really see how a delay here could be
useful in practice.

* library_idbfs.js: Handle `transaction.onabort` in `reconcile()` (emscripten-core#21326)

If the transaction aborts (which can happen due to, for example, a QuotaExceededError), `onabort` must be handled to ensure that the `callback` actually gets called.

* [wasm64] Run all browser tests in 4gb mode (emscripten-core#21334)

* Allow comments in response files. (emscripten-core#21330)

It can be useful to have comments in a response file for exported
symbols to explain what some stuff might be in there for.

* Site: Remove old, unused copy of theme layout (emscripten-core#21338)

This was added in 2014, not used.

* Fix asan.test_main_thread_em_asm_pthread (emscripten-core#21339)

Without this change this tests fails to compile with `em++: error:
-pthread + ALLOW_MEMORY_GROWTH may run non-wasm code slowly`.

This test was recently added in emscripten-core#21292 and this wasn't caught
immediately because we don't run the `asan` suite during CI.

* Site: Fix typos (emscripten-core#21344)

* Add external ports + options support to embuilder (emscripten-core#21345)

* Update SDL2 version from 2.24.2 to 2.26.0 (emscripten-core#21337)

* Move `demangle` helper to library_legacy.js (emscripten-core#21346)

Followup to emscripten-core#21156

We no longer use this function anywhere in emscripten.

* [embind] Minor refactor to use more modern JS features (emscripten-core#21331)

* Unify handling of deprecated settings (emscripten-core#21355)

Unlike `LEGACY_SETTINGS`, deprecated settings can continue to be used
and the values passed in will continue to be honored.

Once folks have stopped using them we can move them to
`LEGACY_SETTINGS`.

* Warn of usage of legacy library symbols (emscripten-core#21357)

* Rebaseline codesize expectations. NFC

* Remove unused src/library_cyberdwarf.js (emscripten-core#21356)

The rest of the cyberdwarf support was removed back in emscripten-core#12195

* Mark 3.1.54 as released (emscripten-core#21358)

* [test] Simplify new KeyboardEvent calls in test_browser.py. NFC (emscripten-core#21351)

Closure knows about these property bags so there is no need to quote
the keys.

* Consolidate port loading code + embuilder documentation (emscripten-core#21353)

* Always free allocaed memory in mmunmap. (emscripten-core#21363)

Without this change we were returning early from `__syscall_munmap`
if `_munmap_js` failed.  This could happen if `fd` was no longer a valid
open file descriptor.  However, even in this case we still want to go
ahead and free any allocated memory.

Fixes: emscripten-core#21360

* Use `isfile` rather than `exists` when checking for config files (emscripten-core#21361)

This avoids trying parse non-files.

Also, explicitly log when we are not using a config file at all.

* Rebaseline codesize expectations. NFC

* Avoid malloc dependency in tzset (emscripten-core#21375)

* Update glfw port to 1.0.5 (emscripten-core#21369)

This update includes a fix for a memory corruption bug.

* [test] Add EMTEST_SKIP_NETWORK_TESTS (emscripten-core#21380)

I was doing some work on an airplane over the weekend and I found this
useful.

* Feedback from emscripten-core#21380

I accidentally hit submit before applying this change.

* Clarify MIN_CHROME_VERSION also applies to modern Edge [NFC] (emscripten-core#18222)

* Fix python error when building with audio worklets enabled (emscripten-core#21340)

MIN_EDGE_VERSION was removed (emscripten-core#20881), so we do not need it in the
feature matrix.

* Cleanup cpuprofiler.js. NFC (emscripten-core#21387)

- Use mathod syntax
- Cleanup long line

* Fix typo in embind.js (emscripten-core#21384)

nonexistant ==> nonexistent

Fixes: emscripten-core#21372

* Avoid calling addCxaCatch when not linking as C++ (emscripten-core#21386)

For the test I was unable to figure out a way to generate a call to
`__cxa_find_matching_catch` withing hand coding it like this.

This doesn't fix emscripten-core#21381 but it makes the error message way less
confusing.

* Add changelog entry for SDL2 update. NFC (emscripten-core#21390)

Followup to emscripten-core#21337

* Update sdl2-mixer from 2.6.0 to 2.8.0 (emscripten-core#21391)

* [test] Remove redundante/broken call to glTexImage2D. NFC (emscripten-core#21394)

This line was fixed/patched in 2736a26 but I think the old line
was mistakenly left in.

* Simplify test_gl_subdata and test_float_tex. NFC (emscripten-core#21393)

Also, remove test_std_cout_new.cpp completely.  This test seems to
be based on the code from these other two tests but doesn't seem to
server any useful purpose anymore.  Its was first added in ad285f6.

* [Docs] Fix typos [NFC] (emscripten-core#21395)

* Rebaseline codesize expectations. NFC

* Run test_subdata in webgl2 mode. (emscripten-core#21398)

This involved improving the emulation in glTexSubImage2D.

Sadly I needed to disable this new tests in 4gb+ mode since it runs
into a chromium bug.

* file_packager.py: Handle failure to get cached package (emscripten-core#21328)

In certain scenarios (such as when quota is exceeded), it's possible for a metadata entry to exist, but the package data to be missing - and `event.target.result` will be undefined.

Check for and properly handle this by calling `errback`, so that the `preloadFallback` gets triggered.

* [test] Simplify test_openjpeg. NFC (emscripten-core#21401)

This change simplifies the test in 2 ways:

1. Remove the "extra testing" part of the test that tries to run the
   test again if `ALLOW_MEMORY_GROWTH` is set.  The only test modes that
   have `ALLOW_MEMORY_GROWTH` are the santizier modes and it seems odd
   for an individual test to decide to disable this.
2. Remove the alternate `is_sanitizing` method of running the test.
   I believe this was only needed becuase of (1), and so can be safely
   removed.

By removing this complexity this test now has less nesting and is more
directly readable and more similar to other tests.

* Parameterize test_webgpu_compiletest. NFC (emscripten-core#21402)

* Fix webgl tracing issues (emscripten-core#21389)

The webgl tracing mechanism was assuming a fixed number of arguments for
a given function whereas some webgl function can take variable number of
arguments.

Fix this by using the rest operator.  This is not as slow as using
`arguments`.  Also, performance is not really an issue here since we are
about to serialize all the arguments to string and send to the console
which will vastly out weight the cost of using spread here.

I believe the comments here about hot and cold functions as well as the
comment at about the cost of using `arguments` were copied from the
cpuprofiler.js but they don't apply here.

Also, avoid serializing the entire heap, which can cause chrome to hang.

* [test] Add `reftest` helper method for browser tests. NFC (emscripten-core#21392)

This makes it easy distinguish reference tests from other btests.

* Fix EM_JS macro in the face of recent llvm change (emscripten-core#21403)

A recent change to llvm (llvm/llvm-project#81539)
means that the `used` attribute on data forces the segment to be
present in the output file, even if it's not used.

The usage here in `em_js.h` was assuming that the data was not incldued
in the final output.  This change makes the symbol non-static instead
of used, which is enough to force clang to keep the data around but
not the linker (which is exactly the effect we want).

* Fix dup in nodefs by refcounting nodefs file descriptors (emscripten-core#21399)

* Mark test_itimer_pthread as flaky. NFC (emscripten-core#21404)

This should have been marked as such when the other itimer tests were.

* Rebaseline codesize expectations. NFC

* Use JS class for FSStream, FSNode and LazyUint8Array. NFC (emscripten-core#21406)

Converting each of these to classes led to code size savings.

* Added a way to get more information a port (emscripten-core#21376)

* Fix test_openjpeg under wasm64. NFC (emscripten-core#21408)

openjpeg was assuming a different signature for getopt_long which
was not problem under wasm32.

* [test] Move `requires_wasm2js` to `test/common.js`. NFC (emscripten-core#21412)

* Fix some closure compile warnings in JS library code (emscripten-core#21385)

* Fix for resize events when building with ASSERTIONS (emscripten-core#21362)

Building with ASSERTIONS is failing the safe heap checks when e.detail is undefined.

* [emval] Reduce C++ -> JS calls in emscripten::val lifetime management (emscripten-core#21366)

Related to emscripten-core#21300, but some obviously good incremental wins to reduce the cost of ref counting:

1. Have C++ consistently avoid inc/dec for the special reserved values that don't need to be counted, this saves decref calls every time such a `val` object goes out of scope.
2. Add an rvalue reference version of toWireType for `emscripten::val` that can transfer ownership to JS. This saves one call to incref and one call to decref for the case of a c++ function with return type `emscripten::val`  

The cost seems to be single-digit bytes to the WASM.

* [test] Make use of `is_wasm2js` helper (emscripten-core#21413)

Also, don't check for `WASM2JS` settings.  That is a private setting
that cannot be set on the command line.

* Feedback from emscripten-core#21406. NFC (emscripten-core#21415)

* Fix interactive SDL1 tests (emscripten-core#21420)

* [ports] upgrade SDL to 2.28.4 (emscripten-core#20417)

* embind - Remove node exception handling flag for node 17+. (emscripten-core#21411)

Fixes: emscripten-core#21405

* Remove DEMANGLE_SUPPORT from docs (NFC) (emscripten-core#21430)

* Revert "Proxy webgpu calls back to the main thread. NFC (emscripten-core#20124)" (emscripten-core#21388)

This is a partial revert of 992d1e9

* [emrun] Use GNU command line flag names (emscripten-core#21424)

For example `--no-browser` vs `--no_browser`.

Continue to support the old style but don't advertise these.

* Remove IE workaround in jsStackTrace (emscripten-core#21431)

* Extract getIncludeFile function. NFC (emscripten-core#21425)

* Round down any canvas-relative mouse event coordinates (fixes SAFE_HEAP asserts) (emscripten-core#21429)

When using a custom target the coordinates may be doubles, which causes SAFE_HEAP to assert. These are truncated to avoid this (which is what happens anyway, only now it's explicit).

* Cleanup src/library_sdl.js. NFC (emscripten-core#21416)

- Wrap long lines
- Format comments
- Use method syntax
- Remove unnecessary `SDL_audio`/`SDL_unicode`/`SDL_ttfContext` accessor
  functions.

* Remove remaining uses of `eval` in the JS compiler (emscripten-core#21423)

Use `vm.runInCurrentContext` instead.

We already use this in the preprocessor, but not we also use it for
macro expansion and loading of the compiler code itself.

This change should facilitate future changes to the JS compiler, such
as changing the compiler itself to use JS modules.

* Run test_metadce_minimal in STRICT mode. NFC (emscripten-core#21438)

* Rebaseline codesize expectations. NFC

* [Docs] Document how to build and view the website locally (emscripten-core#21434)

* Allow HEAPX symbols in EXPORT_RUNTIME_METHODS (emscripten-core#21439)

- Factor out updateMemoryViews.
- Enable HEAPXX exports to be specified in EXPORT_RUNTIME_METHODS.
- Add all HEAP symbosl to EXPORT_RUNTIME_METHODS unless in STRICT mode.

Replaces emscripten-core#21407

* Add name section and object symbol table support to emsymbolizer (emscripten-core#21367)

With llvm/llvm-project#82083, llvm-symbolizer works
correctly with name sections, so emsymbolizer can use it. Also do the
same for object files with symbol tables.
Object files do not currently work correctly in llvm-symbolizer where code addresses overlap with
data addresses; when that is fixed, emsymbolizer will start working, but we should add a test for it.

* Add some comments regarding __c_longjmp. NFC (emscripten-core#21442)

* [wasm2js] Remove all handling for external memory file (emscripten-core#21217)

We have a lot of support code and complexity in emscripten for handling
of external memory files.  However, its only ever used in wasm2js mode
which is a legacy mode.  The only reason we continue to support it here
IIUC is because its slightly more space efficient than embedding the
data as base64.

For small programs like hello_world this is an over codesize win.  For
larger programs there is a regression in overall size in proportion to
the amount of static data in the program.

* Limit `isCurrentContextWebGL2` usage. NFC (emscripten-core#21444)

I observed that this helper macro is only needed when webgl2 is
supported.

In fact, it would be a bug if it was used when webgl2 was not supported.

* Update expected binaryen version to 116 (emscripten-core#21446)

After WebAssembly/binaryen#6358, we need to
update this to pass the tests.

* Update val.h.rst (emscripten-core#21449)

Update typo in EM_ASYNC_JS code sample

* Update Binaryen version to 117 (emscripten-core#21451)

After WebAssembly/binaryen#6358, I tried to
update this to 117, but it looks due to some unfinished builds I ended
up updating it to 116
(emscripten-core#21446 (comment)).
This brings it up to 117.

* [circleci] Create `run-tests-firefox` task. NFC (emscripten-core#21452)

This allows use to create different firefox test runs, just like
we already can for chrome.

* Update test_sdl_canvas (emscripten-core#21453)

When I run this test locally in firefox I was getting 2785 as the
sum value.  I believe this is because the test includes SDL1 font
rendering which can depend on the system fonts you have installed.

* Minor library_webgl.js cleanup (emscripten-core#21457)

Split out from emscripten-core#21445

* Another library_webgl.js cleanup. NFC (emscripten-core#21458)

Similar to emscripten-core#21457 but this one actually as a code size saving

* Avoid garbage-free WebGL APIs when memory size is over 2gb. (emscripten-core#21445)

Both chrome and firefox see have some issues with passing 2gb+ and 4gb+
offsets to these APIs.

Once the browser issues are addressed we can lift these restrictions
over time.

Fixes: emscripten-core#20533

* Update GLFW contrib port to v1.1.0 (GLFW 3.4.0) (emscripten-core#21455)

On Feb 23rd 2024, GLFW released a new version 3.4.0. This is the changes in contrib.glfw3 (https://github.com/pongasoft/emscripten-glfw) to implement the new apis/features added to 3.4

Release notes for the port: https://github.com/pongasoft/emscripten-glfw/releases/tag/v1.1.0

* Initial new `INITIAL_HEAP` setting (emscripten-core#21071)

Changes in default behavior:
1) INITIAL_HEAP is the new default for most builds.
   This means that there is an increase in the effective
   initial memory used by "sizeof(stack) + sizeof(static data)".
   In typical small applications this should be on the order
   of half a megabyte.
2) Because we cannot precisely calculate the amount
   of initial memory now, ASAN support will use
   the conservative upper estimate of MAXIMUM_MEMORY.
   This only affects ALLOW_MEMORY_GROWTH=0 builds.

This change does not yet enable INITIAL_HEAP for builds
that instantiate the memory in JS, e. g. with threading.

* Fix file:// protocol not working in Ports.fetch_project (emscripten-core#21456)

* Mark 3.1.55 as released (emscripten-core#21461)

* Improve ES6 support in TypeScript definitions generation (emscripten-core#21460)

Users building with --emit-tsd and the EXPORT_ES6 setting should get
TypeScript definitions accounting for the fact that ES6 modules
include a default export that is a functor to instantiate and access
the wasm module in question

When generating TS definitions, query the EXPORT_ES6 setting and,
if present, add the appropriate exports to the output

Include options param in default functor export for `--emit-tsd`.
This serves as a starting point for incluing all options such as
`locateFile` (and the slew of others), without requiring manually
iterating through them

Update tests to include factory function

* Fix Getting WebGPU Context in pthread (emscripten-core#21467)

Failed to run compiled WGPU code clips:
 wgpu::SurfaceDescriptor surfDesc{};
 surfDesc.nextInChain = &canvasDesc;
 wgpu::Surface surface = instance.CreateSurface(&surfDesc);

The reason is that it cannot call getContext from correct canvas
object.

This PR fixed the problem and add correct build flags for
webgpu_basic_rendering test in pthread.

* Honor WEBGL_USE_GARBAGE_FREE_APIS (emscripten-core#21462)

Followup to emscripten-core#21445.  I overlooked some of the webgl2-only paths.

* Rebaseline codesize expectations. NFC

* [test] Disable asan.test_externref_emjs_dynlink. NFC (emscripten-core#21490)

This test is failing due to a crash in LLVM that was introduced
in llvm/llvm-project#83196.

* [JSPI] - Assert that JSPI is supported by the environment. (emscripten-core#21483)

* Fix test_extended_const after recent binaryen change. NFC (emscripten-core#21492)

See WebAssembly/binaryen#6379

* Fix for longjmp(.., 0) under wasm EH (emscripten-core#21493)

Fixes: emscripten-core#21486

* [wasm64] Enable SDL2 tests under wasm64 (emscripten-core#21489)

I think the recent SDL2 version bump must have fixed the issues we
were previously seeing.  See emscripten-core#21337 and emscripten-core#20417.

* Avoid string property access in library_webgpu.js. NFC (emscripten-core#21454)

* Multiple fixes to EmscriptenOrientationChangeEvent (emscripten-core#21428)

* Add support for "-Ofast" (emscripten-core#21494)

Based on emscripten-core#11884

* Fix broken regex from emscripten-core#21492 (emscripten-core#21498)

* [wasm64] Enable test_sdl_audio_beep_sleep (emscripten-core#21495)

* Warn when setting used on the command line more than once (emscripten-core#21464)

See emscripten-core#19938

* [test] Remove EMTEST_LACKS_THREAD_SUPPORT (emscripten-core#21496)

All the browsers we test against these days support threads

* Convert unsafe_optimizations.js to mjs. NFC (emscripten-core#21504)

* [test] Disable asan.test_externref_emjs. NFC (emscripten-core#21508)

Should have been part of emscripten-core#21490.

* Re-enable test_dlfcn_em_asm. NFC (emscripten-core#21500)

This test was disabled due to EM_ASM not working in side modules but
that was fixed in emscripten-core#18228.

* Remove unused genArgSequence and needsQuoting. NFC (emscripten-core#21505)

The usage of genArgSequence removed in emscripten-core#17420.

The usage of needsQuoting was removed in emscripten-core#17462

* Avoid generating empty statement in receiveI64ParamAsI53 (emscripten-core#21487)

Fixes a few Closure lint warnings. (Though of course there are very many
other Closure warnings.)

* Convert lz4-compress.js to mjs. NFC (emscripten-core#21507)

* Fix acorn-optimizer error when destructuring array with empty elements (emscripten-core#21501)

This fixes cases like this:

function ([, a]) { }

In such arrays it is possible to have empty elements, which must be skipped.

* Run JS linter on src/*.mjs files. NFC (emscripten-core#21510)

As of today all `.mjs` files are part of the compiler itself and don't
contains preproccess macros, so that are safe to be run through linter
tools.

* [test] Add `skipExecIf` which just skips the running of the test (emscripten-core#21499)

This means that even in CI when we might skip certain tests for graphics
or sounds we still get some assurance that the test code compiles.

* Avoid use of port 8088 in socket tests. NFC (emscripten-core#21512)

This port is used by the goma compiler webserver which causes these
tests to fail on machines that are running the goma compiler.

* Remove check for file type of `.a` files. NFC (emscripten-core#21513)

Instead just pass them through the linker like other inputs.

See emscripten-core#21128

* [wasm64] Fix WebSocket API under wasm64 (emscripten-core#21514)

Fixes: emscripten-core#21503

* Only check for WebAssembly support in debug builds. NFC (emscripten-core#21511)

Also, avoid the use of `abort` in this case since abort itself depends
on `WebAssembly.RuntimeError`.

Fixes: emscripten-core#21484

* Fix unconditional usage of `requests` import (emscripten-core#21523)

On systems that don't have the requests python we cannot catch
this exception.

* Use curl to download files on macOS (emscripten-core#21525)

* Use DEPRECATED_SETTINGS for RUNTIME_LINKED_LIBS (emscripten-core#21522)

And also for CLOSURE_WARNINGS

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Brendan Dahl <[email protected]>
Co-authored-by: Sam Clegg <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Filip Lundgren <[email protected]>
Co-authored-by: Kai Ninomiya <[email protected]>
Co-authored-by: Alon Zakai <[email protected]>
Co-authored-by: Kleis Auke Wolthuizen <[email protected]>
Co-authored-by: Xdestiny <[email protected]>
Co-authored-by: Jerry.Zhuang <[email protected]>
Co-authored-by: Yan Pujante <[email protected]>
Co-authored-by: Bruce Mitchener <[email protected]>
Co-authored-by: MichalGrzymek <[email protected]>
Co-authored-by: Simon Cooper <[email protected]>
Co-authored-by: mrolig5267319 <[email protected]>
Co-authored-by: kangtastic <[email protected]>
Co-authored-by: Derek Schuff <[email protected]>
Co-authored-by: Piotr Wierciński <[email protected]>
Co-authored-by: Dannii Willis <[email protected]>
Co-authored-by: pastdue <[email protected]>
Co-authored-by: François Hautier <[email protected]>
Co-authored-by: Marcin Wojdyr <[email protected]>
Co-authored-by: Hood Chatham <[email protected]>
Co-authored-by: Carl Woffenden <[email protected]>
Co-authored-by: Charlie Birks <[email protected]>
Co-authored-by: Érico Porto <[email protected]>
Co-authored-by: Heejin Ahn <[email protected]>
Co-authored-by: patrick kettner <[email protected]>
Co-authored-by: SingleAccretion <[email protected]>
Co-authored-by: J Nicholas Giampietro <[email protected]>
Co-authored-by: Yan, Shaobo <[email protected]>
Co-authored-by: nsfisis <[email protected]>
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.

2 participants