Skip to content

Conversation

@adamperlin
Copy link
Contributor

@adamperlin adamperlin commented Jan 22, 2026

These are (hopefully) the last few features needed to get a usable wasm module from crossgen2 that we can use in our test harness. It adds:

  • An offset for the data section to reserve space for a runtime stack
  • A table section with no assigned elements
  • Logic to generate wasm-level type signatures for any methods in the compilation

WasmObjectWriter

Fix section incorrect section ordering after addition of table section
…tack

Fix {i32, i64}.const encoding (const should only ever be encoded as SLEB128
@kg
Copy link
Member

kg commented Jan 22, 2026

Two quick TODOs:

  • Export the memory
  • Export the function table

@adamperlin
Copy link
Contributor Author

adamperlin commented Jan 23, 2026

Note: Full support for proper wasm-level signature generation (including by-value structs) will depend on #123515

@adamperlin adamperlin marked this pull request as ready for review January 24, 2026 01:41
Copilot AI review requested due to automatic review settings January 24, 2026 01:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Summary: This PR adds essential WebAssembly module features to the crossgen2 object writer to generate usable WASM modules for testing. The changes enable data section offsets for runtime stack allocation, add a table section for function references, and implement type signature generation for methods.

Changes:

  • Introduces a data section offset (0x10000 / 64KB) to reserve space for runtime stack
  • Adds table section support with configurable size based on method count
  • Refactors export functionality to support multiple export types (function, table, memory, global)
  • Implements WebAssembly type signature generation from .NET method signatures, mapping .NET types to WASM value types

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

adamperlin and others added 3 commits January 24, 2026 14:08
…r.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…r.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@kg kg left a comment

Choose a reason for hiding this comment

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

I'd like to get this in as-is and do any necessary cleanup in followup PRs

@adamperlin
Copy link
Contributor Author

I'd like to get this in as-is and do any necessary cleanup in followup PRs

That sounds good to me, I've mostly been working on follow up to this PR. This seems blocked on CI?

@adamperlin
Copy link
Contributor Author

/ba-g infra failures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture area-crossgen2-coreclr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants