aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS9
-rw-r--r--demos/scons-embind/SConstruct23
-rw-r--r--demos/scons-embind/bar.cpp2
-rw-r--r--demos/scons-embind/foo.cpp11
-rw-r--r--demos/scons-embind/test.js2
-rw-r--r--docs/splashpres.pdfbin0 -> 131072 bytes
-rwxr-xr-xemcc47
-rwxr-xr-xemscons20
-rw-r--r--scons-tools/closure.py28
-rwxr-xr-xscons-tools/emscripten.py359
-rwxr-xr-xscons-tools/llvm.py33
-rw-r--r--src/determinstic.js8
-rw-r--r--src/embind/embind.js99
-rw-r--r--src/embind/emval.js177
-rw-r--r--src/intertyper.js15
-rw-r--r--src/jsifier.js17
-rw-r--r--src/library.js1242
-rw-r--r--src/library_browser.js72
-rw-r--r--src/library_gc.js2
-rw-r--r--src/library_gl.js1492
-rw-r--r--src/library_glut.js10
-rw-r--r--src/library_sdl.js25
-rw-r--r--src/parseTools.js40
-rw-r--r--src/postamble.js2
-rw-r--r--src/preamble.js13
-rw-r--r--src/relooper/Relooper.cpp127
-rw-r--r--src/relooper/Relooper.h7
-rw-r--r--src/relooper/fuzzer.py4
-rw-r--r--src/relooper/test.cpp41
-rw-r--r--src/relooper/test.txt27
-rw-r--r--src/relooper/test4.txt1
-rw-r--r--src/relooper/test_debug.txt76
-rw-r--r--src/relooper/test_fuzz1.txt11
-rw-r--r--src/relooper/test_fuzz5.txt24
-rw-r--r--src/relooper/test_fuzz6.txt1
-rwxr-xr-xsrc/relooper/testit.sh2
-rwxr-xr-xsrc/relooper/updateit.sh2
-rw-r--r--src/settings.js7
-rw-r--r--src/shell.js1
-rw-r--r--src/socket.io.js3870
-rw-r--r--src/wrtcp.js821
-rw-r--r--system/include/emscripten/bind.h62
-rw-r--r--system/include/emscripten/emscripten.h13
-rw-r--r--system/include/emscripten/val.h116
-rw-r--r--system/include/emscripten/wire.h81
-rw-r--r--system/include/libcxx/exception4
-rw-r--r--system/lib/embind/bind.cpp1
-rw-r--r--system/lib/libcxx/symbols1
-rw-r--r--tests/aniso.c16
-rw-r--r--tests/cases/emptystruct.ll2
-rw-r--r--tests/cases/fp80_ta2.ll (renamed from tests/cases/fp80.ll)0
-rw-r--r--tests/cases/muli33_ta2.ll114
-rw-r--r--tests/cases/muli33_ta2.txt1
-rw-r--r--tests/cases/oob_ta2.ll25
-rw-r--r--tests/cases/philoop_ta2.ll305
-rw-r--r--tests/cases/philoop_ta2.txt1
-rw-r--r--tests/embind/build_benchmark2
-rw-r--r--tests/embind/embind.benchmark.js35
-rw-r--r--tests/embind/embind.test.js153
-rw-r--r--tests/embind/embind_benchmark.cpp71
-rw-r--r--tests/embind/embind_test.cpp65
-rw-r--r--tests/files.cpp3
-rw-r--r--tests/full_es2_sdlproc.c727
-rw-r--r--tests/gl_ps.c40
-rw-r--r--tests/gl_ps_workaround.c230
-rw-r--r--tests/gl_ps_workaround2.c230
-rw-r--r--tests/glbegin_points.c44
-rw-r--r--tests/linpack.c1153
-rwxr-xr-xtests/runner.py662
-rw-r--r--tests/s3tc.c16
-rw-r--r--tests/s3tc_crunch.c16
-rw-r--r--tests/sdl_audio.c4
-rw-r--r--tests/sdl_fog_density.c48
-rw-r--r--tests/sdl_fog_exp2.c48
-rw-r--r--tests/sdl_fog_linear.c48
-rw-r--r--tests/sdl_fog_negative.c48
-rw-r--r--tests/sdl_fog_simple.c51
-rw-r--r--tests/sdl_ogl.c48
-rw-r--r--tests/sdl_ogl_defaultMatrixMode.c46
-rw-r--r--tests/sdl_ogl_p.c44
-rw-r--r--tests/time/src.c5
-rw-r--r--tests/unistd/login.out2
-rw-r--r--tests/unistd/misc.out8
-rw-r--r--tests/unistd/unlink.out2
-rw-r--r--tests/websockets.c2
-rw-r--r--tests/websockets_bi.c16
-rw-r--r--tests/websockets_bi_side.c7
-rw-r--r--third_party/lzma.js/lzip/Makefile18
-rw-r--r--tools/cache.py5
-rw-r--r--tools/eliminator/asm-eliminator-test-output.js4605
-rw-r--r--tools/eliminator/asm-eliminator-test.js6087
-rw-r--r--tools/file_packager.py90
-rw-r--r--tools/js-optimizer.js120
-rw-r--r--tools/shared.py10
-rw-r--r--tools/test-js-optimizer-asm-pre-output.js20
-rw-r--r--tools/test-js-optimizer-asm-pre.js14
-rw-r--r--tools/test-js-optimizer-asm-regs-output.js81
-rw-r--r--tools/test-js-optimizer-asm-regs.js84
98 files changed, 22670 insertions, 1850 deletions
diff --git a/AUTHORS b/AUTHORS
index 6b48014f..9e9d5748 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -76,4 +76,13 @@ a license to everyone to use it as detailed in LICENSE.)
* John Allwine <jallwine86@gmail.com>
* Martin Gerhardy <martin.gerhardy@gmail.com>
* James Gregory <jgregory@zynga.com> (copyright owned by Zynga, Inc)
+* Dan Gohman <sunfish@google.com> (copyright owned by Google, Inc.)
+* Jeff Gilbert <jgilbert@mozilla.com> (copyright owned by Mozilla Foundation)
+* Frits Talbot <frits@metapathy.com>
+* Onno Jongbloed <hey@onnoj.net>
+* Jez Ng <me@jezng.com>
+* Marc Feeley <mfeeley@mozilla.com> (copyright owned by Mozilla Foundation)
* Ludovic Perrine <jazzzz@gmail.com>
+
+
+
diff --git a/demos/scons-embind/SConstruct b/demos/scons-embind/SConstruct
new file mode 100644
index 00000000..8afc3e27
--- /dev/null
+++ b/demos/scons-embind/SConstruct
@@ -0,0 +1,23 @@
+env = Environment(
+ toolpath=['../../scons-tools'],
+ tools=['cc', 'c++', 'ar', 'emscripten', 'llvm', 'closure'],
+ LLVM_ROOT='/opt/local/bin',
+ CLANG='clang-mp-3.2',
+ CLANGXX='clang++-mp-3.2',
+ LLVM_LINK='llvm-link-mp-3.2',
+ LLVM_OPT='opt-mp-3.2',
+ LLVM_DIS='llvm-dis-mp-3.2',
+ EMSCRIPTEN_VERSION_FILE=File('build/version_file'),
+ EMSCRIPTEN_SETTINGS={
+ 'ASM_JS': 0,
+ })
+env['BUILDERS']['WrapInModule'] = Builder(
+ action='cp $SOURCE $TARGET',
+)
+
+env.Append()
+a1 = env.Object('build/foo.bc', 'foo.cpp')
+a2 = env.Object('build/bar.bc', 'bar.cpp')
+total = env.LLVMLink('build/thelibrary.bc', [a1, a2])
+
+env.emscripten('build/thelibrary.js', total)
diff --git a/demos/scons-embind/bar.cpp b/demos/scons-embind/bar.cpp
new file mode 100644
index 00000000..a3908014
--- /dev/null
+++ b/demos/scons-embind/bar.cpp
@@ -0,0 +1,2 @@
+void foo() {
+}
diff --git a/demos/scons-embind/foo.cpp b/demos/scons-embind/foo.cpp
new file mode 100644
index 00000000..61be501a
--- /dev/null
+++ b/demos/scons-embind/foo.cpp
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <emscripten/bind.h>
+
+void print_some_stuff(int a, float b, const std::string& s) {
+ printf("print_some_stuff: %d, %f, %s\n", a, b, s.c_str());
+}
+
+EMSCRIPTEN_BINDINGS(foo) {
+ emscripten::function("print_some_stuff", &print_some_stuff);
+}
+
diff --git a/demos/scons-embind/test.js b/demos/scons-embind/test.js
new file mode 100644
index 00000000..a6252fd8
--- /dev/null
+++ b/demos/scons-embind/test.js
@@ -0,0 +1,2 @@
+var thelibrary = require('./build/thelibrary.js');
+thelibrary.Module.print_some_stuff(1, 2, 'hello world');
diff --git a/docs/splashpres.pdf b/docs/splashpres.pdf
new file mode 100644
index 00000000..02fa4ea0
--- /dev/null
+++ b/docs/splashpres.pdf
Binary files differ
diff --git a/emcc b/emcc
index 1ed5fcb6..2a7e10d0 100755
--- a/emcc
+++ b/emcc
@@ -28,34 +28,6 @@ Example uses:
so it should relay everything to gcc/g++. You should not define that when
running make, of course.
- * With CMake, the same command will work (with cmake instead of ./configure). You may also be
- able to do the following in your CMakeLists.txt:
-
- SET(CMAKE_C_COMPILER "PATH/emcc")
- SET(CMAKE_CXX_COMPILER "PATH/em++")
- SET(CMAKE_LINKER "PATH/emcc")
- SET(CMAKE_CXX_LINKER "PATH/emcc")
- SET(CMAKE_C_LINK_EXECUTABLE "PATH/emcc")
- SET(CMAKE_CXX_LINK_EXECUTABLE "PATH/emcc")
- SET(CMAKE_AR "PATH/emar")
- SET(CMAKE_RANLIB "PATH/emranlib")
-
- * For SCons the shared.py can be imported like so:
- __file__ = str(Dir('#/project_path_to_emscripten/dummy/dummy'))
- __rootpath__ = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
- def path_from_root(*pathelems):
- return os.path.join(__rootpath__, *pathelems)
- sys.path += [path_from_root('')]
- from tools.shared import *
-
- For using the Emscripten compilers/linkers/etc. you can do:
- env = Environment()
- ...
- env.Append(CCFLAGS = COMPILER_OPTS)
- env.Replace(LINK = LLVM_LD)
- env.Replace(LD = LLVM_LD)
- TODO: Document all relevant setup changes
-
After setting that up, run your build system normally.
Note the appearance of em++ instead of emcc
@@ -138,7 +110,7 @@ while response_file:
sys.argv[index:index+1] = extra_args
break
-if len(sys.argv) == 1 or sys.argv[1] == '--help':
+if len(sys.argv) == 1 or '--help' in sys.argv:
this = os.path.basename('em++' if os.environ.get('EMMAKEN_CXX') else 'emcc')
print '''%s [options] file...
@@ -567,7 +539,7 @@ if CONFIGURE_CONFIG or CMAKE_CONFIG:
skip_next = False
idx += 1
continue
- if el == '-s' and is_minus_s_for_emcc(argv, idx):
+ if not use_js and el == '-s' and is_minus_s_for_emcc(argv, idx): # skip -s X=Y if not using js for configure
skip_next = True
else:
yield el
@@ -629,7 +601,7 @@ if EMMAKEN_CFLAGS: CC_ADDITIONAL_ARGS += shlex.split(EMMAKEN_CFLAGS)
# ---------------- Utilities ---------------
-SOURCE_SUFFIXES = ('.c', '.cpp', '.cxx', '.cc')
+SOURCE_SUFFIXES = ('.c', '.cpp', '.cxx', '.cc', '.m', '.mm')
BITCODE_SUFFIXES = ('.bc', '.o', '.obj')
DYNAMICLIB_SUFFIXES = ('.dylib', '.so', '.dll')
STATICLIB_SUFFIXES = ('.a',)
@@ -657,7 +629,7 @@ header = False # pre-compiled headers. We fake that by just copying the file
for i in range(1, len(sys.argv)):
arg = sys.argv[i]
if not arg.startswith('-'):
- if arg.endswith('.c'):
+ if arg.endswith(('.c','.m')):
use_cxx = False
if arg.endswith('.h') and sys.argv[i-1] != '-include':
header = True
@@ -932,6 +904,9 @@ try:
prev = newargs[i-1]
if prev in ['-MT', '-install_name', '-I', '-L']: continue # ignore this gcc-style argument
+ if (os.path.islink(arg) and os.path.realpath(arg).endswith(SOURCE_SUFFIXES + BITCODE_SUFFIXES + DYNAMICLIB_SUFFIXES + ASSEMBLY_SUFFIXES)):
+ arg = os.path.realpath(arg)
+
if not arg.startswith('-') and (arg.endswith(SOURCE_SUFFIXES + BITCODE_SUFFIXES + DYNAMICLIB_SUFFIXES + ASSEMBLY_SUFFIXES) or shared.Building.is_ar(arg)): # we already removed -o <target>, so all these should be inputs
newargs[i] = ''
if os.path.exists(arg):
@@ -1019,7 +994,8 @@ try:
for change in settings_changes:
key, value = change.split('=')
if value[0] == '@':
- value = '"' + value + '"'
+ value = '"@' + os.path.abspath(value[1:]) + '"'
+ value = value.replace('\\\\', '/').replace('\\', '/') # Convert backslash paths to forward slashes on Windows as well, since the JS compiler otherwise needs the backslashes escaped (alternative is to escape all input paths passing to JS, which feels clumsier to read)
exec('shared.Settings.' + key + ' = ' + value)
# Apply effects from settings
@@ -1027,8 +1003,7 @@ try:
assert opt_level >= 1, 'asm.js requires -O1 or above'
if bind:
- shared.Settings.ASM_JS = 0
- logging.warning('disabling asm.js because it is not compatible with embind yet')
+ shared.Settings.RESERVED_FUNCTION_POINTERS = max(shared.Settings.RESERVED_FUNCTION_POINTERS, 10)
if shared.Settings.CORRECT_SIGNS != 1:
logging.warning('setting CORRECT_SIGNS to 1 for asm.js code generation')
shared.Settings.CORRECT_SIGNS = 1
@@ -1047,8 +1022,6 @@ try:
logging.warning('disabling closure because debug info was requested')
closure = False
- if jcache and not keep_js_debug: print >> sys.stderr, 'emcc: warning: it is recommended to run jcache with -g when compiling bitcode to JS'
-
if minify_whitespace is None:
minify_whitespace = opt_level >= 2 and not keep_js_debug
diff --git a/emscons b/emscons
new file mode 100755
index 00000000..2666f18c
--- /dev/null
+++ b/emscons
@@ -0,0 +1,20 @@
+#!/usr/bin/env python2
+
+'''
+Wrapping the scons invocation, EMSCRIPTEN_TOOL_PATH is set in the process
+environment, and can be used to locate the emscripten SCons Tool.
+Example:
+# Load emscripten Tool
+my_env = Environment(tools=['emscripten'], toolpath=[os.environ['EMSCRIPTEN_TOOL_PATH']])
+'''
+
+import os, subprocess, sys
+from tools import shared
+
+tool_path = os.path.join(shared.path_from_root('tools'), 'scons', 'site_scons', 'site_tools', 'emscripten')
+
+env = os.environ.copy()
+env[ 'EMSCRIPTEN_TOOL_PATH' ] = tool_path
+
+exit(subprocess.call(sys.argv[1:], env=env))
+
diff --git a/sco