Skip to content

Update wasm_offset_converter. NFC #24588

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
Jun 17, 2025

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Jun 17, 2025

  • Convert to ES class
  • Use string templates

@sbc100 sbc100 requested review from kripken and RReverser June 17, 2025 15:54
@sbc100
Copy link
Collaborator Author

sbc100 commented Jun 17, 2025

View with "hide whitespace"

@sbc100 sbc100 force-pushed the wasm_offset_converter branch from 4fd35c4 to 4a7ea80 Compare June 17, 2025 16:01
@RReverser
Copy link
Collaborator

But is it still necessary at all? (see #24587, I think it can be just removed nowadays?)

@sbc100 sbc100 force-pushed the wasm_offset_converter branch from 4a7ea80 to 562ef6b Compare June 17, 2025 16:04
- Convert to ES class
- Use string templates
@sbc100 sbc100 force-pushed the wasm_offset_converter branch from 562ef6b to 72f35a7 Compare June 17, 2025 16:06
@sbc100
Copy link
Collaborator Author

sbc100 commented Jun 17, 2025

Yes, I was inspired to create this while trying to figure out if this is still needed.

My guess is that it is still needed for things ASAN, but I will do some more investigation.

@RReverser
Copy link
Collaborator

RReverser commented Jun 17, 2025

If you're referring to usage in

if (match = /\bwasm-function\[\d+\]:(0x[0-9a-f]+)/.exec(frame)) {
// some engines give the binary offset directly, so we use that as return address
return +match[1];
} else if (match = /\bwasm-function\[(\d+)\]:(\d+)/.exec(frame)) {
// other engines only give function index and offset in the function,
// so we try using the offset converter. If that doesn't work,
// we pack index and offset into a "return address"
return wasmOffsetConverter.convert(+match[1], +match[2]);
} else if (match = /:(\d+):\d+(?:\)|$)/.exec(frame)) {
, then first branch should be sufficient nowadays as stacktrace format was standardised as part of Web API.

@sbc100
Copy link
Collaborator Author

sbc100 commented Jun 17, 2025

You may well the correct yes, but can we land this change anyway, and attempt to delete this code as a followup?

Copy link
Collaborator

@RReverser RReverser left a comment

Choose a reason for hiding this comment

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

It does feel a bit like unnecessary work if it turns out we can delete it right after, but sure, why not :)

@sbc100
Copy link
Collaborator Author

sbc100 commented Jun 17, 2025

It does feel a bit like unnecessary work if it turns out we can delete it right after, but sure, why not :)

I think I agree, but since I already did it ...

@sbc100 sbc100 merged commit b4b5469 into emscripten-core:main Jun 17, 2025
26 of 30 checks passed
@sbc100 sbc100 deleted the wasm_offset_converter branch June 17, 2025 17:09
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