Skip to content

Commit 158359c

Browse files
Allow components to have multiple memories.
Viceroy currently uses arbitrary values for the number of instances and tables allowed in components. Use a similarly arbitrary number of memories as well.
1 parent 24f796f commit 158359c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/linking.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ pub struct Limiter {
2121

2222
impl Default for Limiter {
2323
fn default() -> Self {
24-
Limiter::new(1, 1)
24+
Limiter::new(1, 1, 1)
2525
}
2626
}
2727

2828
impl Limiter {
29-
fn new(max_instances: usize, max_tables: usize) -> Self {
29+
fn new(max_instances: usize, max_memories: usize, max_tables: usize) -> Self {
3030
Limiter {
3131
memory_allocated: 0,
3232
internal: StoreLimitsBuilder::new()
3333
.instances(max_instances)
34-
.memories(1)
34+
.memories(max_memories)
3535
.memory_size(128 * 1024 * 1024)
3636
.table_elements(98765)
3737
.tables(max_tables)
@@ -159,7 +159,7 @@ impl ComponentCtx {
159159
wasi_random: wasmtime_wasi::random::WasiRandomCtx::default(),
160160
session,
161161
guest_profiler: guest_profiler.map(Box::new),
162-
limiter: Limiter::new(100, 100),
162+
limiter: Limiter::new(100, 100, 100),
163163
};
164164
let mut store = Store::new(ctx.engine(), wasm_ctx);
165165
store.set_epoch_deadline(1);

0 commit comments

Comments
 (0)