Skip to content
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

GC+atomics and features #7184

Closed
kripken opened this issue Dec 30, 2024 · 1 comment · Fixed by #7185
Closed

GC+atomics and features #7184

kripken opened this issue Dec 30, 2024 · 1 comment · Fixed by #7185
Assignees

Comments

@kripken
Copy link
Member

kripken commented Dec 30, 2024

(module
 (type $0 (struct (field i32)))
 (type $1 (func (result i32)))
 (func $0 (result i32)
  (struct.atomic.get $0 0
   (struct.new_default $0)
  )
 )
)

This validates with --enable-gc --enable-shared-everything --enable-reference-types: GC for structs, shared-all for the new atomic operation there, and references as a dependency of GC. However, adding --heap2local will cause an atomic.fence to be emitted, and that requires --enable-threads, so this errors:

$ wasm-opt w.wasm --enable-gc --enable-shared-everything --enable-reference-types --heap2local
[wasm-validator error in function 0] unexpected false: Atomic operations require threads [--enable-threads], on 
(atomic.fence)
Fatal: error after opts

Should struct.atomic.* require --enable-threads? Or is this intentionally separate, and so we should avoid emitting atomic.fence here? @tlively

@tlively
Copy link
Member

tlively commented Jan 1, 2025

The GC atomic instructions should probably require the threads feature.

@kripken kripken self-assigned this Jan 2, 2025
kripken added a commit that referenced this issue Jan 6, 2025
Without this, it is invalid to lower them to simpler atomic operations like
atomic.fence (as some passes do) or linear memory atomics (as a future
lowering pass might do).

Fixes #7184
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 a pull request may close this issue.

2 participants