suggest use of EMTERPRETIFY_FILE when emterpreter bitcode is large
This commit is contained in:
Родитель
0be444adb1
Коммит
5e68c85806
|
@ -5166,3 +5166,16 @@ main(int argc, char **argv)
|
|||
out, err = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_libcxx.cpp')], stderr=PIPE).communicate()
|
||||
assert err == '', err
|
||||
|
||||
def test_emterpreter_file_suggestion(self):
|
||||
for linkable in [0, 1]:
|
||||
for to_file in [0, 1]:
|
||||
self.clear()
|
||||
cmd = [PYTHON, EMCC, '-s', 'EMTERPRETIFY=1', path_from_root('tests', 'hello_libcxx.cpp'), '-s', 'LINKABLE=' + str(linkable), '-O1', '-s', 'USE_ZLIB=1']
|
||||
if to_file:
|
||||
cmd += ['-s', 'EMTERPRETIFY_FILE="code.dat"']
|
||||
print cmd
|
||||
stdout, stderr = Popen(cmd, stderr=PIPE).communicate()
|
||||
need_warning = linkable and not to_file
|
||||
assert ('''warning: emterpreter bytecode is fairly large''' in stderr) == need_warning, stderr
|
||||
assert ('''It is recommended to use -s EMTERPRETIFY_FILE=..''' in stderr) == need_warning, stderr
|
||||
|
||||
|
|
|
@ -1044,6 +1044,9 @@ __ATPRERUN__.push(function() {
|
|||
''' % (len(all_code), all_code[0], all_code[1], all_code[2], all_code[3], len(relocations), relocations[0])]
|
||||
|
||||
else:
|
||||
if len(all_code) > 1024*1024:
|
||||
shared.logging.warning('warning: emterpreter bytecode is fairly large, %.2f MB. It is recommended to use -s EMTERPRETIFY_FILE=.. so that it is saved as a binary file, instead of the default behavior which is to embed it as text (as text, it can cause very slow compile and startup times)' % (len(all_code) / (1024*1024.)))
|
||||
|
||||
CHUNK_SIZE = 10240
|
||||
|
||||
i = 0
|
||||
|
|
Загрузка…
Ссылка в новой задаче