Switch default backend from 'fastcomp' to 'upstream' (#373)
When users as for 'latest' or just '1.39.0' we now default to the upstream llvm backend. For versions before 1.39.0 we continue to default to fastcomp. Fixes: https://github.com/emscripten-core/emscripten/issues/5488
This commit is contained in:
40
emsdk.py
40
emsdk.py
@@ -1941,7 +1941,7 @@ def find_used_python():
|
|||||||
|
|
||||||
|
|
||||||
def version_key(ver):
|
def version_key(ver):
|
||||||
return list(map(int, re.split('[._-]', ver)))
|
return tuple(map(int, re.split('[._-]', ver)))
|
||||||
|
|
||||||
|
|
||||||
# A sort function that is compatible with both Python 2 and Python 3 using a
|
# A sort function that is compatible with both Python 2 and Python 3 using a
|
||||||
@@ -2710,14 +2710,29 @@ def main():
|
|||||||
|
|
||||||
releases_info = load_releases_info()['releases']
|
releases_info = load_releases_info()['releases']
|
||||||
|
|
||||||
|
def report_upstream_by_default():
|
||||||
|
print('''\
|
||||||
|
** NOTICE **: The default SDK changed from `fastcomp` to `upstream`.
|
||||||
|
If you have problems, or wish to revert back to fastcomp for some other reason
|
||||||
|
you can add `-fastcomp` to explicitly install that fastcomp-based
|
||||||
|
SDK, .e.g ./emsdk install latest-fastcomp.
|
||||||
|
''', file=sys.stderr)
|
||||||
|
|
||||||
# Replace meta-packages with the real package names.
|
# Replace meta-packages with the real package names.
|
||||||
if cmd in ('update', 'install', 'activate'):
|
if cmd in ('update', 'install', 'activate'):
|
||||||
for i in range(2, len(sys.argv)):
|
for i in range(2, len(sys.argv)):
|
||||||
arg = sys.argv[i]
|
arg = sys.argv[i]
|
||||||
if arg in ('latest', 'sdk-latest', 'latest-64bit', 'sdk-latest-64bit', 'latest-fastcomp', 'latest-releases-fastcomp'):
|
if arg in ('latest', 'sdk-latest', 'latest-64bit', 'sdk-latest-64bit'):
|
||||||
|
# This is effectly the default SDK
|
||||||
|
report_upstream_by_default()
|
||||||
|
sys.argv[i] = str(find_latest_releases_sdk('upstream'))
|
||||||
|
elif arg in ('latest-fastcomp', 'latest-releases-fastcomp'):
|
||||||
sys.argv[i] = str(find_latest_releases_sdk('fastcomp'))
|
sys.argv[i] = str(find_latest_releases_sdk('fastcomp'))
|
||||||
elif arg in ('latest-upstream', 'latest-clang-upstream', 'latest-releases-upstream'):
|
elif arg in ('latest-upstream', 'latest-clang-upstream', 'latest-releases-upstream'):
|
||||||
sys.argv[i] = str(find_latest_releases_sdk('upstream'))
|
sys.argv[i] = str(find_latest_releases_sdk('upstream'))
|
||||||
|
elif arg in ('tot', 'sdk-tot'):
|
||||||
|
report_upstream_by_default()
|
||||||
|
sys.argv[i] = str(find_tot_sdk('upstream'))
|
||||||
elif arg == 'tot-upstream':
|
elif arg == 'tot-upstream':
|
||||||
sys.argv[i] = str(find_tot_sdk('upstream'))
|
sys.argv[i] = str(find_tot_sdk('upstream'))
|
||||||
elif arg in ('tot-fastcomp', 'sdk-nightly-latest'):
|
elif arg in ('tot-fastcomp', 'sdk-nightly-latest'):
|
||||||
@@ -2728,17 +2743,23 @@ def main():
|
|||||||
# x.y.z[-(upstream|fastcomp_])
|
# x.y.z[-(upstream|fastcomp_])
|
||||||
# sdk-x.y.z[-(upstream|fastcomp_])-64bit
|
# sdk-x.y.z[-(upstream|fastcomp_])-64bit
|
||||||
# TODO: support short notation for old builds too?
|
# TODO: support short notation for old builds too?
|
||||||
upstream = False
|
backend = None
|
||||||
if '-upstream' in arg:
|
if '-upstream' in arg:
|
||||||
arg = arg.replace('-upstream', '')
|
arg = arg.replace('-upstream', '')
|
||||||
upstream = True
|
backend = 'upstream'
|
||||||
elif '-fastcomp' in arg:
|
elif '-fastcomp' in arg:
|
||||||
arg = arg.replace('-fastcomp', '')
|
arg = arg.replace('-fastcomp', '')
|
||||||
upstream = False
|
backend = 'fastcomp'
|
||||||
arg = arg.replace('sdk-', '').replace('-64bit', '').replace('tag-', '')
|
arg = arg.replace('sdk-', '').replace('-64bit', '').replace('tag-', '')
|
||||||
release_hash = releases_info.get(arg, None) or releases_info.get('sdk-' + arg + '-64bit')
|
release_hash = releases_info.get(arg, None) or releases_info.get('sdk-' + arg + '-64bit')
|
||||||
if release_hash:
|
if release_hash:
|
||||||
sys.argv[i] = 'sdk-releases-%s-%s-64bit' % ('upstream' if upstream else 'fastcomp', release_hash)
|
if backend is None:
|
||||||
|
if version_key(arg) >= (1, 39, 0):
|
||||||
|
report_upstream_by_default()
|
||||||
|
backend = 'upstream'
|
||||||
|
else:
|
||||||
|
backend = 'fastcomp'
|
||||||
|
sys.argv[i] = 'sdk-releases-%s-%s-64bit' % (backend, release_hash)
|
||||||
|
|
||||||
if cmd == 'list':
|
if cmd == 'list':
|
||||||
print('')
|
print('')
|
||||||
@@ -2747,12 +2768,12 @@ def main():
|
|||||||
print('The *recommended* precompiled SDK download is %s (%s).' % (find_latest_releases_version(), find_latest_releases_hash()))
|
print('The *recommended* precompiled SDK download is %s (%s).' % (find_latest_releases_version(), find_latest_releases_hash()))
|
||||||
print()
|
print()
|
||||||
print('To install/activate it, use one of:')
|
print('To install/activate it, use one of:')
|
||||||
print(' latest [default (fastcomp) backend]')
|
print(' latest [default (llvm) backend]')
|
||||||
print(' latest-upstream [upstream LLVM wasm backend]')
|
print(' latest-fastcomp [legacy (fastcomp) backend]')
|
||||||
print('')
|
print('')
|
||||||
print('Those are equivalent to installing/activating the following:')
|
print('Those are equivalent to installing/activating the following:')
|
||||||
print(' %s' % find_latest_releases_version())
|
print(' %s' % find_latest_releases_version())
|
||||||
print(' %s-upstream' % find_latest_releases_version())
|
print(' %s-fastcomp' % find_latest_releases_version())
|
||||||
print('')
|
print('')
|
||||||
else:
|
else:
|
||||||
print('Warning: your platform does not have precompiled SDKs available.')
|
print('Warning: your platform does not have precompiled SDKs available.')
|
||||||
@@ -2764,7 +2785,6 @@ def main():
|
|||||||
releases_versions.reverse()
|
releases_versions.reverse()
|
||||||
for ver in releases_versions:
|
for ver in releases_versions:
|
||||||
print(' %s' % ver)
|
print(' %s' % ver)
|
||||||
print(' %s-upstream' % ver)
|
|
||||||
print()
|
print()
|
||||||
|
|
||||||
# Use array to work around the lack of being able to mutate from enclosing
|
# Use array to work around the lack of being able to mutate from enclosing
|
||||||
|
|||||||
23
test.py
23
test.py
@@ -61,8 +61,8 @@ LIBC = os.path.expanduser('~/.emscripten_cache/wasm-obj/libc.a')
|
|||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
print('test .emscripten contents (latest was installed/activated in test.sh)')
|
print('test .emscripten contents (latest was installed/activated in test.sh)')
|
||||||
assert 'fastcomp' in open(os.path.expanduser('~/.emscripten')).read()
|
assert 'fastcomp' not in open(os.path.expanduser('~/.emscripten')).read()
|
||||||
assert 'upstream' not in open(os.path.expanduser('~/.emscripten')).read()
|
assert 'upstream' in open(os.path.expanduser('~/.emscripten')).read()
|
||||||
|
|
||||||
print('building proper system libraries')
|
print('building proper system libraries')
|
||||||
|
|
||||||
@@ -114,23 +114,22 @@ if WINDOWS:
|
|||||||
else:
|
else:
|
||||||
emsdk = './emsdk'
|
emsdk = './emsdk'
|
||||||
|
|
||||||
test_lib_building(fastcomp_emcc, use_asmjs_optimizer=True)
|
test_lib_building(upstream_emcc, use_asmjs_optimizer=True)
|
||||||
|
|
||||||
print('update')
|
print('update')
|
||||||
run_emsdk('update-tags')
|
run_emsdk('update-tags')
|
||||||
|
|
||||||
print('test latest-releases-upstream')
|
print('test latest-releases-fastcomp')
|
||||||
run_emsdk('install latest-upstream')
|
run_emsdk('install latest-fastcomp')
|
||||||
run_emsdk('activate latest-upstream')
|
run_emsdk('activate latest-fastcomp')
|
||||||
|
|
||||||
test_lib_building(upstream_emcc, use_asmjs_optimizer=False)
|
test_lib_building(fastcomp_emcc, use_asmjs_optimizer=False)
|
||||||
assert open(os.path.expanduser('~/.emscripten')).read().count('LLVM_ROOT') == 1
|
assert open(os.path.expanduser('~/.emscripten')).read().count('LLVM_ROOT') == 1
|
||||||
assert 'upstream' in open(os.path.expanduser('~/.emscripten')).read()
|
assert 'upstream' not in open(os.path.expanduser('~/.emscripten')).read()
|
||||||
assert 'fastcomp' not in open(os.path.expanduser('~/.emscripten')).read()
|
assert 'fastcomp' in open(os.path.expanduser('~/.emscripten')).read()
|
||||||
|
|
||||||
|
|
||||||
print('verify version')
|
print('verify version')
|
||||||
checked_call_with_output(upstream_emcc + ' -v', TAGS['latest'], stderr=subprocess.STDOUT)
|
checked_call_with_output(fastcomp_emcc + ' -v', TAGS['latest'], stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
print('clear cache')
|
print('clear cache')
|
||||||
check_call(upstream_emcc + ' --clear-cache')
|
check_call(upstream_emcc + ' --clear-cache')
|
||||||
@@ -160,8 +159,8 @@ run_emsdk('install 1.38.33')
|
|||||||
print('another install must re-download')
|
print('another install must re-download')
|
||||||
checked_call_with_output(emsdk + ' install 1.38.33', expected='Downloading:', unexpected='already exist in destination')
|
checked_call_with_output(emsdk + ' install 1.38.33', expected='Downloading:', unexpected='already exist in destination')
|
||||||
run_emsdk('activate 1.38.33')
|
run_emsdk('activate 1.38.33')
|
||||||
assert 'fastcomp' in open(os.path.expanduser('~/.emscripten')).read()
|
|
||||||
assert 'upstream' not in open(os.path.expanduser('~/.emscripten')).read()
|
assert 'upstream' not in open(os.path.expanduser('~/.emscripten')).read()
|
||||||
|
assert 'fastcomp' in open(os.path.expanduser('~/.emscripten')).read()
|
||||||
|
|
||||||
print('test specific release (new, full name)')
|
print('test specific release (new, full name)')
|
||||||
run_emsdk('install sdk-1.38.33-upstream-64bit')
|
run_emsdk('install sdk-1.38.33-upstream-64bit')
|
||||||
|
|||||||
Reference in New Issue
Block a user