aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS2
-rw-r--r--ChangeLog4
-rwxr-xr-xemcc120
-rwxr-xr-xemscripten.py6
-rw-r--r--src/compiler.js3
-rw-r--r--src/headless.js12
-rw-r--r--src/headlessCanvas.js1
-rw-r--r--src/library.js412
-rw-r--r--src/library_browser.js9
-rw-r--r--src/library_gl.js273
-rw-r--r--src/library_glew.js135
-rw-r--r--src/library_sdl.js64
-rw-r--r--src/modules.js2
-rw-r--r--src/parseTools.js67
-rw-r--r--src/postamble.js5
-rw-r--r--src/preamble.js36
-rw-r--r--src/relooper/Relooper.cpp27
-rw-r--r--src/relooper/Relooper.h4
-rw-r--r--src/relooper/test.txt4
-rw-r--r--src/runtime.js14
-rw-r--r--src/shell.js12
-rw-r--r--system/include/GL/glew.h841
-rw-r--r--system/include/libcxx/exception4
-rw-r--r--system/lib/libc.symbols33
-rw-r--r--system/lib/libc/gen/err.c49
-rw-r--r--system/lib/libc/gen/errx.c49
-rw-r--r--system/lib/libc/gen/verr.c58
-rw-r--r--system/lib/libc/gen/verrx.c51
-rw-r--r--system/lib/libc/gen/vwarn.c55
-rw-r--r--system/lib/libc/gen/vwarnx.c48
-rw-r--r--system/lib/libc/gen/warn.c49
-rw-r--r--system/lib/libc/gen/warnx.c49
-rw-r--r--system/lib/libc/musl/readme.txt4
-rw-r--r--system/lib/libc/musl/src/legacy/err.c67
-rw-r--r--system/lib/libc/musl/src/math/__cos.c71
-rw-r--r--system/lib/libc/musl/src/math/__sin.c64
-rw-r--r--system/lib/libc/musl/src/misc/getopt.c74
-rw-r--r--system/lib/libc/musl/src/misc/getopt_long.c59
-rw-r--r--system/lib/libc/musl/src/regex/fnmatch.c299
-rw-r--r--system/lib/libc/musl/src/stdio/__toread.c10
-rw-r--r--system/lib/libc/musl/src/stdio/__towrite.c18
-rw-r--r--system/lib/libc/musl/src/stdio/fputwc.c22
-rw-r--r--system/lib/libc/musl/src/stdio/fputws.c30
-rw-r--r--system/lib/libc/musl/src/stdio/vswprintf.c17
-rw-r--r--system/lib/libc/musl/src/stdlib/strtod.c24
-rw-r--r--system/lib/libc/stdlib/getopt_long.c511
-rw-r--r--system/lib/libc/stdlib/strtod.c305
-rw-r--r--system/lib/libcextra.symbols26
-rw-r--r--tests/cases/fptosi.ll28
-rw-r--r--tests/cases/fptosi.txt6
-rw-r--r--tests/cases/longjmp_tiny_invoke.ll6
-rw-r--r--tests/cases/longjmp_tiny_invoke_phi.ll4
-rw-r--r--tests/cases/longjmp_tiny_phi.ll2
-rw-r--r--tests/cases/longjmp_tiny_phi2.ll2
-rw-r--r--tests/core/fnmatch.c79
-rw-r--r--tests/core/fnmatch.out23
-rw-r--r--tests/core/test_alloca.in13
-rw-r--r--tests/core/test_exceptions_2.in (renamed from tests/core/test_exception_2.in)0
-rw-r--r--tests/core/test_exceptions_2.out (renamed from tests/core/test_exception_2.out)0
-rw-r--r--tests/core/test_exceptions_multi.in (renamed from tests/core/test_multiexception.in)6
-rw-r--r--tests/core/test_exceptions_multi.out (renamed from tests/core/test_multiexception.out)0
-rw-r--r--tests/core/test_exceptions_std.in (renamed from tests/core/test_std_exception.in)1
-rw-r--r--tests/core/test_exceptions_std.out2
-rw-r--r--tests/core/test_exceptions_typed.in (renamed from tests/exceptions/typed.cpp)0
-rw-r--r--tests/core/test_exceptions_typed.out (renamed from tests/exceptions/output.txt)0
-rw-r--r--tests/core/test_exceptions_white_list.in (renamed from tests/core/test_white_list_exception.in)0
-rw-r--r--tests/core/test_exceptions_white_list.out (renamed from tests/core/test_white_list_exception.out)0
-rw-r--r--tests/core/test_inlinejs3.in2
-rw-r--r--tests/core/test_nl_types.in8
-rw-r--r--tests/core/test_nl_types.out1
-rw-r--r--tests/core/test_std_exception.out1
-rw-r--r--tests/core/test_wprintf.c50
-rw-r--r--tests/core/test_wprintf.out35
-rw-r--r--tests/doublestart.c23
-rw-r--r--tests/glew.c51
-rwxr-xr-xtests/runner.py2
-rw-r--r--tests/test_benchmark.py12
-rw-r--r--tests/test_browser.py24
-rw-r--r--tests/test_core.py127
-rw-r--r--tests/test_other.py97
-rw-r--r--tests/utf32.cpp20
-rw-r--r--tools/eliminator/asm-eliminator-test-output.js506
-rw-r--r--tools/eliminator/asm-eliminator-test.js651
-rw-r--r--tools/js-optimizer.js1387
-rw-r--r--tools/js_optimizer.py7
-rw-r--r--tools/shared.py79
-rw-r--r--tools/test-js-optimizer-asm-regs-min-output.js5
-rw-r--r--tools/test-js-optimizer-asm-regs-min.js5
-rw-r--r--tools/test-js-optimizer-shiftsAggressive-output.js11
-rw-r--r--tools/test-js-optimizer-shiftsAggressive.js13
90 files changed, 5472 insertions, 1916 deletions
diff --git a/AUTHORS b/AUTHORS
index cc5dfb56..792fb523 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -117,3 +117,5 @@ a license to everyone to use it as detailed in LICENSE.)
* Andre Weissflog <floooh@gmail.com>
* Alexandre Perrot <alexandre.perrot@gmail.com>
* Emerson José Silveira da Costa <emerson.costa@gmail.com>
+* Jari Vetoniemi <mailroxas@gmail.com>
+* Sindre Sorhus <sindresorhus@gmail.com>
diff --git a/ChangeLog b/ChangeLog
index 8749f02f..9d1d85d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,12 +12,12 @@ Current trunk code
- To see a list of commits in the active development branch 'incoming', which have not yet been packaged in a release, see
https://github.com/kripken/emscripten/compare/1.8.2...incoming
-v1.8.2: 1/4/2013
+v1.8.2: 1/4/2014
------------------
- Fixed glGetFramebufferAttachmentParameteriv and an issue with glGetXXX when the returned value was null.
- Full list of changes: https://github.com/kripken/emscripten/compare/1.8.1...1.8.2
-v1.8.1: 1/3/2013
+v1.8.1: 1/3/2014
------------------
- Added support for WebGL hardware instancing extension.
- Improved fastcomp native LLVM backend support.
diff --git a/emcc b/emcc
index 8bfa0942..7460da61 100755
--- a/emcc
+++ b/emcc
@@ -146,7 +146,7 @@ Options that are modified or new in %s include:
This is the recommended setting when you want a
reasonably optimized build that is generated as
- quickly as possible (it is much faster than -O2).
+ quickly as possible (it builds much faster than -O2).
(Note: for details on the affects of different
opt levels, see apply_opt_level() in
@@ -158,20 +158,11 @@ Options that are modified or new in %s include:
time in return for the smallest and fastest
output.
- -O3 As -O2, plus dangerous optimizations that may
- break the generated code! This adds
+ -O3 As -O2, plus additional optimizations that can
+ take a significant amount of compilation time.
- -s FORCE_ALIGNED_MEMORY=1
- -s DOUBLE_MODE=0
- -s PRECISE_I64_MATH=0
- --closure 1
- --llvm-lto 3
-
- This is not recommended at all. A better idea
- is to try each of these separately on top of
- -O2 to see what works. See the wiki and
- src/settings.js (for the -s options) for more
- information.
+ For tips on optimizing your code, see
+ https://github.com/kripken/emscripten/wiki/Optimizing-Code
-s OPTION=VALUE JavaScript code generation option passed
into the emscripten compiler. For the
@@ -267,8 +258,7 @@ Options that are modified or new in %s include:
code size and may in some cases increase
runtime speed (although the opposite can also
occur). Note that it takes time to run, and
- may require some changes to the code. This
- is run by default in -O3.
+ may require some changes to the code.
In asm.js mode, closure will only be used on the
'shell' code around the compiled code (the
@@ -781,6 +771,14 @@ def filename_type_ending(filename):
suffix = filename_type_suffix(filename)
return '' if not suffix else ('.' + suffix)
+# Log out times for emcc stages
+log_time_last = time.time()
+def log_time(name):
+ global log_time_last
+ now = time.time()
+ logging.debug('emcc step "%s" took %.2f seconds' % (name, now - log_time_last))
+ log_time_last = now
+
try:
call = CXX if use_cxx else CC
@@ -1029,9 +1027,7 @@ try:
if js_opts is None: js_opts = opt_level >= 2
if llvm_opts is None: llvm_opts = LLVM_OPT_LEVEL[opt_level]
- 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
@@ -1196,7 +1192,6 @@ try:
shared.Settings.ASM_JS = 1
assert shared.Settings.ALLOW_MEMORY_GROWTH == 0, 'memory growth not supported in fastcomp yet'
assert shared.Settings.UNALIGNED_MEMORY == 0, 'forced unaligned memory not supported in fastcomp'
- assert shared.Settings.SAFE_HEAP == 0, 'safe heap not supported in fastcomp yet'
assert shared.Settings.CHECK_HEAP_ALIGN == 0, 'check heap align not supported in fastcomp yet'
assert shared.Settings.SAFE_DYNCALLS == 0, 'safe dyncalls not supported in fastcomp'
assert shared.Settings.RESERVED_FUNCTION_POINTERS == 0, 'reserved function pointers not supported in fastcomp'
@@ -1230,6 +1225,13 @@ try:
shared.Settings.CORRECT_OVERFLOWS = 1
assert not shared.Settings.PGO, 'cannot run PGO in ASM_JS mode'
+ if shared.Settings.SAFE_HEAP and not js_opts:
+ logging.warning('asm.js+SAFE_HEAP requires js opts to be run (-O1 or above by default)')
+
+ if shared.Settings.ALLOW_MEMORY_GROWTH:
+ logging.error('Cannot enable ALLOW_MEMORY_GROWTH with asm.js, build with -s ASM_JS=0 if you need a growable heap');
+ sys.exit(1);
+
if shared.Settings.CORRECT_SIGNS >= 2 or shared.Settings.CORRECT_OVERFLOWS >= 2 or shared.Settings.CORRECT_ROUNDINGS >= 2:
debug_level = 4 # must keep debug info to do line-by-line operations
@@ -1295,6 +1297,8 @@ try:
temp_files = []
+ log_time('parse arguments and setup')
+
# First, generate LLVM bitcode. For each input file, we get base.o with bitcode
for input_file in input_files:
file_ending = filename_type_ending(input_file)
@@ -1334,6 +1338,8 @@ try:
logging.error(input_file + ': Unknown file suffix when compiling to LLVM bitcode!')
sys.exit(1)
+ log_time('bitcodeize inputs')
+
if not LEAVE_INPUTS_RAW:
assert len(temp_files) == len(input_files)
@@ -1380,6 +1386,8 @@ try:
shared.Building.link(temp_files, specified_target)
exit(0)
+ log_time('bitcodeize inputs')
+
## Continue on to create JavaScript
logging.debug('will generate JavaScript')
@@ -1440,15 +1448,6 @@ try:
libc_files = [
'dlmalloc.c',
os.path.join('libcxx', 'new.cpp'),
- os.path.join('libc', 'stdlib', 'getopt_long.c'),
- os.path.join('libc', 'gen', 'err.c'),
- os.path.join('libc', 'gen', 'errx.c'),
- os.path.join('libc', 'gen', 'warn.c'),
- os.path.join('libc', 'gen', 'warnx.c'),
- os.path.join('libc', 'gen', 'verr.c'),
- os.path.join('libc', 'gen', 'verrx.c'),
- os.path.join('libc', 'gen', 'vwarn.c'),
- os.path.join('libc', 'gen', 'vwarnx.c'),
]
musl_files = [
['internal', [
@@ -1462,6 +1461,7 @@ try:
['stdio', [
'__overflow.c',
'__toread.c',
+ '__towrite.c',
'__uflow.c',
]],
['stdlib', [
@@ -1511,6 +1511,9 @@ try:
['internal', [
'intscan.c',
]],
+ ['legacy', [
+ 'err.c',
+ ]],
['locale', [
'iconv.c',
'iswalnum_l.c',
@@ -1541,7 +1544,9 @@ try:
'wctype_l.c',
]],
['math', [
+ '__cos.c',
'__cosdf.c',
+ '__sin.c',
'__sindf.c',
'ilogb.c',
'ilogbf.c',
@@ -1563,6 +1568,10 @@ try:
'tgammaf.c',
'tgammal.c'
]],
+ ['misc', [
+ 'getopt.c',
+ 'getopt_long.c',
+ ]],
['multibyte', [
'btowc.c',
'mblen.c',
@@ -1581,6 +1590,7 @@ try:
'wctomb.c',
]],
['regex', [
+ 'fnmatch.c',
'regcomp.c',
'regerror.c',
'regexec.c',
@@ -1594,6 +1604,7 @@ try:
'vwprintf.c',
'wprintf.c',
'fputwc.c',
+ 'fputws.c',
]],
['stdlib', [
'ecvt.c',
@@ -1750,15 +1761,14 @@ try:
libfile = shared.Cache.get(name, create)
extra_files_to_link.append(libfile)
+ log_time('calculate system libraries')
+
# First, combine the bitcode files if there are several. We must also link if we have a singleton .a
if len(input_files) + len(extra_files_to_link) > 1 or \
(not LEAVE_INPUTS_RAW and not (suffix(temp_files[0]) in BITCODE_ENDINGS or suffix(temp_files[0]) in DYNAMICLIB_ENDINGS) and shared.Building.is_ar(temp_files[0])):
linker_inputs = temp_files + extra_files_to_link
logging.debug('linking: ' + str(linker_inputs))
- t0 = time.time()
shared.Building.link(linker_inputs, in_temp(target_basename + '.bc'), force_archive_contents = len(filter(lambda temp: not temp.endswith(STATICLIB_ENDINGS), temp_files)) == 0)
- t1 = time.time()
- logging.debug(' linking took %.2f seconds' % (t1 - t0))
final = in_temp(target_basename + '.bc')
else:
if not LEAVE_INPUTS_RAW:
@@ -1768,19 +1778,16 @@ try:
final = in_temp(input_files[0])
shutil.copyfile(input_files[0], final)
+ log_time('link')
+
if DEBUG:
logging.debug('saving intermediate processing steps to %s' % shared.EMSCRIPTEN_TEMP_DIR)
intermediate_counter = 0
- intermediate_time = None
def save_intermediate(name=None, suffix='js'):
- global intermediate_counter, intermediate_time
+ global intermediate_counter
shutil.copyfile(final, os.path.join(shared.EMSCRIPTEN_TEMP_DIR, 'emcc-%d%s.%s' % (intermediate_counter, '' if name is None else '-' + name, suffix)))
intermediate_counter += 1
- now = time.time()
- if intermediate_time:
- logg