From a0e9770d4de49de26fbbe70927a35e479f091a8b Mon Sep 17 00:00:00 2001 From: onnoj Date: Mon, 23 Dec 2013 12:15:09 +0100 Subject: [PATCH 01/15] Added workaround for window.scrollX compat. window.scrollX/Y is not available in IE11. As far as specifications go, is currently only specified in draft (http://dev.w3.org/csswg/cssom-view/#refsCSSOM). Falling back to window.pageXOffset seems like a good workaround. On a related note; my Emscriptified project runs on IE11 although performance is very poor (mostly due to Internet Explorer itself, I think). It's pretty finicky about the shaders, as they introduced an extra set of requirements. (inout/in/out keywords not supported, can't construct mat3 from mat4, etc). --- src/library_browser.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/library_browser.js b/src/library_browser.js index b368c6ac8ba1d..f3363e51667fa 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -478,19 +478,21 @@ mergeInto(LibraryManager.library, { // in the coordinates. var rect = Module["canvas"].getBoundingClientRect(); var x, y; + var scrollX = ((window.scrollX !== undefined) ? window.scrollX : window.pageXOffset); + var scrollY = ((window.scrollY !== undefined) ? window.scrollY : window.pageYOffset); if (event.type == 'touchstart' || event.type == 'touchend' || event.type == 'touchmove') { var t = event.touches.item(0); if (t) { - x = t.pageX - (window.scrollX + rect.left); - y = t.pageY - (window.scrollY + rect.top); + x = t.pageX - (scrollX + rect.left); + y = t.pageY - (scrollY + rect.top); } else { return; } } else { - x = event.pageX - (window.scrollX + rect.left); - y = event.pageY - (window.scrollY + rect.top); + x = event.pageX - (scrollX + rect.left); + y = event.pageY - (scrollY + rect.top); } // the canvas might be CSS-scaled compared to its backbuffer; From e132e7a2b54564ffb710c4fc5a8f29fc0431f847 Mon Sep 17 00:00:00 2001 From: onnoj Date: Thu, 2 Jan 2014 11:48:39 +0100 Subject: [PATCH 02/15] Added comments & assert to scrollX fix. Added comments to fix as per @kripken's request. Added an assert too (guarded by ASSERTIONS define) --- src/library_browser.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/library_browser.js b/src/library_browser.js index f3363e51667fa..bf8444bdf1c92 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -478,8 +478,17 @@ mergeInto(LibraryManager.library, { // in the coordinates. var rect = Module["canvas"].getBoundingClientRect(); var x, y; + + //Neither .scrollX or .pageXOffset are defined in a spec, but + //we prefer .scrollX because it is currently in a spec draft. + //(see: http://www.w3.org/TR/2013/WD-cssom-view-20131217/) var scrollX = ((window.scrollX !== undefined) ? window.scrollX : window.pageXOffset); var scrollY = ((window.scrollY !== undefined) ? window.scrollY : window.pageYOffset); + #if ASSERTIONS + //If this assert lands, it's likely because the browser doesn't support scrollX or pageXOffset + //and we have no viable fallback. + assert((scrollX !== undefined) && (scrollY !== undefined), 'Unable to retrieve scroll position, mouse positions likely broken.'); + #endif if (event.type == 'touchstart' || event.type == 'touchend' || event.type == 'touchmove') { From 76ba593a1cbd2f55c1bb8966929405b4a47a3185 Mon Sep 17 00:00:00 2001 From: onnoj Date: Thu, 2 Jan 2014 11:57:21 +0100 Subject: [PATCH 03/15] Fixed undefined check. Forgot I had to explicitly check the type of variable type to see if it's undefined. --- src/library_browser.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/library_browser.js b/src/library_browser.js index bf8444bdf1c92..029598f3e0f98 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -482,12 +482,12 @@ mergeInto(LibraryManager.library, { //Neither .scrollX or .pageXOffset are defined in a spec, but //we prefer .scrollX because it is currently in a spec draft. //(see: http://www.w3.org/TR/2013/WD-cssom-view-20131217/) - var scrollX = ((window.scrollX !== undefined) ? window.scrollX : window.pageXOffset); - var scrollY = ((window.scrollY !== undefined) ? window.scrollY : window.pageYOffset); + var scrollX = ((typeof window.scrollX !== 'undefined') ? window.scrollX : window.pageXOffset); + var scrollY = ((typeof window.scrollY !== 'undefined') ? window.scrollY : window.pageYOffset); #if ASSERTIONS //If this assert lands, it's likely because the browser doesn't support scrollX or pageXOffset //and we have no viable fallback. - assert((scrollX !== undefined) && (scrollY !== undefined), 'Unable to retrieve scroll position, mouse positions likely broken.'); + assert((typeof scrollX !== 'undefined') && (typeof scrollY !== 'undefined'), 'Unable to retrieve scroll position, mouse positions likely broken.'); #endif if (event.type == 'touchstart' || event.type == 'touchend' || From 902926d8ae794594ded16b2074c8731ff318c248 Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Fri, 3 Jan 2014 14:17:06 +0800 Subject: [PATCH 04/15] clean extra arg of JSify --- src/jsifier.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/jsifier.js b/src/jsifier.js index 58dc46532e1f8..d533e36b76058 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -18,7 +18,7 @@ var INDENTATION = ' '; var functionStubSigs = {}; // JSifier -function JSify(data, functionsOnly, givenFunctions) { +function JSify(data, functionsOnly) { //B.start('jsifier'); var mainPass = !functionsOnly; @@ -109,7 +109,7 @@ function JSify(data, functionsOnly, givenFunctions) { dprint('unparsedFunctions','====================\n// Processing function batch of ' + currBaseLineNums.length + ' functions, ' + currFuncLines.length + ' lines, functions left: ' + data.unparsedFunctions.length); if (DEBUG_MEMORY) MemoryDebugger.tick('pre-func'); - JSify(analyzer(intertyper(currFuncLines, true, currBaseLineNums), true), true, Functions); + JSify(analyzer(intertyper(currFuncLines, true, currBaseLineNums), true), true); if (DEBUG_MEMORY) MemoryDebugger.tick('post-func'); } currFuncLines = currBaseLineNums = null; // Do not hold on to anything from inside that loop (JS function scoping..) @@ -1796,7 +1796,7 @@ function JSify(data, functionsOnly, givenFunctions) { } }); } - JSify(globalsData, true, Functions); + JSify(globalsData, true); globalsData = null; data.unparsedGlobalss = null; From fe66c89196353e99712993a362c31b1914d07cb2 Mon Sep 17 00:00:00 2001 From: onnoj Date: Fri, 3 Jan 2014 11:48:31 +0100 Subject: [PATCH 05/15] Update library_browser.js --- src/library_browser.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/library_browser.js b/src/library_browser.js index 029598f3e0f98..e0f53052d1639 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -479,16 +479,16 @@ mergeInto(LibraryManager.library, { var rect = Module["canvas"].getBoundingClientRect(); var x, y; - //Neither .scrollX or .pageXOffset are defined in a spec, but - //we prefer .scrollX because it is currently in a spec draft. - //(see: http://www.w3.org/TR/2013/WD-cssom-view-20131217/) + // Neither .scrollX or .pageXOffset are defined in a spec, but + // we prefer .scrollX because it is currently in a spec draft. + // (see: http://www.w3.org/TR/2013/WD-cssom-view-20131217/) var scrollX = ((typeof window.scrollX !== 'undefined') ? window.scrollX : window.pageXOffset); var scrollY = ((typeof window.scrollY !== 'undefined') ? window.scrollY : window.pageYOffset); - #if ASSERTIONS - //If this assert lands, it's likely because the browser doesn't support scrollX or pageXOffset - //and we have no viable fallback. +#if ASSERTIONS + // If this assert lands, it's likely because the browser doesn't support scrollX or pageXOffset + // and we have no viable fallback. assert((typeof scrollX !== 'undefined') && (typeof scrollY !== 'undefined'), 'Unable to retrieve scroll position, mouse positions likely broken.'); - #endif +#endif if (event.type == 'touchstart' || event.type == 'touchend' || event.type == 'touchmove') { From 2268e7b0b65b532f4bc762b394e8d1c4a590fefc Mon Sep 17 00:00:00 2001 From: John Vilk Date: Fri, 3 Jan 2014 15:26:47 -0500 Subject: [PATCH 06/15] [SDL] Fixing SDL_UnlockSurface in IE10/IE11. Previously, just calling SDL_UnlockSurface in IE10/IE11 would throw an exception, since Emscripten assumed that the ImageData's `data` property was Uint8ClampedArray, which has a backing buffer. IE10/IE11 still uses the deprecated CanvasPixelArray, which does not have a backing buffer property: https://developer.mozilla.org/en-US/docs/Web/API/CanvasPixelArray I've added an additional path to SDL_UnlockSurface for these browsers. --- src/library_sdl.js | 26 ++++++++++++++++++++------ tests/sdl_canvas.c | 2 ++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/library_sdl.js b/src/library_sdl.js index 1c1e8107cb819..78f6a628ff74f 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -1056,14 +1056,28 @@ var LibrarySDL = { var buffer = surfData.buffer; #if USE_TYPED_ARRAYS == 2 assert(buffer % 4 == 0, 'Invalid buffer offset: ' + buffer); - var src = buffer >> 2; + var src; var dst = 0; var isScreen = surf == SDL.screen; - var data32 = new Uint32Array(data.buffer); - var num = data32.length; - while (dst < num) { - // HEAP32[src++] is an optimization. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}}; - data32[dst++] = HEAP32[src++] | (isScreen ? 0xff000000 : 0); + var num; + if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) { + // IE10/IE11: Canvases are backed by the deprecated CanvasPixelArray, + // not UInt8ClampedArray. These don't have buffers, so we need to revert + // to copying a byte at a time. We do the undefined check because modern + // browsers do not define CanvasPixelArray anymore. + src = buffer; + num = data.length; + while (dst < num) { + data[dst++] = HEAP8[src++]; + } + } else { + var data32 = new Uint32Array(data.buffer); + src = buffer >> 2; + num = data32.length; + while (dst < num) { + // HEAP32[src++] is an optimization. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}}; + data32[dst++] = HEAP32[src++] | (isScreen ? 0xff000000 : 0); + } } #else var num = surfData.image.data.length; diff --git a/tests/sdl_canvas.c b/tests/sdl_canvas.c index 6bd659b8ff51b..cab48985b11b3 100644 --- a/tests/sdl_canvas.c +++ b/tests/sdl_canvas.c @@ -62,6 +62,8 @@ int main(int argc, char **argv) { printf("you should see two lines of text in different colors and a blue rectangle\n"); + SDL_UnlockSurface(screen); + SDL_Quit(); printf("done.\n"); From c7ccd83f14bde44767c296da7bd626c12f67c8f7 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 3 Jan 2014 15:42:17 -0800 Subject: [PATCH 07/15] convert test_sdl_canvas to btest --- tests/test_browser.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/test_browser.py b/tests/test_browser.py index 920c6f8c589d4..21fa395f5a822 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -680,10 +680,7 @@ def test_sdl_stb_image_data(self): self.btest('sdl_stb_image_data.c', reference='screenshot.jpg', args=['-s', 'STB_IMAGE=1', '--preload-file', 'screenshot.not']) def test_sdl_canvas(self): - open(os.path.join(self.get_dir(), 'sdl_canvas.c'), 'w').write(self.with_report_result(open(path_from_root('tests', 'sdl_canvas.c')).read())) - - Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'sdl_canvas.c'), '-o', 'page.html', '-s', 'LEGACY_GL_EMULATION=1']).communicate() - self.run_browser('page.html', '', '/report_result?1') + self.btest('sdl_canvas.c', expected='1', args=['-s', 'LEGACY_GL_EMULATION=1']) def test_sdl_canvas_proxy(self): def post(): From c9b22f467094404a062112c9b93199f59e6e93c7 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 3 Jan 2014 15:51:22 -0800 Subject: [PATCH 08/15] disable named globals test in fastcomp --- tests/test_core.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_core.py b/tests/test_core.py index a1b8279a549a0..6442f8942c78f 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -937,6 +937,8 @@ def test_strings(self): for named in (0, 1): print named + if os.environ.get('EMCC_FAST_COMPILER') == '1' and named: continue # no named globals in fastcomp + Settings.NAMED_GLOBALS = named self.do_run_from_file(src, output, ['wowie', 'too', '74']) From 05299686d45df2b5ee273c464dbf6d4b49d58fb5 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 3 Jan 2014 16:32:15 -0800 Subject: [PATCH 09/15] fix benchmark suite bug where args got appended --- tests/test_benchmark.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py index d84f36e469148..625340ea7fda7 100644 --- a/tests/test_benchmark.py +++ b/tests/test_benchmark.py @@ -58,7 +58,7 @@ def __init__(self, name, cc, cxx): def build(self, parent, filename, args, shared_args, emcc_args, native_args, native_exec, lib_builder): self.parent = parent - if lib_builder: native_args += lib_builder(self.name, native=True, env_init={ 'CC': self.cc, 'CXX': self.cxx }) + if lib_builder: native_args = native_args + lib_builder(self.name, native=True, env_init={ 'CC': self.cc, 'CXX': self.cxx }) if not native_exec: compiler = self.cxx if filename.endswith('cpp') else self.cc process = Popen([compiler, '-O2', '-fno-math-errno', filename, '-o', filename+'.native'] + shared_args + native_args, stdout=PIPE, stderr=parent.stderr_redirect) @@ -90,7 +90,7 @@ def __init__(self, name, engine, extra_args=[], env={}): def build(self, parent, filename, args, shared_args, emcc_args, native_args, native_exec, lib_builder): self.filename = filename - if lib_builder: emcc_args += lib_builder('js', native=False, env_init={}) + if lib_builder: emcc_args = emcc_args + lib_builder('js', native=False, env_init={}) open('hardcode.py', 'w').write(''' def process(filename): From 5f21294665db19cc072645cb87f8a0e2210141ba Mon Sep 17 00:00:00 2001 From: John Vilk Date: Fri, 3 Jan 2014 20:04:42 -0500 Subject: [PATCH 10/15] [SDL] Actually fix SDL_UnlockSurface in IE10/IE11. The previous revision did not copy over pixel data properly. This time, I have reverted the IE path to the code used in this method prior to the breaking change, and have tested it with JSMESS. --- src/library_sdl.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/library_sdl.js b/src/library_sdl.js index 78f6a628ff74f..cc969c27b1004 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -1056,23 +1056,27 @@ var LibrarySDL = { var buffer = surfData.buffer; #if USE_TYPED_ARRAYS == 2 assert(buffer % 4 == 0, 'Invalid buffer offset: ' + buffer); - var src; + var src = buffer >> 2; var dst = 0; var isScreen = surf == SDL.screen; var num; if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) { - // IE10/IE11: Canvases are backed by the deprecated CanvasPixelArray, + // IE10/IE11: ImageData objects are backed by the deprecated CanvasPixelArray, // not UInt8ClampedArray. These don't have buffers, so we need to revert // to copying a byte at a time. We do the undefined check because modern // browsers do not define CanvasPixelArray anymore. - src = buffer; num = data.length; while (dst < num) { - data[dst++] = HEAP8[src++]; + var val = HEAP32[src]; // This is optimized. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}}; + data[dst ] = val & 0xff; + data[dst+1] = (val >> 8) & 0xff; + data[dst+2] = (val >> 16) & 0xff; + data[dst+3] = isScreen ? 0xff : ((val >> 24) & 0xff); + src++; + dst += 4; } } else { var data32 = new Uint32Array(data.buffer); - src = buffer >> 2; num = data32.length; while (dst < num) { // HEAP32[src++] is an optimization. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}}; From c67e7e831cfd3c67b533f9e44b75c0925a5c52b9 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 3 Jan 2014 17:29:32 -0800 Subject: [PATCH 11/15] disable/update various browser tests for fastcomp --- tests/runner.py | 1 + tests/test_browser.py | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/runner.py b/tests/runner.py index 37e307e9e17e8..72e940cb92c41 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -649,6 +649,7 @@ def reftest(self, expected): def btest(self, filename, expected=None, reference=None, force_c=False, reference_slack=0, manual_reference=False, post_build=None, args=[], outfile='test.html', message='.'): # TODO: use in all other tests + if os.environ.get('EMCC_FAST_COMPILER') == '1' and 'LEGACY_GL_EMULATION=1' in args: return self.skip('no legacy gl emulation in fastcomp') # if we are provided the source and not a path, use that filename_is_src = '\n' in filename src = filename if filename_is_src else '' diff --git a/tests/test_browser.py b/tests/test_browser.py index 21fa395f5a822..20b38bb500fd0 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -120,6 +120,8 @@ def test_html_source_map(self): ''' def test_emscripten_log(self): + if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('fastcomp uses asm, where call stacks are sometimes less clear') + src = os.path.join(self.get_dir(), 'src.cpp') open(src, 'w').write(self.with_report_result(open(path_from_root('tests', 'emscripten_log', 'emscripten_log.cpp')).read())) @@ -1108,6 +1110,8 @@ def test_sdl_audio_quickload(self): self.run_browser('page.html', '', '/report_result?1') def test_sdl_audio_beeps(self): + if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo c++ exceptions in fastcomp') + open(os.path.join(self.get_dir(), 'sdl_audio_beep.cpp'), 'w').write(self.with_report_result(open(path_from_root('tests', 'sdl_audio_beep.cpp')).read())) # use closure to check for a possible bug with closure minifying away newer Audio() attributes @@ -1191,10 +1195,7 @@ def test_openal_buffers(self): self.btest('openal_buffers.c', '0', args=['--preload-file', 'the_entertainer.wav'],) def test_glfw(self): - open(os.path.join(self.get_dir(), 'glfw.c'), 'w').write(self.with_report_result(open(path_from_root('tests', 'glfw.c')).read())) - - Popen([PYTHON, EMCC, '-O2', os.path.join(self.get_dir(), 'glfw.c'), '-o', 'page.html', '-s', 'LEGACY_GL_EMULATION=1']).communicate() - self.run_browser('page.html', '', '/report_result?1') + self.btest('glfw.c', '1', args=['-s', 'LEGACY_GL_EMULATION=1']) def test_egl(self): open(os.path.join(self.get_dir(), 'test_egl.c'), 'w').write(self.with_report_result(open(path_from_root('tests', 'test_egl.c')).read())) @@ -1433,6 +1434,8 @@ def test_sdl_resize(self): self.btest('sdl_resize.c', '1') def test_gc(self): + if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('flaky in fastcomp and also non-fastcomp -O1, timing issues') + self.btest('browser_gc.cpp', '1') def test_glshaderinfo(self): @@ -1619,11 +1622,12 @@ def test_s3tc_crunch_split(self): # load several datafiles/outputs of file packa self.btest('s3tc_crunch.c', reference='s3tc_crunch.png', reference_slack=11, args=['--pre-js', 'asset_a.js', '--pre-js', 'asset_b.js', '-s', 'LEGACY_GL_EMULATION=1']) def test_aniso(self): - if SPIDERMONKEY_ENGINE in JS_ENGINES: + if SPIDERMONKEY_ENGINE in JS_ENGINES and os.environ.get('EMCC_FAST_COMPILER') != '1': # asm.js-ification check Popen([PYTHON, EMCC, path_from_root('tests', 'aniso.c'), '-O2', '-g2', '-s', 'LEGACY_GL_EMULATION=1']).communicate() Settings.ASM_JS = 1 self.run_generated_code(SPIDERMONKEY_ENGINE, 'a.out.js') + print 'passed asm test' shutil.copyfile(path_from_root('tests', 'water.dds'), 'water.dds') self.btest('aniso.c', reference='aniso.png', reference_slack=2, args=['--preload-file', 'water.dds', '-s', 'LEGACY_GL_EMULATION=1']) @@ -1678,6 +1682,8 @@ def test_emscripten_async_wget2(self): self.btest('http.cpp', expected='0', args=['-I' + path_from_root('tests')]) def test_module(self): + if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp') + Popen([PYTHON, EMCC, path_from_root('tests', 'browser_module.cpp'), '-o', 'module.js', '-O2', '-s', 'SIDE_MODULE=1', '-s', 'DLOPEN_SUPPORT=1', '-s', 'EXPORTED_FUNCTIONS=["_one", "_two"]']).communicate() self.btest('browser_main.cpp', args=['-O2', '-s', 'MAIN_MODULE=1', '-s', 'DLOPEN_SUPPORT=1'], expected='8') From c0beb1cff3a831039884f90ef2978e2345610992 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 3 Jan 2014 17:35:59 -0800 Subject: [PATCH 12/15] optimize main loop in SDL_UnlockSurface to avoid a branch --- src/library_sdl.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/library_sdl.js b/src/library_sdl.js index cc969c27b1004..fc38dd1ca48ca 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -1078,9 +1078,15 @@ var LibrarySDL = { } else { var data32 = new Uint32Array(data.buffer); num = data32.length; - while (dst < num) { - // HEAP32[src++] is an optimization. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}}; - data32[dst++] = HEAP32[src++] | (isScreen ? 0xff000000 : 0); + if (isScreen) { + while (dst < num) { + // HEAP32[src++] is an optimization. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}}; + data32[dst++] = HEAP32[src++] | 0xff000000; + } + } else { + while (dst < num) { + data32[dst++] = HEAP32[src++]; + } } } #else From ddaac5fbe1c40c4c15bb7cf47ba03d4d4a4847e2 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 4 Jan 2014 14:02:51 -0800 Subject: [PATCH 13/15] specify (void) as the arguments in webgl_context_attributes test, to avoid confusion with varargs by clang --- tests/test_webgl_context_attributes_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_webgl_context_attributes_common.c b/tests/test_webgl_context_attributes_common.c index 7131203bffa2a..80506b5003ccc 100644 --- a/tests/test_webgl_context_attributes_common.c +++ b/tests/test_webgl_context_attributes_common.c @@ -238,9 +238,9 @@ static void draw() { } -extern int webglAntialiasSupported(); -extern int webglDepthSupported(); -extern int webglStencilSupported(); +extern int webglAntialiasSupported(void); +extern int webglDepthSupported(void); +extern int webglStencilSupported(void); // Check attributes support in the WebGL implementation (see test_webgl_context_attributes function in test_browser.py) // Tests will succeed if they are not. From 0895a9801ef922f4b0655d24eb1569092014eebe Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 4 Jan 2014 16:34:06 -0800 Subject: [PATCH 14/15] todo about async script tags --- emcc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emcc b/emcc index 621cb340a7e87..e02854bdb231f 100755 --- a/emcc +++ b/emcc @@ -1973,6 +1973,11 @@ try: if debug_level >= 4: generate_source_map(target) shutil.move(final, js_target) + # TODO: use an async blob, which would allow code rewriting on the client: + # var blob = new Blob([codeString]); + # var script = document.createElement('script'); + # script.src = URL.createObjectURL(blob); + # document.body.appendChild(script); script_tag = '''''' % base_js_target html.write(shell.replace('{{{ SCRIPT }}}', script_tag)) else: From 354b32d93817bcf88dcb9117ccb449b534fb5cd2 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 4 Jan 2014 17:20:57 -0800 Subject: [PATCH 15/15] fix some relooper compiler warnings and update reftests for previous fixes --- src/relooper/Relooper.cpp | 14 +++++++------- src/relooper/test.txt | 4 ++-- tools/shared.py | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/relooper/Relooper.cpp b/src/relooper/Relooper.cpp index de69e0ef3520b..389d7447d963f 100644 --- a/src/relooper/Relooper.cpp +++ b/src/relooper/Relooper.cpp @@ -308,7 +308,7 @@ void MultipleShape::Render(bool InLoop) { } RenderLoopPostfix(); if (Next) Next->Render(InLoop); -}; +} // LoopShape @@ -323,7 +323,7 @@ void LoopShape::Render(bool InLoop) { Indenter::Unindent(); PrintIndented("}\n"); if (Next) Next->Render(InLoop); -}; +} // EmulatedShape @@ -350,7 +350,7 @@ void EmulatedShape::Render(bool InLoop) { Indenter::Unindent(); PrintIndented("}\n"); if (Next) Next->Render(InLoop); -}; +} // Relooper @@ -358,8 +358,8 @@ Relooper::Relooper() : Root(NULL), Emulate(false), BlockIdCounter(1), ShapeIdCou } Relooper::~Relooper() { - for (int i = 0; i < Blocks.size(); i++) delete Blocks[i]; - for (int i = 0; i < Shapes.size(); i++) delete Shapes[i]; + for (unsigned i = 0; i < Blocks.size(); i++) delete Blocks[i]; + for (unsigned i = 0; i < Shapes.size(); i++) delete Shapes[i]; } void Relooper::AddBlock(Block *New) { @@ -399,7 +399,7 @@ void Relooper::Calculate(Block *Entry) { // RAII cleanup. Without splitting, we will be forced to introduce labelled loops to allow // reaching the final block void SplitDeadEnds() { - int TotalCodeSize = 0; + unsigned TotalCodeSize = 0; for (BlockSet::iterator iter = Live.begin(); iter != Live.end(); iter++) { Block *Curr = *iter; TotalCodeSize += strlen(Curr->Code); @@ -451,7 +451,7 @@ void Relooper::Calculate(Block *Entry) { Pre.FindLive(Entry); // Add incoming branches from live blocks, ignoring dead code - for (int i = 0; i < Blocks.size(); i++) { + for (unsigned i = 0; i < Blocks.size(); i++) { Block *Curr = Blocks[i]; if (!contains(Pre.Live, Curr)) continue; for (BlockBranchMap::iterator iter = Curr->BranchesOut.begin(); iter != Curr->BranchesOut.end(); iter++) { diff --git a/src/relooper/test.txt b/src/relooper/test.txt index 540f7bdb1a9b1..9bdd40939c1ee 100644 --- a/src/relooper/test.txt +++ b/src/relooper/test.txt @@ -91,7 +91,7 @@ } default: { var $x_1 = $x_0; - label = -1; + label = 8; break L1; } } @@ -106,7 +106,7 @@ } } } - if (label == -1) { + if (label == 8) { // code 7 } // code 4 diff --git a/tools/shared.py b/tools/shared.py index 5b02fa4c75850..bd0626dc2fe23 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -337,7 +337,7 @@ def find_temp_directory(): # we re-check sanity when the settings are changed) # We also re-check sanity and clear the cache when the version changes -EMSCRIPTEN_VERSION = '1.8.2' +EMSCRIPTEN_VERSION = '1.8.3' def generate_sanity(): return EMSCRIPTEN_VERSION + '|' + get_llvm_target() + '|' + LLVM_ROOT