AssemblyScript / binaryen.js

A buildbot for browser & Node.js builds of Binaryen, a compiler infrastructure and toolchain library for WebAssembly.
http://github.com/WebAssembly/binaryen
Apache License 2.0
360 stars 50 forks source link

Add patch and apply patch for binaryen's CMakeList.txt #54

Closed MaxGraey closed 2 years ago

MaxGraey commented 2 years ago

Patch content:

@@ -258,12 +258,7 @@
   endif()
   add_debug_compile_flag("-O0")
   add_debug_compile_flag("-g3")
-  if(EMSCRIPTEN)
-    # really focus on minimizing output size when compiling sources
-    add_nondebug_compile_flag("-Oz")
-  else()
-    add_nondebug_compile_flag("-O2")
-  endif()
+  add_nondebug_compile_flag("-O2")
   if(BYN_ENABLE_ASSERTIONS)
     # On non-Debug builds cmake automatically defines NDEBUG, so we
     # explicitly undefine it:
@@ -375,6 +370,7 @@
   target_link_libraries(binaryen_wasm optimized "--closure 1")
   target_link_libraries(binaryen_wasm optimized "--closure-args \"--language_in=ECMASCRIPT6 --language_out=ECMASCRIPT6\"")
   target_link_libraries(binaryen_wasm optimized "-flto")
+  target_link_libraries(binaryen_wasm optimized "-msign-ext") # enable sign-extending proposal
   target_link_libraries(binaryen_wasm debug "--profiling")
   set_property(TARGET binaryen_wasm PROPERTY CXX_STANDARD ${CXX_STANDARD})
   set_property(TARGET binaryen_wasm PROPERTY CXX_STANDARD_REQUIRED ON)
dcodeIO commented 2 years ago

Gave this a try, and optimizing the bootstrapped AS compiler goes from ~59 seconds to ~15 (lol).