Skip to content

fix(p3): use async lower result pointer from params trail#1486

Open
andreiltd wants to merge 1 commit into
bytecodealliance:mainfrom
andreiltd:fix/flat-count
Open

fix(p3): use async lower result pointer from params trail#1486
andreiltd wants to merge 1 commit into
bytecodealliance:mainfrom
andreiltd:fix/flat-count

Conversation

@andreiltd
Copy link
Copy Markdown
Member

Async canonical lower appends a result pointer to flat params when flat_results is non-empty. The async task metadata was treating the first raw param as the result pointer, which corrupts params for async imports that have both params and results.

The relevant spec snippet is this:

case 'lower':
  if len(flat_params) > MAX_FLAT_ASYNC_PARAMS:
    flat_params = [opts.memory.ptr_type()]
  if len(flat_results) > 0:
    flat_params += [opts.memory.ptr_type()]
  flat_results = ['i32']

@andreiltd andreiltd requested a review from vados-cosmonic as a code owner May 14, 2026 14:52
Async canonical lower appends a result pointer to flat params when
flat_results is non-empty. The async task metadata was treating the
first raw param as the result pointer, which corrupts params for async
imports that have both params and results.

The relevant spec snippet is this:

```
case 'lower':
  if len(flat_params) > MAX_FLAT_ASYNC_PARAMS:
    flat_params = [opts.memory.ptr_type()]
  if len(flat_results) > 0:
    flat_params += [opts.memory.ptr_type()]
  flat_results = ['i32']
```
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.

1 participant