-
Notifications
You must be signed in to change notification settings - Fork 695
Read-only tables (and memories) #1278
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
Comments
@sbc100 and I had discussed the value of having immutable tables before too. |
I believe @fgmccabe was interested in this too. From the emscripten/llvm producer side tables have generally been considered read-only, but now that we are doing more dynamic linking we are adding table entries on the fly. Mostly this is done by the dynamic linker during startup before any user code runs, but we also do it in "dysym". |
A read-only Memory would be desirable in order to first set up state in your Memory (initially read-write), and then create multiple Instances which all point to the same Memory (now read-only). |
Immutable tables may also lead to more efficient I ran into this in a WASM to JVM classfile compiler, where it is possible to further optimize |
Some of us were discussing alias analysis for a wasm compiler yesterday and it was observed that writing to a mutable global should not kill a value loaded from an immutable global.
This made me realize: we have multiple tables (introduced by the bulk memory proposal or reftypes, I'm not actually sure which) and table.fill and table.copy and table.get and table.set (introduced by the reftypes proposal), but so far as I can tell we have no immutable tables. If tables really are "generalized global variables", then perhaps we should, for symmetry. More importantly it would make it possible to export a table without fear of the table being tampered with.
Immutable tables must probably be initialized by an active element segment or from an imported immutable table, in the fashion of globals; this adds another wrinkle to our table initialization semantics puzzle.
(And once we have multiple memories, read-only memories will be attractive for some applications.)
The text was updated successfully, but these errors were encountered: