webruby 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/webruby +36 -0
- data/driver/driver.c +50 -0
- data/driver/main.c +40 -0
- data/lib/webruby/app.rb +13 -0
- data/lib/webruby/config.rb +61 -0
- data/lib/webruby/environment.rb +32 -0
- data/lib/webruby/rake/files.rake +66 -0
- data/lib/webruby/rake/general.rake +22 -0
- data/lib/webruby/rake/mruby.rake +44 -0
- data/lib/webruby/utility.rb +132 -0
- data/lib/webruby.rb +10 -0
- data/modules/emscripten/AUTHORS +89 -0
- data/modules/emscripten/LICENSE +68 -0
- data/modules/emscripten/README.markdown +14 -0
- data/modules/emscripten/cmake/Platform/Emscripten.cmake +61 -0
- data/modules/emscripten/cmake/Platform/Emscripten_unix.cmake +24 -0
- data/modules/emscripten/em++ +12 -0
- data/modules/emscripten/em++.bat +2 -0
- data/modules/emscripten/em-config +24 -0
- data/modules/emscripten/em-config.bat +2 -0
- data/modules/emscripten/emar +24 -0
- data/modules/emscripten/emar.bat +2 -0
- data/modules/emscripten/emcc +1744 -0
- data/modules/emscripten/emcc.bat +2 -0
- data/modules/emscripten/emcc.py +5 -0
- data/modules/emscripten/emconfigure +27 -0
- data/modules/emscripten/emconfigure.bat +2 -0
- data/modules/emscripten/emlibtool +11 -0
- data/modules/emscripten/emlibtool.bat +2 -0
- data/modules/emscripten/emlink.py +293 -0
- data/modules/emscripten/emmake +29 -0
- data/modules/emscripten/emmake.bat +2 -0
- data/modules/emscripten/emranlib +9 -0
- data/modules/emscripten/emranlib.bat +2 -0
- data/modules/emscripten/emscons +20 -0
- data/modules/emscripten/emscripten.py +835 -0
- data/modules/emscripten/patches/README +4 -0
- data/modules/emscripten/patches/series +2 -0
- data/modules/emscripten/scons-tools/closure.py +28 -0
- data/modules/emscripten/scons-tools/emscripten.py +359 -0
- data/modules/emscripten/scons-tools/llvm.py +33 -0
- data/modules/emscripten/src/analyzer.js +1695 -0
- data/modules/emscripten/src/compiler.html +48 -0
- data/modules/emscripten/src/compiler.js +298 -0
- data/modules/emscripten/src/corruptionCheck.js +98 -0
- data/modules/emscripten/src/determinstic.js +20 -0
- data/modules/emscripten/src/embind/embind.js +1677 -0
- data/modules/emscripten/src/embind/emval.js +283 -0
- data/modules/emscripten/src/experimental/allow_loopvars_from_memsetcpy_inasm.diff +97 -0
- data/modules/emscripten/src/experimental/batching.diff +44 -0
- data/modules/emscripten/src/experimental/functypeopt.diff +113 -0
- data/modules/emscripten/src/experimental/multiple_heaps.diff +175 -0
- data/modules/emscripten/src/experimental/noncallgraphprofiling.diff +197 -0
- data/modules/emscripten/src/experimental/optimize_memcpy_for_ta1.diff +124 -0
- data/modules/emscripten/src/experimental/remove__label__s.diff +140 -0
- data/modules/emscripten/src/experimental/renderer_cache_hash.diff +99 -0
- data/modules/emscripten/src/experimental/sdl_key_forwarding.diff +57 -0
- data/modules/emscripten/src/experimental/simplifyGeneratedFunctionsDetection.diff +336 -0
- data/modules/emscripten/src/experimental/stringCache.diff +147 -0
- data/modules/emscripten/src/fastLong.js +299 -0
- data/modules/emscripten/src/framework.js +257 -0
- data/modules/emscripten/src/gl-matrix.js +1952 -0
- data/modules/emscripten/src/headless.js +904 -0
- data/modules/emscripten/src/intertyper.js +1050 -0
- data/modules/emscripten/src/jsifier.js +1827 -0
- data/modules/emscripten/src/library.js +8270 -0
- data/modules/emscripten/src/library_browser.js +911 -0
- data/modules/emscripten/src/library_egl.js +491 -0
- data/modules/emscripten/src/library_gc.js +236 -0
- data/modules/emscripten/src/library_gl.js +4452 -0
- data/modules/emscripten/src/library_glfw.js +576 -0
- data/modules/emscripten/src/library_glut.js +449 -0
- data/modules/emscripten/src/library_jansson.js +320 -0
- data/modules/emscripten/src/library_openal.js +602 -0
- data/modules/emscripten/src/library_sdl.js +2024 -0
- data/modules/emscripten/src/library_strtok_r.c +97 -0
- data/modules/emscripten/src/library_xlib.js +23 -0
- data/modules/emscripten/src/long.js +1609 -0
- data/modules/emscripten/src/modules.js +491 -0
- data/modules/emscripten/src/parseTools.js +2474 -0
- data/modules/emscripten/src/postamble.js +170 -0
- data/modules/emscripten/src/postamble_sharedlib.js +16 -0
- data/modules/emscripten/src/preamble.js +914 -0
- data/modules/emscripten/src/preamble_sharedlib.js +25 -0
- data/modules/emscripten/src/relooper/README.markdown +14 -0
- data/modules/emscripten/src/relooper/Relooper.cpp +1236 -0
- data/modules/emscripten/src/relooper/Relooper.h +250 -0
- data/modules/emscripten/src/relooper/doit.sh +70 -0
- data/modules/emscripten/src/relooper/emscripten/glue.js +57 -0
- data/modules/emscripten/src/relooper/emscripten/test.js +44 -0
- data/modules/emscripten/src/relooper/fuzzer.py +116 -0
- data/modules/emscripten/src/relooper/ministring.h +35 -0
- data/modules/emscripten/src/relooper/paper.pdf +0 -0
- data/modules/emscripten/src/relooper/test.cpp +262 -0
- data/modules/emscripten/src/relooper/test.txt +155 -0
- data/modules/emscripten/src/relooper/test2.c +44 -0
- data/modules/emscripten/src/relooper/test2.txt +12 -0
- data/modules/emscripten/src/relooper/test3.c +42 -0
- data/modules/emscripten/src/relooper/test3.txt +27 -0
- data/modules/emscripten/src/relooper/test4.cpp +40 -0
- data/modules/emscripten/src/relooper/test4.txt +23 -0
- data/modules/emscripten/src/relooper/test5.cpp +40 -0
- data/modules/emscripten/src/relooper/test5.txt +32 -0
- data/modules/emscripten/src/relooper/test6.cpp +31 -0
- data/modules/emscripten/src/relooper/test6.txt +12 -0
- data/modules/emscripten/src/relooper/test_dead.cpp +28 -0
- data/modules/emscripten/src/relooper/test_dead.txt +9 -0
- data/modules/emscripten/src/relooper/test_debug.cpp +30 -0
- data/modules/emscripten/src/relooper/test_debug.txt +128 -0
- data/modules/emscripten/src/relooper/test_fuzz1.cpp +52 -0
- data/modules/emscripten/src/relooper/test_fuzz1.txt +32 -0
- data/modules/emscripten/src/relooper/test_fuzz2.cpp +34 -0
- data/modules/emscripten/src/relooper/test_fuzz2.txt +13 -0
- data/modules/emscripten/src/relooper/test_fuzz3.cpp +36 -0
- data/modules/emscripten/src/relooper/test_fuzz3.txt +9 -0
- data/modules/emscripten/src/relooper/test_fuzz4.cpp +38 -0
- data/modules/emscripten/src/relooper/test_fuzz4.txt +19 -0
- data/modules/emscripten/src/relooper/test_fuzz5.cpp +57 -0
- data/modules/emscripten/src/relooper/test_fuzz5.txt +52 -0
- data/modules/emscripten/src/relooper/test_fuzz6.cpp +322 -0
- data/modules/emscripten/src/relooper/test_fuzz6.txt +108 -0
- data/modules/emscripten/src/relooper/test_inf.cpp +813 -0
- data/modules/emscripten/src/relooper/test_inf.txt +385 -0
- data/modules/emscripten/src/relooper/testit.sh +62 -0
- data/modules/emscripten/src/relooper/updateit.sh +17 -0
- data/modules/emscripten/src/relooper.js +11516 -0
- data/modules/emscripten/src/relooper.js.raw.js +11511 -0
- data/modules/emscripten/src/runtime.js +546 -0
- data/modules/emscripten/src/settings.js +1284 -0
- data/modules/emscripten/src/shell.html +92 -0
- data/modules/emscripten/src/shell.js +153 -0
- data/modules/emscripten/src/shell_sharedlib.js +12 -0
- data/modules/emscripten/src/socket.io.js +3870 -0
- data/modules/emscripten/src/utility.js +379 -0
- data/modules/emscripten/src/wrtcp.js +821 -0
- data/modules/emscripten/system/include/AL/al.h +172 -0
- data/modules/emscripten/system/include/AL/alc.h +84 -0
- data/modules/emscripten/system/include/EGL/egl.h +329 -0
- data/modules/emscripten/system/include/EGL/eglext.h +398 -0
- data/modules/emscripten/system/include/EGL/eglplatform.h +141 -0
- data/modules/emscripten/system/include/GL/freeglut_std.h +628 -0
- data/modules/emscripten/system/include/GL/gl.h +2241 -0
- data/modules/emscripten/system/include/GL/glew.h +6 -0
- data/modules/emscripten/system/include/GL/glext.h +11127 -0
- data/modules/emscripten/system/include/GL/glfw.h +518 -0
- data/modules/emscripten/system/include/GL/glu.h +353 -0
- data/modules/emscripten/system/include/GL/glut.h +21 -0
- data/modules/emscripten/system/include/GLES/gl.h +770 -0
- data/modules/emscripten/system/include/GLES/glext.h +1278 -0
- data/modules/emscripten/system/include/GLES/glplatform.h +30 -0
- data/modules/emscripten/system/include/GLES2/gl2.h +621 -0
- data/modules/emscripten/system/include/GLES2/gl2ext.h +803 -0
- data/modules/emscripten/system/include/GLES2/gl2platform.h +30 -0
- data/modules/emscripten/system/include/KHR/khrplatform.h +277 -0
- data/modules/emscripten/system/include/SDL/COPYING +19 -0
- data/modules/emscripten/system/include/SDL/SDL.h +162 -0
- data/modules/emscripten/system/include/SDL/SDL_assert.h +241 -0
- data/modules/emscripten/system/include/SDL/SDL_atomic.h +318 -0
- data/modules/emscripten/system/include/SDL/SDL_audio.h +509 -0
- data/modules/emscripten/system/include/SDL/SDL_blendmode.h +60 -0
- data/modules/emscripten/system/include/SDL/SDL_clipboard.h +75 -0
- data/modules/emscripten/system/include/SDL/SDL_compat.h +365 -0
- data/modules/emscripten/system/include/SDL/SDL_config.h +48 -0
- data/modules/emscripten/system/include/SDL/SDL_config.h.in +297 -0
- data/modules/emscripten/system/include/SDL/SDL_config_android.h +133 -0
- data/modules/emscripten/system/include/SDL/SDL_config_iphoneos.h +148 -0
- data/modules/emscripten/system/include/SDL/SDL_config_macosx.h +172 -0
- data/modules/emscripten/system/include/SDL/SDL_config_minimal.h +74 -0
- data/modules/emscripten/system/include/SDL/SDL_config_nintendods.h +129 -0
- data/modules/emscripten/system/include/SDL/SDL_config_pandora.h +125 -0
- data/modules/emscripten/system/include/SDL/SDL_config_windows.h +207 -0
- data/modules/emscripten/system/include/SDL/SDL_config_wiz.h +119 -0
- data/modules/emscripten/system/include/SDL/SDL_copying.h +20 -0
- data/modules/emscripten/system/include/SDL/SDL_cpuinfo.h +150 -0
- data/modules/emscripten/system/include/SDL/SDL_endian.h +248 -0
- data/modules/emscripten/system/include/SDL/SDL_error.h +77 -0
- data/modules/emscripten/system/include/SDL/SDL_events.h +639 -0
- data/modules/emscripten/system/include/SDL/SDL_gesture.h +91 -0
- data/modules/emscripten/system/include/SDL/SDL_gfxPrimitives.h +246 -0
- data/modules/emscripten/system/include/SDL/SDL_haptic.h +1200 -0
- data/modules/emscripten/system/include/SDL/SDL_hints.h +206 -0
- data/modules/emscripten/system/include/SDL/SDL_image.h +138 -0
- data/modules/emscripten/system/include/SDL/SDL_input.h +87 -0
- data/modules/emscripten/system/include/SDL/SDL_joystick.h +208 -0
- data/modules/emscripten/system/include/SDL/SDL_keyboard.h +169 -0
- data/modules/emscripten/system/include/SDL/SDL_keycode.h +344 -0
- data/modules/emscripten/system/include/SDL/SDL_loadso.h +85 -0
- data/modules/emscripten/system/include/SDL/SDL_log.h +211 -0
- data/modules/emscripten/system/include/SDL/SDL_main.h +98 -0
- data/modules/emscripten/system/include/SDL/SDL_mixer.h +634 -0
- data/modules/emscripten/system/include/SDL/SDL_mouse.h +213 -0
- data/modules/emscripten/system/include/SDL/SDL_mutex.h +248 -0
- data/modules/emscripten/system/include/SDL/SDL_name.h +11 -0
- data/modules/emscripten/system/include/SDL/SDL_opengl.h +11116 -0
- data/modules/emscripten/system/include/SDL/SDL_opengles.h +38 -0
- data/modules/emscripten/system/include/SDL/SDL_opengles2.h +38 -0
- data/modules/emscripten/system/include/SDL/SDL_pixels.h +423 -0
- data/modules/emscripten/system/include/SDL/SDL_platform.h +160 -0
- data/modules/emscripten/system/include/SDL/SDL_power.h +79 -0
- data/modules/emscripten/system/include/SDL/SDL_quit.h +58 -0
- data/modules/emscripten/system/include/SDL/SDL_rect.h +136 -0
- data/modules/emscripten/system/include/SDL/SDL_render.h +615 -0
- data/modules/emscripten/system/include/SDL/SDL_revision.h +2 -0
- data/modules/emscripten/system/include/SDL/SDL_revision.h.orig +2 -0
- data/modules/emscripten/system/include/SDL/SDL_rotozoom.h +123 -0
- data/modules/emscripten/system/include/SDL/SDL_rwops.h +220 -0
- data/modules/emscripten/system/include/SDL/SDL_scancode.h +398 -0
- data/modules/emscripten/system/include/SDL/SDL_shape.h +147 -0
- data/modules/emscripten/system/include/SDL/SDL_stdinc.h +764 -0
- data/modules/emscripten/system/include/SDL/SDL_surface.h +499 -0
- data/modules/emscripten/system/include/SDL/SDL_syswm.h +241 -0
- data/modules/emscripten/system/include/SDL/SDL_thread.h +182 -0
- data/modules/emscripten/system/include/SDL/SDL_timer.h +108 -0
- data/modules/emscripten/system/include/SDL/SDL_touch.h +124 -0
- data/modules/emscripten/system/include/SDL/SDL_ttf.h +249 -0
- data/modules/emscripten/system/include/SDL/SDL_types.h +29 -0
- data/modules/emscripten/system/include/SDL/SDL_version.h +166 -0
- data/modules/emscripten/system/include/SDL/SDL_video.h +820 -0
- data/modules/emscripten/system/include/SDL/begin_code.h +135 -0
- data/modules/emscripten/system/include/SDL/close_code.h +37 -0
- data/modules/emscripten/system/include/X11/X.h +717 -0
- data/modules/emscripten/system/include/X11/Xatom.h +79 -0
- data/modules/emscripten/system/include/X11/Xfuncproto.h +127 -0
- data/modules/emscripten/system/include/X11/Xlib.h +4023 -0
- data/modules/emscripten/system/include/X11/Xosdefs.h +116 -0
- data/modules/emscripten/system/include/X11/Xutil.h +826 -0
- data/modules/emscripten/system/include/X11/keysym.h +73 -0
- data/modules/emscripten/system/include/X11/keysymdef.h +2389 -0
- data/modules/emscripten/system/include/bsd/float.h +91 -0
- data/modules/emscripten/system/include/bsd/readme.txt +2 -0
- data/modules/emscripten/system/include/bsd/sys/mman.h +180 -0
- data/modules/emscripten/system/include/bsd/sys/utsname.h +70 -0
- data/modules/emscripten/system/include/dlfcn.h +31 -0
- data/modules/emscripten/system/include/emscripten/bind.h +1210 -0
- data/modules/emscripten/system/include/emscripten/emscripten.h +388 -0
- data/modules/emscripten/system/include/emscripten/val.h +311 -0
- data/modules/emscripten/system/include/emscripten/wire.h +393 -0
- data/modules/emscripten/system/include/err.h +95 -0
- data/modules/emscripten/system/include/execinfo.h +44 -0
- data/modules/emscripten/system/include/features.h +3 -0
- data/modules/emscripten/system/include/gc.h +70 -0
- data/modules/emscripten/system/include/gfx/png.h +3798 -0
- data/modules/emscripten/system/include/gfx/pngconf.h +1665 -0
- data/modules/emscripten/system/include/gfx/tiff.h +654 -0
- data/modules/emscripten/system/include/gfx/tiffconf.h +104 -0
- data/modules/emscripten/system/include/gfx/tiffio.h +526 -0
- data/modules/emscripten/system/include/gfx/tiffvers.h +9 -0
- data/modules/emscripten/system/include/jansson.h +323 -0
- data/modules/emscripten/system/include/jansson_config.h +54 -0
- data/modules/emscripten/system/include/libc/_ansi.h +135 -0
- data/modules/emscripten/system/include/libc/_syslist.h +40 -0
- data/modules/emscripten/system/include/libc/alloca.h +21 -0
- data/modules/emscripten/system/include/libc/ar.h +69 -0
- data/modules/emscripten/system/include/libc/argz.h +33 -0
- data/modules/emscripten/system/include/libc/assert.h +46 -0
- data/modules/emscripten/system/include/libc/complex.h +124 -0
- data/modules/emscripten/system/include/libc/ctype.h +196 -0
- data/modules/emscripten/system/include/libc/dirent.h +16 -0
- data/modules/emscripten/system/include/libc/endian.h +3 -0
- data/modules/emscripten/system/include/libc/envlock.h +15 -0
- data/modules/emscripten/system/include/libc/envz.h +16 -0
- data/modules/emscripten/system/include/libc/errno.h +11 -0
- data/modules/emscripten/system/include/libc/fastmath.h +13 -0
- data/modules/emscripten/system/include/libc/fcntl.h +1 -0
- data/modules/emscripten/system/include/libc/fnmatch.h +55 -0
- data/modules/emscripten/system/include/libc/getopt.h +196 -0
- data/modules/emscripten/system/include/libc/glob.h +89 -0
- data/modules/emscripten/system/include/libc/grp.h +94 -0
- data/modules/emscripten/system/include/libc/iconv.h +62 -0
- data/modules/emscripten/system/include/libc/ieeefp.h +256 -0
- data/modules/emscripten/system/include/libc/ifaddrs.h +64 -0
- data/modules/emscripten/system/include/libc/inttypes.h +290 -0
- data/modules/emscripten/system/include/libc/iso646.h +43 -0
- data/modules/emscripten/system/include/libc/langinfo.h +316 -0
- data/modules/emscripten/system/include/libc/libgen.h +23 -0
- data/modules/emscripten/system/include/libc/limits.h +155 -0
- data/modules/emscripten/system/include/libc/locale.h +80 -0
- data/modules/emscripten/system/include/libc/machine/_default_types.h +121 -0
- data/modules/emscripten/system/include/libc/machine/_types.h +8 -0
- data/modules/emscripten/system/include/libc/machine/ansi.h +1 -0
- data/modules/emscripten/system/include/libc/machine/endian.h +31 -0
- data/modules/emscripten/system/include/libc/machine/fastmath.h +100 -0
- data/modules/emscripten/system/include/libc/machine/ieeefp.h +376 -0
- data/modules/emscripten/system/include/libc/machine/malloc.h +8 -0
- data/modules/emscripten/system/include/libc/machine/param.h +1 -0
- data/modules/emscripten/system/include/libc/machine/setjmp-dj.h +43 -0
- data/modules/emscripten/system/include/libc/machine/setjmp.h +361 -0
- data/modules/emscripten/system/include/libc/machine/stdlib.h +8 -0
- data/modules/emscripten/system/include/libc/machine/termios.h +1 -0
- data/modules/emscripten/system/include/libc/machine/time.h +19 -0
- data/modules/emscripten/system/include/libc/machine/types.h +30 -0
- data/modules/emscripten/system/include/libc/malloc.h +169 -0
- data/modules/emscripten/system/include/libc/math.h +594 -0
- data/modules/emscripten/system/include/libc/newlib.h +2 -0
- data/modules/emscripten/system/include/libc/paths.h +7 -0
- data/modules/emscripten/system/include/libc/process.h +44 -0
- data/modules/emscripten/system/include/libc/pthread.h +362 -0
- data/modules/emscripten/system/include/libc/pwd.h +78 -0
- data/modules/emscripten/system/include/libc/readme.txt +3 -0
- data/modules/emscripten/system/include/libc/reent.h +183 -0
- data/modules/emscripten/system/include/libc/regdef.h +7 -0
- data/modules/emscripten/system/include/libc/regex.h +102 -0
- data/modules/emscripten/system/include/libc/sched.h +97 -0
- data/modules/emscripten/system/include/libc/search.h +59 -0
- data/modules/emscripten/system/include/libc/setjmp.h +20 -0
- data/modules/emscripten/system/include/libc/signal.h +30 -0
- data/modules/emscripten/system/include/libc/stdarg.h +50 -0
- data/modules/emscripten/system/include/libc/stddef.h +64 -0
- data/modules/emscripten/system/include/libc/stdint.h +493 -0
- data/modules/emscripten/system/include/libc/stdio.h +694 -0
- data/modules/emscripten/system/include/libc/stdlib.h +230 -0
- data/modules/emscripten/system/include/libc/string.h +105 -0
- data/modules/emscripten/system/include/libc/strings.h +35 -0
- data/modules/emscripten/system/include/libc/sys/_default_fcntl.h +223 -0
- data/modules/emscripten/system/include/libc/sys/_types.h +93 -0
- data/modules/emscripten/system/include/libc/sys/cdefs.h +123 -0
- data/modules/emscripten/system/include/libc/sys/config.h +255 -0
- data/modules/emscripten/system/include/libc/sys/custom_file.h +2 -0
- data/modules/emscripten/system/include/libc/sys/dir.h +10 -0
- data/modules/emscripten/system/include/libc/sys/dirent.h +58 -0
- data/modules/emscripten/system/include/libc/sys/errno.h +190 -0
- data/modules/emscripten/system/include/libc/sys/fcntl.h +4 -0
- data/modules/emscripten/system/include/libc/sys/features.h +212 -0
- data/modules/emscripten/system/include/libc/sys/file.h +2 -0
- data/modules/emscripten/system/include/libc/sys/iconvnls.h +77 -0
- data/modules/emscripten/system/include/libc/sys/lock.h +24 -0
- data/modules/emscripten/system/include/libc/sys/param.h +25 -0
- data/modules/emscripten/system/include/libc/sys/queue.h +471 -0
- data/modules/emscripten/system/include/libc/sys/reent.h +843 -0
- data/modules/emscripten/system/include/libc/sys/resource.h +59 -0
- data/modules/emscripten/system/include/libc/sys/sched.h +67 -0
- data/modules/emscripten/system/include/libc/sys/signal.h +314 -0
- data/modules/emscripten/system/include/libc/sys/stat.h +222 -0
- data/modules/emscripten/system/include/libc/sys/stdio.h +27 -0
- data/modules/emscripten/system/include/libc/sys/string.h +2 -0
- data/modules/emscripten/system/include/libc/sys/syslimits.h +65 -0
- data/modules/emscripten/system/include/libc/sys/termios.h +280 -0
- data/modules/emscripten/system/include/libc/sys/time.h +85 -0
- data/modules/emscripten/system/include/libc/sys/timeb.h +39 -0
- data/modules/emscripten/system/include/libc/sys/times.h +28 -0
- data/modules/emscripten/system/include/libc/sys/ttydefaults.h +97 -0
- data/modules/emscripten/system/include/libc/sys/types.h +481 -0
- data/modules/emscripten/system/include/libc/sys/unistd.h +514 -0
- data/modules/emscripten/system/include/libc/sys/utime.h +26 -0
- data/modules/emscripten/system/include/libc/sys/wait.h +40 -0
- data/modules/emscripten/system/include/libc/tar.h +39 -0
- data/modules/emscripten/system/include/libc/termios.h +7 -0
- data/modules/emscripten/system/include/libc/time.h +273 -0
- data/modules/emscripten/system/include/libc/unctrl.h +46 -0
- data/modules/emscripten/system/include/libc/unistd.h +6 -0
- data/modules/emscripten/system/include/libc/utime.h +12 -0
- data/modules/emscripten/system/include/libc/utmp.h +8 -0
- data/modules/emscripten/system/include/libc/wchar.h +194 -0
- data/modules/emscripten/system/include/libc/wctype.h +47 -0
- data/modules/emscripten/system/include/libc/wordexp.h +53 -0
- data/modules/emscripten/system/include/libcxx/CREDITS.TXT +91 -0
- data/modules/emscripten/system/include/libcxx/LICENSE.txt +76 -0
- data/modules/emscripten/system/include/libcxx/__bit_reference +1268 -0
- data/modules/emscripten/system/include/libcxx/__config +485 -0
- data/modules/emscripten/system/include/libcxx/__debug +193 -0
- data/modules/emscripten/system/include/libcxx/__functional_03 +2130 -0
- data/modules/emscripten/system/include/libcxx/__functional_base +437 -0
- data/modules/emscripten/system/include/libcxx/__functional_base_03 +1087 -0
- data/modules/emscripten/system/include/libcxx/__hash_table +1945 -0
- data/modules/emscripten/system/include/libcxx/__locale +1435 -0
- data/modules/emscripten/system/include/libcxx/__mutex_base +438 -0
- data/modules/emscripten/system/include/libcxx/__split_buffer +654 -0
- data/modules/emscripten/system/include/libcxx/__sso_allocator +77 -0
- data/modules/emscripten/system/include/libcxx/__std_stream +317 -0
- data/modules/emscripten/system/include/libcxx/__tree +2293 -0
- data/modules/emscripten/system/include/libcxx/__tuple +305 -0
- data/modules/emscripten/system/include/libcxx/__tuple_03 +27 -0
- data/modules/emscripten/system/include/libcxx/__undef_min_max +19 -0
- data/modules/emscripten/system/include/libcxx/algorithm +5458 -0
- data/modules/emscripten/system/include/libcxx/array +341 -0
- data/modules/emscripten/system/include/libcxx/atomic +1521 -0
- data/modules/emscripten/system/include/libcxx/bitset +1081 -0
- data/modules/emscripten/system/include/libcxx/cassert +25 -0
- data/modules/emscripten/system/include/libcxx/ccomplex +29 -0
- data/modules/emscripten/system/include/libcxx/cctype +164 -0
- data/modules/emscripten/system/include/libcxx/cerrno +393 -0
- data/modules/emscripten/system/include/libcxx/cfenv +82 -0
- data/modules/emscripten/system/include/libcxx/cfloat +78 -0
- data/modules/emscripten/system/include/libcxx/chrono +898 -0
- data/modules/emscripten/system/include/libcxx/cinttypes +259 -0
- data/modules/emscripten/system/include/libcxx/ciso646 +25 -0
- data/modules/emscripten/system/include/libcxx/climits +48 -0
- data/modules/emscripten/system/include/libcxx/clocale +53 -0
- data/modules/emscripten/system/include/libcxx/cmath +1683 -0
- data/modules/emscripten/system/include/libcxx/codecvt +547 -0
- data/modules/emscripten/system/include/libcxx/complex +1526 -0
- data/modules/emscripten/system/include/libcxx/complex.h +35 -0
- data/modules/emscripten/system/include/libcxx/condition_variable +256 -0
- data/modules/emscripten/system/include/libcxx/csetjmp +52 -0
- data/modules/emscripten/system/include/libcxx/csignal +58 -0
- data/modules/emscripten/system/include/libcxx/cstdarg +48 -0
- data/modules/emscripten/system/include/libcxx/cstdbool +32 -0
- data/modules/emscripten/system/include/libcxx/cstddef +103 -0
- data/modules/emscripten/system/include/libcxx/cstdint +191 -0
- data/modules/emscripten/system/include/libcxx/cstdio +175 -0
- data/modules/emscripten/system/include/libcxx/cstdlib +172 -0
- data/modules/emscripten/system/include/libcxx/cstring +112 -0
- data/modules/emscripten/system/include/libcxx/ctgmath +29 -0
- data/modules/emscripten/system/include/libcxx/ctime +72 -0
- data/modules/emscripten/system/include/libcxx/cwchar +208 -0
- data/modules/emscripten/system/include/libcxx/cwctype +213 -0
- data/modules/emscripten/system/include/libcxx/deque +2846 -0
- data/modules/emscripten/system/include/libcxx/exception +250 -0
- data/modules/emscripten/system/include/libcxx/ext/__hash +46 -0
- data/modules/emscripten/system/include/libcxx/ext/hash_map +1003 -0
- data/modules/emscripten/system/include/libcxx/ext/hash_set +657 -0
- data/modules/emscripten/system/include/libcxx/forward_list +1636 -0
- data/modules/emscripten/system/include/libcxx/fstream +1415 -0
- data/modules/emscripten/system/include/libcxx/functional +2063 -0
- data/modules/emscripten/system/include/libcxx/future +2505 -0
- data/modules/emscripten/system/include/libcxx/initializer_list +105 -0
- data/modules/emscripten/system/include/libcxx/iomanip +504 -0
- data/modules/emscripten/system/include/libcxx/ios +988 -0
- data/modules/emscripten/system/include/libcxx/iosfwd +194 -0
- data/modules/emscripten/system/include/libcxx/iostream +60 -0
- data/modules/emscripten/system/include/libcxx/istream +1713 -0
- data/modules/emscripten/system/include/libcxx/iterator +1869 -0
- data/modules/emscripten/system/include/libcxx/limits +809 -0
- data/modules/emscripten/system/include/libcxx/list +2275 -0
- data/modules/emscripten/system/include/libcxx/locale +4591 -0
- data/modules/emscripten/system/include/libcxx/map +1924 -0
- data/modules/emscripten/system/include/libcxx/memory +5437 -0
- data/modules/emscripten/system/include/libcxx/mutex +566 -0
- data/modules/emscripten/system/include/libcxx/new +117 -0
- data/modules/emscripten/system/include/libcxx/numeric +197 -0
- data/modules/emscripten/system/include/libcxx/ostream +1286 -0
- data/modules/emscripten/system/include/libcxx/queue +717 -0
- data/modules/emscripten/system/include/libcxx/random +6750 -0
- data/modules/emscripten/system/include/libcxx/ratio +487 -0
- data/modules/emscripten/system/include/libcxx/readme.txt +1 -0
- data/modules/emscripten/system/include/libcxx/regex +6439 -0
- data/modules/emscripten/system/include/libcxx/scoped_allocator +578 -0
- data/modules/emscripten/system/include/libcxx/set +1025 -0
- data/modules/emscripten/system/include/libcxx/sstream +888 -0
- data/modules/emscripten/system/include/libcxx/stack +292 -0
- data/modules/emscripten/system/include/libcxx/stdexcept +162 -0
- data/modules/emscripten/system/include/libcxx/streambuf +564 -0
- data/modules/emscripten/system/include/libcxx/string +3987 -0
- data/modules/emscripten/system/include/libcxx/strstream +400 -0
- data/modules/emscripten/system/include/libcxx/support/solaris/floatingpoint.h +5 -0
- data/modules/emscripten/system/include/libcxx/support/solaris/wchar.h +38 -0
- data/modules/emscripten/system/include/libcxx/support/solaris/xlocale.h +146 -0
- data/modules/emscripten/system/include/libcxx/support/win32/limits_win32.h +79 -0
- data/modules/emscripten/system/include/libcxx/support/win32/locale_win32.h +116 -0
- data/modules/emscripten/system/include/libcxx/support/win32/math_win32.h +113 -0
- data/modules/emscripten/system/include/libcxx/support/win32/support.h +115 -0
- data/modules/emscripten/system/include/libcxx/system_error +636 -0
- data/modules/emscripten/system/include/libcxx/tgmath.h +29 -0
- data/modules/emscripten/system/include/libcxx/thread +459 -0
- data/modules/emscripten/system/include/libcxx/tuple +1092 -0
- data/modules/emscripten/system/include/libcxx/type_traits +3040 -0
- data/modules/emscripten/system/include/libcxx/typeindex +103 -0
- data/modules/emscripten/system/include/libcxx/typeinfo +124 -0
- data/modules/emscripten/system/include/libcxx/unordered_map +1864 -0
- data/modules/emscripten/system/include/libcxx/unordered_set +1144 -0
- data/modules/emscripten/system/include/libcxx/utility +583 -0
- data/modules/emscripten/system/include/libcxx/valarray +4779 -0
- data/modules/emscripten/system/include/libcxx/vector +3228 -0
- data/modules/emscripten/system/include/memory.h +10 -0
- data/modules/emscripten/system/include/mntent.h +23 -0
- data/modules/emscripten/system/include/net/arpa/inet.h +32 -0
- data/modules/emscripten/system/include/net/arpa/nameser.h +535 -0
- data/modules/emscripten/system/include/net/arpa/nameser_compat.h +187 -0
- data/modules/emscripten/system/include/net/if.h +87 -0
- data/modules/emscripten/system/include/net/netinet/in.h +166 -0
- data/modules/emscripten/system/include/net/netinet/tcp.h +246 -0
- data/modules/emscripten/system/include/net/resolv.h +389 -0
- data/modules/emscripten/system/include/netdb.h +94 -0
- data/modules/emscripten/system/include/nl_types.h +19 -0
- data/modules/emscripten/system/include/poll.h +3 -0
- data/modules/emscripten/system/include/pty.h +6 -0
- data/modules/emscripten/system/include/semaphore.h +31 -0
- data/modules/emscripten/system/include/spawn.h +105 -0
- data/modules/emscripten/system/include/stdbool.h +16 -0
- data/modules/emscripten/system/include/sys/bitypes.h +3 -0
- data/modules/emscripten/system/include/sys/io.h +14 -0
- data/modules/emscripten/system/include/sys/ioctl.h +26 -0
- data/modules/emscripten/system/include/sys/poll.h +31 -0
- data/modules/emscripten/system/include/sys/select.h +14 -0
- data/modules/emscripten/system/include/sys/socket.h +101 -0
- data/modules/emscripten/system/include/sys/socketvar.h +3 -0
- data/modules/emscripten/system/include/sys/statvfs.h +32 -0
- data/modules/emscripten/system/include/sys/sysctl.h +14 -0
- data/modules/emscripten/system/include/sys/uio.h +22 -0
- data/modules/emscripten/system/include/sys/un.h +66 -0
- data/modules/emscripten/system/include/sysexits.h +108 -0
- data/modules/emscripten/system/include/unwind.h +154 -0
- data/modules/emscripten/system/include/xlocale.h +47 -0
- data/modules/emscripten/system/include/zconf.h +428 -0
- data/modules/emscripten/system/include/zlib.h +1613 -0
- data/modules/emscripten/system/lib/compiler-rt/LICENSE.TXT +97 -0
- data/modules/emscripten/system/lib/compiler-rt/divdi3.c +47 -0
- data/modules/emscripten/system/lib/compiler-rt/int_endianness.h +116 -0
- data/modules/emscripten/system/lib/compiler-rt/int_lib.h +46 -0
- data/modules/emscripten/system/lib/compiler-rt/int_math.h +67 -0
- data/modules/emscripten/system/lib/compiler-rt/int_types.h +140 -0
- data/modules/emscripten/system/lib/compiler-rt/int_util.h +29 -0
- data/modules/emscripten/system/lib/compiler-rt/muldi3.c +56 -0
- data/modules/emscripten/system/lib/compiler-rt/readme.txt +20 -0
- data/modules/emscripten/system/lib/compiler-rt/udivdi3.c +36 -0
- data/modules/emscripten/system/lib/compiler-rt/udivmoddi4.c +251 -0
- data/modules/emscripten/system/lib/debugging.cpp +24 -0
- data/modules/emscripten/system/lib/dlmalloc.c +6299 -0
- data/modules/emscripten/system/lib/embind/bind.cpp +63 -0
- data/modules/emscripten/system/lib/libc/gen/err.c +49 -0
- data/modules/emscripten/system/lib/libc/gen/errx.c +49 -0
- data/modules/emscripten/system/lib/libc/gen/verr.c +58 -0
- data/modules/emscripten/system/lib/libc/gen/verrx.c +51 -0
- data/modules/emscripten/system/lib/libc/gen/vwarn.c +55 -0
- data/modules/emscripten/system/lib/libc/gen/vwarnx.c +48 -0
- data/modules/emscripten/system/lib/libc/gen/warn.c +49 -0
- data/modules/emscripten/system/lib/libc/gen/warnx.c +49 -0
- data/modules/emscripten/system/lib/libc/musl/COPYRIGHT +92 -0
- data/modules/emscripten/system/lib/libc/musl/readme.txt +1 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/alpha.h +125 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswalnum.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswalpha.c +14 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswblank.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswcntrl.c +10 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswctype.c +63 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswdigit.c +9 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswgraph.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswlower.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswprint.c +19 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswpunct.c +12 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswspace.c +19 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswupper.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswxdigit.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/nonspacing.h +62 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/punct.h +109 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/towctrans.c +268 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/wcswidth.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/wctrans.c +16 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/wcwidth.c +29 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/wide.h +42 -0
- data/modules/emscripten/system/lib/libc/musl/src/internal/libc.c +22 -0
- data/modules/emscripten/system/lib/libc/musl/src/internal/libc.h +71 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/btowc.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/internal.c +38 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/internal.h +22 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mblen.c +17 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbrlen.c +18 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbrtowc.c +57 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsinit.c +17 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsnrtowcs.c +65 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsrtowcs.c +100 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbstowcs.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbtowc.c +53 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcrtomb.c +38 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcsnrtombs.c +52 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcsrtombs.c +58 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcstombs.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wctob.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wctomb.c +18 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcpcpy.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcpncpy.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscasecmp.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscasecmp_l.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscat.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcschr.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscmp.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscpy.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscspn.c +10 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsdup.c +11 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcslen.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncasecmp.c +9 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncasecmp_l.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncat.c +10 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncmp.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncpy.c +9 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsnlen.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcspbrk.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsrchr.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsspn.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsstr.c +108 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcstok.c +12 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcswcs.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemchr.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemcmp.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemcpy.c +9 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemmove.c +12 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemset.c +9 -0
- data/modules/emscripten/system/lib/libc/stdlib/getopt_long.c +511 -0
- data/modules/emscripten/system/lib/libc/stdlib/strtod.c +305 -0
- data/modules/emscripten/system/lib/libc.symbols +81 -0
- data/modules/emscripten/system/lib/libcextra.symbols +61 -0
- data/modules/emscripten/system/lib/libcxx/CREDITS.TXT +91 -0
- data/modules/emscripten/system/lib/libcxx/LICENSE.txt +76 -0
- data/modules/emscripten/system/lib/libcxx/algorithm.cpp +83 -0
- data/modules/emscripten/system/lib/libcxx/bind.cpp +30 -0
- data/modules/emscripten/system/lib/libcxx/chrono.cpp +132 -0
- data/modules/emscripten/system/lib/libcxx/condition_variable.cpp +81 -0
- data/modules/emscripten/system/lib/libcxx/debug.cpp +504 -0
- data/modules/emscripten/system/lib/libcxx/exception.cpp +226 -0
- data/modules/emscripten/system/lib/libcxx/future.cpp +285 -0
- data/modules/emscripten/system/lib/libcxx/hash.cpp +564 -0
- data/modules/emscripten/system/lib/libcxx/ios.cpp +455 -0
- data/modules/emscripten/system/lib/libcxx/iostream.cpp +68 -0
- data/modules/emscripten/system/lib/libcxx/locale.cpp +6093 -0
- data/modules/emscripten/system/lib/libcxx/memory.cpp +223 -0
- data/modules/emscripten/system/lib/libcxx/mutex.cpp +250 -0
- data/modules/emscripten/system/lib/libcxx/new.cpp +205 -0
- data/modules/emscripten/system/lib/libcxx/random.cpp +48 -0
- data/modules/emscripten/system/lib/libcxx/readme.txt +1 -0
- data/modules/emscripten/system/lib/libcxx/regex.cpp +325 -0
- data/modules/emscripten/system/lib/libcxx/stdexcept.cpp +196 -0
- data/modules/emscripten/system/lib/libcxx/string.cpp +687 -0
- data/modules/emscripten/system/lib/libcxx/strstream.cpp +329 -0
- data/modules/emscripten/system/lib/libcxx/support/solaris/README +4 -0
- data/modules/emscripten/system/lib/libcxx/support/solaris/mbsnrtowcs.inc +76 -0
- data/modules/emscripten/system/lib/libcxx/support/solaris/wcsnrtombs.inc +93 -0
- data/modules/emscripten/system/lib/libcxx/support/solaris/xlocale.c +245 -0
- data/modules/emscripten/system/lib/libcxx/support/win32/locale_win32.cpp +94 -0
- data/modules/emscripten/system/lib/libcxx/support/win32/support.cpp +70 -0
- data/modules/emscripten/system/lib/libcxx/symbols +2927 -0
- data/modules/emscripten/system/lib/libcxx/system_error.cpp +201 -0
- data/modules/emscripten/system/lib/libcxx/thread.cpp +208 -0
- data/modules/emscripten/system/lib/libcxx/typeinfo.cpp +60 -0
- data/modules/emscripten/system/lib/libcxx/utility.cpp +17 -0
- data/modules/emscripten/system/lib/libcxx/valarray.cpp +54 -0
- data/modules/emscripten/system/lib/libcxxabi/CREDITS.TXT +38 -0
- data/modules/emscripten/system/lib/libcxxabi/LICENSE.TXT +76 -0
- data/modules/emscripten/system/lib/libcxxabi/include/cxa_demangle.h +167 -0
- data/modules/emscripten/system/lib/libcxxabi/include/cxxabi.h +175 -0
- data/modules/emscripten/system/lib/libcxxabi/lib/buildit +99 -0
- data/modules/emscripten/system/lib/libcxxabi/readme.txt +1 -0
- data/modules/emscripten/system/lib/libcxxabi/src/abort_message.cpp +50 -0
- data/modules/emscripten/system/lib/libcxxabi/src/abort_message.h +33 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_aux_runtime.cpp +34 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_demangle.cpp +11036 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception.cpp +622 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception.hpp +123 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception_storage.cpp +91 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_guard.cpp +231 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_handlers.cpp +125 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_handlers.hpp +54 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_new_delete.cpp +242 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_personality.cpp +1055 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_unexpected.cpp +27 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_vector.cpp +367 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_virtual.cpp +31 -0
- data/modules/emscripten/system/lib/libcxxabi/src/exception.cpp +41 -0
- data/modules/emscripten/system/lib/libcxxabi/src/fallback_malloc.ipp +174 -0
- data/modules/emscripten/system/lib/libcxxabi/src/private_typeinfo.cpp +1146 -0
- data/modules/emscripten/system/lib/libcxxabi/src/private_typeinfo.h +248 -0
- data/modules/emscripten/system/lib/libcxxabi/src/stdexcept.cpp +169 -0
- data/modules/emscripten/system/lib/libcxxabi/src/typeinfo.cpp +53 -0
- data/modules/emscripten/system/lib/libcxxabi/symbols +236 -0
- data/modules/emscripten/system/lib/sdl.cpp +13 -0
- data/modules/emscripten/system/lib/sdl.symbols +1 -0
- data/modules/emscripten/tests/hello_world.js +92 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/CppHeaderParser.py +2347 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/__init__.py +4 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/doc/CppHeaderParser.html +657 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/examples/SampleClass.h +147 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/examples/readSampleClass.py +74 -0
- data/modules/emscripten/third_party/CppHeaderParser/PKG-INFO +249 -0
- data/modules/emscripten/third_party/CppHeaderParser/README.html +544 -0
- data/modules/emscripten/third_party/CppHeaderParser/README.txt +226 -0
- data/modules/emscripten/third_party/CppHeaderParser/setup.py +43 -0
- data/modules/emscripten/third_party/ansidecl.h +371 -0
- data/modules/emscripten/third_party/closure-compiler/COPYING +202 -0
- data/modules/emscripten/third_party/closure-compiler/README +292 -0
- data/modules/emscripten/third_party/closure-compiler/compiler.jar +0 -0
- data/modules/emscripten/third_party/closure-compiler/readme.txt +3 -0
- data/modules/emscripten/third_party/cp-demangle.h +161 -0
- data/modules/emscripten/third_party/demangle.h +549 -0
- data/modules/emscripten/third_party/demangler.py +49 -0
- data/modules/emscripten/third_party/gcc_demangler.c +4226 -0
- data/modules/emscripten/third_party/gcc_demangler.js +21282 -0
- data/modules/emscripten/third_party/jni/emjvm.cpp +133 -0
- data/modules/emscripten/third_party/jni/emjvm.h +8 -0
- data/modules/emscripten/third_party/jni/emjvm.js +185 -0
- data/modules/emscripten/third_party/jni/jni.h +1154 -0
- data/modules/emscripten/third_party/libiberty.h +634 -0
- data/modules/emscripten/third_party/lzma.js/README.markdown +37 -0
- data/modules/emscripten/third_party/lzma.js/doit.sh +37 -0
- data/modules/emscripten/third_party/lzma.js/lzip/AUTHORS +7 -0
- data/modules/emscripten/third_party/lzma.js/lzip/COPYING +676 -0
- data/modules/emscripten/third_party/lzma.js/lzip/ChangeLog +201 -0
- data/modules/emscripten/third_party/lzma.js/lzip/INSTALL +56 -0
- data/modules/emscripten/third_party/lzma.js/lzip/Makefile +160 -0
- data/modules/emscripten/third_party/lzma.js/lzip/Makefile.in +138 -0
- data/modules/emscripten/third_party/lzma.js/lzip/NEWS +22 -0
- data/modules/emscripten/third_party/lzma.js/lzip/README +77 -0
- data/modules/emscripten/third_party/lzma.js/lzip/arg_parser.cc +204 -0
- data/modules/emscripten/third_party/lzma.js/lzip/arg_parser.h +106 -0
- data/modules/emscripten/third_party/lzma.js/lzip/configure +192 -0
- data/modules/emscripten/third_party/lzma.js/lzip/decoder.cc +252 -0
- data/modules/emscripten/third_party/lzma.js/lzip/decoder.h +268 -0
- data/modules/emscripten/third_party/lzma.js/lzip/encoder.cc +643 -0
- data/modules/emscripten/third_party/lzma.js/lzip/encoder.h +582 -0
- data/modules/emscripten/third_party/lzma.js/lzip/fast_encoder.cc +378 -0
- data/modules/emscripten/third_party/lzma.js/lzip/fast_encoder.h +171 -0
- data/modules/emscripten/third_party/lzma.js/lzip/lzip.h +264 -0
- data/modules/emscripten/third_party/lzma.js/lzip/main.cc +545 -0
- data/modules/emscripten/third_party/lzma.js/lzma-decoder.js +27 -0
- data/modules/emscripten/third_party/lzma.js/lzma-full.js +27 -0
- data/modules/emscripten/third_party/lzma.js/native_test.sh +5 -0
- data/modules/emscripten/third_party/lzma.js/post.js +13 -0
- data/modules/emscripten/third_party/lzma.js/pre.js +13 -0
- data/modules/emscripten/third_party/lzma.js/test-decoder.js +39 -0
- data/modules/emscripten/third_party/lzma.js/test-full.html +9 -0
- data/modules/emscripten/third_party/lzma.js/test-full.js +78 -0
- data/modules/emscripten/third_party/ply/ANNOUNCE +40 -0
- data/modules/emscripten/third_party/ply/CHANGES +1093 -0
- data/modules/emscripten/third_party/ply/PKG-INFO +22 -0
- data/modules/emscripten/third_party/ply/README +271 -0
- data/modules/emscripten/third_party/ply/TODO +16 -0
- data/modules/emscripten/third_party/ply/doc/internal.html +874 -0
- data/modules/emscripten/third_party/ply/doc/makedoc.py +194 -0
- data/modules/emscripten/third_party/ply/doc/ply.html +3262 -0
- data/modules/emscripten/third_party/ply/example/BASIC/README +79 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basic.py +71 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basiclex.py +74 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basiclog.py +79 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basinterp.py +441 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basparse.py +424 -0
- data/modules/emscripten/third_party/ply/example/BASIC/dim.bas +14 -0
- data/modules/emscripten/third_party/ply/example/BASIC/func.bas +5 -0
- data/modules/emscripten/third_party/ply/example/BASIC/gcd.bas +22 -0
- data/modules/emscripten/third_party/ply/example/BASIC/gosub.bas +13 -0
- data/modules/emscripten/third_party/ply/example/BASIC/hello.bas +4 -0
- data/modules/emscripten/third_party/ply/example/BASIC/linear.bas +17 -0
- data/modules/emscripten/third_party/ply/example/BASIC/maxsin.bas +12 -0
- data/modules/emscripten/third_party/ply/example/BASIC/powers.bas +13 -0
- data/modules/emscripten/third_party/ply/example/BASIC/rand.bas +4 -0
- data/modules/emscripten/third_party/ply/example/BASIC/sales.bas +20 -0
- data/modules/emscripten/third_party/ply/example/BASIC/sears.bas +18 -0
- data/modules/emscripten/third_party/ply/example/BASIC/sqrt1.bas +5 -0
- data/modules/emscripten/third_party/ply/example/BASIC/sqrt2.bas +4 -0
- data/modules/emscripten/third_party/ply/example/GardenSnake/GardenSnake.py +709 -0
- data/modules/emscripten/third_party/ply/example/GardenSnake/README +5 -0
- data/modules/emscripten/third_party/ply/example/README +10 -0
- data/modules/emscripten/third_party/ply/example/ansic/README +2 -0
- data/modules/emscripten/third_party/ply/example/ansic/clex.py +164 -0
- data/modules/emscripten/third_party/ply/example/ansic/cparse.py +863 -0
- data/modules/emscripten/third_party/ply/example/calc/calc.py +107 -0
- data/modules/emscripten/third_party/ply/example/calcdebug/calc.py +113 -0
- data/modules/emscripten/third_party/ply/example/classcalc/calc.py +157 -0
- data/modules/emscripten/third_party/ply/example/cleanup.sh +2 -0
- data/modules/emscripten/third_party/ply/example/closurecalc/calc.py +130 -0
- data/modules/emscripten/third_party/ply/example/hedit/hedit.py +48 -0
- data/modules/emscripten/third_party/ply/example/newclasscalc/calc.py +160 -0
- data/modules/emscripten/third_party/ply/example/optcalc/README +9 -0
- data/modules/emscripten/third_party/ply/example/optcalc/calc.py +119 -0
- data/modules/emscripten/third_party/ply/example/unicalc/calc.py +117 -0
- data/modules/emscripten/third_party/ply/example/yply/README +41 -0
- data/modules/emscripten/third_party/ply/example/yply/ylex.py +112 -0
- data/modules/emscripten/third_party/ply/example/yply/yparse.py +217 -0
- data/modules/emscripten/third_party/ply/example/yply/yply.py +53 -0
- data/modules/emscripten/third_party/ply/ply/__init__.py +4 -0
- data/modules/emscripten/third_party/ply/ply/cpp.py +898 -0
- data/modules/emscripten/third_party/ply/ply/ctokens.py +133 -0
- data/modules/emscripten/third_party/ply/ply/lex.py +1058 -0
- data/modules/emscripten/third_party/ply/ply/yacc.py +3276 -0
- data/modules/emscripten/third_party/ply/setup.py +31 -0
- data/modules/emscripten/third_party/ply/test/README +7 -0
- data/modules/emscripten/third_party/ply/test/calclex.py +49 -0
- data/modules/emscripten/third_party/ply/test/cleanup.sh +4 -0
- data/modules/emscripten/third_party/ply/test/lex_closure.py +54 -0
- data/modules/emscripten/third_party/ply/test/lex_doc1.py +26 -0
- data/modules/emscripten/third_party/ply/test/lex_dup1.py +29 -0
- data/modules/emscripten/third_party/ply/test/lex_dup2.py +33 -0
- data/modules/emscripten/third_party/ply/test/lex_dup3.py +31 -0
- data/modules/emscripten/third_party/ply/test/lex_empty.py +20 -0
- data/modules/emscripten/third_party/ply/test/lex_error1.py +24 -0
- data/modules/emscripten/third_party/ply/test/lex_error2.py +26 -0
- data/modules/emscripten/third_party/ply/test/lex_error3.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_error4.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_hedit.py +47 -0
- data/modules/emscripten/third_party/ply/test/lex_ignore.py +31 -0
- data/modules/emscripten/third_party/ply/test/lex_ignore2.py +29 -0
- data/modules/emscripten/third_party/ply/test/lex_literal1.py +25 -0
- data/modules/emscripten/third_party/ply/test/lex_literal2.py +25 -0
- data/modules/emscripten/third_party/ply/test/lex_many_tokens.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_module.py +10 -0
- data/modules/emscripten/third_party/ply/test/lex_module_import.py +42 -0
- data/modules/emscripten/third_party/ply/test/lex_object.py +55 -0
- data/modules/emscripten/third_party/ply/test/lex_opt_alias.py +54 -0
- data/modules/emscripten/third_party/ply/test/lex_optimize.py +50 -0
- data/modules/emscripten/third_party/ply/test/lex_optimize2.py +50 -0
- data/modules/emscripten/third_party/ply/test/lex_optimize3.py +52 -0
- data/modules/emscripten/third_party/ply/test/lex_re1.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_re2.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_re3.py +29 -0
- data/modules/emscripten/third_party/ply/test/lex_rule1.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_rule2.py +29 -0
- data/modules/emscripten/third_party/ply/test/lex_rule3.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_state1.py +40 -0
- data/modules/emscripten/third_party/ply/test/lex_state2.py +40 -0
- data/modules/emscripten/third_party/ply/test/lex_state3.py +42 -0
- data/modules/emscripten/third_party/ply/test/lex_state4.py +41 -0
- data/modules/emscripten/third_party/ply/test/lex_state5.py +40 -0
- data/modules/emscripten/third_party/ply/test/lex_state_noerror.py +39 -0
- data/modules/emscripten/third_party/ply/test/lex_state_norule.py +40 -0
- data/modules/emscripten/third_party/ply/test/lex_state_try.py +45 -0
- data/modules/emscripten/third_party/ply/test/lex_token1.py +19 -0
- data/modules/emscripten/third_party/ply/test/lex_token2.py +22 -0
- data/modules/emscripten/third_party/ply/test/lex_token3.py +24 -0
- data/modules/emscripten/third_party/ply/test/lex_token4.py +26 -0
- data/modules/emscripten/third_party/ply/test/lex_token5.py +31 -0
- data/modules/emscripten/third_party/ply/test/lex_token_dup.py +29 -0
- data/modules/emscripten/third_party/ply/test/testlex.py +606 -0
- data/modules/emscripten/third_party/ply/test/testyacc.py +347 -0
- data/modules/emscripten/third_party/ply/test/yacc_badargs.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_badid.py +77 -0
- data/modules/emscripten/third_party/ply/test/yacc_badprec.py +64 -0
- data/modules/emscripten/third_party/ply/test/yacc_badprec2.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_badprec3.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_badrule.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_badtok.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_dup.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_error1.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_error2.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_error3.py +67 -0
- data/modules/emscripten/third_party/ply/test/yacc_error4.py +72 -0
- data/modules/emscripten/third_party/ply/test/yacc_inf.py +56 -0
- data/modules/emscripten/third_party/ply/test/yacc_literal.py +69 -0
- data/modules/emscripten/third_party/ply/test/yacc_misplaced.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_missing1.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_nested.py +33 -0
- data/modules/emscripten/third_party/ply/test/yacc_nodoc.py +67 -0
- data/modules/emscripten/third_party/ply/test/yacc_noerror.py +66 -0
- data/modules/emscripten/third_party/ply/test/yacc_nop.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_notfunc.py +66 -0
- data/modules/emscripten/third_party/ply/test/yacc_notok.py +67 -0
- data/modules/emscripten/third_party/ply/test/yacc_prec1.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_rr.py +72 -0
- data/modules/emscripten/third_party/ply/test/yacc_rr_unused.py +30 -0
- data/modules/emscripten/third_party/ply/test/yacc_simple.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_sr.py +63 -0
- data/modules/emscripten/third_party/ply/test/yacc_term1.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_unused.py +77 -0
- data/modules/emscripten/third_party/ply/test/yacc_unused_rule.py +72 -0
- data/modules/emscripten/third_party/ply/test/yacc_uprec.py +63 -0
- data/modules/emscripten/third_party/ply/test/yacc_uprec2.py +63 -0
- data/modules/emscripten/third_party/readme.txt +7 -0
- data/modules/emscripten/third_party/websockify/CHANGES.txt +23 -0
- data/modules/emscripten/third_party/websockify/LICENSE.txt +16 -0
- data/modules/emscripten/third_party/websockify/MANIFEST.in +1 -0
- data/modules/emscripten/third_party/websockify/Makefile +11 -0
- data/modules/emscripten/third_party/websockify/README.md +168 -0
- data/modules/emscripten/third_party/websockify/Windows/Windows Service Readme.txt +39 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Program.cs +24 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.Designer.cs +61 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.cs +19 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.resx +129 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Properties/AssemblyInfo.cs +36 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.Designer.cs +37 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.cs +41 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/noVNC Websocket.csproj +75 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/noVNC Websocket.sln +20 -0
- data/modules/emscripten/third_party/websockify/docs/LICENSE.GPL-3 +621 -0
- data/modules/emscripten/third_party/websockify/docs/LICENSE.LGPL-3 +165 -0
- data/modules/emscripten/third_party/websockify/docs/LICENSE.MPL-2.0 +373 -0
- data/modules/emscripten/third_party/websockify/docs/TODO +9 -0
- data/modules/emscripten/third_party/websockify/docs/flash_policy.txt +4 -0
- data/modules/emscripten/third_party/websockify/docs/latency_results.txt +114 -0
- data/modules/emscripten/third_party/websockify/docs/notes +17 -0
- data/modules/emscripten/third_party/websockify/docs/release.txt +9 -0
- data/modules/emscripten/third_party/websockify/docs/websockify.1 +110 -0
- data/modules/emscripten/third_party/websockify/include/VT100.js +919 -0
- data/modules/emscripten/third_party/websockify/include/base64.js +114 -0
- data/modules/emscripten/third_party/websockify/include/keysym.js +99 -0
- data/modules/emscripten/third_party/websockify/include/util.js +359 -0
- data/modules/emscripten/third_party/websockify/include/web-socket-js/README.txt +109 -0
- data/modules/emscripten/third_party/websockify/include/web-socket-js/WebSocketMain.swf +0 -0
- data/modules/emscripten/third_party/websockify/include/web-socket-js/swfobject.js +4 -0
- data/modules/emscripten/third_party/websockify/include/web-socket-js/web_socket.js +391 -0
- data/modules/emscripten/third_party/websockify/include/websock.js +422 -0
- data/modules/emscripten/third_party/websockify/include/webutil.js +216 -0
- data/modules/emscripten/third_party/websockify/include/wsirc.js +235 -0
- data/modules/emscripten/third_party/websockify/include/wstelnet.js +335 -0
- data/modules/emscripten/third_party/websockify/other/Makefile +14 -0
- data/modules/emscripten/third_party/websockify/other/README.md +51 -0
- data/modules/emscripten/third_party/websockify/other/launch.sh +108 -0
- data/modules/emscripten/third_party/websockify/other/project.clj +13 -0
- data/modules/emscripten/third_party/websockify/other/websocket.c +802 -0
- data/modules/emscripten/third_party/websockify/other/websocket.h +84 -0
- data/modules/emscripten/third_party/websockify/other/websocket.rb +456 -0
- data/modules/emscripten/third_party/websockify/other/websockify.c +385 -0
- data/modules/emscripten/third_party/websockify/other/websockify.clj +233 -0
- data/modules/emscripten/third_party/websockify/other/websockify.js +196 -0
- data/modules/emscripten/third_party/websockify/other/websockify.rb +171 -0
- data/modules/emscripten/third_party/websockify/other/wswrap +22 -0
- data/modules/emscripten/third_party/websockify/rebind +18 -0
- data/modules/emscripten/third_party/websockify/rebind.c +94 -0
- data/modules/emscripten/third_party/websockify/run +5 -0
- data/modules/emscripten/third_party/websockify/setup.py +30 -0
- data/modules/emscripten/third_party/websockify/tests/b64_vs_utf8.py +29 -0
- data/modules/emscripten/third_party/websockify/tests/base64.html +91 -0
- data/modules/emscripten/third_party/websockify/tests/base64.js +12 -0
- data/modules/emscripten/third_party/websockify/tests/echo.html +148 -0
- data/modules/emscripten/third_party/websockify/tests/echo.py +75 -0
- data/modules/emscripten/third_party/websockify/tests/echo.rb +62 -0
- data/modules/emscripten/third_party/websockify/tests/latency.html +290 -0
- data/modules/emscripten/third_party/websockify/tests/latency.py +75 -0
- data/modules/emscripten/third_party/websockify/tests/load.html +250 -0
- data/modules/emscripten/third_party/websockify/tests/load.py +167 -0
- data/modules/emscripten/third_party/websockify/tests/plain_echo.html +168 -0
- data/modules/emscripten/third_party/websockify/tests/simple.html +68 -0
- data/modules/emscripten/third_party/websockify/tests/utf8-list.py +22 -0
- data/modules/emscripten/third_party/websockify/websockify/__init__.py +2 -0
- data/modules/emscripten/third_party/websockify/websockify/websocket.py +982 -0
- data/modules/emscripten/third_party/websockify/websockify/websocketproxy.py +393 -0
- data/modules/emscripten/third_party/websockify/websockify.py +5 -0
- data/modules/emscripten/third_party/websockify/wsirc.html +99 -0
- data/modules/emscripten/third_party/websockify/wstelnet.html +74 -0
- data/modules/emscripten/tools/__init__.py +0 -0
- data/modules/emscripten/tools/__init__.pyc +0 -0
- data/modules/emscripten/tools/autodebugger.py +289 -0
- data/modules/emscripten/tools/autodebugger_c.py +37 -0
- data/modules/emscripten/tools/autodebugger_indenter.py +18 -0
- data/modules/emscripten/tools/autodebugger_js.py +47 -0
- data/modules/emscripten/tools/autodediffer.py +60 -0
- data/modules/emscripten/tools/bindings_generator.py +832 -0
- data/modules/emscripten/tools/bisect_pair.py +88 -0
- data/modules/emscripten/tools/cache.py +198 -0
- data/modules/emscripten/tools/cache.pyc +0 -0
- data/modules/emscripten/tools/clean_webconsole.py +34 -0
- data/modules/emscripten/tools/crunch-worker.js +124 -0
- data/modules/emscripten/tools/diff_autodebugger.py +15 -0
- data/modules/emscripten/tools/eliminator/asm-eliminator-test-output.js +5129 -0
- data/modules/emscripten/tools/eliminator/asm-eliminator-test.js +6861 -0
- data/modules/emscripten/tools/eliminator/eliminator-test-output.js +6122 -0
- data/modules/emscripten/tools/eliminator/eliminator-test.js +8856 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/README.html +888 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/README.org +463 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/bin/uglifyjs +317 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/docstyle.css +75 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/object-ast.js +75 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/parse-js.js +1363 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/process.js +2005 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/squeeze-more.js +51 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/package.json +22 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/beautify.js +28 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/testparser.js +402 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array1.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array2.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array3.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array4.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/assignment.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/concatstring.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/const.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/empty-blocks.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/forstatement.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/if.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/ifreturn.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/ifreturn2.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue10.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue11.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue13.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue14.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue16.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue17.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue20.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue21.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue25.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue27.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue28.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue29.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue30.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue34.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue4.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue48.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue50.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue53.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue54.1.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue68.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue69.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue9.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/mangle.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/strict-equals.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/var.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/with.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array1.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array2.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array3.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array4.js +6 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/assignment.js +20 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/concatstring.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/const.js +5 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/empty-blocks.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/forstatement.js +10 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/if.js +6 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/ifreturn.js +9 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/ifreturn2.js +16 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue10.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue11.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue13.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue14.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue16.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue17.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue20.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue21.js +6 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue25.js +7 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue27.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue28.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue29.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue30.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue34.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue4.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue48.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue50.js +9 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue53.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue54.1.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue68.js +5 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue69.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue9.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/mangle.js +5 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/strict-equals.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/var.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/with.js +2 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/scripts.js +55 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/hoist.js +33 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/instrument.js +97 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/instrument2.js +138 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/test.js +16 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/uglify-js.js +17 -0
- data/modules/emscripten/tools/eliminator/safe-eliminator-test-output.js +85 -0
- data/modules/emscripten/tools/eliminator/safe-eliminator-test.js +103 -0
- data/modules/emscripten/tools/emconfiguren.py +19 -0
- data/modules/emscripten/tools/emmaken.py +230 -0
- data/modules/emscripten/tools/emmakenxx.py +18 -0
- data/modules/emscripten/tools/exec_llvm.py +50 -0
- data/modules/emscripten/tools/file2json.py +49 -0
- data/modules/emscripten/tools/file_packager.py +649 -0
- data/modules/emscripten/tools/find_bigfuncs.py +23 -0
- data/modules/emscripten/tools/find_bigis.py +18 -0
- data/modules/emscripten/tools/fix_closure.py +88 -0
- data/modules/emscripten/tools/ie7_fix.py +14 -0
- data/modules/emscripten/tools/js-optimizer.js +3440 -0
- data/modules/emscripten/tools/js_optimizer.py +341 -0
- data/modules/emscripten/tools/js_optimizer.pyc +0 -0
- data/modules/emscripten/tools/jsrun.py +27 -0
- data/modules/emscripten/tools/jsrun.pyc +0 -0
- data/modules/emscripten/tools/ll-strip.py +56 -0
- data/modules/emscripten/tools/make_file.py +19 -0
- data/modules/emscripten/tools/make_minigzip.py +13 -0
- data/modules/emscripten/tools/namespacer.py +95 -0
- data/modules/emscripten/tools/nativize_llvm.py +34 -0
- data/modules/emscripten/tools/node_modules/source-map/CHANGELOG.md +58 -0
- data/modules/emscripten/tools/node_modules/source-map/LICENSE +28 -0
- data/modules/emscripten/tools/node_modules/source-map/Makefile.dryice.js +166 -0
- data/modules/emscripten/tools/node_modules/source-map/README.md +347 -0
- data/modules/emscripten/tools/node_modules/source-map/build/assert-shim.js +56 -0
- data/modules/emscripten/tools/node_modules/source-map/build/mini-require.js +152 -0
- data/modules/emscripten/tools/node_modules/source-map/build/prefix-source-map.jsm +20 -0
- data/modules/emscripten/tools/node_modules/source-map/build/prefix-utils.jsm +18 -0
- data/modules/emscripten/tools/node_modules/source-map/build/suffix-browser.js +8 -0
- data/modules/emscripten/tools/node_modules/source-map/build/suffix-source-map.jsm +6 -0
- data/modules/emscripten/tools/node_modules/source-map/build/suffix-utils.jsm +21 -0
- data/modules/emscripten/tools/node_modules/source-map/build/test-prefix.js +8 -0
- data/modules/emscripten/tools/node_modules/source-map/build/test-suffix.js +3 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/array-set.js +96 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/base64.js +42 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/binary-search.js +81 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-map-consumer.js +430 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-map-generator.js +381 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-node.js +353 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/util.js +117 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map.js +8 -0
- data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
- data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/README.md +119 -0
- data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
- data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/package.json +33 -0
- data/modules/emscripten/tools/node_modules/source-map/package.json +74 -0
- data/modules/emscripten/tools/node_modules/source-map/test/run-tests.js +73 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-api.js +26 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-array-set.js +71 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-base64.js +35 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-map-consumer.js +306 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-map-generator.js +391 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-node.js +282 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/util.js +152 -0
- data/modules/emscripten/tools/reproduceriter.js +216 -0
- data/modules/emscripten/tools/reproduceriter.py +160 -0
- data/modules/emscripten/tools/response_file.py +28 -0
- data/modules/emscripten/tools/response_file.pyc +0 -0
- data/modules/emscripten/tools/scan_js.py +20 -0
- data/modules/emscripten/tools/scan_ll.py +18 -0
- data/modules/emscripten/tools/scons/site_scons/site_tools/emscripten/__init__.py +3 -0
- data/modules/emscripten/tools/scons/site_scons/site_tools/emscripten/emscripten.py +46 -0
- data/modules/emscripten/tools/settings_template_readonly.py +47 -0
- data/modules/emscripten/tools/shared.py +1437 -0
- data/modules/emscripten/tools/shared.pyc +0 -0
- data/modules/emscripten/tools/source-maps/sourcemap2json.js +15 -0
- data/modules/emscripten/tools/source-maps/sourcemapper.js +177 -0
- data/modules/emscripten/tools/split.py +97 -0
- data/modules/emscripten/tools/tempfiles.py +40 -0
- data/modules/emscripten/tools/tempfiles.pyc +0 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-last-output.js +75 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-last.js +91 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-outline-output.js +570 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-outline.js +606 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-pre-output.js +540 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-pre.js +550 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-regs-min-output.js +36 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-regs-min.js +37 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-regs-output.js +106 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-regs.js +110 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-relocate-output.js +9 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-relocate.js +12 -0
- data/modules/emscripten/tools/test-js-optimizer-output.js +291 -0
- data/modules/emscripten/tools/test-js-optimizer-regs-output.js +232 -0
- data/modules/emscripten/tools/test-js-optimizer-regs.js +237 -0
- data/modules/emscripten/tools/test-js-optimizer-t2-output.js +91 -0
- data/modules/emscripten/tools/test-js-optimizer-t2.js +92 -0
- data/modules/emscripten/tools/test-js-optimizer-t2c-output.js +17 -0
- data/modules/emscripten/tools/test-js-optimizer-t2c.js +18 -0
- data/modules/emscripten/tools/test-js-optimizer-t3-output.js +49 -0
- data/modules/emscripten/tools/test-js-optimizer-t3.js +50 -0
- data/modules/emscripten/tools/test-js-optimizer.js +401 -0
- data/modules/mruby/AUTHORS +18 -0
- data/modules/mruby/CONTRIBUTING.md +65 -0
- data/modules/mruby/ChangeLog +15 -0
- data/modules/mruby/INSTALL +29 -0
- data/modules/mruby/LEGAL +6 -0
- data/modules/mruby/MITL +20 -0
- data/modules/mruby/Makefile +18 -0
- data/modules/mruby/NEWS +13 -0
- data/modules/mruby/README.md +116 -0
- data/modules/mruby/Rakefile +114 -0
- data/modules/mruby/TODO +11 -0
- data/modules/mruby/benchmark/ao-render.rb +315 -0
- data/modules/mruby/benchmark/bm_so_lists.rb +47 -0
- data/modules/mruby/benchmark/fib39.rb +8 -0
- data/modules/mruby/build_config.rb +88 -0
- data/modules/mruby/doc/compile/README.md +376 -0
- data/modules/mruby/doc/mrbgems/README.md +254 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/README.md +4 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake +23 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb +5 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/src/example.c +20 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/test/example.rb +7 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/README.md +4 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/mrbgem.rake +23 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/src/example.c +20 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/test/example.c +7 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/test/example.rb +3 -0
- data/modules/mruby/examples/mrbgems/ruby_extension_example/README.md +4 -0
- data/modules/mruby/examples/mrbgems/ruby_extension_example/mrbgem.rake +23 -0
- data/modules/mruby/examples/mrbgems/ruby_extension_example/mrblib/example.rb +5 -0
- data/modules/mruby/examples/mrbgems/ruby_extension_example/test/example.rb +3 -0
- data/modules/mruby/examples/targets/ArduinoDue.rb +65 -0
- data/modules/mruby/examples/targets/chipKitMax32.rb +68 -0
- data/modules/mruby/include/mrbconf.h +87 -0
- data/modules/mruby/include/mruby/array.h +63 -0
- data/modules/mruby/include/mruby/class.h +75 -0
- data/modules/mruby/include/mruby/compile.h +176 -0
- data/modules/mruby/include/mruby/data.h +53 -0
- data/modules/mruby/include/mruby/dump.h +151 -0
- data/modules/mruby/include/mruby/gc.h +17 -0
- data/modules/mruby/include/mruby/hash.h +54 -0
- data/modules/mruby/include/mruby/irep.h +40 -0
- data/modules/mruby/include/mruby/khash.h +257 -0
- data/modules/mruby/include/mruby/numeric.h +32 -0
- data/modules/mruby/include/mruby/proc.h +62 -0
- data/modules/mruby/include/mruby/range.h +35 -0
- data/modules/mruby/include/mruby/string.h +78 -0
- data/modules/mruby/include/mruby/value.h +483 -0
- data/modules/mruby/include/mruby/variable.h +78 -0
- data/modules/mruby/include/mruby.h +388 -0
- data/modules/mruby/minirake +477 -0
- data/modules/mruby/mrbgems/default.gembox +61 -0
- data/modules/mruby/mrbgems/full-core.gembox +9 -0
- data/modules/mruby/mrbgems/mruby-array-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +204 -0
- data/modules/mruby/mrbgems/mruby-array-ext/src/array.c +140 -0
- data/modules/mruby/mrbgems/mruby-array-ext/test/array.rb +109 -0
- data/modules/mruby/mrbgems/mruby-bin-mirb/mrbgem.rake +5 -0
- data/modules/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +365 -0
- data/modules/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +5 -0
- data/modules/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +243 -0
- data/modules/mruby/mrbgems/mruby-enum-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb +164 -0
- data/modules/mruby/mrbgems/mruby-enum-ext/test/enum.rb +44 -0
- data/modules/mruby/mrbgems/mruby-eval/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-eval/src/eval.c +23 -0
- data/modules/mruby/mrbgems/mruby-fiber/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-fiber/src/fiber.c +251 -0
- data/modules/mruby/mrbgems/mruby-fiber/test/fiber.rb +64 -0
- data/modules/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb +13 -0
- data/modules/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +62 -0
- data/modules/mruby/mrbgems/mruby-hash-ext/test/hash.rb +26 -0
- data/modules/mruby/mrbgems/mruby-math/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-math/src/math.c +685 -0
- data/modules/mruby/mrbgems/mruby-math/test/math.rb +136 -0
- data/modules/mruby/mrbgems/mruby-numeric-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +31 -0
- data/modules/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +10 -0
- data/modules/mruby/mrbgems/mruby-object-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-object-ext/src/object.c +108 -0
- data/modules/mruby/mrbgems/mruby-object-ext/test/nil.rb +11 -0
- data/modules/mruby/mrbgems/mruby-object-ext/test/object.rb +9 -0
- data/modules/mruby/mrbgems/mruby-objectspace/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +117 -0
- data/modules/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +38 -0
- data/modules/mruby/mrbgems/mruby-print/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-print/mrblib/print.rb +64 -0
- data/modules/mruby/mrbgems/mruby-print/src/print.c +44 -0
- data/modules/mruby/mrbgems/mruby-proc-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-proc-ext/mrblib/proc.rb +40 -0
- data/modules/mruby/mrbgems/mruby-proc-ext/src/proc.c +97 -0
- data/modules/mruby/mrbgems/mruby-proc-ext/test/proc.rb +41 -0
- data/modules/mruby/mrbgems/mruby-random/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-random/src/mt19937ar.c +193 -0
- data/modules/mruby/mrbgems/mruby-random/src/mt19937ar.h +48 -0
- data/modules/mruby/mrbgems/mruby-random/src/random.c +231 -0
- data/modules/mruby/mrbgems/mruby-random/src/random.h +12 -0
- data/modules/mruby/mrbgems/mruby-random/test/random.rb +32 -0
- data/modules/mruby/mrbgems/mruby-range-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-range-ext/src/range.c +141 -0
- data/modules/mruby/mrbgems/mruby-range-ext/test/range.rb +20 -0
- data/modules/mruby/mrbgems/mruby-sprintf/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-sprintf/src/kernel.c +30 -0
- data/modules/mruby/mrbgems/mruby-sprintf/src/sprintf.c +1102 -0
- data/modules/mruby/mrbgems/mruby-sprintf/test/sprintf.rb +3 -0
- data/modules/mruby/mrbgems/mruby-string-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +52 -0
- data/modules/mruby/mrbgems/mruby-string-ext/src/string.c +175 -0
- data/modules/mruby/mrbgems/mruby-string-ext/test/string.rb +112 -0
- data/modules/mruby/mrbgems/mruby-struct/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-struct/mrblib/struct.rb +50 -0
- data/modules/mruby/mrbgems/mruby-struct/src/struct.c +818 -0
- data/modules/mruby/mrbgems/mruby-struct/test/struct.rb +77 -0
- data/modules/mruby/mrbgems/mruby-symbol-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-symbol-ext/mrblib/symbol.rb +9 -0
- data/modules/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +55 -0
- data/modules/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +12 -0
- data/modules/mruby/mrbgems/mruby-time/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-time/src/time.c +749 -0
- data/modules/mruby/mrbgems/mruby-time/test/time.rb +201 -0
- data/modules/mruby/mrbgems/mruby-toplevel-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb +11 -0
- data/modules/mruby/mrbgems/mruby-toplevel-ext/test/toplevel.rb +24 -0
- data/modules/mruby/mrblib/array.rb +111 -0
- data/modules/mruby/mrblib/class.rb +26 -0
- data/modules/mruby/mrblib/compar.rb +104 -0
- data/modules/mruby/mrblib/enum.rb +398 -0
- data/modules/mruby/mrblib/error.rb +66 -0
- data/modules/mruby/mrblib/hash.rb +193 -0
- data/modules/mruby/mrblib/init_mrblib.c +14 -0
- data/modules/mruby/mrblib/kernel.rb +46 -0
- data/modules/mruby/mrblib/mrblib.rake +18 -0
- data/modules/mruby/mrblib/numeric.rb +101 -0
- data/modules/mruby/mrblib/print.rb +18 -0
- data/modules/mruby/mrblib/range.rb +40 -0
- data/modules/mruby/mrblib/string.rb +145 -0
- data/modules/mruby/src/array.c +1150 -0
- data/modules/mruby/src/backtrace.c +73 -0
- data/modules/mruby/src/class.c +1942 -0
- data/modules/mruby/src/codegen.c +2864 -0
- data/modules/mruby/src/compar.c +13 -0
- data/modules/mruby/src/crc.c +38 -0
- data/modules/mruby/src/dump.c +542 -0
- data/modules/mruby/src/enum.c +14 -0
- data/modules/mruby/src/error.c +454 -0
- data/modules/mruby/src/error.h +18 -0
- data/modules/mruby/src/etc.c +204 -0
- data/modules/mruby/src/gc.c +1542 -0
- data/modules/mruby/src/hash.c +1261 -0
- data/modules/mruby/src/init.c +62 -0
- data/modules/mruby/src/kernel.c +1105 -0
- data/modules/mruby/src/keywords +50 -0
- data/modules/mruby/src/lex.def +212 -0
- data/modules/mruby/src/load.c +629 -0
- data/modules/mruby/src/mruby_core.rake +28 -0
- data/modules/mruby/src/node.h +117 -0
- data/modules/mruby/src/numeric.c +1418 -0
- data/modules/mruby/src/object.c +593 -0
- data/modules/mruby/src/opcode.h +160 -0
- data/modules/mruby/src/parse.y +6050 -0
- data/modules/mruby/src/pool.c +190 -0
- data/modules/mruby/src/print.c +71 -0
- data/modules/mruby/src/proc.c +209 -0
- data/modules/mruby/src/range.c +442 -0
- data/modules/mruby/src/re.h +13 -0
- data/modules/mruby/src/state.c +200 -0
- data/modules/mruby/src/string.c +2580 -0
- data/modules/mruby/src/symbol.c +456 -0
- data/modules/mruby/src/value_array.h +27 -0
- data/modules/mruby/src/variable.c +1147 -0
- data/modules/mruby/src/vm.c +2129 -0
- data/modules/mruby/tasks/libmruby.rake +18 -0
- data/modules/mruby/tasks/mrbgem_spec.rake +297 -0
- data/modules/mruby/tasks/mrbgems.rake +85 -0
- data/modules/mruby/tasks/mrbgems_test.rake +88 -0
- data/modules/mruby/tasks/mruby_build.rake +211 -0
- data/modules/mruby/tasks/mruby_build_commands.rake +287 -0
- data/modules/mruby/tasks/mruby_build_gem.rake +67 -0
- data/modules/mruby/tasks/ruby_ext.rake +70 -0
- data/modules/mruby/tasks/toolchains/androideabi.rake +126 -0
- data/modules/mruby/tasks/toolchains/clang.rake +8 -0
- data/modules/mruby/tasks/toolchains/gcc.rake +21 -0
- data/modules/mruby/tasks/toolchains/vs2010.rake +3 -0
- data/modules/mruby/tasks/toolchains/vs2012.rake +44 -0
- data/modules/mruby/test/README.md +7 -0
- data/modules/mruby/test/assert.rb +238 -0
- data/modules/mruby/test/driver.c +118 -0
- data/modules/mruby/test/init_mrbtest.c +24 -0
- data/modules/mruby/test/mrbtest.rake +47 -0
- data/modules/mruby/test/report.rb +4 -0
- data/modules/mruby/test/t/argumenterror.rb +21 -0
- data/modules/mruby/test/t/array.rb +309 -0
- data/modules/mruby/test/t/basicobject.rb +11 -0
- data/modules/mruby/test/t/bs_block.rb +489 -0
- data/modules/mruby/test/t/bs_literal.rb +38 -0
- data/modules/mruby/test/t/class.rb +219 -0
- data/modules/mruby/test/t/comparable.rb +72 -0
- data/modules/mruby/test/t/enumerable.rb +108 -0
- data/modules/mruby/test/t/exception.rb +337 -0
- data/modules/mruby/test/t/false.rb +33 -0
- data/modules/mruby/test/t/float.rb +145 -0
- data/modules/mruby/test/t/gc.rb +45 -0
- data/modules/mruby/test/t/hash.rb +310 -0
- data/modules/mruby/test/t/indexerror.rb +10 -0
- data/modules/mruby/test/t/integer.rb +222 -0
- data/modules/mruby/test/t/kernel.rb +425 -0
- data/modules/mruby/test/t/literals.rb +287 -0
- data/modules/mruby/test/t/localjumperror.rb +13 -0
- data/modules/mruby/test/t/methods.rb +109 -0
- data/modules/mruby/test/t/module.rb +344 -0
- data/modules/mruby/test/t/nameerror.rb +32 -0
- data/modules/mruby/test/t/nil.rb +29 -0
- data/modules/mruby/test/t/nomethoderror.rb +13 -0
- data/modules/mruby/test/t/numeric.rb +29 -0
- data/modules/mruby/test/t/object.rb +11 -0
- data/modules/mruby/test/t/proc.rb +56 -0
- data/modules/mruby/test/t/range.rb +82 -0
- data/modules/mruby/test/t/rangeerror.rb +10 -0
- data/modules/mruby/test/t/regexperror.rb +4 -0
- data/modules/mruby/test/t/runtimeerror.rb +6 -0
- data/modules/mruby/test/t/standarderror.rb +10 -0
- data/modules/mruby/test/t/string.rb +483 -0
- data/modules/mruby/test/t/symbol.rb +27 -0
- data/modules/mruby/test/t/syntax.rb +67 -0
- data/modules/mruby/test/t/true.rb +33 -0
- data/modules/mruby/test/t/typeerror.rb +11 -0
- data/modules/mruby/tools/mrbc/mrbc.c +318 -0
- data/modules/mruby/tools/mrbc/mrbc.rake +14 -0
- data/modules/mruby/travis_config.rb +6 -0
- data/modules/mrubymix/LICENSE +21 -0
- data/modules/mrubymix/README.md +6 -0
- data/modules/mrubymix/bin/mrubymix +29 -0
- data/modules/mrubymix/lib/mrubymix.rb +93 -0
- data/modules/mrubymix/mrubymix.gemspec +13 -0
- data/scripts/gen_gems_config.rb +185 -0
- data/scripts/gen_post.rb +104 -0
- data/templates/minimal/Rakefile +36 -0
- data/templates/minimal/app/app.rb +3 -0
- metadata +1408 -0
|
@@ -0,0 +1,1695 @@
|
|
|
1
|
+
//"use strict";
|
|
2
|
+
|
|
3
|
+
// Analyze intertype data. Calculates things that are necessary in order
|
|
4
|
+
// to do the final conversion into JavaScript later, for example,
|
|
5
|
+
// properties of variables, loop structures of functions, etc.
|
|
6
|
+
|
|
7
|
+
var VAR_NATIVE = 'native';
|
|
8
|
+
var VAR_NATIVIZED = 'nativized';
|
|
9
|
+
var VAR_EMULATED = 'emulated';
|
|
10
|
+
|
|
11
|
+
var ENTRY_IDENT = toNiceIdent('%0');
|
|
12
|
+
|
|
13
|
+
function recomputeLines(func) {
|
|
14
|
+
func.lines = func.labels.map(function(label) { return label.lines }).reduce(concatenator, []);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Handy sets
|
|
18
|
+
|
|
19
|
+
var BRANCH_INVOKE = set('branch', 'invoke');
|
|
20
|
+
var LABEL_ENDERS = set('branch', 'return', 'switch');
|
|
21
|
+
var SIDE_EFFECT_CAUSERS = set('call', 'invoke', 'atomic');
|
|
22
|
+
var UNUNFOLDABLE = set('value', 'structvalue', 'type', 'phiparam');
|
|
23
|
+
var SHADOW_FLIP = { i64: 'double', double: 'i64' }; //, i32: 'float', float: 'i32' };
|
|
24
|
+
|
|
25
|
+
// Analyzer
|
|
26
|
+
|
|
27
|
+
function analyzer(data, sidePass) {
|
|
28
|
+
var mainPass = !sidePass;
|
|
29
|
+
|
|
30
|
+
// Substrate
|
|
31
|
+
var substrate = new Substrate('Analyzer');
|
|
32
|
+
|
|
33
|
+
// Sorter
|
|
34
|
+
substrate.addActor('Sorter', {
|
|
35
|
+
processItem: function(item) {
|
|
36
|
+
item.items.sort(function (a, b) { return a.lineNum - b.lineNum });
|
|
37
|
+
this.forwardItem(item, 'Gatherer');
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Gatherer
|
|
42
|
+
substrate.addActor('Gatherer', {
|
|
43
|
+
processItem: function(item) {
|
|
44
|
+
// Single-liners
|
|
45
|
+
['globalVariable', 'functionStub', 'unparsedFunction', 'unparsedGlobals', 'unparsedTypes', 'alias'].forEach(function(intertype) {
|
|
46
|
+
var temp = splitter(item.items, function(item) { return item.intertype == intertype });
|
|
47
|
+
item.items = temp.leftIn;
|
|
48
|
+
item[intertype + 's'] = temp.splitOut;
|
|
49
|
+
});
|
|
50
|
+
var temp = splitter(item.items, function(item) { return item.intertype == 'type' });
|
|
51
|
+
item.items = temp.leftIn;
|
|
52
|
+
temp.splitOut.forEach(function(type) {
|
|
53
|
+
//dprint('types', 'adding defined type: ' + type.name_);
|
|
54
|
+
Types.types[type.name_] = type;
|
|
55
|
+
if (QUANTUM_SIZE === 1) {
|
|
56
|
+
Types.fatTypes[type.name_] = copy(type);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Functions & labels
|
|
61
|
+
item.functions = [];
|
|
62
|
+
var currLabelFinished; // Sometimes LLVM puts a branch in the middle of a label. We need to ignore all lines after that.
|
|
63
|
+
item.items.sort(function(a, b) { return a.lineNum - b.lineNum });
|
|
64
|
+
for (var i = 0; i < item.items.length; i++) {
|
|
65
|
+
var subItem = item.items[i];
|
|
66
|
+
assert(subItem.lineNum);
|
|
67
|
+
if (subItem.intertype == 'function') {
|
|
68
|
+
item.functions.push(subItem);
|
|
69
|
+
subItem.endLineNum = null;
|
|
70
|
+
subItem.lines = []; // We will fill in the function lines after the legalizer, since it can modify them
|
|
71
|
+
subItem.labels = [];
|
|
72
|
+
subItem.forceEmulated = false;
|
|
73
|
+
|
|
74
|
+
// no explicit 'entry' label in clang on LLVM 2.8 - most of the time, but not all the time! - so we add one if necessary
|
|
75
|
+
if (item.items[i+1].intertype !== 'label') {
|
|
76
|
+
item.items.splice(i+1, 0, {
|
|
77
|
+
intertype: 'label',
|
|
78
|
+
ident: ENTRY_IDENT,
|
|
79
|
+
lineNum: subItem.lineNum + '.5'
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
} else if (subItem.intertype == 'functionEnd') {
|
|
83
|
+
item.functions.slice(-1)[0].endLineNum = subItem.lineNum;
|
|
84
|
+
} else if (subItem.intertype == 'label') {
|
|
85
|
+
item.functions.slice(-1)[0].labels.push(subItem);
|
|
86
|
+
subItem.lines = [];
|
|
87
|
+
currLabelFinished = false;
|
|
88
|
+
} else if (item.functions.length > 0 && item.functions.slice(-1)[0].endLineNum === null) {
|
|
89
|
+
// Internal line
|
|
90
|
+
if (!currLabelFinished) {
|
|
91
|
+
item.functions.slice(-1)[0].labels.slice(-1)[0].lines.push(subItem); // If this line fails, perhaps missing a label?
|
|
92
|
+
if (subItem.intertype in LABEL_ENDERS) {
|
|
93
|
+
currLabelFinished = true;
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
print('// WARNING: content after a branch in a label, line: ' + subItem.lineNum);
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
throw 'ERROR: what is this? ' + dump(subItem);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
delete item.items;
|
|
103
|
+
this.forwardItem(item, 'CastAway');
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// CastAway - try to remove bitcasts of double<-->i64, which LLVM sometimes generates unnecessarily
|
|
108
|
+
// (load a double, convert to i64, use as i64).
|
|
109
|
+
// We optimize this by checking if there are such bitcasts. If so we create a shadow
|
|
110
|
+
// variable that is of the other type, and use that in the relevant places. (As SSA, this is valid, and
|
|
111
|
+
// variable elimination later will remove the double load if it is no longer needed.)
|
|
112
|
+
//
|
|
113
|
+
// Note that aside from being an optimization, this is needed for correctness in some cases: If code
|
|
114
|
+
// assumes it can bitcast a double to an i64 and back and forth without loss, that may be violated
|
|
115
|
+
// due to NaN canonicalization.
|
|
116
|
+
substrate.addActor('CastAway', {
|
|
117
|
+
processItem: function(item) {
|
|
118
|
+
this.forwardItem(item, 'Legalizer');
|
|
119
|
+
if (USE_TYPED_ARRAYS != 2) return;
|
|
120
|
+
|
|
121
|
+
item.functions.forEach(function(func) {
|
|
122
|
+
var has = false;
|
|
123
|
+
func.labels.forEach(function(label) {
|
|
124
|
+
var lines = label.lines;
|
|
125
|
+
for (var i = 0; i < lines.length; i++) {
|
|
126
|
+
var line = lines[i];
|
|
127
|
+
if (line.intertype == 'bitcast' && line.type in SHADOW_FLIP) {
|
|
128
|
+
has = true;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
if (!has) return;
|
|
133
|
+
// there are integer<->floating-point bitcasts, create shadows for everything
|
|
134
|
+
var shadowed = {};
|
|
135
|
+
func.labels.forEach(function(label) {
|
|
136
|
+
var lines = label.lines;
|
|
137
|
+
var i = 0;
|
|
138
|
+
while (i < lines.length) {
|
|
139
|
+
var lines = label.lines;
|
|
140
|
+
var line = lines[i];
|
|
141
|
+
if (line.intertype == 'load' && line.type in SHADOW_FLIP) {
|
|
142
|
+
if (line.pointer.intertype != 'value') { i++; continue } // TODO
|
|
143
|
+
shadowed[line.assignTo] = 1;
|
|
144
|
+
var shadow = line.assignTo + '$$SHADOW';
|
|
145
|
+
var flip = SHADOW_FLIP[line.type];
|
|
146
|
+
lines.splice(i + 1, 0, { // if necessary this element will be legalized in the next phase
|
|
147
|
+
tokens: null,
|
|
148
|
+
indent: 2,
|
|
149
|
+
lineNum: line.lineNum + 0.5,
|
|
150
|
+
assignTo: shadow,
|
|
151
|
+
intertype: 'load',
|
|
152
|
+
pointerType: flip + '*',
|
|
153
|
+
type: flip,
|
|
154
|
+
valueType: flip,
|
|
155
|
+
pointer: {
|
|
156
|
+
intertype: 'value',
|
|
157
|
+
ident: line.pointer.ident,
|
|
158
|
+
type: flip + '*'
|
|
159
|
+
},
|
|
160
|
+
align: line.align,
|
|
161
|
+
ident: line.ident
|
|
162
|
+
});
|
|
163
|
+
// note: no need to update func.lines, it is generated in a later pass
|
|
164
|
+
i++;
|
|
165
|
+
}
|
|
166
|
+
i++;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
// use shadows where possible
|
|
170
|
+
func.labels.forEach(function(label) {
|
|
171
|
+
var lines = label.lines;
|
|
172
|
+
for (var i = 0; i < lines.length; i++) {
|
|
173
|
+
var line = lines[i];
|
|
174
|
+
if (line.intertype == 'bitcast' && line.type in SHADOW_FLIP && line.ident in shadowed) {
|
|
175
|
+
var shadow = line.ident + '$$SHADOW';
|
|
176
|
+
line.params[0].ident = shadow;
|
|
177
|
+
line.params[0].type = line.type;
|
|
178
|
+
line.type2 = line.type;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// Legalize LLVM unrealistic types into realistic types.
|
|
187
|
+
//
|
|
188
|
+
// With full LLVM optimizations, it can generate types like i888 which do not exist in
|
|
189
|
+
// any actual hardware implementation, but are useful during optimization. LLVM then
|
|
190
|
+
// legalizes these types into real ones during code generation. Sadly, there is no LLVM
|
|
191
|
+
// IR pass to legalize them, which would have been useful and nice from a design perspective.
|
|
192
|
+
// The LLVM community is also not interested in receiving patches to implement that
|
|
193
|
+
// functionality, since it would duplicate existing code from the code generation
|
|
194
|
+
// component. Therefore, we implement legalization here in Emscripten.
|
|
195
|
+
//
|
|
196
|
+
// Currently we just legalize completely unrealistic types into bundles of i32s, and just
|
|
197
|
+
// the most common instructions that can be involved with such types: load, store, shifts,
|
|
198
|
+
// trunc and zext.
|
|
199
|
+
substrate.addActor('Legalizer', {
|
|
200
|
+
processItem: function(data) {
|
|
201
|
+
// Legalization
|
|
202
|
+
if (USE_TYPED_ARRAYS == 2) {
|
|
203
|
+
function getLegalVars(base, bits, allowLegal) {
|
|
204
|
+
bits = bits || 32; // things like pointers are all i32, but show up as 0 bits from getBits
|
|
205
|
+
if (allowLegal && bits <= 32) return [{ ident: base + ('i' + bits in Runtime.INT_TYPES ? '' : '$0'), bits: bits }];
|
|
206
|
+
if (isNumber(base)) return getLegalLiterals(base, bits);
|
|
207
|
+
if (base[0] == '{') {
|
|
208
|
+
warnOnce('seeing source of illegal data ' + base + ', likely an inline struct - assuming zeroinit');
|
|
209
|
+
return getLegalLiterals('0', bits);
|
|
210
|
+
}
|
|
211
|
+
var ret = new Array(Math.ceil(bits/32));
|
|
212
|
+
var i = 0;
|
|
213
|
+
if (base == 'zeroinitializer' || base == 'undef') base = 0;
|
|
214
|
+
while (bits > 0) {
|
|
215
|
+
ret[i] = { ident: base ? base + '$' + i : '0', bits: Math.min(32, bits) };
|
|
216
|
+
bits -= 32;
|
|
217
|
+
i++;
|
|
218
|
+
}
|
|
219
|
+
return ret;
|
|
220
|
+
}
|
|
221
|
+
function getLegalLiterals(text, bits) {
|
|
222
|
+
var parsed = parseArbitraryInt(text, bits);
|
|
223
|
+
var ret = new Array(Math.ceil(bits/32));
|
|
224
|
+
var i = 0;
|
|
225
|
+
while (bits > 0) {
|
|
226
|
+
ret[i] = { ident: (parsed[i]|0).toString(), bits: Math.min(32, bits) }; // resign all values
|
|
227
|
+
bits -= 32;
|
|
228
|
+
i++;
|
|
229
|
+
}
|
|
230
|
+
return ret;
|
|
231
|
+
}
|
|
232
|
+
function getLegalStructuralParts(value) {
|
|
233
|
+
return value.params.slice(0);
|
|
234
|
+
}
|
|
235
|
+
function getLegalParams(params, bits) {
|
|
236
|
+
return params.map(function(param) {
|
|
237
|
+
var value = param.value || param;
|
|
238
|
+
if (isNumber(value.ident)) {
|
|
239
|
+
return getLegalLiterals(value.ident, bits);
|
|
240
|
+
} else if (value.intertype == 'structvalue') {
|
|
241
|
+
return getLegalStructuralParts(value).map(function(part) {
|
|
242
|
+
return { ident: part.ident, bits: part.type.substr(1) };
|
|
243
|
+
});
|
|
244
|
+
} else {
|
|
245
|
+
return getLegalVars(value.ident, bits);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
// Uses the right factor to multiply line numbers by so that they fit in between
|
|
250
|
+
// the line[i] and the line after it
|
|
251
|
+
function interpLines(lines, i, toAdd) {
|
|
252
|
+
var prev = i >= 0 ? lines[i].lineNum : -1;
|
|
253
|
+
var next = (i < lines.length-1) ? lines[i+1].lineNum : (lines[i].lineNum + 0.5);
|
|
254
|
+
var factor = (next - prev)/(4*toAdd.length+3);
|
|
255
|
+
for (var k = 0; k < toAdd.length; k++) {
|
|
256
|
+
toAdd[k].lineNum = prev + ((k+1)*factor);
|
|
257
|
+
assert(k == 0 || toAdd[k].lineNum > toAdd[k-1].lineNum);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function removeAndAdd(lines, i, toAdd) {
|
|
261
|
+
var item = lines[i];
|
|
262
|
+
interpLines(lines, i, toAdd);
|
|
263
|
+
Array.prototype.splice.apply(lines, [i, 1].concat(toAdd));
|
|
264
|
+
if (i > 0) assert(lines[i].lineNum > lines[i-1].lineNum);
|
|
265
|
+
if (i + toAdd.length < lines.length) assert(lines[i + toAdd.length - 1].lineNum < lines[i + toAdd.length].lineNum);
|
|
266
|
+
return toAdd.length;
|
|
267
|
+
}
|
|
268
|
+
function legalizeFunctionParameters(params) {
|
|
269
|
+
var i = 0;
|
|
270
|
+
while (i < params.length) {
|
|
271
|
+
var param = params[i];
|
|
272
|
+
if (param.intertype == 'value' && isIllegalType(param.type)) {
|
|
273
|
+
var toAdd = getLegalVars(param.ident, getBits(param.type)).map(function(element) {
|
|
274
|
+
return {
|
|
275
|
+
intertype: 'value',
|
|
276
|
+
type: 'i' + element.bits,
|
|
277
|
+
ident: element.ident,
|
|
278
|
+
byval: 0
|
|
279
|
+
};
|
|
280
|
+
});
|
|
281
|
+
Array.prototype.splice.apply(params, [i, 1].concat(toAdd));
|
|
282
|
+
i += toAdd.length;
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
i++;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function fixUnfolded(item) {
|
|
289
|
+
// Unfolded items may need some correction to work properly in the global scope
|
|
290
|
+
if (item.intertype in MATHOPS) {
|
|
291
|
+
item.op = item.intertype;
|
|
292
|
+
item.intertype = 'mathop';
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
data.functions.forEach(function(func) {
|
|
296
|
+
// Legalize function params
|
|
297
|
+
legalizeFunctionParameters(func.params);
|
|
298
|
+
// Legalize lines in labels
|
|
299
|
+
var tempId = 0;
|
|
300
|
+
func.labels.forEach(function(label) {
|
|
301
|
+
if (dcheck('legalizer')) dprint('zz legalizing: \n' + dump(label.lines));
|
|
302
|
+
var i = 0, bits;
|
|
303
|
+
while (i < label.lines.length) {
|
|
304
|
+
var item = label.lines[i];
|
|
305
|
+
var value = item;
|
|
306
|
+
// Check if we need to legalize here, and do some trivial legalization along the way
|
|
307
|
+
var isIllegal = false;
|
|
308
|
+
walkInterdata(item, function(item) {
|
|
309
|
+
if (item.intertype == 'getelementptr' || (item.intertype == 'call' && item.ident in LLVM.INTRINSICS_32)) {
|
|
310
|
+
// Turn i64 args into i32
|
|
311
|
+
for (var i = 0; i < item.params.length; i++) {
|
|
312
|
+
if (item.params[i].type == 'i64') item.params[i].type = 'i32';
|
|
313
|
+
}
|
|
314
|
+
} else if (item.intertype == 'inttoptr') {
|
|
315
|
+
var input = item.params[0];
|
|
316
|
+
if (input.type == 'i64') input.type = 'i32'; // inttoptr can only care about 32 bits anyhow since pointers are 32-bit
|
|
317
|
+
}
|
|
318
|
+
if (isIllegalType(item.valueType) || isIllegalType(item.type)) {
|
|
319
|
+
isIllegal = true;
|
|
320
|
+
} else if ((item.intertype == 'load' || item.intertype == 'store') && isStructType(item.valueType)) {
|
|
321
|
+
isIllegal = true; // storing an entire structure is illegal
|
|
322
|
+
} else if (item.intertype == 'mathop' && item.op == 'trunc' && isIllegalType(item.params[1].ident)) { // trunc stores target value in second ident
|
|
323
|
+
isIllegal = true;
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
if (!isIllegal) {
|
|
327
|
+
//if (dcheck('legalizer')) dprint('no need to legalize \n' + dump(item));
|
|
328
|
+
i++;
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
// Unfold this line. If we unfolded, we need to return and process the lines we just
|
|
332
|
+
// generated - they may need legalization too
|
|
333
|
+
var unfolded = [];
|
|
334
|
+
walkAndModifyInterdata(item, function(subItem) {
|
|
335
|
+
// Unfold all non-value interitems that we can, and also unfold all numbers (doing the latter
|
|
336
|
+
// makes it easier later since we can then assume illegal expressions are always variables
|
|
337
|
+
// accessible through ident$x, and not constants we need to parse then and there)
|
|
338
|
+
if (subItem != item && (!(subItem.intertype in UNUNFOLDABLE) ||
|
|
339
|
+
(subItem.intertype == 'value' && isNumber(subItem.ident) && isIllegalType(subItem.type)))) {
|
|
340
|
+
if (item.intertype == 'phi') {
|
|
341
|
+
assert(subItem.intertype == 'value' || subItem.intertype == 'structvalue', 'We can only unfold illegal constants in phis');
|
|
342
|
+
// we must handle this in the phi itself, if we unfold normally it will not be pushed back with the phi
|
|
343
|
+
} else {
|
|
344
|
+
var tempIdent = '$$etemp$' + (tempId++);
|
|
345
|
+
subItem.assignTo = tempIdent;
|
|
346
|
+
unfolded.unshift(subItem);
|
|
347
|
+
fixUnfolded(subItem);
|
|
348
|
+
return { intertype: 'value', ident: tempIdent, type: subItem.type };
|
|
349
|
+
}
|
|
350
|
+
} else if (subItem.intertype == 'switch' && isIllegalType(subItem.type)) {
|
|
351
|
+
subItem.switchLabels.forEach(function(switchLabel) {
|
|
352
|
+
if (switchLabel.value[0] != '$') {
|
|
353
|
+
var tempIdent = '$$etemp$' + (tempId++);
|
|
354
|
+
unfolded.unshift({
|
|
355
|
+
assignTo: tempIdent,
|
|
356
|
+
intertype: 'value',
|
|
357
|
+
ident: switchLabel.value,
|
|
358
|
+
type: subItem.type
|
|
359
|
+
});
|
|
360
|
+
switchLabel.value = tempIdent;
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
if (unfolded.length > 0) {
|
|
366
|
+
interpLines(label.lines, i-1, unfolded);
|
|
367
|
+
Array.prototype.splice.apply(label.lines, [i, 0].concat(unfolded));
|
|
368
|
+
continue; // remain at this index, to unfold newly generated lines
|
|
369
|
+
}
|
|
370
|
+
// This is an illegal-containing line, and it is unfolded. Legalize it now
|
|
371
|
+
dprint('legalizer', 'Legalizing ' + item.intertype + ' at line ' + item.lineNum);
|
|
372
|
+
var finalizer = null;
|
|
373
|
+
switch (item.intertype) {
|
|
374
|
+
case 'store': {
|
|
375
|
+
var toAdd = [];
|
|
376
|
+
bits = getBits(item.valueType);
|
|
377
|
+
var elements = getLegalParams([item.value], bits)[0];
|
|
378
|
+
var j = 0;
|
|
379
|
+
elements.forEach(function(element) {
|
|
380
|
+
var tempVar = '$st$' + (tempId++) + '$' + j;
|
|
381
|
+
toAdd.push({
|
|
382
|
+
intertype: 'getelementptr',
|
|
383
|
+
assignTo: tempVar,
|
|
384
|
+
ident: item.pointer.ident,
|
|
385
|
+
type: '[0 x i32]*',
|
|
386
|
+
params: [
|
|
387
|
+
{ intertype: 'value', ident: item.pointer.ident, type: '[0 x i32]*' }, // technically a bitcase is needed in llvm, but not for us
|
|
388
|
+
{ intertype: 'value', ident: '0', type: 'i32' },
|
|
389
|
+
{ intertype: 'value', ident: j.toString(), type: 'i32' }
|
|
390
|
+
],
|
|
391
|
+
});
|
|
392
|
+
var actualSizeType = 'i' + element.bits; // The last one may be smaller than 32 bits
|
|
393
|
+
toAdd.push({
|
|
394
|
+
intertype: 'store',
|
|
395
|
+
valueType: actualSizeType,
|
|
396
|
+
value: { intertype: 'value', ident: element.ident, type: actualSizeType },
|
|
397
|
+
pointer: { intertype: 'value', ident: tempVar, type: actualSizeType + '*' },
|
|
398
|
+
ident: tempVar,
|
|
399
|
+
pointerType: actualSizeType + '*',
|
|
400
|
+
align: item.align,
|
|
401
|
+
});
|
|
402
|
+
j++;
|
|
403
|
+
});
|
|
404
|
+
Types.needAnalysis['[0 x i32]'] = 0;
|
|
405
|
+
i += removeAndAdd(label.lines, i, toAdd);
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
// call, return: Return the first 32 bits, the rest are in temp
|
|
409
|
+
case 'call': {
|
|
410
|
+
var toAdd = [value];
|
|
411
|
+
// legalize parameters
|
|
412
|
+
legalizeFunctionParameters(value.params);
|
|
413
|
+
// legalize return value, if any
|
|
414
|
+
var returnType = getReturnType(item.type);
|
|
415
|
+
if (value.assignTo && isIllegalType(returnType)) {
|
|
416
|
+
bits = getBits(returnType);
|
|
417
|
+
var elements = getLegalVars(item.assignTo, bits);
|
|
418
|
+
// legalize return value
|
|
419
|
+
value.assignTo = elements[0].ident;
|
|
420
|
+
for (var j = 1; j < elements.length; j++) {
|
|
421
|
+
var element = elements[j];
|
|
422
|
+
toAdd.push({
|
|
423
|
+
intertype: 'value',
|
|
424
|
+
assignTo: element.ident,
|
|
425
|
+
type: element.bits,
|
|
426
|
+
ident: 'tempRet' + (j - 1)
|
|
427
|
+
});
|
|
428
|
+
assert(j<10); // TODO: dynamically create more than 10 tempRet-s
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
i += removeAndAdd(label.lines, i, toAdd);
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
case 'landingpad': {
|
|
435
|
+
// not much to legalize
|
|
436
|
+
i++;
|
|
437
|
+
continue;
|
|
438
|
+
}
|
|
439
|
+
case 'return': {
|
|
440
|
+
bits = getBits(item.type);
|
|
441
|
+
var elements = getLegalVars(item.value.ident, bits);
|
|
442
|
+
item.value.ident = '(';
|
|
443
|
+
for (var j = 1; j < elements.length; j++) {
|
|
444
|
+
item.value.ident += 'tempRet' + (j-1) + '=' + elements[j].ident + ',';
|
|
445
|
+
}
|
|
446
|
+
item.value.ident += elements[0].ident + ')';
|
|
447
|
+
i++;
|
|
448
|
+
continue;
|
|
449
|
+
}
|
|
450
|
+
case 'invoke': {
|
|
451
|
+
legalizeFunctionParameters(value.params);
|
|
452
|
+
// We can't add lines after this, since invoke already modifies control flow. So we handle the return in invoke
|
|
453
|
+
i++;
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
case 'value': {
|
|
457
|
+
bits = getBits(value.type);
|
|
458
|
+
var elements = getLegalVars(item.assignTo, bits);
|
|
459
|
+
var values = getLegalLiterals(item.ident, bits);
|
|
460
|
+
var j = 0;
|
|
461
|
+
var toAdd = elements.map(function(element) {
|
|
462
|
+
return {
|
|
463
|
+
intertype: 'value',
|
|
464
|
+
assignTo: element.ident,
|
|
465
|
+
type: 'i' + bits,
|
|
466
|
+
ident: values[j++].ident
|
|
467
|
+
};
|
|
468
|
+
});
|
|
469
|
+
i += removeAndAdd(label.lines, i, toAdd);
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
case 'structvalue': {
|
|
473
|
+
bits = getBits(value.type);
|
|
474
|
+
var elements = getLegalVars(item.assignTo, bits);
|
|
475
|
+
var toAdd = [];
|
|
476
|
+
for (var j = 0; j < item.params.length; j++) {
|
|
477
|
+
toAdd[j] = {
|
|
478
|
+
intertype: 'value',
|
|
479
|
+
assignTo: elements[j].ident,
|
|
480
|
+
type: 'i32',
|
|
481
|
+
ident: item.params[j].ident
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
i += removeAndAdd(label.lines, i, toAdd);
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
case 'load': {
|
|
488
|
+
bits = getBits(value.valueType);
|
|
489
|
+
var elements = getLegalVars(item.assignTo, bits);
|
|
490
|
+
var j = 0;
|
|
491
|
+
var toAdd = [];
|
|
492
|
+
elements.forEach(function(element) {
|
|
493
|
+
var tempVar = '$ld$' + (tempId++) + '$' + j;
|
|
494
|
+
toAdd.push({
|
|
495
|
+
intertype: 'getelementptr',
|
|
496
|
+
assignTo: tempVar,
|
|
497
|
+
ident: value.pointer.ident,
|
|
498
|
+
type: '[0 x i32]*',
|
|
499
|
+
params: [
|
|
500
|
+
{ intertype: 'value', ident: value.pointer.ident, type: '[0 x i32]*' }, // technically bitcast is needed in llvm, but not for us
|
|
501
|
+
{ intertype: 'value', ident: '0', type: 'i32' },
|
|
502
|
+
{ intertype: 'value', ident: j.toString(), type: 'i32' }
|
|
503
|
+
]
|
|
504
|
+
});
|
|
505
|
+
var actualSizeType = 'i' + element.bits; // The last one may be smaller than 32 bits
|
|
506
|
+
toAdd.push({
|
|
507
|
+
intertype: 'load',
|
|
508
|
+
assignTo: element.ident,
|
|
509
|
+
pointerType: actualSizeType + '*',
|
|
510
|
+
valueType: actualSizeType,
|
|
511
|
+
type: actualSizeType, // XXX why is this missing from intertyper?
|
|
512
|
+
pointer: { intertype: 'value', ident: tempVar, type: actualSizeType + '*' },
|
|
513
|
+
ident: tempVar,
|
|
514
|
+
pointerType: actualSizeType + '*',
|
|
515
|
+
align: value.align
|
|
516
|
+
});
|
|
517
|
+
j++;
|
|
518
|
+
});
|
|
519
|
+
Types.needAnalysis['[0 x i32]'] = 0;
|
|
520
|
+
i += removeAndAdd(label.lines, i, toAdd);
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
case 'phi': {
|
|
524
|
+
bits = getBits(value.type);
|
|
525
|
+
var toAdd = [];
|
|
526
|
+
var elements = getLegalVars(item.assignTo, bits);
|
|
527
|
+
var j = 0;
|
|
528
|
+
var values = getLegalParams(value.params, bits);
|
|
529
|
+
elements.forEach(function(element) {
|
|
530
|
+
var k = 0;
|
|
531
|
+
toAdd.push({
|
|
532
|
+
intertype: 'phi',
|
|
533
|
+
assignTo: element.ident,
|
|
534
|
+
type: 'i' + element.bits,
|
|
535
|
+
params: value.params.map(function(param) {
|
|
536
|
+
return {
|
|
537
|
+
intertype: 'phiparam',
|
|
538
|
+
label: param.label,
|
|
539
|
+
value: {
|
|
540
|
+
intertype: 'value',
|
|
541
|
+
ident: values[k++][j].ident,
|
|
542
|
+
type: 'i' + element.bits,
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
})
|
|
546
|
+
});
|
|
547
|
+
j++;
|
|
548
|
+
});
|
|
549
|
+
i += removeAndAdd(label.lines, i, toAdd);
|
|
550
|
+
continue;
|
|
551
|
+
}
|
|
552
|
+
case 'switch': {
|
|
553
|
+
i++;
|
|
554
|
+
continue; // special case, handled in makeComparison
|
|
555
|
+
}
|
|
556
|
+
case 'va_arg': {
|
|
557
|
+
assert(value.type == 'i64');
|
|
558
|
+
assert(value.value.type == 'i32*', value.value.type);
|
|
559
|
+
i += removeAndAdd(label.lines, i, range(2).map(function(x) {
|
|
560
|
+
return {
|
|
561
|
+
intertype: 'va_arg',
|
|
562
|
+
assignTo: value.assignTo + '$' + x,
|
|
563
|
+
type: 'i32',
|
|
564
|
+
value: {
|
|
565
|
+
intertype: 'value',
|
|
566
|
+
ident: value.value.ident, // We read twice from the same i32* var, incrementing // + '$' + x,
|
|
567
|
+
type: 'i32*'
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
}));
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
case 'extractvalue': { // XXX we assume 32-bit alignment in extractvalue/insertvalue,
|
|
574
|
+
// but in theory they can run on packed structs too (see use getStructuralTypePartBits)
|
|
575
|
+
// potentially legalize the actual extracted value too if it is >32 bits, not just the extraction in general
|
|
576
|
+
var index = item.indexes[0][0].text;
|
|
577
|
+
var parts = getStructureTypeParts(item.type);
|
|
578
|
+
var indexedType = parts[index];
|
|
579
|
+
var targetBits = getBits(indexedType);
|
|
580
|
+
var sourceBits = getBits(item.type);
|
|
581
|
+
var elements = getLegalVars(item.assignTo, targetBits, true); // possibly illegal
|
|
582
|
+
var sourceElements = getLegalVars(item.ident, sourceBits); // definitely illegal
|
|
583
|
+
var toAdd = [];
|
|
584
|
+
var sourceIndex = 0;
|
|
585
|
+
for (var partIndex = 0; partIndex < parts.length; partIndex++) {
|
|
586
|
+
if (partIndex == index) {
|
|
587
|
+
for (var j = 0; j < elements.length; j++) {
|
|
588
|
+
toAdd.push({
|
|
589
|
+
intertype: 'value',
|
|
590
|
+
assignTo: elements[j].ident,
|
|
591
|
+
type: 'i' + elements[j].bits,
|
|
592
|
+
ident: sourceElements[sourceIndex+j].ident
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
break;
|
|
596
|
+
}
|
|
597
|
+
sourceIndex += getStructuralTypePartBits(parts[partIndex])/32;
|
|
598
|
+
}
|
|
599
|
+
i += removeAndAdd(label.lines, i, toAdd);
|
|
600
|
+
continue;
|
|
601
|
+
}
|
|
602
|
+
case 'insertvalue': {
|
|
603
|
+
var index = item.indexes[0][0].text; // the modified index
|
|
604
|
+
var parts = getStructureTypeParts(item.type);
|
|
605
|
+
var indexedType = parts[index];
|
|
606
|
+
var indexBits = getBits(indexedType);
|
|
607
|
+
var bits = getBits(item.type); // source and target
|
|
608
|
+
bits = getBits(value.type);
|
|
609
|
+
var toAdd = [];
|
|
610
|
+
var elements = getLegalVars(item.assignTo, bits);
|
|
611
|
+
var sourceElements = getLegalVars(item.ident, bits);
|
|
612
|
+
var indexElements = getLegalVars(item.value.ident, indexBits, true); // possibly legal
|
|
613
|
+
var sourceIndex = 0;
|
|
614
|
+
for (var partIndex = 0; partIndex < parts.length; partIndex++) {
|
|
615
|
+
var currNum = getStructuralTypePartBits(parts[partIndex])/32;
|
|
616
|
+
for (var j = 0; j < currNum; j++) {
|
|
617
|
+
toAdd.push({
|
|
618
|
+
intertype: 'value',
|
|
619
|
+
assignTo: elements[sourceIndex+j].ident,
|
|
620
|
+
type: 'i' + elements[sourceIndex+j].bits,
|
|
621
|
+
ident: partIndex == index ? indexElements[j].ident : sourceElements[sourceIndex+j].ident
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
sourceIndex += currNum;
|
|
625
|
+
}
|
|
626
|
+
i += removeAndAdd(label.lines, i, toAdd);
|
|
627
|
+
continue;
|
|
628
|
+
}
|
|
629
|
+
case 'bitcast': {
|
|
630
|
+
var inType = item.type2;
|
|
631
|
+
var outType = item.type;
|
|
632
|
+
if ((inType in Runtime.INT_TYPES && outType in Runtime.FLOAT_TYPES) ||
|
|
633
|
+
(inType in Runtime.FLOAT_TYPES && outType in Runtime.INT_TYPES)) {
|
|
634
|
+
i++;
|
|
635
|
+
continue; // special case, handled in processMathop
|
|
636
|
+
}
|
|
637
|
+
// fall through
|
|
638
|
+
}
|
|
639
|
+
case 'inttoptr': case 'ptrtoint': case 'zext': case 'sext': case 'trunc': case 'ashr': case 'lshr': case 'shl': case 'or': case 'and': case 'xor': {
|
|
640
|
+
value = {
|
|
641
|
+
op: item.intertype,
|
|
642
|
+
variant: item.variant,
|
|
643
|
+
type: item.type,
|
|
644
|
+
params: item.params
|
|
645
|
+
};
|
|
646
|
+
// fall through
|
|
647
|
+
}
|
|
648
|
+
case 'mathop': {
|
|
649
|
+
var toAdd = [];
|
|
650
|
+
var sourceBits = getBits(value.params[0].type);
|
|
651
|
+
// All mathops can be parametrized by how many shifts we do, and how big the source is
|
|
652
|
+
var shifts = 0;
|
|
653
|
+
var targetBits = sourceBits;
|
|
654
|
+
var processor = null;
|
|
655
|
+
var signed = false;
|
|
656
|
+
switch (value.op) {
|
|
657
|
+
case 'ashr': {
|
|
658
|
+
signed = true;
|
|
659
|
+
// fall through
|
|
660
|
+
}
|
|
661
|
+
case 'lshr': {
|
|
662
|
+
shifts = parseInt(value.params[1].ident);
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
case 'shl': {
|
|
666
|
+
shifts = -parseInt(value.params[1].ident);
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
case 'sext': {
|
|
670
|
+
signed = true;
|
|
671
|
+
// fall through
|
|
672
|
+
}
|
|
673
|
+
case 'trunc': case 'zext': case 'ptrtoint': {
|
|
674
|
+
targetBits = getBits(value.params[1] ? value.params[1].ident : value.type);
|
|
675
|
+
break;
|
|
676
|
+
}
|
|
677
|
+
case 'inttoptr': {
|
|
678
|
+
targetBits = 32;
|
|
679
|
+
break;
|
|
680
|
+
}
|
|
681
|
+
case 'bitcast': {
|
|
682
|
+
if (!sourceBits) {
|
|
683
|
+
// we can be asked to bitcast doubles or such to integers, handle that as best we can (if it's a double that
|
|
684
|
+
// was an x86_fp80, this code will likely break when called)
|
|
685
|
+
sourceBits = targetBits = Runtime.getNativeTypeSize(value.params[0].type);
|
|
686
|
+
warn('legalizing non-integer bitcast on ll #' + item.lineNum);
|
|
687
|
+
}
|
|
688
|
+
break;
|
|
689
|
+
}
|
|
690
|
+
case 'select': {
|
|
691
|
+
sourceBits = targetBits = getBits(value.params[1].type);
|
|
692
|
+
var params = getLegalParams(value.params.slice(1), sourceBits);
|
|
693
|
+
processor = function(result, j) {
|
|
694
|
+
return {
|
|
695
|
+
intertype: 'mathop',
|
|
696
|
+
op: 'select',
|
|
697
|
+
type: 'i' + params[0][j].bits,
|
|
698
|
+
params: [
|
|
699
|
+
value.params[0],
|
|
700
|
+
{ intertype: 'value', ident: params[0][j].ident, type: 'i' + params[0][j].bits },
|
|
701
|
+
{ intertype: 'value', ident: params[1][j].ident, type: 'i' + params[1][j].bits }
|
|
702
|
+
]
|
|
703
|
+
};
|
|
704
|
+
};
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
case 'or': case 'and': case 'xor': case 'icmp': {
|
|
708
|
+
var otherElements = getLegalVars(value.params[1].ident, sourceBits);
|
|
709
|
+
processor = function(result, j) {
|
|
710
|
+
return {
|
|
711
|
+
intertype: 'mathop',
|
|
712
|
+
op: value.op,
|
|
713
|
+
variant: value.variant,
|
|
714
|
+
type: 'i' + otherElements[j].bits,
|
|
715
|
+
params: [
|
|
716
|
+
result,
|
|
717
|
+
{ intertype: 'value', ident: otherElements[j].ident, type: 'i' + otherElements[j].bits }
|
|
718
|
+
]
|
|
719
|
+
};
|
|
720
|
+
};
|
|
721
|
+
if (value.op == 'icmp') {
|
|
722
|
+
if (sourceBits == 64) { // handle the i64 case in processMathOp, where we handle full i64 math
|
|
723
|
+
i++;
|
|
724
|
+
continue;
|
|
725
|
+
}
|
|
726
|
+
finalizer = function() {
|
|
727
|
+
var ident = '';
|
|
728
|
+
for (var i = 0; i < targetElements.length; i++) {
|
|
729
|
+
if (i > 0) {
|
|
730
|
+
switch(value.variant) {
|
|
731
|
+
case 'eq': ident += '&'; break;
|
|
732
|
+
case 'ne': ident += '|'; break;
|
|
733
|
+
default: throw 'unhandleable illegal icmp: ' + value.variant;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
ident += targetElements[i].ident;
|
|
737
|
+
}
|
|
738
|
+
return {
|
|
739
|
+
intertype: 'value',
|
|
740
|
+
ident: ident,
|
|
741
|
+
type: 'rawJS',
|
|
742
|
+
assignTo: item.assignTo
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
break;
|
|
747
|
+
}
|
|
748
|
+
case 'add': case 'sub': case 'sdiv': case 'udiv': case 'mul': case 'urem': case 'srem':
|
|
749
|
+
case 'uitofp': case 'sitofp': case 'fptosi': case 'fptoui': {
|
|
750
|
+
// We cannot do these in parallel chunks of 32-bit operations. We will handle these in processMathop
|
|
751
|
+
i++;
|
|
752
|
+
continue;
|
|
753
|
+
}
|
|
754
|
+
default: throw 'Invalid mathop for legalization: ' + [value.op, item.lineNum, dump(item)];
|
|
755
|
+
}
|
|
756
|
+
// Do the legalization
|
|
757
|
+
var sourceElements = getLegalVars(value.params[0].ident, sourceBits, true);
|
|
758
|
+
if (!isNumber(shifts)) {
|
|
759
|
+
// We can't statically legalize this, do the operation at runtime TODO: optimize
|
|
760
|
+
assert(sourceBits == 64, 'TODO: handle nonconstant shifts on != 64 bits');
|
|
761
|
+
assert(PRECISE_I64_MATH, 'Must have precise i64 math for non-constant 64-bit shifts');
|
|
762
|
+
Types.preciseI64MathUsed = 1;
|
|
763
|
+
value.intertype = 'value';
|
|
764
|
+
value.ident = 'var ' + value.assignTo + '$0 = ' +
|
|
765
|
+
asmCoercion('_bitshift64' + value.op[0].toUpperCase() + value.op.substr(1) + '(' +
|
|
766
|
+
asmCoercion(sourceElements[0].ident, 'i32') + ',' +
|
|
767
|
+
asmCoercion(sourceElements[1].ident, 'i32') + ',' +
|
|
768
|
+
asmCoercion(value.params[1].ident + '$0', 'i32') + ')', 'i32'
|
|
769
|
+
) + ';' +
|
|
770
|
+
'var ' + value.assignTo + '$1 = tempRet0;';
|
|
771
|
+
value.assignTo = null;
|
|
772
|
+
i++;
|
|
773
|
+
continue;
|
|
774
|
+
}
|
|
775
|
+
var targetElements = getLegalVars(item.assignTo, targetBits);
|
|
776
|
+
var sign = shifts >= 0 ? 1 : -1;
|
|
777
|
+
var shiftOp = shifts >= 0 ? 'shl' : 'lshr';
|
|
778
|
+
var shiftOpReverse = shifts >= 0 ? 'lshr' : 'shl';
|
|
779
|
+
var whole = shifts >= 0 ? Math.floor(shifts/32) : Math.ceil(shifts/32);
|
|
780
|
+
var fraction = Math.abs(shifts % 32);
|
|
781
|
+
if (signed) {
|
|
782
|
+
var signedFill = '(' + makeSignOp(sourceElements[sourceElements.length-1].ident, 'i' + sourceElements[sourceElements.length-1].bits, 're', 1, 1) + ' < 0 ? -1 : 0)';
|
|
783
|
+
var signedKeepAlive = { intertype: 'value', ident: sourceElements[sourceElements.length-1].ident, type: 'i32' };
|
|
784
|
+
}
|
|
785
|
+
for (var j = 0; j < targetElements.length; j++) {
|
|
786
|
+
var result = {
|
|
787
|
+
intertype: 'value',
|
|
788
|
+
ident: (j + whole >= 0 && j + whole < sourceElements.length) ? sourceElements[j + whole].ident : (signed ? signedFill : '0'),
|
|
789
|
+
params: [(signed && j + whole > sourceElements.length) ? signedKeepAlive : null],
|
|
790
|
+
type: 'i32',
|
|
791
|
+
};
|
|
792
|
+
if (j == 0 && sourceBits < 32) {
|
|
793
|
+
// zext sign correction
|
|
794
|
+
result.ident = makeSignOp(result.ident, 'i' + sourceBits, isUnsignedOp(value.op) ? 'un' : 're', 1, 1);
|
|
795
|
+
}
|
|
796
|
+
if (fraction != 0) {
|
|
797
|
+
var other = {
|
|
798
|
+
intertype: 'value',
|
|
799
|
+
ident: (j + sign + whole >= 0 && j + sign + whole < sourceElements.length) ? sourceElements[j + sign + whole].ident : (signed ? signedFill : '0'),
|
|
800
|
+
params: [(signed && j + sign + whole > sourceElements.length) ? signedKeepAlive : null],
|
|
801
|
+
type: 'i32',
|
|
802
|
+
};
|
|
803
|
+
other = {
|
|
804
|
+
intertype: 'mathop',
|
|
805
|
+
op: shiftOp,
|
|
806
|
+
type: 'i32',
|
|
807
|
+
params: [
|
|
808
|
+
other,
|
|
809
|
+
{ intertype: 'value', ident: (32 - fraction).toString(), type: 'i32' }
|
|
810
|
+
]
|
|
811
|
+
};
|
|
812
|
+
result = {
|
|
813
|
+
intertype: 'mathop',
|
|
814
|
+
// shifting in 1s from the top is a special case
|
|
815
|
+
op: (signed && shifts >= 0 && j + sign + whole >= sourceElements.length) ? 'ashr' : shiftOpReverse,
|
|
816
|
+
type: 'i32',
|
|
817
|
+
params: [
|
|
818
|
+
result,
|
|
819
|
+
{ intertype: 'value', ident: fraction.toString(), type: 'i32' }
|
|
820
|
+
]
|
|
821
|
+
};
|
|
822
|
+
result = {
|
|
823
|
+
intertype: 'mathop',
|
|
824
|
+
op: 'or',
|
|
825
|
+
type: 'i32',
|
|
826
|
+
params: [
|
|
827
|
+
result,
|
|
828
|
+
other
|
|
829
|
+
]
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
if (targetElements[j].bits < 32 && shifts < 0) {
|
|
833
|
+
// truncate bits that fall off the end. This is not needed in most cases, can probably be optimized out
|
|
834
|
+
result = {
|
|
835
|
+
intertype: 'mathop',
|
|
836
|
+
op: 'and',
|
|
837
|
+
type: 'i32',
|
|
838
|
+
params: [
|
|
839
|
+
result,
|
|
840
|
+
{ intertype: 'value', ident: (Math.pow(2, targetElements[j].bits)-1).toString(), type: 'i32' }
|
|
841
|
+
]
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
if (processor) {
|
|
845
|
+
result = processor(result, j);
|
|
846
|
+
}
|
|
847
|
+
result.assignTo = targetElements[j].ident;
|
|
848
|
+
toAdd.push(result);
|
|
849
|
+
}
|
|
850
|
+
if (targetBits <= 32) {
|
|
851
|
+
// We are generating a normal legal type here
|
|
852
|
+
legalValue = {
|
|
853
|
+
intertype: 'value',
|
|
854
|
+
ident: targetElements[0].ident + (targetBits < 32 ? '&' + (Math.pow(2, targetBits)-1) : ''),
|
|
855
|
+
type: 'rawJS'
|
|
856
|
+
};
|
|
857
|
+
legalValue.assignTo = item.assignTo;
|
|
858
|
+
toAdd.push(legalValue);
|
|
859
|
+
} else if (finalizer) {
|
|
860
|
+
toAdd.push(finalizer());
|
|
861
|
+
}
|
|
862
|
+
i += removeAndAdd(label.lines, i, toAdd);
|
|
863
|
+
continue;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
assert(0, 'Could not legalize illegal line: ' + [item.lineNum, dump(item)]);
|
|
867
|
+
}
|
|
868
|
+
if (dcheck('legalizer')) dprint('zz legalized: \n' + dump(label.lines));
|
|
869
|
+
});
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
// Add function lines to func.lines, after our modifications to the label lines
|
|
874
|
+
data.functions.forEach(function(func) {
|
|
875
|
+
func.labels.forEach(function(label) {
|
|
876
|
+
func.lines = func.lines.concat(label.lines);
|
|
877
|
+
});
|
|
878
|
+
});
|
|
879
|
+
this.forwardItem(data, 'Typevestigator');
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
|
|
883
|
+
function addTypeInternal(type, data) {
|
|
884
|
+
if (type.length == 1) return;
|
|
885
|
+
if (Types.types[type]) return;
|
|
886
|
+
if (['internal', 'hidden', 'inbounds', 'void'].indexOf(type) != -1) return;
|
|
887
|
+
if (Runtime.isNumberType(type)) return;
|
|
888
|
+
dprint('types', 'Adding type: ' + type);
|
|
889
|
+
|
|
890
|
+
// 'blocks': [14 x %struct.X] etc. If this is a pointer, we need
|
|
891
|
+
// to look at the underlying type - it was not defined explicitly
|
|
892
|
+
// anywhere else.
|
|
893
|
+
var nonPointing = removeAllPointing(type);
|
|
894
|
+
var check = /^\[(\d+)\ x\ (.*)\]$/.exec(nonPointing);
|
|
895
|
+
if (check && !Types.types[nonPointing]) {
|
|
896
|
+
var num = parseInt(check[1]);
|
|
897
|
+
num = Math.max(num, 1); // [0 x something] is used not for allocations and such of course, but
|
|
898
|
+
// for indexing - for an |array of unknown length|, basically. So we
|
|
899
|
+
// define the 'type' as having a single field. TODO: Ensure as a sanity
|
|
900
|
+
// check that we never allocate with this (either as a child structure
|
|
901
|
+
// in the analyzer, or in calcSize in alloca).
|
|
902
|
+
var subType = check[2];
|
|
903
|
+
addTypeInternal(subType, data); // needed for anonymous structure definitions (see below)
|
|
904
|
+
|
|
905
|
+
// Huge structural types are represented very inefficiently, both here and in generated JS. Best to avoid them - for example static char x[10*1024*1024]; is bad, while static char *x = malloc(10*1024*1024) is fine.
|
|
906
|
+
if (num >= 10*1024*1024) warnOnce('warning: very large fixed-size structural type: ' + type + ' - can you reduce it? (compilation may be slow)');
|
|
907
|
+
Types.types[nonPointing] = {
|
|
908
|
+
name_: nonPointing,
|
|
909
|
+
fields: range(num).map(function() { return subType }),
|
|
910
|
+
lineNum: '?'
|
|
911
|
+
};
|
|
912
|
+
// Also add a |[0 x type]| type
|
|
913
|
+
var zerod = '[0 x ' + subType + ']';
|
|
914
|
+
if (!Types.types[zerod]) {
|
|
915
|
+
Types.types[zerod] = {
|
|
916
|
+
name_: zerod,
|
|
917
|
+
fields: [subType, subType], // Two, so we get the flatFactor right. We care about the flatFactor, not the size here
|
|
918
|
+
lineNum: '?'
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
// anonymous structure definition, for example |{ i32, i8*, void ()*, i32 }|
|
|
925
|
+
if (type[0] == '{' || type[0] == '<') {
|
|
926
|
+
type = nonPointing;
|
|
927
|
+
var packed = type[0] == '<';
|
|
928
|
+
Types.types[type] = {
|
|
929
|
+
name_: type,
|
|
930
|
+
fields: splitTokenList(tokenize(type.substr(2 + packed, type.length - 4 - 2*packed)).tokens).map(function(segment) {
|
|
931
|
+
return segment[0].text;
|
|
932
|
+
}),
|
|
933
|
+
packed: packed,
|
|
934
|
+
lineNum: '?'
|
|
935
|
+
};
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
if (isPointerType(type)) return;
|
|
940
|
+
if (['['].indexOf(type) != -1) return;
|
|
941
|
+
Types.types[type] = {
|
|
942
|
+
name_: type,
|
|
943
|
+
fields: [ 'i' + (QUANTUM_SIZE*8) ], // a single quantum size
|
|
944
|
+
flatSize: 1,
|
|
945
|
+
lineNum: '?'
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
function addType(type, data) {
|
|
950
|
+
addTypeInternal(type, data);
|
|
951
|
+
if (QUANTUM_SIZE === 1) {
|
|
952
|
+
Types.flipTypes();
|
|
953
|
+
addTypeInternal(type, data);
|
|
954
|
+
Types.flipTypes();
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
// Typevestigator
|
|
959
|
+
substrate.addActor('Typevestigator', {
|
|
960
|
+
processItem: function(data) {
|
|
961
|
+
if (sidePass) { // Do not investigate in the main pass - it is only valid to start to do so in the first side pass,
|
|
962
|
+
// which handles type definitions, and later. Doing so before the first side pass will result in
|
|
963
|
+
// making bad guesses about types which are actually defined
|
|
964
|
+
for (var type in Types.needAnalysis) {
|
|
965
|
+
if (type) addType(type, data);
|
|
966
|
+
}
|
|
967
|
+
Types.needAnalysis = {};
|
|
968
|
+
}
|
|
969
|
+
this.forwardItem(data, 'Typeanalyzer');
|
|
970
|
+
}
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
// Type analyzer
|
|
974
|
+
substrate.addActor('Typeanalyzer', {
|
|
975
|
+
processItem: function analyzeTypes(item, fatTypes) {
|
|
976
|
+
var types = Types.types;
|
|
977
|
+
|
|
978
|
+
// 'fields' is the raw list of LLVM fields. However, we embed
|
|
979
|
+
// child structures into parent structures, basically like C.
|
|
980
|
+
// So { int, { int, int }, int } would be represented as
|
|
981
|
+
// an Array of 4 ints. getelementptr on the parent would take
|
|
982
|
+
// values 0, 1, 2, where 2 is the entire middle structure.
|
|
983
|
+
// We also need to be careful with getelementptr to child
|
|
984
|
+
// structures - we return a pointer to the same slab, just
|
|
985
|
+
// a different offset. Likewise, need to be careful for
|
|
986
|
+
// getelementptr of 2 (the last int) - it's real index is 4.
|
|
987
|
+
// The benefit of this approach is inheritance -
|
|
988
|
+
// { { ancestor } , etc. } = descendant
|
|
989
|
+
// In this case it is easy to bitcast ancestor to descendant
|
|
990
|
+
// pointers - nothing needs to be done. If the ancestor were
|
|
991
|
+
// a new slab, it would need some pointer to the outer one
|
|
992
|
+
// for casting in that direction.
|
|
993
|
+
// TODO: bitcasts of non-inheritance cases of embedding (not at start)
|
|
994
|
+
var more = true;
|
|
995
|
+
while (more) {
|
|
996
|
+
more = false;
|
|
997
|
+
for (var typeName in types) {
|
|
998
|
+
var type = types[typeName];
|
|
999
|
+
if (type.flatIndexes) continue;
|
|
1000
|
+
var ready = true;
|
|
1001
|
+
type.fields.forEach(function(field) {
|
|
1002
|
+
if (isStructType(field)) {
|
|
1003
|
+
if (!types[field]) {
|
|
1004
|
+
addType(field, item);
|
|
1005
|
+
ready = false;
|
|
1006
|
+
} else {
|
|
1007
|
+
if (!types[field].flatIndexes) {
|
|
1008
|
+
ready = false;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
if (!ready) {
|
|
1014
|
+
more = true;
|
|
1015
|
+
continue;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
Runtime.calculateStructAlignment(type);
|
|
1019
|
+
|
|
1020
|
+
if (dcheck('types')) dprint('type (fat=' + !!fatTypes + '): ' + type.name_ + ' : ' + JSON.stringify(type.fields));
|
|
1021
|
+
if (dcheck('types')) dprint(' has final size of ' + type.flatSize + ', flatting: ' + type.needsFlattening + ' ? ' + (type.flatFactor ? type.flatFactor : JSON.stringify(type.flatIndexes)));
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
if (QUANTUM_SIZE === 1 && !fatTypes) {
|
|
1026
|
+
Types.flipTypes();
|
|
1027
|
+
// Fake a quantum size of 4 for fat types. TODO: Might want non-4 for some reason?
|
|
1028
|
+
var trueQuantumSize = QUANTUM_SIZE;
|
|
1029
|
+
Runtime.QUANTUM_SIZE = 4;
|
|
1030
|
+
analyzeTypes(item, true);
|
|
1031
|
+
Runtime.QUANTUM_SIZE = trueQuantumSize;
|
|
1032
|
+
Types.flipTypes();
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
if (!fatTypes) {
|
|
1036
|
+
this.forwardItem(item, 'VariableAnalyzer');
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
// Variable analyzer
|
|
1042
|
+
substrate.addActor('VariableAnalyzer', {
|
|
1043
|
+
processItem: function(item) {
|
|
1044
|
+
// Globals
|
|
1045
|
+
|
|
1046
|
+
var old = item.globalVariables;
|
|
1047
|
+
item.globalVariables = {};
|
|
1048
|
+
old.forEach(function(variable) {
|
|
1049
|
+
variable.impl = 'emulated'; // All global variables are emulated, for now. Consider optimizing later if useful
|
|
1050
|
+
item.globalVariables[variable.ident] = variable;
|
|
1051
|
+
});
|
|
1052
|
+
|
|
1053
|
+
// Function locals
|
|
1054
|
+
|
|
1055
|
+
item.functions.forEach(function(func) {
|
|
1056
|
+
func.variables = {};
|
|
1057
|
+
|
|
1058
|
+
// LLVM is SSA, so we always have a single assignment/write. We care about
|
|
1059
|
+
// the reads/other uses.
|
|
1060
|
+
|
|
1061
|
+
// Function parameters
|
|
1062
|
+
func.params.forEach(function(param) {
|
|
1063
|
+
if (param.intertype !== 'varargs') {
|
|
1064
|
+
if (func.variables[param.ident]) warn('cannot have duplicate variable names: ' + param.ident); // toNiceIdent collisions?
|
|
1065
|
+
func.variables[param.ident] = {
|
|
1066
|
+
ident: param.ident,
|
|
1067
|
+
type: param.type,
|
|
1068
|
+
origin: 'funcparam',
|
|
1069
|
+
lineNum: func.lineNum,
|
|
1070
|
+
rawLinesIndex: -1
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
|
|
1075
|
+
// Normal variables
|
|
1076
|
+
func.lines.forEach(function(item, i) {
|
|
1077
|
+
if (item.assignTo) {
|
|
1078
|
+
if (func.variables[item.assignTo]) warn('cannot have duplicate variable names: ' + item.assignTo); // toNiceIdent collisions?
|
|
1079
|
+
var variable = func.variables[item.assignTo] = {
|
|
1080
|
+
ident: item.assignTo,
|
|
1081
|
+
type: item.type,
|
|
1082
|
+
origin: item.intertype,
|
|
1083
|
+
lineNum: item.lineNum,
|
|
1084
|
+
rawLinesIndex: i
|
|
1085
|
+
};
|
|
1086
|
+
if (variable.origin === 'alloca') {
|
|
1087
|
+
variable.allocatedNum = item.allocatedNum;
|
|
1088
|
+
}
|
|
1089
|
+
if (variable.origin === 'call') {
|
|
1090
|
+
variable.type = getReturnType(variable.type);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
|
|
1095
|
+
if (QUANTUM_SIZE === 1) {
|
|
1096
|
+
// Second pass over variables - notice when types are crossed by bitcast
|
|
1097
|
+
|
|
1098
|
+
func.lines.forEach(function(item) {
|
|
1099
|
+
if (item.assignTo && item.intertype === 'bitcast') {
|
|
1100
|
+
// bitcasts are unique in that they convert one pointer to another. We
|
|
1101
|
+
// sometimes need to know the original type of a pointer, so we save that.
|
|
1102
|
+
//
|
|
1103
|
+
// originalType is the type this variable is created from
|
|
1104
|
+
// derivedTypes are the types that this variable is cast into
|
|
1105
|
+
func.variables[item.assignTo].originalType = item.type2;
|
|
1106
|
+
|
|
1107
|
+
if (!isNumber(item.assignTo)) {
|
|
1108
|
+
if (!func.variables[item.assignTo].derivedTypes) {
|
|
1109
|
+
func.variables[item.assignTo].derivedTypes = [];
|
|
1110
|
+
}
|
|
1111
|
+
func.variables[item.assignTo].derivedTypes.push(item.type);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
// Analyze variable uses
|
|
1118
|
+
|
|
1119
|
+
function analyzeVariableUses() {
|
|
1120
|
+
dprint('vars', 'Analyzing variables for ' + func.ident + '\n');
|
|
1121
|
+
|
|
1122
|
+
for (vname in func.variables) {
|
|
1123
|
+
var variable = func.variables[vname];
|
|
1124
|
+
|
|
1125
|
+
// Whether the value itself is used. For an int, always yes. For a pointer,
|
|
1126
|
+
// we might never use the pointer's value - we might always just store to it /
|
|
1127
|
+
// read from it. If so, then we can optimize away the pointer.
|
|
1128
|
+
variable.hasValueTaken = false;
|
|
1129
|
+
|
|
1130
|
+
variable.pointingLevels = pointingLevels(variable.type);
|
|
1131
|
+
|
|
1132
|
+
variable.uses = 0;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
// TODO: improve the analysis precision. bitcast, for example, means we take the value, but perhaps we only use it to load/store
|
|
1136
|
+
var inNoop = 0;
|
|
1137
|
+
func.lines.forEach(function(line) {
|
|
1138
|
+
walkInterdata(line, function(item) {
|
|
1139
|
+
if (item.intertype == 'noop') inNoop++;
|
|
1140
|
+
if (!inNoop) {
|
|
1141
|
+
if (item.ident in func.variables) {
|
|
1142
|
+
func.variables[item.ident].uses++;
|
|
1143
|
+
|
|
1144
|
+
if (item.intertype != 'load' && item.intertype != 'store') {
|
|
1145
|
+
func.variables[item.ident].hasValueTaken = true;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
}, function(item) {
|
|
1150
|
+
if (item.intertype == 'noop') inNoop--;
|
|
1151
|
+
});
|
|
1152
|
+
});
|
|
1153
|
+
|
|
1154
|
+
//if (dcheck('vars')) dprint('analyzed variables: ' + dump(func.variables));
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
analyzeVariableUses();
|
|
1158
|
+
|
|
1159
|
+
// Decision time
|
|
1160
|
+
|
|
1161
|
+
for (vname in func.variables) {
|
|
1162
|
+
var variable = func.variables[vname];
|
|
1163
|
+
var pointedType = pointingLevels(variable.type) > 0 ? removePointing(variable.type) : null;
|
|
1164
|
+
if (variable.origin == 'getelementptr') {
|
|
1165
|
+
// Use our implementation that emulates pointers etc.
|
|
1166
|
+
// TODO Can we perhaps nativize some of these? However to do so, we need to discover their
|
|
1167
|
+
// true types; we have '?' for them now, as they cannot be discovered in the intertyper.
|
|
1168
|
+
variable.impl = VAR_EMULATED;
|
|
1169
|
+
} else if (variable.origin == 'funcparam') {
|
|
1170
|
+
variable.impl = VAR_EMULATED;
|
|
1171
|
+
} else if (variable.type == 'i64*' && USE_TYPED_ARRAYS == 2) {
|
|
1172
|
+
variable.impl = VAR_EMULATED;
|
|
1173
|
+
} else if (MICRO_OPTS && variable.pointingLevels === 0) {
|
|
1174
|
+
// A simple int value, can be implemented as a native variable
|
|
1175
|
+
variable.impl = VAR_NATIVE;
|
|
1176
|
+
} else if (MICRO_OPTS && variable.origin === 'alloca' && !variable.hasValueTaken &&
|
|
1177
|
+
variable.allocatedNum === 1 &&
|
|
1178
|
+
(Runtime.isNumberType(pointedType) || Runtime.isPointerType(pointedType))) {
|
|
1179
|
+
// A pointer to a value which is only accessible through this pointer. Basically
|
|
1180
|
+
// a local value on the stack, which nothing fancy is done on. So we can
|
|
1181
|
+
// optimize away the pointing altogether, and just have a native variable
|
|
1182
|
+
variable.impl = VAR_NATIVIZED;
|
|
1183
|
+
} else {
|
|
1184
|
+
variable.impl = VAR_EMULATED;
|
|
1185
|
+
}
|
|
1186
|
+
if (dcheck('vars')) dprint('// var ' + vname + ': ' + JSON.stringify(variable));
|
|
1187
|
+
}
|
|
1188
|
+
});
|
|
1189
|
+
this.forwardItem(item, 'Signalyzer');
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
|
|
1193
|
+
// Sign analyzer
|
|
1194
|
+
//
|
|
1195
|
+
// Analyze our variables and detect their signs. In USE_TYPED_ARRAYS == 2,
|
|
1196
|
+
// we can read signed or unsigned values and prevent the need for signing
|
|
1197
|
+
// corrections. If on the other hand we are doing corrections anyhow, then
|
|
1198
|
+
// we can skip this pass.
|
|
1199
|
+
//
|
|
1200
|
+
// For each variable that is the result of a Load, we look a little forward
|
|
1201
|
+
// to see where it is used. We only care about mathops, since only they
|
|
1202
|
+
// need signs.
|
|
1203
|
+
//
|
|
1204
|
+
substrate.addActor('Signalyzer', {
|
|
1205
|
+
processItem: function(item) {
|
|
1206
|
+
this.forwardItem(item, 'QuantumFixer');
|
|
1207
|
+
if (USE_TYPED_ARRAYS != 2 || CORRECT_SIGNS == 1) return;
|
|
1208
|
+
|
|
1209
|
+
function seekIdent(item, obj) {
|
|
1210
|
+
if (item.ident === obj.ident) {
|
|
1211
|
+
obj.found++;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
function seekMathop(item, obj) {
|
|
1216
|
+
if (item.intertype === 'mathop' && obj.found && !obj.decided) {
|
|
1217
|
+
if (isUnsignedOp(item.op, item.variant)) {
|
|
1218
|
+
obj.unsigned++;
|
|
1219
|
+
} else {
|
|
1220
|
+
obj.signed++;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
item.functions.forEach(function(func) {
|
|
1226
|
+
func.lines.forEach(function(line, i) {
|
|
1227
|
+
if (line.intertype === 'load') {
|
|
1228
|
+
// Floats have no concept of signedness. Mark them as 'signed', which is the default, for which we do nothing
|
|
1229
|
+
if (line.type in Runtime.FLOAT_TYPES) {
|
|
1230
|
+
line.unsigned = false;
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
// Booleans are always unsigned
|
|
1234
|
+
var data = func.variables[line.assignTo];
|
|
1235
|
+
if (data.type === 'i1') {
|
|
1236
|
+
line.unsigned = true;
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
var total = data.uses;
|
|
1241
|
+
if (total === 0) return;
|
|
1242
|
+
var obj = { ident: line.assignTo, found: 0, unsigned: 0, signed: 0, total: total };
|
|
1243
|
+
// in loops with phis, we can also be used *before* we are defined
|
|
1244
|
+
var j = i-1, k = i+1;
|
|
1245
|
+
while(1) {
|
|
1246
|
+
assert(j >= 0 || k < func.lines.length, 'Signalyzer ran out of space to look for sign indications for line ' + line.lineNum);
|
|
1247
|
+
if (j >= 0 && walkInterdata(func.lines[j], seekIdent, seekMathop, obj)) break;
|
|
1248
|
+
if (k < func.lines.length && walkInterdata(func.lines[k], seekIdent, seekMathop, obj)) break;
|
|
1249
|
+
if (obj.total && obj.found >= obj.total) break; // see comment below
|
|
1250
|
+
j -= 1;
|
|
1251
|
+
k += 1;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
// unsigned+signed might be < total, since the same ident can appear multiple times in the same mathop.
|
|
1255
|
+
// found can actually be > total, since we currently have the same ident in a GEP (see cubescript test)
|
|
1256
|
+
// in the GEP item, and a child item (we have the ident copied onto the GEP item as a convenience).
|
|
1257
|
+
// probably not a bug-causer, but FIXME. see also a reference to this above
|
|
1258
|
+
// we also leave the loop above potentially early due to this. otherwise, though, we end up scanning the
|
|
1259
|
+
// entire function in some cases which is very slow
|
|
1260
|
+
assert(obj.found >= obj.total, 'Could not Signalyze line ' + line.lineNum);
|
|
1261
|
+
line.unsigned = obj.unsigned > 0;
|
|
1262
|
+
dprint('vars', 'Signalyzer: ' + line.assignTo + ' has unsigned == ' + line.unsigned + ' (line ' + line.lineNum + ')');
|
|
1263
|
+
}
|
|
1264
|
+
});
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
});
|
|
1268
|
+
|
|
1269
|
+
// Quantum fixer
|
|
1270
|
+
//
|
|
1271
|
+
// See settings.js for the meaning of QUANTUM_SIZE. The issue we fix here is,
|
|
1272
|
+
// to correct the .ll assembly code so that things work with QUANTUM_SIZE=1.
|
|
1273
|
+
//
|
|
1274
|
+
substrate.addActor('QuantumFixer', {
|
|
1275
|
+
processItem: function(item) {
|
|
1276
|
+
this.forwardItem(item, 'LabelAnalyzer');
|
|
1277
|
+
if (QUANTUM_SIZE !== 1) return;
|
|
1278
|
+
|
|
1279
|
+
// ptrs: the indexes of parameters that are pointers, whose originalType is what we want
|
|
1280
|
+
// bytes: the index of the 'bytes' parameter
|
|
1281
|
+
// TODO: malloc, realloc?
|
|
1282
|
+
var FIXABLE_CALLS = {
|
|
1283
|
+
'memcpy': { ptrs: [0,1], bytes: 2 },
|
|
1284
|
+
'memmove': { ptrs: [0,1], bytes: 2 },
|
|
1285
|
+
'memset': { ptrs: [0], bytes: 2 },
|
|
1286
|
+
'qsort': { ptrs: [0], bytes: 2 }
|
|
1287
|
+
};
|
|
1288
|
+
|
|
1289
|
+
function getSize(types, type, fat) {
|
|
1290
|
+
if (types[type]) return types[type].flatSize;
|
|
1291
|
+
if (fat) {
|
|
1292
|
+
Runtime.QUANTUM_SIZE = 4;
|
|
1293
|
+
}
|
|
1294
|
+
var ret = Runtime.getNativeTypeSize(type);
|
|
1295
|
+
if (fat) {
|
|
1296
|
+
Runtime.QUANTUM_SIZE = 1;
|
|
1297
|
+
}
|
|
1298
|
+
return ret;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
function getFlatIndexes(types, type) {
|
|
1302
|
+
if (types[type]) return types[type].flatIndexes;
|
|
1303
|
+
return [0];
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
item.functions.forEach(function(func) {
|
|
1307
|
+
function getOriginalType(param) {
|
|
1308
|
+
function get() {
|
|
1309
|
+
if (param.intertype === 'value' && !isNumber(param.ident)) {
|
|
1310
|
+
if (func.variables[param.ident]) {
|
|
1311
|
+
return func.variables[param.ident].originalType || null;
|
|
1312
|
+
} else {
|
|
1313
|
+
return item.globalVariables[param.ident].originalType;
|
|
1314
|
+
}
|
|
1315
|
+
} else if (param.intertype === 'bitcast') {
|
|
1316
|
+
return param.params[0].type;
|
|
1317
|
+
} else if (param.intertype === 'getelementptr') {
|
|
1318
|
+
if (param.params[0].type[0] === '[') return param.params[0].type;
|
|
1319
|
+
}
|
|
1320
|
+
return null;
|
|
1321
|
+
}
|
|
1322
|
+
var ret = get();
|
|
1323
|
+
if (ret && ret[0] === '[') {
|
|
1324
|
+
var check = /^\[(\d+)\ x\ (.*)\]\*$/.exec(ret);
|
|
1325
|
+
assert(check);
|
|
1326
|
+
ret = check[2] + '*';
|
|
1327
|
+
}
|
|
1328
|
+
return ret;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
func.lines.forEach(function(line) {
|
|
1332
|
+
// Call
|
|
1333
|
+
if (line.intertype === 'call') {
|
|
1334
|
+
var funcIdent = LibraryManager.getRootIdent(line.ident.substr(1));
|
|
1335
|
+
var fixData = FIXABLE_CALLS[funcIdent];
|
|
1336
|
+
if (!fixData) return;
|
|
1337
|
+
var ptrs = fixData.ptrs.map(function(ptr) { return line.params[ptr] });
|
|
1338
|
+
var bytes = line.params[fixData.bytes].ident;
|
|
1339
|
+
|
|
1340
|
+
// Only consider original types. This assumes memcpy always has pointers bitcast to i8*
|
|
1341
|
+
var originalTypes = ptrs.map(getOriginalType);
|
|
1342
|
+
for (var i = 0; i < originalTypes.length; i++) {
|
|
1343
|
+
if (!originalTypes[i]) return;
|
|
1344
|
+
}
|
|
1345
|
+
originalTypes = originalTypes.map(function(type) { return removePointing(type) });
|
|
1346
|
+
var sizes = originalTypes.map(function(type) { return getSize(Types.types, type) });
|
|
1347
|
+
var fatSizes = originalTypes.map(function(type) { return getSize(Types.fatTypes, type, true) });
|
|
1348
|
+
// The sizes may not be identical, if we copy a descendant class into a parent class. We use
|
|
1349
|
+
// the smaller size in that case. However, this may also be a bug, it is hard to tell, hence a warning
|
|
1350
|
+
warn(dedup(sizes).length === 1, 'All sizes should probably be identical here: ' + dump(originalTypes) + ':' + dump(sizes) + ':' +
|
|
1351
|
+
line.lineNum);
|
|
1352
|
+
warn(dedup(fatSizes).length === 1, 'All fat sizes should probably be identical here: ' + dump(originalTypes) + ':' + dump(sizes) + ':' +
|
|
1353
|
+
line.lineNum);
|
|
1354
|
+
var size = Math.min.apply(null, sizes);
|
|
1355
|
+
var fatSize = Math.min.apply(null, fatSizes);
|
|
1356
|
+
if (isNumber(bytes)) {
|
|
1357
|
+
// Figure out how much to copy.
|
|
1358
|
+
var fixedBytes;
|
|
1359
|
+
if (bytes % fatSize === 0) {
|
|
1360
|
+
fixedBytes = size*(bytes/fatSize);
|
|
1361
|
+
} else if (fatSize % bytes === 0 && size % (fatSize/bytes) === 0) {
|
|
1362
|
+
// Assume this is a simple array. XXX We can be wrong though! See next TODO
|
|
1363
|
+
fixedBytes = size/(fatSize/bytes);
|
|
1364
|
+
} else {
|
|
1365
|
+
// Just part of a structure. Align them to see how many fields. Err on copying more.
|
|
1366
|
+
// TODO: properly generate a complete structure, including nesteds, and calculate on that
|
|
1367
|
+
var flatIndexes = getFlatIndexes(Types.types, originalTypes[0]).concat(size);
|
|
1368
|
+
var fatFlatIndexes = getFlatIndexes(Types.fatTypes, originalTypes[0]).concat(fatSize);
|
|
1369
|
+
var index = 0;
|
|
1370
|
+
var left = bytes;
|
|
1371
|
+
fixedBytes = 0;
|
|
1372
|
+
while (left > 0) {
|
|
1373
|
+
left -= fatFlatIndexes[index+1] - fatFlatIndexes[index]; // note: we copy the alignment bytes too, which is unneeded
|
|
1374
|
+
fixedBytes += flatIndexes[index+1] - flatIndexes[index];
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
line.params[fixData.bytes].ident = fixedBytes;
|
|
1378
|
+
} else {
|
|
1379
|
+
line.params[fixData.bytes].intertype = 'jsvalue';
|
|
1380
|
+
// We have an assertion in library::memcpy() that this is round
|
|
1381
|
+
line.params[fixData.bytes].ident = size + '*(' + bytes + '/' + fatSize + ')';
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
});
|
|
1385
|
+
});
|
|
1386
|
+
|
|
1387
|
+
// 2nd part - fix hardcoded constant offsets in global constants
|
|
1388
|
+
values(item.globalVariables).forEach(function(variable) {
|
|
1389
|
+
function recurse(item) {
|
|
1390
|
+
if (item.contents) {
|
|
1391
|
+
item.contents.forEach(recurse);
|
|
1392
|
+
} else if (item.intertype === 'getelementptr' && item.params[0].intertype === 'bitcast' && item.params[0].type === 'i8*') {
|
|
1393
|
+
var originalType = removePointing(item.params[0].params[0].type);
|
|
1394
|
+
var fatSize = getSize(Types.fatTypes, originalType, true);
|
|
1395
|
+
var slimSize = getSize(Types.types, originalType, false);
|
|
1396
|
+
assert(fatSize % slimSize === 0);
|
|
1397
|
+
item.params.slice(1).forEach(function(param) {
|
|
1398
|
+
if (param.intertype === 'value' && isNumber(param.ident)) {
|
|
1399
|
+
var corrected = parseInt(param.ident)/(fatSize/slimSize);
|
|
1400
|
+
assert(corrected % 1 === 0);
|
|
1401
|
+
param.ident = corrected.toString();
|
|
1402
|
+
}
|
|
1403
|
+
});
|
|
1404
|
+
} else if (item.params) {
|
|
1405
|
+
item.params.forEach(recurse);
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
if (!variable.external && variable.value) recurse(variable.value);
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
});
|
|
1412
|
+
|
|
1413
|
+
function operateOnLabels(line, func) {
|
|
1414
|
+
function process(item, id) {
|
|
1415
|
+
['label', 'labelTrue', 'labelFalse', 'toLabel', 'unwindLabel', 'defaultLabel'].forEach(function(id) {
|
|
1416
|
+
if (item[id]) {
|
|
1417
|
+
func(item, id);
|
|
1418
|
+
}
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
if (line.intertype in BRANCH_INVOKE) {
|
|
1422
|
+
process(line);
|
|
1423
|
+
} else if (line.intertype == 'switch') {
|
|
1424
|
+
process(line);
|
|
1425
|
+
line.switchLabels.forEach(process);
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
// Label analyzer
|
|
1430
|
+
substrate.addActor('LabelAnalyzer', {
|
|
1431
|
+
processItem: function(item) {
|
|
1432
|
+
item.functions.forEach(function(func) {
|
|
1433
|
+
func.labelsDict = {};
|
|
1434
|
+
func.labelIds = {};
|
|
1435
|
+
func.labelIdsInverse = {};
|
|
1436
|
+
func.labelIds[toNiceIdent('%0')] = 1;
|
|
1437
|
+
func.labelIdsInverse[0] = toNiceIdent('%0');
|
|
1438
|
+
func.labelIdCounter = 2;
|
|
1439
|
+
func.labels.forEach(function(label) {
|
|
1440
|
+
if (!(label.ident in func.labelIds)) {
|
|
1441
|
+
func.labelIds[label.ident] = func.labelIdCounter++;
|
|
1442
|
+
func.labelIdsInverse[func.labelIdCounter-1] = label.ident;
|
|
1443
|
+
}
|
|
1444
|
+
});
|
|
1445
|
+
|
|
1446
|
+
// Minify label ids to numeric ids.
|
|
1447
|
+
func.labels.forEach(function(label) {
|
|
1448
|
+
label.ident = func.labelIds[label.ident];
|
|
1449
|
+
label.lines.forEach(function(line) {
|
|
1450
|
+
operateOnLabels(line, function(item, id) {
|
|
1451
|
+
item[id] = func.labelIds[item[id]].toString(); // strings, because we will append as we process
|
|
1452
|
+
});
|
|
1453
|
+
});
|
|
1454
|
+
});
|
|
1455
|
+
|
|
1456
|
+
func.labels.forEach(function(label) {
|
|
1457
|
+
func.labelsDict[label.ident] = label;
|
|
1458
|
+
});
|
|
1459
|
+
|
|
1460
|
+
// Correct phis
|
|
1461
|
+
func.labels.forEach(function(label) {
|
|
1462
|
+
label.lines.forEach(function(phi) {
|
|
1463
|
+
if (phi.intertype == 'phi') {
|
|
1464
|
+
for (var i = 0; i < phi.params.length; i++) {
|
|
1465
|
+
phi.params[i].label = func.labelIds[phi.params[i].label];
|
|
1466
|
+
if (VERBOSE && !phi.params[i].label) warn('phi refers to nonexistent label on line ' + phi.lineNum);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
});
|
|
1470
|
+
});
|
|
1471
|
+
|
|
1472
|
+
func.lines.forEach(function(line) {
|
|
1473
|
+
if (line.intertype == 'indirectbr') {
|
|
1474
|
+
func.forceEmulated = true;
|
|
1475
|
+
}
|
|
1476
|
+
});
|
|
1477
|
+
|
|
1478
|
+
function getActualLabelId(labelId) {
|
|
1479
|
+
if (func.labelsDict[labelId]) return labelId;
|
|
1480
|
+
// If not present, it must be a surprisingly-named entry (or undefined behavior, in which case, still ok to use the entry)
|
|
1481
|
+
labelId = func.labelIds[ENTRY_IDENT];
|
|
1482
|
+
assert(func.labelsDict[labelId]);
|
|
1483
|
+
return labelId;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
// Basic longjmp support, see library.js setjmp/longjmp
|
|
1487
|
+
var setjmp = toNiceIdent('@setjmp');
|
|
1488
|
+
func.setjmpTable = null;
|
|
1489
|
+
for (var i = 0; i < func.labels.length; i++) {
|
|
1490
|
+
var label = func.labels[i];
|
|
1491
|
+
for (var j = 0; j < label.lines.length; j++) {
|
|
1492
|
+
var line = label.lines[j];
|
|
1493
|
+
if ((line.intertype == 'call' || line.intertype == 'invoke') && line.ident == setjmp) {
|
|
1494
|
+
// Add a new label
|
|
1495
|
+
var oldLabel = label.ident;
|
|
1496
|
+
var newLabel = func.labelIdCounter++;
|
|
1497
|
+
if (!func.setjmpTable) func.setjmpTable = [];
|
|
1498
|
+
func.setjmpTable.push({ oldLabel: oldLabel, newLabel: newLabel, assignTo: line.assignTo });
|
|
1499
|
+
func.labels.splice(i+1, 0, {
|
|
1500
|
+
intertype: 'label',
|
|
1501
|
+
ident: newLabel,
|
|
1502
|
+
lineNum: label.lineNum + 0.5,
|
|
1503
|
+
lines: label.lines.slice(j+1)
|
|
1504
|
+
});
|
|
1505
|
+
func.labelsDict[newLabel] = func.labels[i+1];
|
|
1506
|
+
label.lines = label.lines.slice(0, j+1);
|
|
1507
|
+
label.lines.push({
|
|
1508
|
+
intertype: 'branch',
|
|
1509
|
+
label: toNiceIdent(newLabel),
|
|
1510
|
+
lineNum: line.lineNum + 0.01, // XXX legalizing might confuse this
|
|
1511
|
+
});
|
|
1512
|
+
// Correct phis
|
|
1513
|
+
func.labels.forEach(function(label) {
|
|
1514
|
+
label.lines.forEach(function(phi) {
|
|
1515
|
+
if (phi.intertype == 'phi') {
|
|
1516
|
+
for (var i = 0; i < phi.params.length; i++) {
|
|
1517
|
+
var sourceLabelId = getActualLabelId(phi.params[i].label);
|
|
1518
|
+
if (sourceLabelId == oldLabel) {
|
|
1519
|
+
phi.params[i].label = newLabel;
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
});
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
if (func.setjmpTable) {
|
|
1529
|
+
func.forceEmulated = true;
|
|
1530
|
+
recomputeLines(func);
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
// Properly implement phis, by pushing them back into the branch
|
|
1534
|
+
// that leads to here. We will only have the |var| definition in this location.
|
|
1535
|
+
|
|
1536
|
+
// First, push phis back
|
|
1537
|
+
func.labels.forEach(function(label) {
|
|
1538
|
+
label.lines.forEach(function(phi) {
|
|
1539
|
+
if (phi.intertype == 'phi') {
|
|
1540
|
+
for (var i = 0; i < phi.params.length; i++) {
|
|
1541
|
+
var param = phi.params[i];
|
|
1542
|
+
if (VERBOSE && !param.label) warn('phi refers to nonexistent label on line ' + phi.lineNum);
|
|
1543
|
+
var sourceLabelId = getActualLabelId(param.label);
|
|
1544
|
+
if (sourceLabelId) {
|
|
1545
|
+
var sourceLabel = func.labelsDict[sourceLabelId];
|
|
1546
|
+
var lastLine = sourceLabel.lines.slice(-1)[0];
|
|
1547
|
+
assert(lastLine.intertype in LLVM.PHI_REACHERS, 'Only some can lead to labels with phis:' + [func.ident, label.ident, lastLine.intertype]);
|
|
1548
|
+
if (!lastLine.phi) {
|
|
1549
|
+
lastLine.phi = true;
|
|
1550
|
+
assert(!lastLine.dependent);
|
|
1551
|
+
lastLine.dependent = {
|
|
1552
|
+
intertype: 'phiassigns',
|
|
1553
|
+
params: []
|
|
1554
|
+
};
|
|
1555
|
+
};
|
|
1556
|
+
lastLine.dependent.params.push({
|
|
1557
|
+
intertype: 'phiassign',
|
|
1558
|
+
ident: phi.assignTo,
|
|
1559
|
+
value: param.value,
|
|
1560
|
+
targetLabel: label.ident
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
// The assign to phi is now just a var
|
|
1565
|
+
phi.intertype = 'var';
|
|
1566
|
+
phi.ident = phi.assignTo;
|
|
1567
|
+
phi.assignTo = null;
|
|
1568
|
+
}
|
|
1569
|
+
});
|
|
1570
|
+
});
|
|
1571
|
+
|
|
1572
|
+
if (func.ident in NECESSARY_BLOCKADDRS) {
|
|
1573
|
+
Functions.blockAddresses[func.ident] = {};
|
|
1574
|
+
for (var needed in NECESSARY_BLOCKADDRS[func.ident]) {
|
|
1575
|
+
assert(needed in func.labelIds);
|
|
1576
|
+
Functions.blockAddresses[func.ident][needed] = func.labelIds[needed];
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
});
|
|
1580
|
+
this.forwardItem(item, 'StackAnalyzer');
|
|
1581
|
+
}
|
|
1582
|
+
});
|
|
1583
|
+
|
|
1584
|
+
// Stack analyzer - calculate the base stack usage
|
|
1585
|
+
substrate.addActor('StackAnalyzer', {
|
|
1586
|
+
processItem: function(data) {
|
|
1587
|
+
data.functions.forEach(function(func) {
|
|
1588
|
+
var lines = func.labels[0].lines;
|
|
1589
|
+
for (var i = 0; i < lines.length; i++) {
|
|
1590
|
+
var item = lines[i];
|
|
1591
|
+
if (!item.assignTo || item.intertype != 'alloca' || !isNumber(item.allocatedNum)) break;
|
|
1592
|
+
item.allocatedSize = func.variables[item.assignTo].impl === VAR_EMULATED ?
|
|
1593
|
+
calcAllocatedSize(item.allocatedType)*item.allocatedNum: 0;
|
|
1594
|
+
if (USE_TYPED_ARRAYS === 2) {
|
|
1595
|
+
// We need to keep the stack aligned
|
|
1596
|
+
item.allocatedSize = Runtime.forceAlign(item.allocatedSize, Runtime.STACK_ALIGN);
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
var index = 0;
|
|
1600
|
+
for (var i = 0; i < lines.length; i++) {
|
|
1601
|
+
var item = lines[i];
|
|
1602
|
+
if (!item.assignTo || item.intertype != 'alloca' || !isNumber(item.allocatedNum)) break;
|
|
1603
|
+
item.allocatedIndex = index;
|
|
1604
|
+
index += item.allocatedSize;
|
|
1605
|
+
delete item.allocatedSize;
|
|
1606
|
+
}
|
|
1607
|
+
func.initialStack = index;
|
|
1608
|
+
func.otherStackAllocations = false;
|
|
1609
|
+
while (func.initialStack == 0) { // one-time loop with possible abort in the middle
|
|
1610
|
+
// If there is no obvious need for stack management, perhaps we don't need it
|
|
1611
|
+
// (we try to optimize that way with SKIP_STACK_IN_SMALL). However,
|
|
1612
|
+
// we need to note if stack allocations other than initial allocs can happen here
|
|
1613
|
+
// If so, we need to rewind the stack when we leave.
|
|
1614
|
+
|
|
1615
|
+
// By-value params are causes of additional allocas (although we could in theory make them normal allocas too)
|
|
1616
|
+
func.params.forEach(function(param) {
|
|
1617
|
+
if (param.byVal) {
|
|
1618
|
+
func.otherStackAllocations = true;
|
|
1619
|
+
}
|
|
1620
|
+
});
|
|
1621
|
+
if (func.otherStackAllocations) break;
|
|
1622
|
+
|
|
1623
|
+
// Allocas
|
|
1624
|
+
var finishedInitial = false;
|
|
1625
|
+
|
|
1626
|
+
lines = func.lines; // We need to consider all the function lines now, not just the first label
|
|
1627
|
+
|
|
1628
|
+
for (var i = 0; i < lines.length; i++) {
|
|
1629
|
+
var item = lines[i];
|
|
1630
|
+
if (!finishedInitial && (!item.assignTo || item.intertype != 'alloca' || !isNumber(item.allocatedNum))) {
|
|
1631
|
+
finishedInitial = true;
|
|
1632
|
+
}
|
|
1633
|
+
if (item.intertype == 'alloca' && finishedInitial) {
|
|
1634
|
+
func.otherStackAllocations = true;
|
|
1635
|
+
break;
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
if (func.otherStackAllocations) break;
|
|
1639
|
+
|
|
1640
|
+
// Varargs
|
|
1641
|
+
for (var i = 0; i < lines.length; i++) {
|
|
1642
|
+
var item = lines[i];
|
|
1643
|
+
if (item.intertype == 'call' && isVarArgsFunctionType(item.type)) {
|
|
1644
|
+
func.otherStackAllocations = true;
|
|
1645
|
+
break;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
if (func.otherStackAllocations) break;
|
|
1649
|
+
|
|
1650
|
+
break;
|
|
1651
|
+
}
|
|
1652
|
+
});
|
|
1653
|
+
this.forwardItem(data, 'Relooper');
|
|
1654
|
+
}
|
|
1655
|
+
});
|
|
1656
|
+
|
|
1657
|
+
// ReLooper - reconstruct nice loops, as much as possible
|
|
1658
|
+
// This is now done in the jsify stage, using compiled relooper2
|
|
1659
|
+
substrate.addActor('Relooper', {
|
|
1660
|
+
processItem: function(item) {
|
|
1661
|
+
function finish() {
|
|
1662
|
+
item.__finalResult__ = true;
|
|
1663
|
+
return [item];
|
|
1664
|
+
}
|
|
1665
|
+
function makeBlock(labels, entries, labelsDict, forceEmulated) {
|
|
1666
|
+
if (labels.length == 0) return null;
|
|
1667
|
+
dprint('relooping', 'prelooping: ' + entries + ',' + labels.length + ' labels');
|
|
1668
|
+
assert(entries && entries[0]); // need at least 1 entry
|
|
1669
|
+
|
|
1670
|
+
var emulated = {
|
|
1671
|
+
type: 'emulated',
|
|
1672
|
+
id: 'B',
|
|
1673
|
+
labels: labels,
|
|
1674
|
+
entries: entries.slice(0)
|
|
1675
|
+
};
|
|
1676
|
+
return emulated;
|
|
1677
|
+
}
|
|
1678
|
+
item.functions.forEach(function(func) {
|
|
1679
|
+
dprint('relooping', "// relooping function: " + func.ident);
|
|
1680
|
+
func.block = makeBlock(func.labels, [func.labels[0].ident], func.labelsDict, func.forceEmulated);
|
|
1681
|
+
});
|
|
1682
|
+
|
|
1683
|
+
return finish();
|
|
1684
|
+
}
|
|
1685
|
+
});
|
|
1686
|
+
|
|
1687
|
+
// Data
|
|
1688
|
+
substrate.addItem({
|
|
1689
|
+
items: data
|
|
1690
|
+
}, 'Sorter');
|
|
1691
|
+
|
|
1692
|
+
// Solve it
|
|
1693
|
+
return substrate.solve();
|
|
1694
|
+
}
|
|
1695
|
+
|