Skip to content

[Wasm64] Changes to make AUDIO_WORKLET work with MEMORY64 #18972

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

Merged
merged 1 commit into from
Apr 12, 2023

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Mar 15, 2023

No description provided.

@sbc100 sbc100 requested review from kripken and juj March 15, 2023 23:06
@@ -43,6 +43,7 @@ let LibraryWebAudio = {
// dependency, because the user will not be able to utilize the node unless they call emscriptenGetAudioObject()
// on it on JS side to connect it to the graph, so this avoids the user needing to manually do it on the command line.
emscripten_create_audio_context__deps: ['$emscriptenRegisterAudioObject', '$emscriptenGetAudioObject'],
emscripten_create_audio_context__sig: 'ip',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looking at the code that is generated with this scheme, adding the p yields

options = Number(options);
...

although the ideal form for this would be that options would retain BigInt form, and instead the code line

sampleRate: HEAP32[options+1] || void 0

would change to

sampleRate: HEAP32[options+1n] || void 0

that would be better codegen for this instance.

For some instances, using an automatic p signature directive will yield the ideal code form, whereas for others, that is not the case. There is also the 4GB consideration, where we'd want to do

options = options >>> 0;

here. Reading convertPointerParams(), it looks like it does not currently handle that scenario, although it could be expanded to do so.

LGTM, I'll need to try to find way to work on #15433.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree there are probably things we can do better here for the wasm64 JS ABI, but hopefully they can be addressed centrally as part of the p signature handling and the makeGetValue/makeSetValue and other macros.

For now, the ABI we are using is to cast all incoming bigint pointers to i53 numbers.. if there are more optimal forms hopefully we can convert to them without needing to change individual functions too much.

@sbc100 sbc100 changed the title [Wasm64] Changes to make AUDIO_WORKLET working with MEMORY64 [Wasm64] Changes to make AUDIO_WORKLET work with MEMORY64 Apr 11, 2023
@sbc100 sbc100 force-pushed the audio_worklet_memory64 branch from 6b1ec8d to e1c1e35 Compare April 11, 2023 19:00
@sbc100 sbc100 enabled auto-merge (squash) April 11, 2023 19:45
@sbc100 sbc100 force-pushed the audio_worklet_memory64 branch from e1c1e35 to b4fdada Compare April 12, 2023 01:41
@sbc100 sbc100 merged commit 2bf3000 into main Apr 12, 2023
@sbc100 sbc100 deleted the audio_worklet_memory64 branch April 12, 2023 02:56
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.

3 participants