summaryrefslogtreecommitdiff
path: root/scripts/spidermonkify.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-03-13 22:05:35 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-03-13 22:05:35 -0700
commit48a12f0cf134a15434432954c56c893ea1fc6eca (patch)
treeeceaab691e14a7a88f2d2c532a87d589f3dcff19 /scripts/spidermonkify.py
parenta1287af38f12b5ba3d2874424f67289fe1ea49e7 (diff)
parent8de76ffa8588a72788f3967806df43d4d4e43453 (diff)
downloadbinaryen-48a12f0cf134a15434432954c56c893ea1fc6eca.tar.gz
binaryen-48a12f0cf134a15434432954c56c893ea1fc6eca.tar.bz2
binaryen-48a12f0cf134a15434432954c56c893ea1fc6eca.zip
Merge pull request #244 from WebAssembly/interpret-binary
wasm-binary method
Diffstat (limited to 'scripts/spidermonkify.py')
-rw-r--r--scripts/spidermonkify.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/scripts/spidermonkify.py b/scripts/spidermonkify.py
index fb20e6dc7..1632c20fd 100644
--- a/scripts/spidermonkify.py
+++ b/scripts/spidermonkify.py
@@ -21,7 +21,6 @@ get rid of these ASAP.
This is meant to be run using BINARYEN_SCRIPTS in emcc, and not standalone.
'''
-import math
import os
import shutil
import subprocess
@@ -54,18 +53,12 @@ shutil.copyfile(wast_target + '.mappedGlobals', wasm_target + '.mappedGlobals')
# fix up wast
wast = open(wast_target).read()
-# memory to page sizes
-PAGE_SIZE = 64 * 1024
+# memory
memory_start = wast.find('(memory') + 1
memory_end = wast.find(')', memory_start)
-memory = wast[memory_start:memory_end]
-parts = memory.split(' ')
-parts[1] = str(int(math.ceil(float(parts[1]) / PAGE_SIZE)))
-if len(parts) == 3:
- parts[2] = str(int(math.ceil(float(parts[2]) / PAGE_SIZE)))
-wast = (wast[:memory_start] + ' '.join(parts) +
- wast[memory_end:memory_end + 1] +
- ' (export "memory" memory) ' + wast[memory_end + 1:])
+wast = (wast[:memory_end + 1] +
+ ' (export "memory" memory) ' +
+ wast[memory_end + 1:])
open(wast_target, 'w').write(wast)
# convert to binary using spidermonkey