@@ -990,9 +990,6 @@ function createWasm() {
990990#endif
991991 updateMemoryViews ( ) ;
992992#endif
993- #if ! MEM_INIT_IN_WASM
994- runMemoryInitializer ( ) ;
995- #endif
996993
997994#if '$wasmTable' in addedLibraryItems && ! RELOCATABLE
998995 wasmTable = wasmExports [ '__indirect_function_table' ] ;
@@ -1140,88 +1137,6 @@ function getCompilerSetting(name) {
11401137}
11411138#endif // RETAIN_COMPILER_SETTINGS
11421139
1143- #if ! MEM_INIT_IN_WASM
1144- var memoryInitializer = < << MEM_INITIALIZER > >> ;
1145-
1146- function runMemoryInitializer ( ) {
1147- #if PTHREADS
1148- if ( ENVIRONMENT_IS_PTHREAD ) return ;
1149- #endif
1150- if ( ! isDataURI ( memoryInitializer ) ) {
1151- memoryInitializer = locateFile ( memoryInitializer ) ;
1152- }
1153- if ( ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL ) {
1154- var data = readBinary ( memoryInitializer ) ;
1155- HEAPU8 . set ( data , { { { GLOBAL_BASE } } } ) ;
1156- } else {
1157- addRunDependency ( 'memory initializer' ) ;
1158- var applyMemoryInitializer = ( data ) => {
1159- if ( data . byteLength ) data = new Uint8Array ( data ) ;
1160- #if ASSERTIONS
1161- for ( var i = 0 ; i < data . length ; i ++ ) {
1162- assert ( HEAPU8 [ { { { GLOBAL_BASE } } } + i ] === 0 , "area for memory initializer should not have been touched before it's loaded" ) ;
1163- }
1164- #endif
1165- HEAPU8 . set ( data , { { { GLOBAL_BASE } } } ) ;
1166- // Delete the typed array that contains the large blob of the memory initializer request response so that
1167- // we won't keep unnecessary memory lying around. However, keep the XHR object itself alive so that e.g.
1168- // its .status field can still be accessed later.
1169- if ( Module [ 'memoryInitializerRequest' ] ) delete Module [ 'memoryInitializerRequest' ] . response ;
1170- removeRunDependency ( 'memory initializer' ) ;
1171- } ;
1172- var doBrowserLoad = ( ) => {
1173- readAsync ( memoryInitializer , applyMemoryInitializer , ( ) => {
1174- var e = new Error ( 'could not load memory initializer ' + memoryInitializer ) ;
1175- #if MODULARIZE
1176- readyPromiseReject ( e ) ;
1177- #else
1178- throw e ;
1179- #endif
1180- } ) ;
1181- } ;
1182- #if SUPPORT_BASE64_EMBEDDING
1183- var memoryInitializerBytes = tryParseAsDataURI ( memoryInitializer ) ;
1184- if ( memoryInitializerBytes ) {
1185- applyMemoryInitializer ( memoryInitializerBytes . buffer ) ;
1186- } else
1187- #endif
1188- if ( Module [ 'memoryInitializerRequest' ] ) {
1189- // a network request has already been created, just use that
1190- var useRequest = ( ) => {
1191- var request = Module [ 'memoryInitializerRequest' ] ;
1192- var response = request . response ;
1193- if ( request . status !== 200 && request . status !== 0 ) {
1194- #if SUPPORT_BASE64_EMBEDDING
1195- var data = tryParseAsDataURI ( Module [ 'memoryInitializerRequestURL' ] ) ;
1196- if ( data ) {
1197- response = data . buffer ;
1198- } else {
1199- #endif
1200- // If you see this warning, the issue may be that you are using locateFile and defining it in JS. That
1201- // means that the HTML file doesn't know about it, and when it tries to create the mem init request early, does it to the wrong place.
1202- // Look in your browser's devtools network console to see what's going on.
1203- console . warn ( 'a problem seems to have happened with Module.memoryInitializerRequest, status: ' + request . status + ', retrying ' + memoryInitializer ) ;
1204- doBrowserLoad ( ) ;
1205- return ;
1206- #if SUPPORT_BASE64_EMBEDDING
1207- }
1208- #endif
1209- }
1210- applyMemoryInitializer ( response ) ;
1211- } ;
1212- if ( Module [ 'memoryInitializerRequest' ] . response ) {
1213- setTimeout ( useRequest , 0 ) ; // it's already here; but, apply it asynchronously
1214- } else {
1215- Module [ 'memoryInitializerRequest' ] . addEventListener ( 'load' , useRequest ) ; // wait for it
1216- }
1217- } else {
1218- // fetch it from the network ourselves
1219- doBrowserLoad ( ) ;
1220- }
1221- }
1222- }
1223- #endif // MEM_INIT_IN_WASM == 0
1224-
12251140#if MAIN_MODULE && ASYNCIFY
12261141// With MAIN_MODULE + ASYNCIFY the normal method of placing stub functions in
12271142// wasmImports for as-yet-undefined symbols doesn't work since ASYNCIFY then
0 commit comments