1
1
mirror of https://github.com/tweag/asterius.git synced 2024-09-21 05:48:04 +03:00

Add script/doc about using experimental nodejs build (#92)

This commit is contained in:
Shao Cheng 2019-03-17 14:24:24 +08:00 committed by GitHub
parent f926cc60d9
commit 7365572dd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 12 deletions

18
docs/wasm-experimental.md Normal file
View File

@ -0,0 +1,18 @@
# Using experimental WebAssembly features
Currently, asterius only emits code that uses WebAssembly MVP features. At this moment, multiple WebAssembly feature proposals are actively being discussed and developed, and we are keeping an eye on them.
The V8 team maintains a Node.js build which integrates V8 trunk, described [here](https://v8.dev/docs/node-next-generation). It's possible to use that build to evaluate experimental WebAssembly features; we provide `utils/v8-node.py` which unzips the latest test-passing build to the current directory.
Here is a list of V8 tracking issues of the features we are interested in. Some are already available in recent Node.js or Chromium releases.
* [WebAssembly SIMD](https://bugs.chromium.org/p/v8/issues/detail?id=6020)
* [WebAssembly Multi-value](https://bugs.chromium.org/p/v8/issues/detail?id=6672)
* [WebAssembly nontrapping float-to-int conversions](https://bugs.chromium.org/p/v8/issues/detail?id=7226)
* [Tail call opcodes](https://bugs.chromium.org/p/v8/issues/detail?id=7431)
* [Reference types](https://bugs.chromium.org/p/v8/issues/detail?id=7581)
* [WebAssembly i64 BigInt integration](https://bugs.chromium.org/p/v8/issues/detail?id=7741)
* [WebAssembly JS Reflection API](https://bugs.chromium.org/p/v8/issues/detail?id=7742)
* [WebAssembly Bulk Memory](https://bugs.chromium.org/p/v8/issues/detail?id=7747)
* [Exception handling support](https://bugs.chromium.org/p/v8/issues/detail?id=8091)
* [Garbage Collection](https://bugs.chromium.org/p/v8/issues/detail?id=8217)

View File

@ -14,6 +14,7 @@ pages:
- 'Writing WebAssembly code in Haskell': 'wasm-in-hs.md'
- 'WebAssembly as a Haskell compilation target': 'webassembly.md'
- 'About the custom GHC fork': 'custom-ghc.md'
- 'Using experimental WebAssembly features': 'wasm-experimental.md'
- 'Reading list': 'readings.md'
- 'Status reports': 'reports.md'
theme: readthedocs

0
utils/clean.sh Normal file → Executable file
View File

42
utils/v8-node.py Normal file → Executable file
View File

@ -1,24 +1,32 @@
#!/usr/bin/env python3
from io import BytesIO
from os import getcwd
from html.parser import HTMLParser
from urllib.request import urlopen
from zipfile import ZipFile
def get(url):
r = urlopen(url)
return r.read().decode(r.info().get_content_charset())
def get_bytes(url):
return urlopen(url).read()
def get_str(url):
return get_bytes(url).decode()
class P0(HTMLParser):
def __init__(self):
super().__init__()
self.__gate = False
self.gate = False
self.success_builds = []
def handle_starttag(self, tag, attrs):
if attrs == [("class", "status-Success")]:
self.__gate = True
elif self.__gate and tag == "a":
self.gate = True
elif self.gate and tag == "a":
self.success_builds.append("https://ci.chromium.org" + attrs[0][1])
self.__gate = False
self.gate = False
class P1(HTMLParser):
@ -27,13 +35,23 @@ class P1(HTMLParser):
self.download_link = None
def handle_starttag(self, tag, attrs):
if len(attrs) >= 3 and attrs[2][1][-4:] == ".zip":
if len(attrs) >= 3 and attrs[2][1].startswith("https://storage.googleapis.com/") and attrs[2][1].endswith(
".zip"):
self.download_link = attrs[2][1]
if __name__ == "__main__":
def get_node_zip_url():
p0 = P0()
p0.feed(get("https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Linux64%20-%20node.js%20integration%20ng"))
p0.feed(get_str("https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Linux64%20-%20node.js%20integration%20ng"))
p1 = P1()
p1.feed(get(p0.success_builds[0]))
print(p1.download_link, end="")
p1.feed(get_str(p0.success_builds[0]))
return p1.download_link
def extract_node_zip(node_zip_bytes, path):
with ZipFile(BytesIO(node_zip_bytes)) as z:
z.extractall(path)
if __name__ == "__main__":
extract_node_zip(get_bytes(get_node_zip_url()), getcwd())