diff options
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | src/compiler.js | 31 | ||||
-rw-r--r-- | src/jsifier.js | 2 | ||||
-rw-r--r-- | src/library.js | 3 | ||||
-rw-r--r-- | src/settings.js | 2 | ||||
-rw-r--r-- | system/lib/dlmalloc.c | 1 | ||||
-rwxr-xr-x | tests/runner.py | 6 | ||||
-rw-r--r-- | tools/js-optimizer.js | 39 | ||||
-rw-r--r-- | tools/shared.py | 15 |
9 files changed, 69 insertions, 32 deletions
@@ -26,7 +26,7 @@ a license to everyone to use it as detailed in LICENSE.) * Jon Bardin <diclophis@gmail.com> * Jukka Jylänki <jujjyl@gmail.com> * Aleksander Guryanov <caiiiycuk@gmail.com> -* Chad Austin <chad@chadaustin.me> +* Chad Austin <chad@chadaustin.me> (copyright owned by IMVU) * nandhp <nandhp@gmail.com> * YeZhongWen <linghuye2.0@gmail.com> * Xingxing Pan <forandom@gmail.com> diff --git a/src/compiler.js b/src/compiler.js index 89da32d5..2863afda 100644 --- a/src/compiler.js +++ b/src/compiler.js @@ -31,15 +31,30 @@ if (ENVIRONMENT_IS_NODE) { var nodeFS = require('fs'); var nodePath = require('path'); - read = function(filename) { - filename = nodePath['normalize'](filename); - var ret = nodeFS['readFileSync'](filename).toString(); - // The path is absolute if the normalized version is the same as the resolved. - if (!ret && filename != nodePath['resolve'](filename)) { - filename = path.join(__dirname, '..', 'src', filename); - ret = nodeFS['readFileSync'](filename).toString(); + if (!nodeFS.existsSync) { + nodeFS.existsSync = function(path) { + try { + return !!nodeFS.readFileSync(path); + } catch(e) { + return false; + } + } + } + + function find(filename) { + var prefixes = [__dirname, process.cwd()]; + for (var i = 0; i < prefixes.length; ++i) { + var combined = nodePath.join(prefixes[i], filename); + if (nodeFS.existsSync(combined)) { + return combined; + } } - return ret; + return filename; + } + + read = function(filename) { + var absolute = find(filename); + return nodeFS['readFileSync'](absolute).toString(); }; load = function(f) { diff --git a/src/jsifier.js b/src/jsifier.js index 01ecd7d3..92b39b7d 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -32,7 +32,7 @@ function JSify(data, functionsOnly, givenFunctions) { // else. This lets us not hold any strings in memory, we simply print // things out as they are ready. - var shellFile = BUILD_AS_SHARED_LIB ? 'shell_sharedlib.js' : 'shell.js'; + var shellFile = SHELL_FILE ? SHELL_FILE : (BUILD_AS_SHARED_LIB ? 'shell_sharedlib.js' : 'shell.js'); var shellParts = read(shellFile).split('{{BODY}}'); print(shellParts[0]); var preFile = BUILD_AS_SHARED_LIB ? 'preamble_sharedlib.js' : 'preamble.js'; diff --git a/src/library.js b/src/library.js index 1c150bc9..3531db97 100644 --- a/src/library.js +++ b/src/library.js @@ -4850,6 +4850,7 @@ LibraryManager.library = { // RTTI hacks for exception handling, defining type_infos for common types. // The values are dummies. We simply use the addresses of these statically // allocated variables as unique identifiers. + _ZTIb: [0], // bool _ZTIi: [0], // int _ZTIj: [0], // unsigned int _ZTIl: [0], // long @@ -4863,7 +4864,7 @@ LibraryManager.library = { _ZTIa: [0], // signed char _ZTIh: [0], // unsigned char _ZTIs: [0], // short - _ZTIt: [0], // signed short + _ZTIt: [0], // unsigned short _ZTIv: [0], // void _ZTIPv: [0], // void* diff --git a/src/settings.js b/src/settings.js index 76dc25a1..f8a81711 100644 --- a/src/settings.js +++ b/src/settings.js @@ -198,6 +198,8 @@ var INCLUDE_FULL_LIBRARY = 0; // Whether to include the whole library rather tha // dynamically loading modules that make use of runtime // library functions that are not used in the main module. +var SHELL_FILE = 0; // set this to a string to override the shell file used + var SHOW_LABELS = 0; // Show labels in the generated code var BUILD_AS_SHARED_LIB = 0; // Whether to build the code as a shared library, which diff --git a/system/lib/dlmalloc.c b/system/lib/dlmalloc.c index 6185b1c7..9ee3709e 100644 --- a/system/lib/dlmalloc.c +++ b/system/lib/dlmalloc.c @@ -4141,6 +4141,7 @@ static int sys_trim(mstate m, size_t pad) { sp->size >= extra && !has_segment_link(m, sp)) { /* can't shrink if pinned */ size_t newsize = sp->size - extra; + (void)newsize; // XXX EMSCRIPTEN /* Prefer mremap, fall back to munmap */ if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) || (CALL_MUNMAP(sp->base + newsize, extra) == 0)) { diff --git a/tests/runner.py b/tests/runner.py index 8d1f0674..a3779668 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -7707,6 +7707,10 @@ fscanfed: 10 - hello elif 'browser' in str(sys.argv): # Browser tests. + print + print 'Running the browser tests. Make sure the browser allows popups from localhost.' + print + # Run a server and a web page. When a test runs, we tell the server about it, # which tells the web page, which then opens a window with the test. Doing # it this way then allows the page to close() itself when done. @@ -8876,7 +8880,7 @@ elif 'sanity' in str(sys.argv): restore() # Clang should report the version number we expect, and emcc should not warn - assert ('clang version ' + '.'.join(map(str, EXPECTED_LLVM_VERSION))) in Popen([CLANG, '-v'], stderr=PIPE).communicate()[1] + assert check_clang_version() output = self.check_working(EMCC) assert LLVM_WARNING not in output, output diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index e1cfbe65..5dac36f0 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -26,15 +26,30 @@ if (ENVIRONMENT_IS_NODE) { var nodeFS = require('fs'); var nodePath = require('path'); - read = function(filename) { - filename = nodePath['normalize'](filename); - var ret = nodeFS['readFileSync'](filename).toString(); - // The path is absolute if the normalized version is the same as the resolved. - if (!ret && filename != nodePath['resolve'](filename)) { - filename = path.join(__dirname, '..', 'src', filename); - ret = nodeFS['readFileSync'](filename).toString(); + if (!nodeFS.existsSync) { + nodeFS.existsSync = function(path) { + try { + return !!nodeFS.readFileSync(path); + } catch(e) { + return false; + } + } + } + + function find(filename) { + var prefixes = [nodePath.join(__dirname, '..', 'src'), process.cwd()]; + for (var i = 0; i < prefixes.length; ++i) { + var combined = nodePath.join(prefixes[i], filename); + if (nodeFS.existsSync(combined)) { + return combined; + } } - return ret; + return filename; + } + + read = function(filename) { + var absolute = find(filename); + return nodeFS['readFileSync'](absolute).toString(); }; load = function(f) { @@ -98,14 +113,6 @@ if (typeof print === 'undefined') { } // *** Environment setup code *** -// Fix read for our location -read = function(filename) { - // The path is absolute if the normalized version is the same as the resolved. - filename = path.normalize(filename); - if (filename != path.resolve(filename)) filename = path.join(__dirname, '..', 'src', filename); - return fs.readFileSync(filename).toString(); -} - var uglify = require('../tools/eliminator/node_modules/uglify-js'); var fs = require('fs'); var path = require('path'); diff --git a/tools/shared.py b/tools/shared.py index 700849e8..2fc894d0 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -47,12 +47,19 @@ except Exception, e: EXPECTED_LLVM_VERSION = (3,1) +def check_clang_version(): + expected = 'clang version ' + '.'.join(map(str, EXPECTED_LLVM_VERSION)) + actual = Popen([CLANG, '-v'], stderr=PIPE).communicate()[1].split('\n')[0] + if expected in actual: + return True + + print >> sys.stderr, 'warning: LLVM version appears incorrect (seeing "%s", expected "%s")' % (actual, expected) + return False + + def check_llvm_version(): try: - expected = 'clang version ' + '.'.join(map(str, EXPECTED_LLVM_VERSION)) - actual = Popen([CLANG, '-v'], stderr=PIPE).communicate()[1].split('\n')[0][0:len(expected)] - if expected != actual: - print >> sys.stderr, 'warning: LLVM version appears incorrect (seeing "%s", expected "%s")' % (actual, expected) + check_clang_version(); except Exception, e: print >> sys.stderr, 'warning: Could not verify LLVM version: %s' % str(e) |