Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
67 lines (61 loc) · 2.12 KB

File metadata and controls

67 lines (61 loc) · 2.12 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* @license
* Copyright 2019 The Emscripten Authors
* SPDX-License-Identifier: MIT
*/
// Create the wasm memory. (Note: this only applies if IMPORTED_MEMORY is defined)
#if !IMPORTED_MEMORY
{{{ throw "this file should not be be included when IMPORTED_MEMORY is set"; }}}
#endif
#if USE_PTHREADS
if (ENVIRONMENT_IS_PTHREAD) {
wasmMemory = Module['wasmMemory'];
buffer = Module['buffer'];
} else {
#endif // USE_PTHREADS
#if expectToReceiveOnModule('wasmMemory')
if (Module['wasmMemory']) {
wasmMemory = Module['wasmMemory'];
} else
#endif
{
wasmMemory = new WebAssembly.Memory({
'initial': INITIAL_MEMORY / {{{ WASM_PAGE_SIZE }}},
#if ALLOW_MEMORY_GROWTH
// In theory we should not need to emit the maximum if we want "unlimited"
// or 4GB of memory, but VMs error on that atm, see
// https://github.com/emscripten-core/emscripten/issues/14130
// And in the pthreads case we definitely need to emit a maximum. So
// always emit one.
'maximum': {{{ MAXIMUM_MEMORY }}} / {{{ WASM_PAGE_SIZE }}}
#else
'maximum': INITIAL_MEMORY / {{{ WASM_PAGE_SIZE }}}
#endif // ALLOW_MEMORY_GROWTH
#if SHARED_MEMORY
,
'shared': true
#endif
});
#if SHARED_MEMORY
if (!(wasmMemory.buffer instanceof SharedArrayBuffer)) {
err('requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag');
if (ENVIRONMENT_IS_NODE) {
console.log('(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)');
}
throw Error('bad memory');
}
#endif
}
#if USE_PTHREADS
}
#endif
if (wasmMemory) {
buffer = wasmMemory.buffer;
}
// If the user provides an incorrect length, just use that length instead rather than providing the user to
// specifically provide the memory length with Module['INITIAL_MEMORY'].
INITIAL_MEMORY = buffer.byteLength;
#if ASSERTIONS
assert(INITIAL_MEMORY % {{{ WASM_PAGE_SIZE }}} === 0);
#endif
updateGlobalBufferAndViews(buffer);
Morty Proxy This is a proxified and sanitized view of the page, visit original site.