Skip to content

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Mar 22, 2023

Followup to #19033.

Updating the test_closure_full_js_library to include webgl2 caused a lot of JSC_REFERENCE_BEFORE_DECLARE closure errors.

This is because we had JS aliases who's target was defined both in JS and in native code. In this case the jsifier chooses not to include the JS version but the location where the aliases are declared in the output comes before the native symbols are declared.

To fix this I removed the native aliases from webgl2.c, since these exact same aliases already exist in library_webgl.js.

This think is also more correct since it means that the emscripten_xx wrappers are defined fully in JS and are not effected by definitions in native code (which is the whole point of them I believe).

@sbc100 sbc100 requested a review from kripken March 22, 2023 19:06
@sbc100 sbc100 force-pushed the enfore_alias_rules branch 2 times, most recently from e2af8ce to 349f1a0 Compare March 22, 2023 19:53
// it is a BigInt. Otherwise, we legalize into pairs of i32s.
function defineI64Param(name) {
if (WASM_BIGINT) {
return `/** @type {!BigInt} */ ${name}`;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was removed because otherwise closure generates errors like this one:

/tmp/emscripten_temp_16el3cc_/hello_world.js:20729:6: WARNING - [JSC_TYPE_MISMATCH] assignment
found   : number
required: BigInt
  20729|       timeout = Number(timeout);

This was happening for any function that used receiveI64ParamAsI53Unchecked which is currently just glClientWaitSync and glWaitSync.

@sbc100 sbc100 force-pushed the enfore_alias_rules branch from 349f1a0 to f4be7f8 Compare March 22, 2023 21:49
Followup to #19033.

Updating the `test_closure_full_js_library` to include webgl2 caused
a lot of `JSC_REFERENCE_BEFORE_DECLARE` closure errors.

This is because we had JS aliases who's target was defined both in
JS and in native code.  In this case the jsifier chooses not to include
the JS version but the location where the aliases are declared in the
output comes before the native symbols are declared.

To fix this I removed the native aliases from webgl2.c, since these
exact same aliases already exist in library_webgl.js.

This think is also more correct since it means that the `emscripten_xx`
wrappers are defined fully in JS and are not effected by definitions
in native code (which is the whole point of them I believe).
@sbc100 sbc100 force-pushed the enfore_alias_rules branch from f4be7f8 to 45ed231 Compare March 22, 2023 22:16
@sbc100 sbc100 closed this Mar 23, 2023
@sbc100 sbc100 deleted the enfore_alias_rules branch March 23, 2023 00:40
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