aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-10-08 17:15:37 -0400
committerAlon Zakai <alonzakai@gmail.com>2013-10-08 17:27:55 -0400
commitb5f705842e51df9ae25be76feaf1495de8e4252c (patch)
treea86cc2da6aaf3af55fce7c3ae0bef182dff4c94d /emcc
parent706907a119b8b74b04daadcd77a741b0bdc74b2c (diff)
automatically adjust asm heap size
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc10
1 files changed, 10 insertions, 0 deletions
diff --git a/emcc b/emcc
index ff81e424..cb489e5d 100755
--- a/emcc
+++ b/emcc
@@ -1105,6 +1105,16 @@ try:
shared.Settings.CORRECT_OVERFLOWS = 1
assert not shared.Settings.PGO, 'cannot run PGO in ASM_JS mode'
+ heap = 4096
+ while heap < shared.Settings.TOTAL_MEMORY:
+ if heap <= 16*1024*1024:
+ heap *= 2
+ else:
+ heap += 16*1024*1024
+ if heap != shared.Settings.TOTAL_MEMORY:
+ logging.warning('increasing TOTAL_MEMORY to %d to be more reasonable for asm.js' % heap)
+ shared.Settings.TOTAL_MEMORY = heap
+
if shared.Settings.CORRECT_SIGNS >= 2 or shared.Settings.CORRECT_OVERFLOWS >= 2 or shared.Settings.CORRECT_ROUNDINGS >= 2:
debug_level = 4 # must keep debug info to do line-by-line operations