Skip to content

Commit

Permalink
Support 4GB of memory both in initial and max.
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Apr 2, 2020
1 parent fcf603f commit a054341
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions document/js-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1126,8 +1126,7 @@ In practice, an implementation may run out of resources for valid modules below
<li>The maximum size of a table is 10000000.</li>
<li>The maximum number of table entries in any table initialization is 10000000.</li>
<li>The maximum number of memories, including declared or imported memories, is 1.</li>
<li>The initial number of pages for any memory, declared or imported, is at most 32767.</li>
<li>The maximum number of pages for any memory, declared or imported, is at most 65536.</li>
<li>The initial or maximum number of pages for any memory, declared or imported, is at most 65536.</li>

<li>The maximum number of parameters to any function is 1000.</li>
<li>The maximum number of return values for any function is 1.</li>
Expand Down
11 changes: 5 additions & 6 deletions test/js-api/limits.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const kJSEmbeddingMaxExports = 100000;
const kJSEmbeddingMaxGlobals = 1000000;
const kJSEmbeddingMaxDataSegments = 100000;

const kJSEmbeddingMaxInitialMemoryPages = 32767;
const kJSEmbeddingMaxMaximumMemoryPages = 65536;
const kJSEmbeddingMaxMemoryPages = 65536;
const kJSEmbeddingMaxModuleSize = 1024 * 1024 * 1024; // = 1 GiB
const kJSEmbeddingMaxFunctionSize = 7654321;
const kJSEmbeddingMaxFunctionLocals = 50000;
Expand Down Expand Up @@ -110,22 +109,22 @@ testLimit("data segments", 1, kJSEmbeddingMaxDataSegments, (builder, count) => {
}
});

testLimit("initial declared memory pages", 1, kJSEmbeddingMaxInitialMemoryPages,
testLimit("initial declared memory pages", 1, kJSEmbeddingMaxMemoryPages,
(builder, count) => {
builder.addMemory(count, undefined, false, false);
});

testLimit("maximum declared memory pages", 1, kJSEmbeddingMaxMaximumMemoryPages,
testLimit("maximum declared memory pages", 1, kJSEmbeddingMaxMemoryPages,
(builder, count) => {
builder.addMemory(1, count, false, false);
});

testLimit("initial imported memory pages", 1, kJSEmbeddingMaxInitialMemoryPages,
testLimit("initial imported memory pages", 1, kJSEmbeddingMaxMemoryPages,
(builder, count) => {
builder.addImportedMemory("mod", "mem", count, undefined);
});

testLimit("maximum imported memory pages", 1, kJSEmbeddingMaxMaximumMemoryPages,
testLimit("maximum imported memory pages", 1, kJSEmbeddingMaxMemoryPages,
(builder, count) => {
builder.addImportedMemory("mod", "mem", 1, count);
});
Expand Down

0 comments on commit a054341

Please sign in to comment.