diff --git a/example/memory.c b/example/memory.c index edd4eba..3d9fcbc 100644 --- a/example/memory.c +++ b/example/memory.c @@ -200,7 +200,7 @@ int main(int argc, const char* argv[]) { // Create stand-alone memory. // TODO(wasm+): Once Wasm allows multiple memories, turn this into import. printf("Creating stand-alone memory...\n"); - wasm_limits_t limits = {5, 5}; + wasm_limits_t limits = {5, 5, false}; own wasm_memorytype_t* memorytype = wasm_memorytype_new(&limits); own wasm_memory_t* memory2 = wasm_memory_new(store, memorytype); check(wasm_memory_size(memory2) == 5); diff --git a/example/reflect.c b/example/reflect.c index 0a7099f..c94d106 100644 --- a/example/reflect.c +++ b/example/reflect.c @@ -17,6 +17,7 @@ void print_mutability(wasm_mutability_t mut) { void print_limits(const wasm_limits_t* limits) { printf("%ud", limits->min); if (limits->max < wasm_limits_max_default) printf(" %ud", limits->max); + if (limits->shared) printf(" shared"); } void print_valtype(const wasm_valtype_t* type) { diff --git a/example/table.c b/example/table.c index 5e91a34..9404076 100644 --- a/example/table.c +++ b/example/table.c @@ -192,7 +192,7 @@ int main(int argc, const char* argv[]) { // Create stand-alone table. // TODO(wasm+): Once Wasm allows multiple tables, turn this into import. printf("Creating stand-alone table...\n"); - wasm_limits_t limits = {5, 5}; + wasm_limits_t limits = {5, 5, false}; own wasm_tabletype_t* tabletype = wasm_tabletype_new(wasm_valtype_new(WASM_FUNCREF), &limits); own wasm_table_t* table2 = wasm_table_new(store, tabletype, NULL); diff --git a/include/wasm.h b/include/wasm.h index 99a35da..50a0529 100644 --- a/include/wasm.h +++ b/include/wasm.h @@ -158,6 +158,7 @@ enum wasm_mutability_enum { typedef struct wasm_limits_t { uint32_t min; uint32_t max; + bool shared; } wasm_limits_t; static const uint32_t wasm_limits_max_default = 0xffffffff; diff --git a/include/wasm.hh b/include/wasm.hh index c98a1f4..08a78ae 100644 --- a/include/wasm.hh +++ b/include/wasm.hh @@ -256,9 +256,10 @@ enum class Mutability : uint8_t { CONST, VAR }; struct Limits { uint32_t min; uint32_t max; + bool shared; - Limits(uint32_t min, uint32_t max = std::numeric_limits::max()) : - min(min), max(max) {} + Limits(uint32_t min, uint32_t max = std::numeric_limits::max(), bool shared = false) : + min(min), max(max), shared(shared) {} };