aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rwxr-xr-xem++4
-rwxr-xr-xem-config2
-rwxr-xr-xemar2
-rwxr-xr-xemcc35
-rwxr-xr-xemconfigure2
-rwxr-xr-xemlibtool2
-rwxr-xr-xemmake2
-rwxr-xr-xemranlib2
-rwxr-xr-xemscripten.py2
-rw-r--r--src/jsifier.js21
-rw-r--r--src/library.js20
-rw-r--r--src/library_gl.js5
-rw-r--r--src/library_sdl.js8
-rw-r--r--src/parseTools.js22
-rw-r--r--src/settings.js13
-rw-r--r--system/include/emscripten/bind.h2
-rw-r--r--system/lib/libcxxabi/CREDITS.TXT16
-rw-r--r--system/lib/libcxxabi/include/cxxabi.h2
-rwxr-xr-xsystem/lib/libcxxabi/lib/buildit11
-rw-r--r--system/lib/libcxxabi/readme.txt2
-rw-r--r--system/lib/libcxxabi/src/abort_message.cpp10
-rw-r--r--system/lib/libcxxabi/src/cxa_demangle.cpp768
-rw-r--r--system/lib/libcxxabi/src/cxa_exception.cpp4
-rw-r--r--system/lib/libcxxabi/src/cxa_exception.hpp5
-rw-r--r--system/lib/libcxxabi/src/cxa_guard.cpp12
-rw-r--r--system/lib/libcxxabi/src/cxa_handlers.cpp109
-rw-r--r--system/lib/libcxxabi/src/cxa_handlers.hpp28
-rw-r--r--system/lib/libcxxabi/src/cxa_personality.cpp156
-rw-r--r--system/lib/libcxxabi/src/fallback_malloc.ipp4
-rw-r--r--system/lib/libcxxabi/src/private_typeinfo.cpp202
-rw-r--r--system/lib/libcxxabi/src/private_typeinfo.h34
-rw-r--r--system/lib/libcxxabi/src/stdexcept.cpp77
-rw-r--r--system/lib/libcxxabi/src/temporary.cpp41
-rwxr-xr-xtests/freetype/src/tools/chktrcmp.py2
-rw-r--r--tests/freetype/src/tools/docmaker/docbeauty.py2
-rw-r--r--tests/freetype/src/tools/docmaker/docmaker.py2
-rw-r--r--tests/freetype/src/tools/glnames.py2
-rw-r--r--tests/python/ccproxy.py2
-rwxr-xr-xtests/runner.py402
-rw-r--r--tests/s3tc_crunch.pngbin353714 -> 353677 bytes
-rw-r--r--third_party/CppHeaderParser/CppHeaderParser/CppHeaderParser.py2
-rw-r--r--third_party/CppHeaderParser/setup.py2
-rw-r--r--third_party/demangler.py2
-rwxr-xr-xthird_party/websockify/run2
-rw-r--r--third_party/websockify/websockify/websocket.py2
-rwxr-xr-xthird_party/websockify/websockify/websocketproxy.py2
-rwxr-xr-xtools/bindings_generator.py2
-rw-r--r--tools/eliminator/eliminator-test-output.js8
-rw-r--r--tools/eliminator/eliminator-test.js12
-rwxr-xr-xtools/emconfiguren.py2
-rwxr-xr-xtools/emmaken.py2
-rwxr-xr-xtools/emmakenxx.py4
-rwxr-xr-xtools/exec_llvm.py2
-rwxr-xr-xtools/fix_closure.py2
-rw-r--r--tools/js-optimizer.js2
-rwxr-xr-xtools/ll-strip.py2
-rw-r--r--tools/make_minigzip.py2
-rw-r--r--tools/namespacer.py2
-rwxr-xr-xtools/nativize_llvm.py2
-rwxr-xr-xtools/reproduceriter.py2
-rw-r--r--tools/scons/site_scons/site_tools/emscripten/__init__.py2
-rw-r--r--tools/scons/site_scons/site_tools/emscripten/emscripten.py2
-rw-r--r--tools/settings_template_readonly.py1
-rw-r--r--tools/shared.py77
65 files changed, 1351 insertions, 827 deletions
diff --git a/AUTHORS b/AUTHORS
index 264f1e4c..710ab203 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -42,4 +42,5 @@ a license to everyone to use it as detailed in LICENSE.)
* Manuel Wellmann <manuel.wellmann@autodesk.com> (copyright owned by Autodesk, Inc.)
* Xuejie Xiao <xxuejie@gmail.com>
* Dominic Wong <dom@slowbunyip.org>
+* Alan Kligman <alan.kligman@gmail.com> (copyright owned by Mozilla Foundation)
diff --git a/em++ b/em++
index be2ed37b..ba09e1a2 100755
--- a/em++
+++ b/em++
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
'''
See emcc.py. This script forwards to there, noting that we want C++ and not C by default
@@ -8,5 +8,5 @@ import os, subprocess, sys
from tools import shared
os.environ['EMMAKEN_CXX'] = '1'
-exit(subprocess.call(['python', shared.EMCC] + sys.argv[1:]))
+exit(subprocess.call([shared.PYTHON, shared.EMCC] + sys.argv[1:]))
diff --git a/em-config b/em-config
index dee399ed..785b04e5 100755
--- a/em-config
+++ b/em-config
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
'''
This is a helper tool which is designed to make it possible
diff --git a/emar b/emar
index 46bc65d7..60498b8f 100755
--- a/emar
+++ b/emar
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
'''
emar - ar helper script
diff --git a/emcc b/emcc
index 2190ff1c..9747dc68 100755
--- a/emcc
+++ b/emcc
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
'''
emcc - compiler helper script
@@ -322,11 +322,6 @@ Options that are modified or new in %s include:
-v to Clang, and also enable EMCC_DEBUG
to details emcc's operations
- --remove-duplicates If set, will remove duplicate symbols when
- linking. This can be useful because
- llvm-link's behavior is not as permissive
- as ld is.
-
--jcache Use a JavaScript cache. This is disabled by
default. When enabled, emcc will store the
results of compilation in a cache and check
@@ -596,7 +591,6 @@ try:
ignore_dynamic_linking = False
shell_path = shared.path_from_root('src', 'shell.html')
js_libraries = []
- remove_duplicates = False
keep_debug = False
bind = False
jcache = False
@@ -705,7 +699,7 @@ try:
newargs[i] = ''
newargs[i+1] = ''
elif newargs[i] == '--remove-duplicates':
- remove_duplicates = True
+ print >> sys.stderr, 'emcc: warning: --remove-duplicates is deprecated as it is no longer needed. If you cannot link without it, file a bug with a testcase'
newargs[i] = ''
elif newargs[i] == '--jcache':
jcache = True
@@ -912,7 +906,7 @@ try:
# We have a specified target (-o <target>), which is not JavaScript or HTML, and
# we have multiple files: Link them
if DEBUG: print >> sys.stderr, 'emcc: link: ' + str(temp_files), specified_target
- shared.Building.link(temp_files, specified_target, remove_duplicates=remove_duplicates)
+ shared.Building.link(temp_files, specified_target)
exit(0)
## Continue on to create JavaScript
@@ -931,9 +925,9 @@ try:
# dlmalloc
def create_dlmalloc():
if DEBUG: print >> sys.stderr, 'emcc: building dlmalloc for cache'
- execute(shared.ENV_PREFIX + ['python', shared.EMCC, shared.path_from_root('system', 'lib', 'dlmalloc.c'), '-g', '-o', in_temp('dlmalloc.o')], stdout=stdout, stderr=stderr)
+ execute([shared.PYTHON, shared.EMCC, shared.path_from_root('system', 'lib', 'dlmalloc.c'), '-g', '-o', in_temp('dlmalloc.o')], stdout=stdout, stderr=stderr)
# we include the libc++ new stuff here, so that the common case of using just new/delete is quick to link
- execute(shared.ENV_PREFIX + ['python', shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', 'new.cpp'), '-g', '-o', in_temp('new.o')], stdout=stdout, stderr=stderr)
+ execute([shared.PYTHON, shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', 'new.cpp'), '-g', '-o', in_temp('new.o')], stdout=stdout, stderr=stderr)
shared.Building.link([in_temp('dlmalloc.o'), in_temp('new.o')], in_temp('dlmalloc_full.o'))
return in_temp('dlmalloc_full.o')
def fix_dlmalloc():
@@ -956,7 +950,7 @@ try:
os = []
for src in ['algorithm.cpp', 'condition_variable.cpp', 'future.cpp', 'iostream.cpp', 'memory.cpp', 'random.cpp', 'stdexcept.cpp', 'system_error.cpp', 'utility.cpp', 'bind.cpp', 'debug.cpp', 'hash.cpp', 'mutex.cpp', 'string.cpp', 'thread.cpp', 'valarray.cpp', 'chrono.cpp', 'exception.cpp', 'ios.cpp', 'locale.cpp', 'regex.cpp', 'strstream.cpp', 'typeinfo.cpp']:
o = in_temp(src + '.o')
- execute(shared.ENV_PREFIX + ['python', shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', src), '-o', o], stdout=stdout, stderr=stderr)
+ execute([shared.PYTHON, shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', src), '-o', o], stdout=stdout, stderr=stderr)
os.append(o)
shared.Building.link(os, in_temp('libcxx.bc'))
return in_temp('libcxx.bc')
@@ -975,7 +969,7 @@ try:
os = []
for src in ['private_typeinfo.cpp']:
o = in_temp(src + '.o')
- execute(shared.ENV_PREFIX + ['python', shared.EMXX, shared.path_from_root('system', 'lib', 'libcxxabi', 'src', src), '-o', o], stdout=stdout, stderr=stderr)
+ execute([shared.PYTHON, shared.EMXX, shared.path_from_root('system', 'lib', 'libcxxabi', 'src', src), '-o', o], stdout=stdout, stderr=stderr)
os.append(o)
shared.Building.link(os, in_temp('libcxxabi.bc'))
return in_temp('libcxxabi.bc')
@@ -1027,7 +1021,7 @@ try:
(not LEAVE_INPUTS_RAW and not (suffix(temp_files[0]) in BITCODE_SUFFIXES or suffix(temp_files[0]) in DYNAMICLIB_SUFFIXES) and shared.Building.is_ar(temp_files[0])):
linker_inputs = temp_files + extra_files_to_link
if DEBUG: print >> sys.stderr, 'emcc: linking: ', linker_inputs
- shared.Building.link(linker_inputs, in_temp(target_basename + '.bc'), remove_duplicates=remove_duplicates)
+ shared.Building.link(linker_inputs, in_temp(target_basename + '.bc'))
final = in_temp(target_basename + '.bc')
else:
if not LEAVE_INPUTS_RAW:
@@ -1061,13 +1055,14 @@ try:
if DEBUG: save_intermediate('opt', 'bc')
# Do LTO in a separate pass to work around LLVM bug XXX (see failure e.g. in cubescript)
if shared.Building.can_build_standalone():
+ # If we can LTO, do it before dce, since it opens up dce opportunities
if llvm_lto and shared.Building.can_use_unsafe_opts():
if not shared.Building.can_inline(): link_opts.append('-disable-inlining')
- link_opts.append('-std-link-opts')
+ # do not internalize in std-link-opts - it ignores internalize-public-api-list - and add a manual internalize
+ link_opts += ['-disable-internalize'] + shared.Building.get_safe_internalize() + ['-std-link-opts']
else:
- # At least remove dead functions etc., this potentially saves a lot in the size of the generated code (and the time to compile it)
- link_opts += ['-internalize', '-globaldce']
- if link_opts:
+ # At minimum remove dead functions etc., this potentially saves a lot in the size of the generated code (and the time to compile it)
+ link_opts += shared.Building.get_safe_internalize() + ['-globaldce']
if DEBUG: print >> sys.stderr, 'emcc: LLVM linktime:', link_opts
shared.Building.llvm_opt(in_temp(target_basename + '.bc'), link_opts)
if DEBUG: save_intermediate('linktime', 'bc')
@@ -1081,7 +1076,7 @@ try:
if AUTODEBUG:
if DEBUG: print >> sys.stderr, 'emcc: autodebug'
- execute(shared.ENV_PREFIX + ['python', shared.AUTODEBUGGER, final, final + '.ad.ll'])
+ execute([shared.PYTHON, shared.AUTODEBUGGER, final, final + '.ad.ll'])
final += '.ad.ll'
if DEBUG: save_intermediate('autodebug', 'll')
@@ -1104,7 +1099,7 @@ try:
file_args += embed_files
if Compression.on:
file_args += ['--compress', Compression.encoder, Compression.decoder, Compression.js_name]
- code = execute(shared.ENV_PREFIX + ['python', shared.FILE_PACKAGER, unsuffixed(target) + '.data'] + file_args, stdout=PIPE)[0]
+ code = execute([shared.PYTHON, shared.FILE_PACKAGER, unsuffixed(target) + '.data'] + file_args, stdout=PIPE)[0]
src = open(final).read().replace('// {{PRE_RUN_ADDITIONS}}', '// {{PRE_RUN_ADDITIONS}}\n' + code)
final += '.files.js'
open(final, 'w').write(src)
diff --git a/emconfigure b/emconfigure
index 64ca8c4f..51e57c64 100755
--- a/emconfigure
+++ b/emconfigure
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
'''
This is a helper script. It runs ./configure for you, setting
diff --git a/emlibtool b/emlibtool
index 1220b93d..1eb18edc 100755
--- a/emlibtool
+++ b/emlibtool
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
'''
This is a helper script. See emcc.
diff --git a/emmake b/emmake
index 70e415a3..05e0a597 100755
--- a/emmake
+++ b/emmake
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
'''
This is a helper script. It runs make for you, setting
diff --git a/emranlib b/emranlib
index 1405320b..35cb44c9 100755
--- a/emranlib
+++ b/emranlib
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
'''
emcc - ranlib helper script
diff --git a/emscripten.py b/emscripten.py
index 98dcb6bb..3c636447 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
'''
You should normally never use this! Use emcc instead.
diff --git a/src/jsifier.js b/src/jsifier.js
index 50703b90..4192cd3f 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -486,6 +486,19 @@ function JSify(data, functionsOnly, givenFunctions) {
}
});
+ // function for filtering functions for label debugging
+ if (LABEL_FUNCTION_FILTERS.length > 0) {
+ var LABEL_FUNCTION_FILTER_SET = set(LABEL_FUNCTION_FILTERS);
+ var functionNameFilterTest = function(ident) {
+ return (ident in LABEL_FUNCTION_FILTER_SET);
+ };
+ } else {
+ // no filters are specified, all function names are printed
+ var functionNameFilterTest = function(ident) {
+ return true;
+ }
+ }
+
// function reconstructor & post-JS optimizer
substrate.addActor('FunctionReconstructor', {
funcs: {},
@@ -566,7 +579,7 @@ function JSify(data, functionsOnly, givenFunctions) {
}
});
- if (LABEL_DEBUG) func.JS += " Module.print(INDENT + ' Entering: " + func.ident + ": ' + Array.prototype.slice.call(arguments)); INDENT += ' ';\n";
+ if (LABEL_DEBUG && functionNameFilterTest(func.ident)) func.JS += " Module.print(INDENT + ' Entering: " + func.ident + ": ' + Array.prototype.slice.call(arguments)); INDENT += ' ';\n";
if (true) { // TODO: optimize away when not needed
if (CLOSURE_ANNOTATIONS) func.JS += '/** @type {number} */';
@@ -580,7 +593,7 @@ function JSify(data, functionsOnly, givenFunctions) {
function getLabelLines(label, indent, relooping) {
if (!label) return '';
var ret = '';
- if (LABEL_DEBUG >= 2) {
+ if ((LABEL_DEBUG >= 2) && functionNameFilterTest(func.ident)) {
ret += indent + "Module.print(INDENT + '" + func.ident + ":" + label.ident + "');\n";
}
if (EXECUTION_TIMEOUT > 0) {
@@ -692,7 +705,7 @@ function JSify(data, functionsOnly, givenFunctions) {
}
func.JS += walkBlock(func.block, ' ');
// Finalize function
- if (LABEL_DEBUG) func.JS += " INDENT = INDENT.substr(0, INDENT.length-2);\n";
+ if (LABEL_DEBUG && functionNameFilterTest(func.ident)) func.JS += " INDENT = INDENT.substr(0, INDENT.length-2);\n";
// Add an unneeded return, needed for strict mode to not throw warnings in some cases.
// If we are not relooping, then switches make it unimportant to have this (and, we lack hasReturn anyhow)
if (RELOOP && func.lines.length > 0 && func.labels.filter(function(label) { return label.hasReturn }).length > 0) {
@@ -1025,7 +1038,7 @@ function JSify(data, functionsOnly, givenFunctions) {
+ 'PROFILING_NODE = __parentProfilingNode__ '
+ '}\n';
}
- if (LABEL_DEBUG) {
+ if (LABEL_DEBUG && functionNameFilterTest(item.funcData.ident)) {
ret += "Module.print(INDENT + 'Exiting: " + item.funcData.ident + "');\n"
+ "INDENT = INDENT.substr(0, INDENT.length-2);\n";
}
diff --git a/src/library.js b/src/library.js
index 1bdd840d..93d54d68 100644
--- a/src/library.js
+++ b/src/library.js
@@ -5886,6 +5886,26 @@ LibraryManager.library = {
},
// ==========================================================================
+ // sys/timeb.h
+ // ==========================================================================
+
+ __timeb_struct_layout: Runtime.generateStructInfo([
+ ['i32', 'time'],
+ ['i16', 'millitm'],
+ ['i16', 'timezone'],
+ ['i16', 'dstflag']
+ ]),
+ ftime__deps: ['__timeb_struct_layout'],
+ ftime: function(p) {
+ var millis = Date.now();
+ {{{ makeSetValue('p', '___timeb_struct_layout.time', 'Math.floor(millis/1000)', 'i32') }}};
+ {{{ makeSetValue('p', '___timeb_struct_layout.millitm', 'millis % 1000', 'i16') }}};
+ {{{ makeSetValue('p', '___timeb_struct_layout.timezone', '0', 'i16') }}}; // TODO
+ {{{ makeSetValue('p', '___timeb_struct_layout.dstflag', '0', 'i16') }}}; // TODO
+ return 0;
+ },
+
+ // ==========================================================================
// sys/times.h
// ==========================================================================
diff --git a/src/library_gl.js b/src/library_gl.js
index b4098813..0f28a6a0 100644
--- a/src/library_gl.js
+++ b/src/library_gl.js
@@ -2099,6 +2099,11 @@ var LibraryGL = {
},
glColor4f: function(r, g, b, a) {
+ r = Math.max(Math.min(r, 1), 0);
+ g = Math.max(Math.min(g, 1), 0);
+ b = Math.max(Math.min(b, 1), 0);
+ a = Math.max(Math.min(a, 1), 0);
+
// TODO: make ub the default, not f, save a few mathops
if (GL.immediate.mode) {
var start = GL.immediate.vertexCounter << 2;
diff --git a/src/library_sdl.js b/src/library_sdl.js
index 0969f738..1cd99534 100644
--- a/src/library_sdl.js
+++ b/src/library_sdl.js
@@ -898,7 +898,7 @@ var LibrarySDL = {
},
SDL_GetError: function() {
- return allocate(intArrayFromString("SDL is cool"), 'i8');
+ return allocate(intArrayFromString("unknown SDL-emscripten error"), 'i8');
},
SDL_CreateRGBSurface: function(flags, width, height, depth, rmask, gmask, bmask, amask) {
@@ -1533,6 +1533,12 @@ var LibrarySDL = {
SDL_GL_SwapBuffers: function() {},
+ // TODO
+
+ SDL_SetGamma: function(r, g, b) {
+ return -1;
+ },
+
// Misc
SDL_InitSubSystem: function(flags) { return 0 },
diff --git a/src/parseTools.js b/src/parseTools.js
index 4a76a9a2..b2093da3 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1328,7 +1328,27 @@ function makePointer(slab, pos, allocator, type, ptr) {
types = de[0];
}
}
- return 'allocate(' + slab + ', ' + JSON.stringify(types) + (allocator ? ', ' + allocator : '') + (allocator == 'ALLOC_NONE' ? ', ' + ptr : '') + ')';
+ // JS engines sometimes say array initializers are too large. Work around that by chunking and calling concat to combine at runtime
+ var chunkSize = 10240;
+ function chunkify(array) {
+ // break very large slabs into parts
+ var ret = '';
+ var index = 0;
+ while (index < array.length) {
+ ret = (ret ? ret + '.concat(' : '') + '[' + array.slice(index, index + chunkSize).map(JSON.stringify) + ']' + (ret ? ')' : '');
+ index += chunkSize;
+ }
+ return ret;
+ }
+ if (typeof slab == 'string' && evaled && evaled.length > chunkSize) {
+ slab = chunkify(evaled);
+ }
+ if (typeof types != 'string' && types.length > chunkSize) {
+ types = chunkify(types);
+ } else {
+ types = JSON.stringify(types);
+ }
+ return 'allocate(' + slab + ', ' + types + (allocator ? ', ' + allocator : '') + (allocator == 'ALLOC_NONE' ? ', ' + ptr : '') + ')';
}
function makeGetSlabs(ptr, type, allowMultiple, unsigned) {
diff --git a/src/settings.js b/src/settings.js
index 1d8805a8..c4d1df48 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -132,6 +132,12 @@ var SAFE_HEAP_LOG = 0; // Log out all SAFE_HEAP operations
var LABEL_DEBUG = 0; // 1: Print out functions as we enter them
// 2: Also print out each label as we enter it
+var LABEL_FUNCTION_FILTERS = []; // Filters for function label debug.
+ // The items for this array will be used
+ // as filters for function names. Only the
+ // labels of functions that is equaled to
+ // one of the filters are printed out
+ // When the array is empty, the filter is disabled.
var EXCEPTION_DEBUG = 1; // Print out exceptions in emscriptened code
var LIBRARY_DEBUG = 0; // Print out when we enter a library call (library*.js). You can also unset
@@ -201,9 +207,10 @@ var NAMED_GLOBALS = 1; // If 1, we use global variables for globals. Otherwise