webruby 0.2.5 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/webruby.rb +0 -4
- data/lib/webruby/app.rb +4 -0
- data/lib/webruby/rake/files.rake +2 -1
- data/lib/webruby/rake/mruby.rake +1 -1
- data/modules/emscripten/AUTHORS +1 -0
- data/modules/emscripten/ChangeLog +34 -1
- data/modules/emscripten/cmake/Platform/Emscripten.cmake +30 -9
- data/modules/emscripten/emcc +61 -28
- data/modules/emscripten/emrun +15 -11
- data/modules/emscripten/emscripten.py +3 -0
- data/modules/emscripten/src/closure-externs.js +110 -0
- data/modules/emscripten/src/intertyper.js +1 -1
- data/modules/emscripten/src/jsifier.js +7 -21
- data/modules/emscripten/src/library.js +2 -1
- data/modules/emscripten/src/library_browser.js +16 -5
- data/modules/emscripten/src/library_fs.js +3 -1
- data/modules/emscripten/src/library_gl.js +691 -591
- data/modules/emscripten/src/library_glut.js +2 -0
- data/modules/emscripten/src/library_sdl.js +29 -5
- data/modules/emscripten/src/library_uuid.js +140 -0
- data/modules/emscripten/src/modules.js +1 -1
- data/modules/emscripten/src/parseTools.js +29 -19
- data/modules/emscripten/src/postamble.js +3 -4
- data/modules/emscripten/src/preamble.js +17 -1
- data/modules/emscripten/src/relooper/Relooper.cpp +8 -8
- data/modules/emscripten/src/relooper/Relooper.h +5 -5
- data/modules/emscripten/src/relooper/test.txt +2 -2
- data/modules/emscripten/src/runtime.js +1 -1
- data/modules/emscripten/src/settings.js +3 -0
- data/modules/emscripten/src/struct_info.json +12 -0
- data/modules/emscripten/system/include/uuid/uuid.h +35 -0
- data/modules/emscripten/tools/js-optimizer.js +191 -142
- data/modules/emscripten/tools/js_optimizer.py +3 -29
- data/modules/emscripten/tools/shared.py +43 -6
- data/modules/mruby/include/mruby/value.h +3 -2
- data/modules/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +5 -9
- data/modules/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +3 -5
- data/modules/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +0 -3
- data/modules/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +0 -1
- data/modules/mruby/mrbgems/mruby-random/src/mt19937ar.c +0 -1
- data/modules/mruby/mrbgems/mruby-range-ext/src/range.c +2 -6
- data/modules/mruby/mrbgems/mruby-sprintf/src/sprintf.c +0 -4
- data/modules/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +22 -0
- data/modules/mruby/mrbgems/mruby-string-ext/src/string.c +2 -2
- data/modules/mruby/mrbgems/mruby-string-ext/test/string.rb +21 -2
- data/modules/mruby/mrbgems/mruby-string-utf8/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-string-utf8/src/string.c +297 -0
- data/modules/mruby/mrbgems/mruby-string-utf8/test/string.rb +27 -0
- data/modules/mruby/mrbgems/mruby-struct/src/struct.c +0 -1
- data/modules/mruby/mrblib/init_mrblib.c +0 -3
- data/modules/mruby/src/array.c +22 -8
- data/modules/mruby/src/backtrace.c +12 -9
- data/modules/mruby/src/class.c +3 -3
- data/modules/mruby/src/codegen.c +17 -5
- data/modules/mruby/src/dump.c +5 -6
- data/modules/mruby/src/error.c +0 -2
- data/modules/mruby/src/etc.c +0 -2
- data/modules/mruby/src/gc.c +4 -8
- data/modules/mruby/src/load.c +1 -6
- data/modules/mruby/src/numeric.c +0 -6
- data/modules/mruby/src/object.c +3 -5
- data/modules/mruby/src/parse.y +37 -38
- data/modules/mruby/src/proc.c +8 -1
- data/modules/mruby/src/range.c +3 -7
- data/modules/mruby/src/state.c +0 -1
- data/modules/mruby/src/string.c +2 -17
- data/modules/mruby/src/symbol.c +0 -1
- data/modules/mruby/src/variable.c +3 -22
- data/modules/mruby/src/vm.c +9 -8
- data/modules/mruby/tasks/mrbgem_spec.rake +13 -5
- data/modules/mruby/tasks/mrbgems_test.rake +3 -3
- data/modules/mruby/tasks/mruby_build_commands.rake +2 -2
- data/modules/mruby/tasks/mruby_build_gem.rake +3 -3
- data/modules/mruby/test/init_mrbtest.c +0 -3
- data/modules/mruby/test/t/array.rb +12 -1
- data/modules/mruby/test/t/class.rb +67 -0
- data/modules/mruby/test/t/exception.rb +12 -0
- data/modules/mruby/test/t/kernel.rb +75 -1
- data/modules/mruby/test/t/syntax.rb +115 -0
- data/scripts/gen_require.rb +12 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6513c6c3002e5e95c2c5a19b60dec1243224216
|
4
|
+
data.tar.gz: f682702ae1a94714e2b6a35a62efa8f9f07803d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76d40913b69ff80303589bf22895a590723d8c245ee47f9afa4578f084ea58cee89bb09dcfc6c83b2aa7238e7b7e2078f8900d69446319fae80c8fc812b95a90
|
7
|
+
data.tar.gz: f0c76941cd3b514e667cb86e352bc225e762a01604f78e515ab4ef34b80c5149acc4cd616a43a2727e4ed2437eb8b6909b73dfdd7a0933c1d2d3c287579ffb03
|
data/lib/webruby.rb
CHANGED
data/lib/webruby/app.rb
CHANGED
data/lib/webruby/rake/files.rake
CHANGED
@@ -11,7 +11,7 @@ end
|
|
11
11
|
file "#{Webruby.build_dir}/rbcode.c" => [Webruby.entrypoint_file,
|
12
12
|
:libmruby,
|
13
13
|
Webruby.build_dir] +
|
14
|
-
|
14
|
+
Webruby.rb_files do |t|
|
15
15
|
if Webruby::App.config.source_processor == :gen_require
|
16
16
|
ENV["MRBC"] = "#{Webruby.full_build_dir}/#{MRBC}"
|
17
17
|
sh "ruby #{SCRIPT_GEN_REQUIRE} #{File.expand_path(Webruby.entrypoint_file)} #{Webruby.full_build_dir}/rbcode.c"
|
@@ -49,6 +49,7 @@ file "#{Webruby.build_dir}/#{Webruby::App.config.output_name}" =>
|
|
49
49
|
["#{Webruby.build_dir}/link.js"] + append_file_deps do |t|
|
50
50
|
sh "cat #{Webruby.build_dir}/link.js > #{Webruby.build_dir}/#{Webruby::App.config.output_name}"
|
51
51
|
if Webruby::App.config.append_file
|
52
|
+
sh "echo '' >> #{Webruby.build_dir}/#{Webruby::App.config.output_name}"
|
52
53
|
sh "cat #{Webruby::App.config.append_file} >> #{Webruby.build_dir}/#{Webruby::App.config.output_name}"
|
53
54
|
end
|
54
55
|
end
|
data/lib/webruby/rake/mruby.rake
CHANGED
@@ -43,5 +43,5 @@ end
|
|
43
43
|
desc "mruby test library"
|
44
44
|
task :libmruby_test => Webruby.build_config do |t|
|
45
45
|
ENV["MRUBY_CONFIG"] = Webruby.full_build_config
|
46
|
-
sh "cd #{MRUBY_DIR} && ruby ./minirake #{Webruby.full_build_dir}/#{MRBTEST}"
|
46
|
+
sh "cd #{MRUBY_DIR} && ruby ./minirake #{Webruby.full_build_dir}/#{LIBMRUBY} #{Webruby.full_build_dir}/#{MRBTEST}"
|
47
47
|
end
|
data/modules/emscripten/AUTHORS
CHANGED
@@ -10,7 +10,40 @@ Not all changes are documented here. In particular, new features, user-oriented
|
|
10
10
|
Current trunk code
|
11
11
|
------------------
|
12
12
|
- To see a list of commits in the active development branch 'incoming', which have not yet been packaged in a release, see
|
13
|
-
https://github.com/kripken/emscripten/compare/1.
|
13
|
+
https://github.com/kripken/emscripten/compare/1.8.2...incoming
|
14
|
+
|
15
|
+
v1.8.2: 1/4/2013
|
16
|
+
------------------
|
17
|
+
- Fixed glGetFramebufferAttachmentParameteriv and an issue with glGetXXX when the returned value was null.
|
18
|
+
- Full list of changes: https://github.com/kripken/emscripten/compare/1.8.1...1.8.2
|
19
|
+
|
20
|
+
v1.8.1: 1/3/2013
|
21
|
+
------------------
|
22
|
+
- Added support for WebGL hardware instancing extension.
|
23
|
+
- Improved fastcomp native LLVM backend support.
|
24
|
+
- Added support for #include filename.js to JS libraries.
|
25
|
+
- Deprecated --compression emcc command line parameter that manually compressed output JS files, due to performance issues. Instead, it is best to rely on the web server to serve compressed JS files.
|
26
|
+
- Full list of changes: https://github.com/kripken/emscripten/compare/1.8.0...1.8.1
|
27
|
+
|
28
|
+
v1.8.0: 12/28/2013
|
29
|
+
------------------
|
30
|
+
- Fix two issues with function outliner and relooper.
|
31
|
+
- Full list of changes: https://github.com/kripken/emscripten/compare/1.7.9...1.8.0
|
32
|
+
|
33
|
+
v1.7.9: 12/27/2013
|
34
|
+
------------------
|
35
|
+
- Added new command line parameter --em-config that allows specifying a custom location for the .emscripten configuration file.
|
36
|
+
- Reintroduced relaxed asm.js heap sizes, which no longer need to be power of 2, but a multiple of 16MB is sufficient.
|
37
|
+
- Added emrun command line tool that allows launching .html pages from command line on desktop and Android as if they were native applications. See https://groups.google.com/forum/#!topic/emscripten-discuss/t2juu3q1H8E . Adds --emrun compiler link flag.
|
38
|
+
- Began initial work on the "fastcomp" compiler toolchain, a rewrite of the previous JS LLVM AST parsing and codegen via a native LLVM backend.
|
39
|
+
- Added --exclude-file command line flag to emcc and a matching --exclude command line flag to file packager, which allows specifying files and directories that should be excluded while packaging a VFS data blob.
|
40
|
+
- Improved GLES2 and EGL support libraries to be more spec-conformant.
|
41
|
+
- Optimized legacy GL emulation code path. Added new GL_FFP_ONLY optimization path to fixed function pipeline emulation.
|
42
|
+
- Added new core functions emscripten_log() and emscripten_get_callstack() that allow printing out log messages with demangled and source-mapped callstack information.
|
43
|
+
- Improved BSD Sockets support. Implemented getprotobyname() for BSD Sockets library.
|
44
|
+
- Fixed issues with simd support.
|
45
|
+
- Various bugfixes: #1573, #1846, #1886, #1908, #1918, #1930, #1931, #1942, #1948, ..
|
46
|
+
- Full list of changes: https://github.com/kripken/emscripten/compare/1.7.8...1.7.9
|
14
47
|
|
15
48
|
v1.7.8: 11/19/2013
|
16
49
|
------------------
|
@@ -124,22 +124,22 @@ SET(APPLE)
|
|
124
124
|
set(CMAKE_C_SIZEOF_DATA_PTR 4)
|
125
125
|
set(CMAKE_CXX_SIZEOF_DATA_PTR 4)
|
126
126
|
|
127
|
-
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_RELEASE")
|
128
|
-
set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_MINSIZEREL")
|
129
|
-
set(CMAKE_C_FLAGS_RELWITHDEBINFO "" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_RELWITHDEBINFO")
|
130
|
-
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_RELEASE")
|
131
|
-
set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_MINSIZEREL")
|
132
|
-
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_RELWITHDEBINFO")
|
127
|
+
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_RELEASE")
|
128
|
+
set(CMAKE_C_FLAGS_MINSIZEREL "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_MINSIZEREL")
|
129
|
+
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING "Emscripten-overridden CMAKE_C_FLAGS_RELWITHDEBINFO")
|
130
|
+
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_RELEASE")
|
131
|
+
set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG -O2" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_MINSIZEREL")
|
132
|
+
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING "Emscripten-overridden CMAKE_CXX_FLAGS_RELWITHDEBINFO")
|
133
133
|
|
134
134
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-O2" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_RELEASE")
|
135
135
|
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-O2" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_MINSIZEREL")
|
136
|
-
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO")
|
136
|
+
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Emscripten-overridden CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO")
|
137
137
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "-O2" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_RELEASE")
|
138
138
|
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "-O2" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL")
|
139
|
-
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO")
|
139
|
+
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Emscripten-overridden CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO")
|
140
140
|
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "-O2" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_RELEASE")
|
141
141
|
set(CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "-O2" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL")
|
142
|
-
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "-O2" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO")
|
142
|
+
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "Emscripten-overridden CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO")
|
143
143
|
|
144
144
|
function(em_validate_asmjs_after_build target)
|
145
145
|
add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E echo Validating build output for asm.js... COMMAND "python" ARGS "${EMSCRIPTEN_ROOT_PATH}/tools/validate_asmjs.py" "$<TARGET_FILE:${target}>")
|
@@ -205,3 +205,24 @@ endfunction()
|
|
205
205
|
function(em_link_post_js target)
|
206
206
|
em_add_tracked_link_flag(${target} "--post-js" ${ARGN})
|
207
207
|
endfunction()
|
208
|
+
|
209
|
+
# Experimental support for targeting generation of Visual Studio project files (vs-tool) of Emscripten projects for Windows.
|
210
|
+
# To use this, pass the combination -G "Visual Studio 10" -DCMAKE_TOOLCHAIN_FILE=Emscripten.cmake
|
211
|
+
if ("${CMAKE_GENERATOR}" MATCHES "^Visual Studio.*")
|
212
|
+
# By default, CMake generates VS project files with a <GenerateManifest>true</GenerateManifest> directive.
|
213
|
+
# This causes VS to attempt to invoke rc.exe during the build, which will fail since app manifests are meaningless for Emscripten.
|
214
|
+
# To disable this, add the following linker flag. This flag will not go to emcc, since the Visual Studio CMake generator will swallow it.
|
215
|
+
set(EMSCRIPTEN_VS_LINKER_FLAGS "/MANIFEST:NO")
|
216
|
+
# CMake is hardcoded to write a ClCompile directive <ObjectFileName>$(IntDir)</ObjectFileName> in all VS project files it generates.
|
217
|
+
# This makes VS pass emcc a -o param that points to a directory instead of a file, which causes emcc autogenerate the output filename.
|
218
|
+
# CMake is hardcoded to assume all object files have the suffix .obj, so adjust the emcc-autogenerated default suffix name to match.
|
219
|
+
set(EMSCRIPTEN_VS_LINKER_FLAGS "${EMSCRIPTEN_VS_LINKER_FLAGS} --default-obj-ext .obj")
|
220
|
+
# Also hint CMake that it should not hardcode <ObjectFileName> generation. Requires a custom CMake build for this to work (ignored on others)
|
221
|
+
# See http://www.cmake.org/Bug/view.php?id=14673 and https://github.com/juj/CMake
|
222
|
+
set(CMAKE_VS_NO_DEFAULT_OBJECTFILENAME 1)
|
223
|
+
|
224
|
+
# Apply and cache Emscripten Visual Studio IDE-specific linker flags.
|
225
|
+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMSCRIPTEN_VS_LINKER_FLAGS}" CACHE STRING "")
|
226
|
+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${EMSCRIPTEN_VS_LINKER_FLAGS}" CACHE STRING "")
|
227
|
+
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${EMSCRIPTEN_VS_LINKER_FLAGS}" CACHE STRING "")
|
228
|
+
endif()
|
data/modules/emscripten/emcc
CHANGED
@@ -348,7 +348,9 @@ Options that are modified or new in %s include:
|
|
348
348
|
--embed-file and --preload-file
|
349
349
|
wildcard is supported
|
350
350
|
|
351
|
-
--compression <codec>
|
351
|
+
--compression <codec> **THIS OPTION IS DEPRECATED**
|
352
|
+
|
353
|
+
Compress both the compiled code and embedded/
|
352
354
|
preloaded files. <codec> should be a triple,
|
353
355
|
|
354
356
|
<native_encoder>,<js_decoder>,<js_name>
|
@@ -517,6 +519,13 @@ Options that are modified or new in %s include:
|
|
517
519
|
file, and if that is not set, the default location
|
518
520
|
~/.emscripten is assumed.
|
519
521
|
|
522
|
+
--default-obj-ext .ext Specifies the file suffix to generate if the location
|
523
|
+
of a directory name is passed to -o directive, e.g.
|
524
|
+
emcc -c a.c -o dir/
|
525
|
+
will by default generate an output name 'dir/a.o',
|
526
|
+
but this cmdline param can be passed to generate a
|
527
|
+
file with a custom suffix 'dir/a.ext'.
|
528
|
+
|
520
529
|
The target file, if specified (-o <target>), defines what will
|
521
530
|
be generated:
|
522
531
|
|
@@ -678,7 +687,7 @@ if os.environ.get('EMMAKEN_CXX'):
|
|
678
687
|
CC_ADDITIONAL_ARGS = shared.COMPILER_OPTS
|
679
688
|
|
680
689
|
EMMAKEN_CFLAGS = os.environ.get('EMMAKEN_CFLAGS')
|
681
|
-
if EMMAKEN_CFLAGS:
|
690
|
+
if EMMAKEN_CFLAGS: sys.argv += shlex.split(EMMAKEN_CFLAGS)
|
682
691
|
|
683
692
|
# ---------------- Utilities ---------------
|
684
693
|
|
@@ -804,6 +813,7 @@ try:
|
|
804
813
|
use_preload_cache = False
|
805
814
|
no_heap_copy = False
|
806
815
|
proxy_to_worker = False
|
816
|
+
default_object_extension = '.o'
|
807
817
|
|
808
818
|
if use_cxx:
|
809
819
|
default_cxx_std = '-std=c++03' # Enforce a consistent C++ standard when compiling .cpp files, if user does not specify one on the cmdline.
|
@@ -914,6 +924,7 @@ try:
|
|
914
924
|
newargs[i] = ''
|
915
925
|
newargs[i+1] = ''
|
916
926
|
elif newargs[i].startswith('--compression'):
|
927
|
+
logging.warning('--compression is deprecated. Instead, it is recommended you use native gzip compression in your webserver')
|
917
928
|
check_bad_eq(newargs[i])
|
918
929
|
parts = newargs[i+1].split(',')
|
919
930
|
assert len(parts) == 3, '--compression requires specifying native_encoder,js_decoder,js_name - see emcc --help. got: %s' % newargs[i+1]
|
@@ -999,6 +1010,12 @@ try:
|
|
999
1010
|
# This option is parsed in tools/shared.py, here only clean it up from being passed to clang.
|
1000
1011
|
newargs[i] = ''
|
1001
1012
|
newargs[i+1] = ''
|
1013
|
+
elif newargs[i] == '--default-obj-ext':
|
1014
|
+
newargs[i] = ''
|
1015
|
+
default_object_extension = newargs[i+1]
|
1016
|
+
if not default_object_extension.startswith('.'):
|
1017
|
+
default_object_extension = '.' + default_object_extension
|
1018
|
+
newargs[i+1] = ''
|
1002
1019
|
|
1003
1020
|
newargs = [ arg for arg in newargs if arg is not '' ]
|
1004
1021
|
|
@@ -1173,11 +1190,10 @@ try:
|
|
1173
1190
|
logging.warning('disabling asm.js since embind is not ready for it yet')
|
1174
1191
|
shared.Settings.ASM_JS = 0
|
1175
1192
|
|
1176
|
-
|
1193
|
+
fastcomp = os.environ.get('EMCC_FAST_COMPILER') == '1'
|
1194
|
+
|
1195
|
+
if fastcomp:
|
1177
1196
|
shared.Settings.ASM_JS = 1
|
1178
|
-
if shared.Settings.DISABLE_EXCEPTION_CATCHING == 0:
|
1179
|
-
logging.warning('disabling exception catching since not supported in fastcomp yet')
|
1180
|
-
shared.Settings.DISABLE_EXCEPTION_CATCHING = 1
|
1181
1197
|
assert shared.Settings.ALLOW_MEMORY_GROWTH == 0, 'memory growth not supported in fastcomp yet'
|
1182
1198
|
assert shared.Settings.UNALIGNED_MEMORY == 0, 'forced unaligned memory not supported in fastcomp'
|
1183
1199
|
assert shared.Settings.SAFE_HEAP == 0, 'safe heap not supported in fastcomp yet'
|
@@ -1191,10 +1207,18 @@ try:
|
|
1191
1207
|
assert shared.Settings.NAMED_GLOBALS == 0, 'named globals not supported in fastcomp'
|
1192
1208
|
assert shared.Settings.PGO == 0, 'pgo not supported in fastcomp'
|
1193
1209
|
assert shared.Settings.TARGET_LE32 == 1, 'fastcomp requires le32'
|
1210
|
+
assert shared.Settings.USE_TYPED_ARRAYS == 2, 'fastcomp assumes ta2'
|
1194
1211
|
assert not bind, 'embind not supported in fastcomp yet'
|
1212
|
+
if jcache:
|
1213
|
+
logging.warning('jcache is not supported in fastcomp (you should not need it anyhow), disabling')
|
1214
|
+
jcache = False
|
1215
|
+
|
1216
|
+
fastcomp_opts = ['-pnacl-abi-simplify-preopt', '-pnacl-abi-simplify-postopt']
|
1217
|
+
if not shared.Settings.DISABLE_EXCEPTION_CATCHING:
|
1218
|
+
fastcomp_opts += ['-enable-emscripten-cxx-exceptions']
|
1195
1219
|
|
1196
1220
|
if shared.Settings.ASM_JS:
|
1197
|
-
assert opt_level >= 1 or
|
1221
|
+
assert opt_level >= 1 or fastcomp, 'asm.js requires -O1 or above'
|
1198
1222
|
|
1199
1223
|
if bind:
|
1200
1224
|
shared.Settings.RESERVED_FUNCTION_POINTERS = max(shared.Settings.RESERVED_FUNCTION_POINTERS, 10)
|
@@ -1206,16 +1230,6 @@ try:
|
|
1206
1230
|
shared.Settings.CORRECT_OVERFLOWS = 1
|
1207
1231
|
assert not shared.Settings.PGO, 'cannot run PGO in ASM_JS mode'
|
1208
1232
|
|
1209
|
-
heap = 4096
|
1210
|
-
while heap < shared.Settings.TOTAL_MEMORY:
|
1211
|
-
if heap < 16*1024*1024:
|
1212
|
-
heap *= 2
|
1213
|
-
else:
|
1214
|
-
heap += 16*1024*1024
|
1215
|
-
if heap != shared.Settings.TOTAL_MEMORY:
|
1216
|
-
logging.warning('increasing TOTAL_MEMORY to %d to be more reasonable for asm.js' % heap)
|
1217
|
-
shared.Settings.TOTAL_MEMORY = heap
|
1218
|
-
|
1219
1233
|
if shared.Settings.CORRECT_SIGNS >= 2 or shared.Settings.CORRECT_OVERFLOWS >= 2 or shared.Settings.CORRECT_ROUNDINGS >= 2:
|
1220
1234
|
debug_level = 4 # must keep debug info to do line-by-line operations
|
1221
1235
|
|
@@ -1340,7 +1354,16 @@ try:
|
|
1340
1354
|
else:
|
1341
1355
|
if len(input_files) == 1:
|
1342
1356
|
temp_output_base = in_temp(unsuffixed(uniquename(input_files[0])))
|
1343
|
-
|
1357
|
+
if specified_target.endswith('/') or specified_target.endswith('\\') or os.path.isdir(specified_target): # User passed '-o <directory' as the location to output to.
|
1358
|
+
obj_output_name = os.path.join(specified_target, os.path.splitext(os.path.basename(input_file))[0] + default_object_extension)
|
1359
|
+
logging.debug('User specified -o <directoryname> as the location of the output. Generating output file ' + obj_output_name)
|
1360
|
+
try:
|
1361
|
+
shutil.move(temp_output_base + '.o', obj_output_name)
|
1362
|
+
except IOError, e:
|
1363
|
+
logging.error('Could not write to output file ' + obj_output_name + '. Perhaps the output directory does not exist?')
|
1364
|
+
exit(1)
|
1365
|
+
else: # User passed '-o <filename>' as the location to output to.
|
1366
|
+
shutil.move(temp_output_base + '.o', specified_target)
|
1344
1367
|
if os.path.exists(temp_output_base + '.d'):
|
1345
1368
|
# There was a .d file generated, from -MD or -MMD and friends, save a copy of it to where the output resides,
|
1346
1369
|
# adjusting the target name away from the temporary file name to the specified target.
|
@@ -1722,22 +1745,24 @@ try:
|
|
1722
1745
|
# At minimum remove dead functions etc., this potentially saves a lot in the size of the generated code (and the time to compile it)
|
1723
1746
|
link_opts += shared.Building.get_safe_internalize() + ['-globaldce']
|
1724
1747
|
|
1725
|
-
|
1726
|
-
if os.environ.get('EMCC_FAST_COMPILER') and not AUTODEBUG:
|
1727
|
-
link_opts += ['-pnacl-abi-simplify-preopt', '-pnacl-abi-simplify-postopt']
|
1728
|
-
|
1729
|
-
if (not save_bc and not os.environ.get('EMCC_FAST_COMPILER')) or AUTODEBUG:
|
1748
|
+
if (not save_bc and not fastcomp) or AUTODEBUG:
|
1730
1749
|
# let llvm opt directly emit ll, to skip writing and reading all the bitcode
|
1731
1750
|
link_opts += ['-S']
|
1732
1751
|
shared.Building.llvm_opt(final, link_opts, final + '.link.ll')
|
1733
1752
|
final = final + '.link.ll'
|
1734
1753
|
if DEBUG: save_intermediate('linktime', 'll')
|
1735
1754
|
else:
|
1755
|
+
if fastcomp and not save_bc:
|
1756
|
+
# Simplify LLVM bitcode for fastcomp
|
1757
|
+
link_opts += fastcomp_opts
|
1736
1758
|
shared.Building.llvm_opt(final, link_opts)
|
1737
1759
|
if DEBUG: save_intermediate('linktime', 'bc')
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1760
|
+
if save_bc:
|
1761
|
+
shutil.copyfile(final, save_bc)
|
1762
|
+
if fastcomp:
|
1763
|
+
shared.Building.llvm_opt(final, fastcomp_opts, final + '.adsimp.bc')
|
1764
|
+
final += '.adsimp.bc'
|
1765
|
+
if DEBUG: save_intermediate('adsimp', 'bc')
|
1741
1766
|
|
1742
1767
|
# Prepare .ll for Emscripten
|
1743
1768
|
if not LEAVE_INPUTS_RAW:
|
@@ -1754,8 +1779,8 @@ try:
|
|
1754
1779
|
if DEBUG: save_intermediate('autodebug', 'll')
|
1755
1780
|
|
1756
1781
|
# Simplify bitcode after autodebug
|
1757
|
-
if
|
1758
|
-
shared.Building.llvm_opt(final,
|
1782
|
+
if fastcomp and (AUTODEBUG or LEAVE_INPUTS_RAW):
|
1783
|
+
shared.Building.llvm_opt(final, fastcomp_opts, final + '.adsimp.bc')
|
1759
1784
|
final += '.adsimp.bc'
|
1760
1785
|
if DEBUG: save_intermediate('adsimp', 'bc')
|
1761
1786
|
|
@@ -1891,6 +1916,9 @@ try:
|
|
1891
1916
|
|
1892
1917
|
js_optimizer_queue += [get_eliminate()]
|
1893
1918
|
|
1919
|
+
if shared.Settings.AGGRESSIVE_VARIABLE_ELIMINATION:
|
1920
|
+
js_optimizer_queue += ['aggressiveVariableElimination']
|
1921
|
+
|
1894
1922
|
if opt_level >= 2:
|
1895
1923
|
js_optimizer_queue += ['simplifyExpressions']
|
1896
1924
|
|
@@ -1949,6 +1977,11 @@ try:
|
|
1949
1977
|
if debug_level >= 4:
|
1950
1978
|
generate_source_map(target)
|
1951
1979
|
shutil.move(final, js_target)
|
1980
|
+
# TODO: use an async blob, which would allow code rewriting on the client:
|
1981
|
+
# var blob = new Blob([codeString]);
|
1982
|
+
# var script = document.createElement('script');
|
1983
|
+
# script.src = URL.createObjectURL(blob);
|
1984
|
+
# document.body.appendChild(script);
|
1952
1985
|
script_tag = '''<script async type="text/javascript" src="%s"></script>''' % base_js_target
|
1953
1986
|
html.write(shell.replace('{{{ SCRIPT }}}', script_tag))
|
1954
1987
|
else:
|
data/modules/emscripten/emrun
CHANGED
@@ -492,15 +492,18 @@ def win_print_gpu_info():
|
|
492
492
|
print "GPU"+str(i)+ ": " + gpus[i] + " with " + gpu_memory[i] + " MBs of VRAM"
|
493
493
|
|
494
494
|
def linux_print_gpu_info():
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
495
|
+
try:
|
496
|
+
glxinfo = subprocess.check_output('glxinfo')
|
497
|
+
for line in glxinfo.split("\n"):
|
498
|
+
if "OpenGL vendor string:" in line:
|
499
|
+
gl_vendor = line[len("OpenGL vendor string:"):].strip()
|
500
|
+
if "OpenGL version string:" in line:
|
501
|
+
gl_version = line[len("OpenGL version string:"):].strip()
|
502
|
+
if "OpenGL renderer string:" in line:
|
503
|
+
gl_renderer = line[len("OpenGL renderer string:"):].strip()
|
504
|
+
logi('GPU: ' + gl_vendor + ' ' + gl_renderer + ', GL version ' + gl_version)
|
505
|
+
except:
|
506
|
+
pass
|
504
507
|
|
505
508
|
def osx_print_gpu_info():
|
506
509
|
try:
|
@@ -722,11 +725,12 @@ def find_browser(name):
|
|
722
725
|
('firefox_beta', os.path.expanduser('~/firefox_beta/firefox')),
|
723
726
|
('firefox_aurora', os.path.expanduser('~/firefox_aurora/firefox')),
|
724
727
|
('firefox_nightly', os.path.expanduser('~/firefox_nightly/firefox')),
|
725
|
-
('chrome', which('google-chrome-stable'))
|
728
|
+
('chrome', which('google-chrome-stable')),
|
729
|
+
('chrome', which('google-chrome'))]
|
726
730
|
|
727
731
|
for (alias, browser_exe) in browser_locations:
|
728
732
|
if name == alias:
|
729
|
-
if os.path.isfile(browser_exe):
|
733
|
+
if browser_exe is not None and os.path.isfile(browser_exe):
|
730
734
|
return [browser_exe]
|
731
735
|
|
732
736
|
return None # Could not find the browser
|
@@ -804,6 +804,9 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
|
|
804
804
|
map(lambda x: x[1:], metadata['implementedFunctions'])
|
805
805
|
)
|
806
806
|
) + map(lambda x: x[1:], metadata['externs'])
|
807
|
+
if metadata['simd']:
|
808
|
+
settings['SIMD'] = 1
|
809
|
+
settings['ASM_JS'] = 2
|
807
810
|
|
808
811
|
# Save settings to a file to work around v8 issue 1579
|
809
812
|
settings_file = temp_files.get('.txt').name
|
@@ -0,0 +1,110 @@
|
|
1
|
+
/**
|
2
|
+
* This file contains definitions for things that we'd really rather the closure compiler *didn't* minify.
|
3
|
+
* See http://code.google.com/p/closure-compiler/wiki/FAQ#How_do_I_write_an_externs_file
|
4
|
+
* See also the discussion here: https://github.com/kripken/emscripten/issues/1979
|
5
|
+
*
|
6
|
+
* The closure_compiler() method in tools/shared.py refers to this file when calling closure.
|
7
|
+
*/
|
8
|
+
|
9
|
+
// Closure externs used by library_uuid.js
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @param {Array} typedArray
|
13
|
+
*/
|
14
|
+
crypto.getRandomValues = function(typedArray) {};
|
15
|
+
|
16
|
+
/**
|
17
|
+
BEGIN_NODE_INCLUDE
|
18
|
+
var crypto = require('crypto');
|
19
|
+
END_NODE_INCLUDE
|
20
|
+
*/
|
21
|
+
|
22
|
+
/**
|
23
|
+
* @type {Object.<string,*>}
|
24
|
+
*/
|
25
|
+
var crypto = {};
|
26
|
+
|
27
|
+
/**
|
28
|
+
* @param {number} size
|
29
|
+
* @param {function(Error, buffer.Buffer)} callback
|
30
|
+
*/
|
31
|
+
crypto.randomBytes = function(size, callback) {};
|
32
|
+
|
33
|
+
|
34
|
+
// Closure externs used by library_sockfs.js
|
35
|
+
|
36
|
+
/**
|
37
|
+
BEGIN_NODE_INCLUDE
|
38
|
+
var ws = require('ws');
|
39
|
+
END_NODE_INCLUDE
|
40
|
+
*/
|
41
|
+
|
42
|
+
/**
|
43
|
+
* @type {Object.<string,*>}
|
44
|
+
*/
|
45
|
+
var ws = {};
|
46
|
+
|
47
|
+
/**
|
48
|
+
* @param {string} event
|
49
|
+
* @param {function()} callback
|
50
|
+
*/
|
51
|
+
ws.on = function(event, callback) {};
|
52
|
+
|
53
|
+
/**
|
54
|
+
* @param {Object} data
|
55
|
+
* @param {Object} flags
|
56
|
+
* @param {function()=} callback
|
57
|
+
*/
|
58
|
+
ws.send = function(data, flags, callback) {};
|
59
|
+
|
60
|
+
/**
|
61
|
+
* @type {boolean}
|
62
|
+
*/
|
63
|
+
ws.binaryType;
|
64
|
+
|
65
|
+
/**
|
66
|
+
* @type {Object.<string,*>}
|
67
|
+
*/
|
68
|
+
var wss = ws.Server;
|
69
|
+
|
70
|
+
/**
|
71
|
+
* @param {string} event
|
72
|
+
* @param {function()} callback
|
73
|
+
*/
|
74
|
+
wss.on = function(event, callback) {};
|
75
|
+
|
76
|
+
/**
|
77
|
+
* @param {function()} callback
|
78
|
+
*/
|
79
|
+
wss.broadcast = function(callback) {};
|
80
|
+
|
81
|
+
/**
|
82
|
+
* @type {Object.<string,*>}
|
83
|
+
*/
|
84
|
+
wss._socket;
|
85
|
+
|
86
|
+
/**
|
87
|
+
* @type {string}
|
88
|
+
*/
|
89
|
+
wss.url;
|
90
|
+
|
91
|
+
/**
|
92
|
+
* @type {string}
|
93
|
+
*/
|
94
|
+
wss._socket.remoteAddress;
|
95
|
+
|
96
|
+
/**
|
97
|
+
* @type {number}
|
98
|
+
*/
|
99
|
+
wss._socket.remotePort;
|
100
|
+
|
101
|
+
/**
|
102
|
+
* @type {Object.<string,*>}
|
103
|
+
*/
|
104
|
+
var flags = {};
|
105
|
+
/**
|
106
|
+
* @type {boolean}
|
107
|
+
*/
|
108
|
+
flags.binary;
|
109
|
+
|
110
|
+
|