diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-02-24 12:36:55 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-02-24 12:36:55 -0800 |
commit | ae764ac73f78fe23813cc1f07bc7b3d7fed65e8b (patch) | |
tree | 29858c553799e4893c9e59374f3b58468c6c4f83 | |
parent | fb9deefc5ac7caaa1b5d2c680a86d9b35238e004 (diff) |
deprecate jcache
-rwxr-xr-x | emcc | 56 | ||||
-rw-r--r-- | tests/test_sanity.py | 84 |
2 files changed, 2 insertions, 138 deletions
@@ -425,59 +425,6 @@ Options that are modified or new in %s include: -v to Clang, and also enable EMCC_DEBUG to details emcc's operations - --jcache Use a JavaScript cache. This is disabled by - default. When enabled, emcc will store the - results of compilation in a cache and check - the cache when compiling later, something - like what ccache does. This allows incremental - builds - where you are compiling a large - program but only modified a small part of it - - to be much faster (at the cost of more disk - IO for cache accesses). Note that you need - to enable --jcache for both loading and saving - of data, so you must enable it on a full build - for a later incremental build (where you also - enable it) to be sped up. - - Caching works separately on 4 parts of compilation: - 'pre' which is types and global variables; that - information is then fed into 'funcs' which are - the functions (which we parallelize), and then - 'post' which adds final information based on - the functions (e.g., do we need long64 support - code). Finally, 'jsfuncs' are JavaScript-level - optimizations. Each of the 4 parts can be cached - separately, but note that they can affect each - other: If you recompile a single C++ file that - changes a global variable - e.g., adds, removes - or modifies a global variable, say by adding - a printf or by adding a compile-time timestamp, - then 'pre' cannot be loaded from the cache. And - since 'pre's output is sent to 'funcs' and 'post', - they will get invalidated as well, and only - 'jsfuncs' will be cached. So avoid modifying - globals to let caching work fully. - - To work around the problem mentioned in the - previous paragraph, you can use - - emscripten_jcache_printf - - when adding debug printfs to your code. That - function is specially preprocessed so that it - does not create a constant string global for - its first argument. See emscripten.h for more - details. Note in particular that you need to - already have a call to that function in your - code *before* you add one and do an incremental - build, so that adding an external reference - (also a global property) does not invalidate - everything. - - Note that you should use -g during the linking - stage (bitcode to JS), for jcache to work - (otherwise, JS minification can confuse it). - --clear-cache Manually clears the cache of compiled emscripten system libraries (libc++, libc++abi, libc). This is normally @@ -986,6 +933,7 @@ try: logging.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': + logging.warning('jcache is deprecated') jcache = True newargs[i] = '' elif newargs[i] == '--clear-cache': @@ -1226,7 +1174,7 @@ try: raise e if jcache: - logging.warning('jcache is not supported in fastcomp (you should not need it anyhow), disabling') + logging.warning('jcache is deprecated and not supported in fastcomp (you should not need it anyhow), disabling') jcache = False fastcomp_opts = ['-pnacl-abi-simplify-preopt', '-pnacl-abi-simplify-postopt'] diff --git a/tests/test_sanity.py b/tests/test_sanity.py index 54a0e99d..5713c99c 100644 --- a/tests/test_sanity.py +++ b/tests/test_sanity.py @@ -482,90 +482,6 @@ fi finally: del os.environ['EMCC_FAST_COMPILER'] - def test_jcache(self): - PRE_LOAD_MSG = 'loading pre from jcache' - PRE_SAVE_MSG = 'saving pre to jcache' - FUNC_CHUNKS_LOAD_MSG = ' funcchunks from jcache' - FUNC_CHUNKS_SAVE_MSG = ' funcchunks to jcache' - JSFUNC_CHUNKS_LOAD_MSG = 'jsfuncchunks from jcache' - JSFUNC_CHUNKS_SAVE_MSG = 'jsfuncchunks to jcache' - - restore() - Cache.erase() - - try: - os.environ['EMCC_DEBUG'] = '1' - os.environ['EMCC_JSOPT_MIN_CHUNK_SIZE'] = str(1024*512) - - self.working_dir = os.path.join(TEMP_DIR, 'emscripten_temp') - if not os.path.exists(self.working_dir): os.makedirs(self.working_dir) - - assert not os.path.exists(JCache.get_cachename('emscript_files')) - - srcs = {} - used_jcache = False - - for args, input_file, expect_pre_save, expect_pre_load, expect_funcs_save, expect_funcs_load, expect_jsfuncs_save, expect_jsfuncs_load, expected in [ - ([], 'hello_world_loop.cpp', False, False, False, False, False, False, []), - (['--jcache'], 'hello_world_loop.cpp', True, False, True, False, True, False, []), - (['--jcache'], 'hello_world_loop.cpp', False, True, False, True, False, True, []), - ([], 'hello_world_loop.cpp', False, False, False, False, False, False, []), - # new - ([], 'hello_world.cpp', False, False, False, False, False, False, []), - (['--jcache'], 'hello_world.cpp', True, False, True, False, True, False, []), - (['--jcache'], 'hello_world.cpp', False, True, False, True, False, True, []), - ([], 'hello_world.cpp', False, False, False, False, False, False, []), - # go back to old file, experience caching - (['--jcache'], 'hello_world_loop.cpp', False, True, False, True, False, True, []), - # new, large file - ([], 'hello_malloc.cpp', False, False, False, False, False, False, []), - (['--jcache'], 'hello_malloc.cpp', True, False, True, False, True, False, []), - (['--jcache'], 'hello_malloc.cpp', False, True, False, True, False, True, []), - ([], 'hello_malloc.cpp', False, False, False, False, False, False, []), - # new, huge file - ([], 'hello_libcxx.cpp', False, False, False, False, False, False, ('4 chunks',)), - (['--jcache'], 'hello_libcxx.cpp', True, False, True, False, True, False, []), - (['--jcache'], 'hello_libcxx.cpp', False, True, False, True, False, True, []), - ([], 'hello_libcxx.cpp', False, False, False, False, False, False, []), - # finally, build a file close to the previous, to see that some chunks are found in the cache and some not - (['--jcache'], 'hello_libcxx_mod1.cpp', False, True, True, True, True, True, []), # win on pre, mix on funcs, mix on jsfuncs - (['--jcache'], 'hello_libcxx_mod1.cpp', False, True, False, True, False, True, []), - (None, None, None, None, None, None, None, None, None), # clear - (['--jcache'], 'hello_libcxx_mod2.cpp', True, False, True, False, True, False, []), # load into cache - (['--jcache'], 'hello_libcxx_mod2a.cpp', False, True, True, True, True, True, []) # add a printf, do not lose everything - ]: - self.clear() - if args is None: - Cache.erase() - continue - - print >> sys.stderr, args, input_file, expect_pre_save, expect_pre_load, expect_funcs_save, expect_funcs_load, expect_jsfuncs_save, expect_jsfuncs_load, expected - - out, err = Popen([PYTHON, EMCC, '-O2', '-g', path_from_root('tests', input_file)] + args, stdout=PIPE, stderr=PIPE).communicate() - errtail = err.split('emcc invocation')[-1] - self.assertContained('hello, world!', run_js('a.out.js'), errtail) - assert (PRE_SAVE_MSG in err) == expect_pre_save, errtail - assert (PRE_LOAD_MSG in err) == expect_pre_load, errtail - assert (FUNC_CHUNKS_SAVE_MSG in err) == expect_funcs_save, errtail - assert (FUNC_CHUNKS_LOAD_MSG in err) == expect_funcs_load, errtail - assert (JSFUNC_CHUNKS_SAVE_MSG in err) == expect_jsfuncs_save, errtail - assert (JSFUNC_CHUNKS_LOAD_MSG in err) == expect_jsfuncs_load, errtail - for expect in expected: assert expect in err, expect + ' ? ' + errtail - curr = open('a.out.js').read() - if input_file not in srcs: - srcs[input_file] = curr - else: - #open('/home/alon/Dev/emscripten/a', 'w').write(srcs[input_file]) - #open('/home/alon/Dev/emscripten/b', 'w').write(curr) - assert abs(len(curr)/float(len(srcs[input_file]))-1)<0.01, 'contents may shift in order, but must remain the same size %d vs %d' % (len(curr), len(srcs[input_file])) + '\n' + errtail - used_jcache = used_jcache or ('--jcache' in args) - assert used_jcache == os.path.exists(JCache.get_cachename('emscript_files')) - #print >> sys.stderr, errtail - - finally: - del os.environ['EMCC_DEBUG'] - del os.environ['EMCC_JSOPT_MIN_CHUNK_SIZE'] - def test_nostdincxx(self): restore() Cache.erase() |