From b0eefc097d2c5270a1a463700335826f156460ea Mon Sep 17 00:00:00 2001 From: Aleksander Guryanov Date: Tue, 23 Jul 2019 11:46:16 +0700 Subject: [PATCH] publish: 6.22.30 --- CMakeLists.txt | 30 ++++++++++++++----- dist/docs/api/js-dos-ts/js-dos-build.md | 10 +++---- .../src/debug/debug.cpp | 2 +- .../src/dos/dos_programs.cpp | 4 +-- .../src/dosbox.cpp | 10 +++++-- .../src/gui/sdlmain.cpp | 2 +- js-dos-ts/js-dos-build.ts | 10 +++---- package.json | 2 +- 8 files changed, 45 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03cf5994..f591dab2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,32 +1,40 @@ cmake_minimum_required(VERSION 3.6) +set(ASYNCIFY OFF) +set(EMTERPRETIFY ON) + if(${EMSCRIPTEN}) + set(OPT_FLAG "-O3") set(USE_PORTS "-s USE_ZLIB=1") - set(CMAKE_C_FLAGS "-Oz -w -Werror=return-type ${USE_PORTS}") + set(CMAKE_C_FLAGS "${OPT_FLAG} -w -Werror=return-type ${USE_PORTS}") set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${USE_PORTS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \ ${USE_PORTS} \ - -Oz \ + ${OPT_FLAG} \ + -s TOTAL_STACK=1MB \ + -s MALLOC=emmalloc \ --emit-symbol-map \ -s EXIT_RUNTIME=1 \ -s ASSERTIONS=0 \ -s SAFE_HEAP=0 \ -s TOTAL_MEMORY=67108864 \ -s ALLOW_MEMORY_GROWTH=1 \ - -s TOTAL_STACK=1MB \ - -s MALLOC=emmalloc \ -s INVOKE_RUN=0 \ -s MODULARIZE=1 \ -s EXPORT_NAME='WDOSBOX' \ -s FORCE_FILESYSTEM=1 \ - -s ASYNCIFY \ -s EXTRA_EXPORTED_RUNTIME_METHODS=\"['getMemory', 'addRunDependency', 'removeRunDependency','FS', 'FS_createPath', 'FS_createPreloadedFile', \ 'FS_createDataFile', 'lengthBytesUTF8', 'stringToUTF8', 'UTF16ToString']\" \ -s NO_EXIT_RUNTIME=1 \ -s ERROR_ON_UNDEFINED_SYMBOLS=0") add_definitions(-DEMSCRIPTEN) -# -s ASYNCIFY_IGNORE_INDIRECT \ -# -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s EMTERPRETIFY_WHITELIST=@${CMAKE_CURRENT_LIST_DIR}/js-dos-cpp/emterpretify.txt \ + + if(ASYNCIFY) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ASYNCIFY") + # -s ASYNCIFY_IGNORE_INDIRECT \ + elseif(EMTERPRETIFY) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s EMTERPRETIFY_WHITELIST=@${CMAKE_CURRENT_LIST_DIR}/js-dos-cpp/emterpretify.txt") + endif() else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type -Wno-deprecated") add_definitions(-DDEBUG -DEMSCRIPTEN_KEEPALIVE=) @@ -35,7 +43,13 @@ else() endif() add_definitions(-DHAVE_CONFIG_H -DGET_X86_FUNCTIONS -DJSDOS) -add_definitions(-DEMTERPRETER_SYNC) + +if(ASYNCIFY) + add_definitions(-DEMTERPRETER_SYNC -DASYNCIFY -Demscripten_sleep_with_yield=emscripten_sleep) +elseif(EMTERPRETIFY) + add_definitions(-DEMTERPRETER_SYNC) +endif() + include( "${CMAKE_CURRENT_LIST_DIR}/3rd-party/3rd-party.cmake" diff --git a/dist/docs/api/js-dos-ts/js-dos-build.md b/dist/docs/api/js-dos-ts/js-dos-build.md index 80d4c513..b8000c41 100644 --- a/dist/docs/api/js-dos-ts/js-dos-build.md +++ b/dist/docs/api/js-dos-ts/js-dos-build.md @@ -20,11 +20,11 @@ gulpfile.js --> generateBuildInfo ``` export const Build = { - version: "6.22.29 (e54c8c8bec01ad1a072f1b0f430cc492)", - jsVersion: "0465870325e768eb26cc06b00d920fc94314efc7", - jsSize: 197174, - wasmVersion: "c22105169b59875d7b46cd156a6e7c17", - wasmSize: 2851969, + version: "6.22.30 (a7b59eaf2e131f1b5328a04f3c33a613)", + jsVersion: "7a9b47b1c3ba95d95d4d2bb58b9248ae603f7479", + jsSize: 502767, + wasmVersion: "8ec72e090a255b8554388f6b0d12602c", + wasmSize: 2297225, }; diff --git a/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/debug/debug.cpp b/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/debug/debug.cpp index 59a2eaef..60819636 100644 --- a/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/debug/debug.cpp +++ b/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/debug/debug.cpp @@ -1825,7 +1825,7 @@ Bitu DEBUG_Loop(void) { PIC_runIRQs(); #if defined(JSDOS) #if defined(EMTERPRETER_SYNC) - emscripten_sleep(1); + emscripten_sleep_with_yield(1); #endif #else SDL_Delay(1); diff --git a/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/dos/dos_programs.cpp b/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/dos/dos_programs.cpp index 843e0477..f8648eae 100644 --- a/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/dos/dos_programs.cpp +++ b/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/dos/dos_programs.cpp @@ -1548,7 +1548,7 @@ class WGET : public Program { /* Emscripten won't allow a sync fetch: * https://kripken.github.io/emscripten-site/docs/api_reference/fetch.html#synchronous-fetches * The program instead waits for these to be called, looping and calling - * emscripten_sleep(). + * emscripten_sleep_with_yield(). */ bool WGET::fetchsuccess = false, WGET::fetchdone = false; void WGET::downloadSucceeded(emscripten_fetch_t *fetch) { @@ -1598,7 +1598,7 @@ void WGET::Run(void) { attr.onerror = downloadFailed; fetchdone = false; emscripten_fetch_t *fetch = emscripten_fetch(&attr, url.c_str()); - while (!fetchdone) emscripten_sleep(10); + while (!fetchdone) emscripten_sleep_with_yield(10); if (fetchsuccess) { Bit16u fhandle; if (!DOS_CreateFile(outname.c_str(),OPEN_WRITE,&fhandle)) { diff --git a/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/dosbox.cpp b/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/dosbox.cpp index 98f745c0..8471306a 100644 --- a/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/dosbox.cpp +++ b/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/dosbox.cpp @@ -153,9 +153,15 @@ bool doHeapOperation() { #if defined(EMTERPRETER_SYNC) && defined(EMSCRIPTEN) +#if defined(ASYNCIFY) bool isNormalState = EM_ASM_INT(( return Asyncify.state === 0 ? 1 : 0; )) == 1; +#else + bool isNormalState = EM_ASM_INT(( + return EmterpreterAsync.state === 0 ? 1 : 0; + )) == 1; +#endif if (!isNormalState) { return false; @@ -204,7 +210,7 @@ static Bitu Normal_Loop(void) { if (SDL_TICKS_PASSED(ticksEntry, last_sleep + 10)) { if (nosleep_lock == 0) { last_sleep = ticksEntry; - emscripten_sleep(1); + emscripten_sleep_with_yield(1); ticksEntry = GetTicks(); } else if (SDL_TICKS_PASSED(ticksEntry, last_sleep + 2000) && !SDL_TICKS_PASSED(ticksEntry, last_loop + 200)) { @@ -409,7 +415,7 @@ static Bitu Normal_Loop(void) { #elif defined(EMTERPRETER_SYNC) if (nosleep_lock == 0) { last_sleep = ticksNew; - emscripten_sleep(1); + emscripten_sleep_with_yield(1); } #endif ticksDone -= GetTicks() - ticksNew; diff --git a/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/gui/sdlmain.cpp b/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/gui/sdlmain.cpp index 06b5d700..1278f805 100644 --- a/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/gui/sdlmain.cpp +++ b/dreamlayers-em-dosbox-em-dosbox-svn-sdl2/src/gui/sdlmain.cpp @@ -2089,7 +2089,7 @@ static void GUI_StartUp(Section * sec) { } if (exit_splash) break; #if defined(JSDOS) && defined(EMTERPRETER_SYNC) - emscripten_sleep(1); + emscripten_sleep_with_yield(1); #endif if (ct<1) { diff --git a/js-dos-ts/js-dos-build.ts b/js-dos-ts/js-dos-build.ts index 1e97f6b8..b5524a37 100644 --- a/js-dos-ts/js-dos-build.ts +++ b/js-dos-ts/js-dos-build.ts @@ -3,9 +3,9 @@ // gulpfile.js --> generateBuildInfo export const Build = { - version: "6.22.29 (e54c8c8bec01ad1a072f1b0f430cc492)", - jsVersion: "0465870325e768eb26cc06b00d920fc94314efc7", - jsSize: 197174, - wasmVersion: "c22105169b59875d7b46cd156a6e7c17", - wasmSize: 2851969, + version: "6.22.30 (a7b59eaf2e131f1b5328a04f3c33a613)", + jsVersion: "7a9b47b1c3ba95d95d4d2bb58b9248ae603f7479", + jsSize: 502767, + wasmVersion: "8ec72e090a255b8554388f6b0d12602c", + wasmSize: 2297225, }; diff --git a/package.json b/package.json index 73064bf2..5a832135 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "js-dos", - "version": "6.22.29", + "version": "6.22.30", "description": "Easiest API to run dos programs in browser", "main": "dist/js-dos.js", "types": "dist/typescript/js-dos.ts",