-
Notifications
You must be signed in to change notification settings - Fork 840
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
Improve importing things #130
Conversation
Love this! |
let local_memory = *ctx.memories.add(memory_index.index()); | ||
let memory = (*local_memory).memory as *mut DynamicMemory; | ||
|
||
if let Some(old) = (*memory).grow(delta, &mut *local_memory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to make this less verbose? The js API for this is memory.grow(1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user can just call memory.grow(delta)
. This cruft in this function is because it's specifically accessing a particular type of memory. The user-exposed api doesn't expose that.
@@ -20,6 +22,8 @@ pub struct ModuleEnv<'module, 'isa> { | |||
pub signatures: Map<SigIndex, ir::Signature>, | |||
globals: Map<GlobalIndex, cranelift_wasm::Global>, | |||
func_bodies: Map<LocalFuncIndex, ir::Function>, | |||
pub deduplicated: PrimaryMap<cranelift_wasm::SignatureIndex, SigIndex>, | |||
duplicated: HashMap<SigIndex, cranelift_wasm::SignatureIndex>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the naming could be more specific deduplicated_signatures
duplicated_signatures
or signatures_all
/signatures_unique
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could probably be designed better tbh. I was just trying to get it to work as quickly as possible.
This commit fixes a bug where the lock guard (for concurrently accessing the same scope from different threads) had basically no effect, due to being bound to a temporary only.
fix(compiler-llvm) Remove an unused import
Now, you can import memories, tables, and globals like such: