aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS3
-rwxr-xr-xemcc220
-rw-r--r--emlink.py293
-rwxr-xr-xemscripten.py97
-rw-r--r--src/compiler.js2
-rw-r--r--src/intertyper.js4
-rw-r--r--src/jsifier.js186
-rw-r--r--src/library.js442
-rw-r--r--src/library_browser.js8
-rw-r--r--src/library_gl.js182
-rw-r--r--src/library_sdl.js245
-rw-r--r--src/modules.js36
-rw-r--r--src/parseTools.js46
-rw-r--r--src/preamble.js10
-rw-r--r--src/relooper/Relooper.cpp74
-rw-r--r--src/relooper/Relooper.h2
-rw-r--r--src/runtime.js8
-rw-r--r--src/settings.js30
-rw-r--r--src/shell.html6
-rw-r--r--src/shell.js10
-rw-r--r--src/utility.js10
-rw-r--r--system/include/SDL/SDL_keycode.h3
-rw-r--r--system/include/libc/grp.h2
-rw-r--r--system/include/libc/sys/dirent.h1
-rw-r--r--system/include/libc/sys/signal.h1
-rw-r--r--system/include/libc/sys/stat.h42
-rw-r--r--system/include/libc/time.h3
-rw-r--r--system/include/net/netinet/in.h94
-rw-r--r--system/include/sys/socket.h2
-rw-r--r--tests/cases/sillyfuncast.ll23
-rw-r--r--tests/cases/sillyfuncast2.ll21
-rw-r--r--tests/cases/zeroextarg.ll22
-rw-r--r--tests/dirent/test_readdir.c132
-rw-r--r--tests/embind/shell.html6
-rw-r--r--tests/fcntl-misc/src.c2
-rw-r--r--tests/fcntl-open/output.txt10
-rw-r--r--tests/fcntl-open/src.c64
-rwxr-xr-xtests/fuzz/creduce_tester.py54
-rwxr-xr-xtests/fuzz/csmith_driver.py30
-rw-r--r--tests/hello_world_gles_shell.html3
-rwxr-xr-xtests/runner.py1306
-rw-r--r--tests/sdl_gfx_primitives.c46
-rw-r--r--tests/sdl_gfx_primitives.pngbin0 -> 2357 bytes
-rw-r--r--tests/sdl_rotozoom.c21
-rw-r--r--tests/sdl_rotozoom.pngbin360054 -> 431921 bytes
-rw-r--r--tests/unistd/isatty.c38
-rw-r--r--tests/unistd/isatty.js5
-rw-r--r--tests/unistd/isatty.out10
-rw-r--r--tests/unistd/ttyname.c76
-rw-r--r--tests/unistd/ttyname.js1
-rw-r--r--tests/unistd/ttyname.out5
-rw-r--r--tests/utime/test_utime.c53
-rw-r--r--tools/autodebugger_js.py2
-rw-r--r--tools/eliminator/eliminator-test-output.js3
-rw-r--r--tools/eliminator/node_modules/uglify-js/lib/parse-js.js32
-rw-r--r--tools/eliminator/node_modules/uglify-js/lib/process.js72
-rw-r--r--tools/js-optimizer.js1138
-rw-r--r--tools/js_optimizer.py74
-rw-r--r--tools/node_modules/source-map/.npmignore2
-rw-r--r--tools/node_modules/source-map/.travis.yml4
-rw-r--r--tools/node_modules/source-map/CHANGELOG.md58
-rw-r--r--tools/node_modules/source-map/LICENSE28
-rw-r--r--tools/node_modules/source-map/Makefile.dryice.js166
-rw-r--r--tools/node_modules/source-map/README.md347
-rw-r--r--tools/node_modules/source-map/build/assert-shim.js56
-rw-r--r--tools/node_modules/source-map/build/mini-require.js152
-rw-r--r--tools/node_modules/source-map/build/prefix-source-map.jsm20
-rw-r--r--tools/node_modules/source-map/build/prefix-utils.jsm18
-rw-r--r--tools/node_modules/source-map/build/suffix-browser.js8
-rw-r--r--tools/node_modules/source-map/build/suffix-source-map.jsm6
-rw-r--r--tools/node_modules/source-map/build/suffix-utils.jsm21
-rw-r--r--tools/node_modules/source-map/build/test-prefix.js8
-rw-r--r--tools/node_modules/source-map/build/test-suffix.js3
-rw-r--r--tools/node_modules/source-map/lib/source-map.js8
-rw-r--r--tools/node_modules/source-map/lib/source-map/array-set.js96
-rw-r--r--tools/node_modules/source-map/lib/source-map/base64-vlq.js144
-rw-r--r--tools/node_modules/source-map/lib/source-map/base64.js42
-rw-r--r--tools/node_modules/source-map/lib/source-map/binary-search.js81
-rw-r--r--tools/node_modules/source-map/lib/source-map/source-map-consumer.js430
-rw-r--r--tools/node_modules/source-map/lib/source-map/source-map-generator.js381
-rw-r--r--tools/node_modules/source-map/lib/source-map/source-node.js353
-rw-r--r--tools/node_modules/source-map/lib/source-map/util.js117
-rw-r--r--tools/node_modules/source-map/node_modules/amdefine/LICENSE58
-rw-r--r--tools/node_modules/source-map/node_modules/amdefine/README.md119
-rw-r--r--tools/node_modules/source-map/node_modules/amdefine/amdefine.js299
-rw-r--r--tools/node_modules/source-map/node_modules/amdefine/package.json33
-rw-r--r--tools/node_modules/source-map/package.json74
-rwxr-xr-xtools/node_modules/source-map/test/run-tests.js73
-rw-r--r--tools/node_modules/source-map/test/source-map/test-api.js26
-rw-r--r--tools/node_modules/source-map/test/source-map/test-array-set.js71
-rw-r--r--tools/node_modules/source-map/test/source-map/test-base64-vlq.js24
-rw-r--r--tools/node_modules/source-map/test/source-map/test-base64.js35
-rw-r--r--tools/node_modules/source-map/test/source-map/test-binary-search.js54
-rw-r--r--tools/node_modules/source-map/test/source-map/test-dog-fooding.js72
-rw-r--r--tools/node_modules/source-map/test/source-map/test-source-map-consumer.js306
-rw-r--r--tools/node_modules/source-map/test/source-map/test-source-map-generator.js391
-rw-r--r--tools/node_modules/source-map/test/source-map/test-source-node.js282
-rw-r--r--tools/node_modules/source-map/test/source-map/util.js152
-rw-r--r--tools/shared.py96
-rw-r--r--tools/source-maps/sourcemap2json.js15
-rwxr-xr-xtools/source-maps/sourcemapper.js177
-rw-r--r--tools/test-js-optimizer-asm-last-output.js29
-rw-r--r--tools/test-js-optimizer-asm-last.js35
-rw-r--r--tools/test-js-optimizer-asm-outline-output.js570
-rw-r--r--tools/test-js-optimizer-asm-outline.js606
-rw-r--r--tools/test-js-optimizer-asm-pre-output.js18
-rw-r--r--tools/test-js-optimizer-asm-pre.js23
-rw-r--r--tools/test-js-optimizer-asm-relocate-output.js8
-rw-r--r--tools/test-js-optimizer-asm-relocate.js10
109 files changed, 10035 insertions, 1481 deletions
diff --git a/AUTHORS b/AUTHORS
index 27206740..021240e2 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -85,3 +85,6 @@ a license to everyone to use it as detailed in LICENSE.)
* Ludovic Perrine <jazzzz@gmail.com>
* David Barksdale <david.barksdale@adcedosolutions.com>
* Manfred Manik Nerurkar <nerurkar*at*made-apps.biz> (copyright owned by MADE, GmbH)
+* Joseph Gentle <me@josephg.com>
+* Douglas T. Crosher <dtc-moz@scieneer.com> (copyright owned by Mozilla Founcation)
+* Soeren Balko <soeren.balko@gmail.com>
diff --git a/emcc b/emcc
index 3bc35aa4..895aab87 100755
--- a/emcc
+++ b/emcc
@@ -49,7 +49,7 @@ emcc can be influenced by a few environment variables:
import os, sys, shutil, tempfile, subprocess, shlex, time, re, logging
from subprocess import PIPE, STDOUT
-from tools import shared
+from tools import shared, jsrun
from tools.shared import Compression, execute, suffix, unsuffixed, unsuffixed_basename
from tools.response_file import read_response_file
@@ -127,11 +127,6 @@ Options that are modified or new in %s include:
(For details on the affects of different
opt levels, see apply_opt_level() in
tools/shared.py and also src/settings.js.)
- Note: Optimizations are only done when
- compiling to JavaScript, not to intermediate
- bitcode, *unless* you build with
- EMCC_OPTIMIZE_NORMALLY=1 (not recommended
- unless you know what you are doing!)
-O2 As -O1, plus the relooper (loop recreation),
LLVM -O2 optimizations, and
@@ -144,7 +139,7 @@ Options that are modified or new in %s include:
-s DOUBLE_MODE=0
-s PRECISE_I64_MATH=0
--closure 1
- --llvm-lto 1
+ --llvm-lto 3
This is not recommended at all. A better idea
is to try each of these separately on top of
@@ -203,10 +198,13 @@ Options that are modified or new in %s include:
-g2 Preserve function names
-g3 Preserve variable names
-g4 Preserve LLVM debug info (if -g was
- used when compiling the C/C++ sources)
- and show line number debug comments.
- This is the highest level of debuggability.
- (default in -O0)
+ used when compiling the C/C++ sources),
+ show line number debug comments, and
+ generate source maps. This is the highest
+ level of debuggability. Note that this
+ may make -O1 and above significantly
+ slower because JS optimization will be
+ limited to 1 core. (default in -O0)
--typed-arrays <mode> 0: No typed arrays
1: Parallel typed arrays
@@ -217,10 +215,15 @@ Options that are modified or new in %s include:
2: -O2 LLVM optimizations
3: -O3 LLVM optimizations (default in -O2+)
- --llvm-lto <level> 0: No LLVM LTO (default in -O2 and below)
- 1: LLVM LTO (default in -O3)
+ --llvm-lto <level> 0: No LLVM LTO (default)
+ 1: LLVM LTO is performed
+ 2: We combine all the bitcode and run LLVM opt -O3
+ on that (which optimizes across modules, but is
+ not the same as normal LTO), but do not do normal
+ LTO
+ 3: We do both 2 and then 1
Note: If LLVM optimizations are not run
- (see --llvm-opts), setting this to 1 has no
+ (see --llvm-opts), setting this has no
effect.
--closure <on> 0: No closure compiler (default in -O2 and below)
@@ -519,14 +522,14 @@ if CONFIGURE_CONFIG or CMAKE_CONFIG:
open(tempout, 'w').write('//\n')
src = None
- for i in range(len(sys.argv)):
- if sys.argv[i].endswith('.c'):
+ for arg in sys.argv:
+ if arg.endswith('.c'):
try:
- src = open(sys.argv[i]).read()
- if debug_configure: open(tempout, 'a').write('============= ' + sys.argv[i] + '\n' + src + '\n=============\n\n')
+ src = open(arg).read()
+ if debug_configure: open(tempout, 'a').write('============= ' + arg + '\n' + src + '\n=============\n\n')
except:
pass
- if sys.argv[i].endswith('.s'):
+ if arg.endswith('.s'):
if debug_configure: open(tempout, 'a').write('(compiling .s assembly, must use clang\n')
use_js = 0
@@ -731,6 +734,14 @@ try:
settings_changes = []
+ def validate_arg_level(level_string, max_level, err_msg):
+ try:
+ level = int(level_string)
+ assert 0 <= level <= max_level
+ except:
+ raise Exception(err_msg)
+ return level
+
for i in range(len(newargs)):
newargs[i] = newargs[i].strip() # On Windows Vista (and possibly others), excessive spaces in the command line leak into the items in this array, so trim e.g. 'foo.cpp ' -> 'foo.cpp'
if newargs[i].startswith('-O'):
@@ -739,11 +750,7 @@ try:
if requested_level == 's':
requested_level = 2
settings_changes.append('INLINING_LIMIT=50')
- try:
- opt_level = int(requested_level)
- assert 0 <= opt_level <= 3
- except:
- raise Exception('Invalid optimization level: ' + newargs[i])
+ opt_level = validate_arg_level(requested_level, 3, 'Invalid optimization level: ' + newargs[i])
newargs[i] = ''
elif newargs[i].startswith('--llvm-opts'):
check_bad_eq(newargs[i])
@@ -787,12 +794,8 @@ try:
newargs[i+1] = ''
elif newargs[i].startswith('-g'):
requested_level = newargs[i][2:] or '3'
- try:
- debug_level = int(requested_level)
- assert 0 <= debug_level <= 4
- except:
- raise Exception('Invalid debug level: ' + newargs[i])
- newargs[i] = '-g' # discard level for clang args
+ debug_level = validate_arg_level(requested_level, 4, 'Invalid debug level: ' + newargs[i])
+ newargs[i] = '-g' # we'll need this to get LLVM debug info
elif newargs[i] == '--bind':
bind = True
newargs[i] = ''
@@ -823,7 +826,7 @@ try:
newargs[i] = ''
newargs[i+1] = ''
elif newargs[i].startswith('--use-preload-cache'):
- use_preload_cache = True;
+ use_preload_cache = True
newargs[i] = ''
elif newargs[i] == '--ignore-dynamic-linking':
ignore_dynamic_linking = True
@@ -881,10 +884,19 @@ try:
newargs = newargs + [default_cxx_std]
if llvm_opts is None: llvm_opts = LLVM_OPT_LEVEL[opt_level]
- if llvm_lto is None: llvm_lto = opt_level >= 3
+ if llvm_lto is None and opt_level >= 3: llvm_lto = 3
if opt_level == 0: debug_level = 4
if closure is None and opt_level == 3: closure = True
+ if llvm_lto is None and bind:
+ logging.debug('running lto for embind') # XXX this is a workaround for a pointer issue
+