Skip to content

wasm2c: Cleanup of handling of WASM_RT_USE_SEGUE macro - #2487

Merged
shravanrn merged 1 commit into
WebAssembly:mainfrom
PLSysSec:permodule-usesegue
Oct 15, 2024
Merged

shravanrn merged 1 commit into
WebAssembly:mainfrom
PLSysSec:permodule-usesegue

Conversation

@shravanrn

@shravanrn shravanrn commented Oct 14, 2024 •

Copy link
Copy Markdown
Collaborator

The WASM_RT_USE_SEGUE macro was previously overloaded for two checks:

  1. Check if Segue is supported by the current compiler/arch/OS combination
  2. Check if the current module only uses one memory, as we do not use Segue for modules using multiple memories

Check 2 means that WASM_RT_USE_SEGUE is only available in the generated C file, and not in the runtime (wasm-rt-impl.c).

However, the runtime needs this information as it must include certain headers only if Segue is supported (Check 1 above), and thus this macro must be available in wasm-rt.h. We thus split this macro into two parts WASM_RT_USE_SEGUE and WASM_RT_USE_SEGUE_FOR_THIS_MODULE to address the two use cases: "check if Segue is supported" and "check if Segue should be used for the current module"

@shravanrn
shravanrn requested review from keithw and sbc100 October 14, 2024 21:56
@sbc100

sbc100 commented Oct 14, 2024

Copy link
Copy Markdown
Member

Rather than creating a new WASM_RT_USE_SEGUE_FOR_THIS_MODULE for use in the generated code could we just undefine WASM_RT_USE_SEGUE when not IS_SINGLE_UNSHARED_MEMORY is not true?

@shravanrn

Copy link
Copy Markdown
Collaborator Author

Rather than creating a new WASM_RT_USE_SEGUE_FOR_THIS_MODULE for use in the generated code could we just undefine WASM_RT_USE_SEGUE when not IS_SINGLE_UNSHARED_MEMORY is not true?

@sbc100 Sure, that would work too. I think, on balance, I think its a bit more confusing though.

Let me know if you have a strong preference for your approach, and I can make the change. If neutral, I prefer this as it is more explicit about the intent.

@sbc100

sbc100 commented Oct 14, 2024

Copy link
Copy Markdown
Member

Rather than creating a new WASM_RT_USE_SEGUE_FOR_THIS_MODULE for use in the generated code could we just undefine WASM_RT_USE_SEGUE when not IS_SINGLE_UNSHARED_MEMORY is not true?

@sbc100 Sure, that would work too. I think, on balance, I think its a bit more confusing though.

Let me know if you have a strong preference for your approach, and I can make the change. If neutral, I prefer this as it is more explicit about the intent.

Its up to you. This change LGTM as is if you prefer it that way. It makes the diff bigger but I guess that in an of itself is not a strong argument.

@shravanrn
shravanrn merged commit 2b4e2c7 into WebAssembly:main Oct 15, 2024
@shravanrn
shravanrn deleted the permodule-usesegue branch October 15, 2024 02:39
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