fixes and struct pits
This commit is contained in:
parent
495dddb932
commit
62f517ff48
344
Cargo.lock
generated
344
Cargo.lock
generated
|
@ -55,9 +55,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstream"
|
name = "anstream"
|
||||||
version = "0.6.14"
|
version = "0.6.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
|
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"anstyle-parse",
|
"anstyle-parse",
|
||||||
|
@ -70,33 +70,33 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle"
|
name = "anstyle"
|
||||||
version = "1.0.7"
|
version = "1.0.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
|
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-parse"
|
name = "anstyle-parse"
|
||||||
version = "0.2.4"
|
version = "0.2.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
|
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"utf8parse",
|
"utf8parse",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-query"
|
name = "anstyle-query"
|
||||||
version = "1.1.0"
|
version = "1.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391"
|
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle-wincon"
|
name = "anstyle-wincon"
|
||||||
version = "3.0.3"
|
version = "3.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
|
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"windows-sys",
|
"windows-sys",
|
||||||
|
@ -154,9 +154,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "2.5.0"
|
version = "2.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
|
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "blake2"
|
name = "blake2"
|
||||||
|
@ -190,18 +190,18 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "castaway"
|
name = "castaway"
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc"
|
checksum = "0abae9be0aaf9ea96a3b1b8b1b55c602ca751eba1b1500220cea4ecbafe7c0d5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustversion",
|
"rustversion",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.98"
|
version = "1.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f"
|
checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
|
@ -226,9 +226,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "colorchoice"
|
name = "colorchoice"
|
||||||
version = "1.0.1"
|
version = "1.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
|
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "convert_case"
|
name = "convert_case"
|
||||||
|
@ -245,6 +245,15 @@ dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cpufeatures"
|
||||||
|
version = "0.2.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cranelift-bforest"
|
name = "cranelift-bforest"
|
||||||
version = "0.104.3"
|
version = "0.104.3"
|
||||||
|
@ -400,15 +409,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derive_more"
|
name = "derive_more"
|
||||||
version = "0.99.17"
|
version = "0.99.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
|
checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"convert_case",
|
"convert_case",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
"syn 1.0.109",
|
"syn 2.0.72",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -424,9 +433,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
version = "1.12.0"
|
version = "1.13.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b"
|
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "encoding_rs"
|
name = "encoding_rs"
|
||||||
|
@ -439,9 +448,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "env_filter"
|
name = "env_filter"
|
||||||
version = "0.1.0"
|
version = "0.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea"
|
checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"regex",
|
"regex",
|
||||||
|
@ -449,9 +458,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "env_logger"
|
name = "env_logger"
|
||||||
version = "0.11.3"
|
version = "0.11.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9"
|
checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
|
@ -478,16 +487,17 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "expander"
|
name = "expander"
|
||||||
version = "2.1.0"
|
version = "2.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "00e83c02035136f1592a47964ea60c05a50e4ed8b5892cfac197063850898d4d"
|
checksum = "e2c470c71d91ecbd179935b24170459e926382eaaa86b590b78814e180d8a8e2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"blake2",
|
"blake2",
|
||||||
|
"file-guard",
|
||||||
"fs-err",
|
"fs-err",
|
||||||
"prettier-please",
|
"prettyplease",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.66",
|
"syn 2.0.72",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -496,6 +506,16 @@ version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
|
checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "file-guard"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "21ef72acf95ec3d7dbf61275be556299490a245f017cf084bd23b4f68cf9407c"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fixedbitset"
|
name = "fixedbitset"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -593,6 +613,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -619,12 +640,33 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hex"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "humantime"
|
name = "humantime"
|
||||||
version = "2.1.0"
|
version = "2.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ic-stable-structures"
|
||||||
|
version = "0.6.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "03f3044466a69802de74e710dc0300b706a05696a0531c942ca856751a13b0db"
|
||||||
|
dependencies = [
|
||||||
|
"ic_principal",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ic_principal"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1762deb6f7c8d8c2bdee4b6c5a47b60195b74e9b5280faa5ba29692f8e17429c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "id-arena"
|
name = "id-arena"
|
||||||
version = "2.2.1"
|
version = "2.2.1"
|
||||||
|
@ -654,9 +696,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is_terminal_polyfill"
|
name = "is_terminal_polyfill"
|
||||||
version = "1.70.0"
|
version = "1.70.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
|
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "isovariant"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itertools"
|
name = "itertools"
|
||||||
|
@ -674,10 +720,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "keccak"
|
||||||
version = "1.4.0"
|
version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654"
|
||||||
|
dependencies = [
|
||||||
|
"cpufeatures",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lazy_static"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leb128"
|
name = "leb128"
|
||||||
|
@ -699,9 +754,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.21"
|
version = "0.4.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "logos"
|
name = "logos"
|
||||||
|
@ -723,7 +778,7 @@ dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"regex-syntax 0.6.29",
|
"regex-syntax 0.6.29",
|
||||||
"syn 2.0.66",
|
"syn 2.0.72",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -752,9 +807,9 @@ checksum = "204651f31b0a6a7b2128d2b92c372cd94607b210c3a6b6e542c57a8cfd4db996"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.7.2"
|
version = "2.7.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
|
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memfd"
|
name = "memfd"
|
||||||
|
@ -785,9 +840,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
version = "0.7.3"
|
version = "0.7.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae"
|
checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"adler",
|
"adler",
|
||||||
]
|
]
|
||||||
|
@ -831,7 +886,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "portal-pc-waffle"
|
name = "portal-pc-waffle"
|
||||||
version = "0.0.27+portal"
|
version = "0.0.27+portal"
|
||||||
source = "git+https://github.com/portal-co/waffle-.git?branch=pr/changes2#3f9e7a560f40c29c1de6389f1f6371cde261adb7"
|
source = "git+https://github.com/portal-co/waffle-.git?branch=pr/changes2#8db8a0234782a612db040282dda2ee177ff36f28"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"addr2line",
|
"addr2line",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
@ -841,22 +896,24 @@ dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
|
"paste",
|
||||||
"rayon",
|
"rayon",
|
||||||
|
"serde",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"stacker",
|
"stacker",
|
||||||
"structopt",
|
"structopt",
|
||||||
"wasm-encoder 0.202.0",
|
"wasm-encoder 0.212.0",
|
||||||
"wasmparser 0.202.0",
|
"wasmparser 0.212.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prettier-please"
|
name = "prettyplease"
|
||||||
version = "0.2.0"
|
version = "0.2.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "22020dfcf177fcc7bf5deaf7440af371400c67c0de14c399938d8ed4fb4645d3"
|
checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"syn 2.0.66",
|
"syn 2.0.72",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -885,9 +942,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.85"
|
version = "1.0.86"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
|
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
@ -969,7 +1026,7 @@ checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.66",
|
"syn 2.0.72",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -987,25 +1044,25 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.10.4"
|
version = "1.10.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
|
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
"regex-automata",
|
"regex-automata",
|
||||||
"regex-syntax 0.8.3",
|
"regex-syntax 0.8.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-automata"
|
name = "regex-automata"
|
||||||
version = "0.4.6"
|
version = "0.4.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
|
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr",
|
"memchr",
|
||||||
"regex-syntax 0.8.3",
|
"regex-syntax 0.8.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1016,9 +1073,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.8.3"
|
version = "0.8.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
|
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "relooper"
|
name = "relooper"
|
||||||
|
@ -1057,7 +1114,7 @@ version = "0.38.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
|
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.6.0",
|
||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys",
|
"linux-raw-sys",
|
||||||
|
@ -1095,35 +1152,46 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.203"
|
version = "1.0.204"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
|
checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.203"
|
version = "1.0.204"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
|
checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.66",
|
"syn 2.0.72",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.117"
|
version = "1.0.121"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
|
checksum = "4ab380d7d9f22ef3f21ad3e6c1ebe8e4fc7a2000ccba2e4d71fc96f15b2cb609"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
|
"memchr",
|
||||||
"ryu",
|
"ryu",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sha3"
|
||||||
|
version = "0.10.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60"
|
||||||
|
dependencies = [
|
||||||
|
"digest",
|
||||||
|
"keccak",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slice-group-by"
|
name = "slice-group-by"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
|
@ -1208,9 +1276,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "subtle"
|
name = "subtle"
|
||||||
version = "2.5.0"
|
version = "2.6.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
|
@ -1225,9 +1293,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.66"
|
version = "2.0.72"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
|
checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -1236,9 +1304,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "target-lexicon"
|
name = "target-lexicon"
|
||||||
version = "0.12.14"
|
version = "0.12.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
|
checksum = "4873307b7c257eddcb50c9bedf158eb669578359fb28428bef438fec8e6ba7c2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "textwrap"
|
name = "textwrap"
|
||||||
|
@ -1251,22 +1319,22 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror"
|
name = "thiserror"
|
||||||
version = "1.0.61"
|
version = "1.0.63"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
|
checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"thiserror-impl",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thiserror-impl"
|
name = "thiserror-impl"
|
||||||
version = "1.0.61"
|
version = "1.0.63"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
|
checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.66",
|
"syn 2.0.72",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1323,9 +1391,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "utf8parse"
|
name = "utf8parse"
|
||||||
version = "0.2.1"
|
version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vec_map"
|
name = "vec_map"
|
||||||
|
@ -1335,9 +1403,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.4"
|
version = "0.9.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "waffle-func-reloop"
|
name = "waffle-func-reloop"
|
||||||
|
@ -1351,13 +1419,15 @@ dependencies = [
|
||||||
name = "wars"
|
name = "wars"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.6.0",
|
||||||
|
"hex",
|
||||||
"portal-pc-waffle",
|
"portal-pc-waffle",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quasiquote",
|
"quasiquote",
|
||||||
"quote",
|
"quote",
|
||||||
"relooper",
|
"relooper",
|
||||||
"syn 2.0.66",
|
"sha3",
|
||||||
|
"syn 2.0.72",
|
||||||
"waffle-func-reloop",
|
"waffle-func-reloop",
|
||||||
"witx",
|
"witx",
|
||||||
]
|
]
|
||||||
|
@ -1370,7 +1440,7 @@ dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quasiquote",
|
"quasiquote",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.66",
|
"syn 2.0.72",
|
||||||
"wars",
|
"wars",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1381,7 +1451,7 @@ dependencies = [
|
||||||
"expander",
|
"expander",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.66",
|
"syn 2.0.72",
|
||||||
"wars",
|
"wars",
|
||||||
"wars-rt",
|
"wars-rt",
|
||||||
"wat",
|
"wat",
|
||||||
|
@ -1394,6 +1464,8 @@ dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"castaway",
|
"castaway",
|
||||||
"derive_more",
|
"derive_more",
|
||||||
|
"either",
|
||||||
|
"ic-stable-structures",
|
||||||
"paste",
|
"paste",
|
||||||
"tramp",
|
"tramp",
|
||||||
"tuple_list",
|
"tuple_list",
|
||||||
|
@ -1405,6 +1477,21 @@ dependencies = [
|
||||||
name = "wars-test"
|
name = "wars-test"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-compile-layer"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"portal-pc-waffle",
|
||||||
|
"proc-macro2",
|
||||||
|
"quasiquote",
|
||||||
|
"quote",
|
||||||
|
"relooper",
|
||||||
|
"syn 2.0.72",
|
||||||
|
"waffle-func-reloop",
|
||||||
|
"wars",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-encoder"
|
name = "wasm-encoder"
|
||||||
version = "0.38.1"
|
version = "0.38.1"
|
||||||
|
@ -1425,18 +1512,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-encoder"
|
name = "wasm-encoder"
|
||||||
version = "0.202.0"
|
version = "0.212.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bfd106365a7f5f7aa3c1916a98cbb3ad477f5ff96ddb130285a91c6e7429e67a"
|
checksum = "501940df4418b8929eb6d52f1aade1fdd15a5b86c92453cb696e3c906bd3fc33"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"leb128",
|
"leb128",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-encoder"
|
name = "wasm-encoder"
|
||||||
version = "0.209.1"
|
version = "0.214.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7b4a05336882dae732ce6bd48b7e11fe597293cb72c13da4f35d7d5f8d53b2a7"
|
checksum = "ff694f02a8d7a50b6922b197ae03883fbf18cdb2ae9fbee7b6148456f5f44041"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"leb128",
|
"leb128",
|
||||||
]
|
]
|
||||||
|
@ -1498,20 +1585,23 @@ version = "0.121.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab"
|
checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.6.0",
|
||||||
"indexmap 2.2.6",
|
"indexmap 2.2.6",
|
||||||
"semver",
|
"semver",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasmparser"
|
name = "wasmparser"
|
||||||
version = "0.202.0"
|
version = "0.212.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d6998515d3cf3f8b980ef7c11b29a9b1017d4cf86b99ae93b546992df9931413"
|
checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"ahash",
|
||||||
|
"bitflags 2.6.0",
|
||||||
|
"hashbrown 0.14.5",
|
||||||
"indexmap 2.2.6",
|
"indexmap 2.2.6",
|
||||||
"semver",
|
"semver",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1574,7 +1664,7 @@ dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.66",
|
"syn 2.0.72",
|
||||||
"wasmtime-component-util",
|
"wasmtime-component-util",
|
||||||
"wasmtime-wit-bindgen",
|
"wasmtime-wit-bindgen",
|
||||||
"wit-parser",
|
"wit-parser",
|
||||||
|
@ -1732,7 +1822,7 @@ checksum = "e04682ce587aa8fa9311d3c95148381f08a1db274ad6bcd3553f7c97c8c2debb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.66",
|
"syn 2.0.72",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1781,24 +1871,24 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wast"
|
name = "wast"
|
||||||
version = "209.0.1"
|
version = "214.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8fffef2ff6147e4d12e972765fd75332c6a11c722571d4ab7a780d81ffc8f0a4"
|
checksum = "694bcdb24c49c8709bd8713768b71301a11e823923eee355d530f1d8d0a7f8e9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
"leb128",
|
"leb128",
|
||||||
"memchr",
|
"memchr",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"wasm-encoder 0.209.1",
|
"wasm-encoder 0.214.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wat"
|
name = "wat"
|
||||||
version = "1.209.1"
|
version = "1.214.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "42203ec0271d113f8eb1f77ebc624886530cecb35915a7f63a497131f16e4d24"
|
checksum = "347249eb56773fa728df2656cfe3a8c19437ded61a922a0b5e0839d9790e278e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"wast 209.0.1",
|
"wast 214.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1850,9 +1940,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-targets"
|
name = "windows-targets"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows_aarch64_gnullvm",
|
"windows_aarch64_gnullvm",
|
||||||
"windows_aarch64_msvc",
|
"windows_aarch64_msvc",
|
||||||
|
@ -1866,51 +1956,51 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_gnullvm"
|
name = "windows_aarch64_gnullvm"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_msvc"
|
name = "windows_aarch64_msvc"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnu"
|
name = "windows_i686_gnu"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnullvm"
|
name = "windows_i686_gnullvm"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_msvc"
|
name = "windows_i686_msvc"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnu"
|
name = "windows_x86_64_gnu"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnullvm"
|
name = "windows_x86_64_gnullvm"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_msvc"
|
name = "windows_x86_64_msvc"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wit-parser"
|
name = "wit-parser"
|
||||||
|
@ -1942,20 +2032,20 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy"
|
name = "zerocopy"
|
||||||
version = "0.7.34"
|
version = "0.7.35"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087"
|
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"zerocopy-derive",
|
"zerocopy-derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zerocopy-derive"
|
name = "zerocopy-derive"
|
||||||
version = "0.7.34"
|
version = "0.7.35"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
|
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.66",
|
"syn 2.0.72",
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
members=[ "waffle-func-reloop", "wars", "wars-component", "wars-macro","wars-rt", "wars-test"]
|
members=[ "waffle-func-reloop", "wars", "wars-component", "wars-macro","wars-rt", "wars-test","isovariant", "wasm-compile-layer"]
|
||||||
resolver="2"
|
resolver="2"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
|
|
8
isovariant/Cargo.toml
Normal file
8
isovariant/Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "isovariant"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
7
isovariant/src/lib.rs
Normal file
7
isovariant/src/lib.rs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
pub trait Iso<T: Into<Self>>: Into<T> {}
|
||||||
|
impl<T: Into<U>, U: Into<T>> Iso<U> for T {}
|
||||||
|
pub trait TryIso<T: TryInto<Self, Error: Iso<Self::Error>>>:
|
||||||
|
TryInto<T, Error: Iso<T::Error>>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
impl<T: TryInto<U, Error: Iso<U::Error>>, U: TryInto<T, Error: Iso<T::Error>>> TryIso<T> for U {}
|
|
@ -1,6 +1,2 @@
|
||||||
pub trait Component{
|
pub trait Component {}
|
||||||
|
impl Component for Opts<golem_wasm_ast::Component> {}
|
||||||
}
|
|
||||||
impl Component for Opts<golem_wasm_ast::Component>{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ struct O {
|
||||||
pub flags: Flags,
|
pub flags: Flags,
|
||||||
pub embed: proc_macro2::TokenStream,
|
pub embed: proc_macro2::TokenStream,
|
||||||
pub data: BTreeMap<Ident, proc_macro2::TokenStream>, // pub cfg: Arc<dyn ImportCfg>,
|
pub data: BTreeMap<Ident, proc_macro2::TokenStream>, // pub cfg: Arc<dyn ImportCfg>,
|
||||||
|
pub roots: BTreeMap<String, proc_macro2::TokenStream>,
|
||||||
}
|
}
|
||||||
// struct NoopCfg {}
|
// struct NoopCfg {}
|
||||||
// impl ImportCfg for NoopCfg {
|
// impl ImportCfg for NoopCfg {
|
||||||
|
@ -32,6 +33,7 @@ impl Parse for O {
|
||||||
flags: Default::default(),
|
flags: Default::default(),
|
||||||
embed: Default::default(),
|
embed: Default::default(),
|
||||||
data: BTreeMap::new(),
|
data: BTreeMap::new(),
|
||||||
|
roots: BTreeMap::new(),
|
||||||
// cfg: Arc::new(NoopCfg {}),
|
// cfg: Arc::new(NoopCfg {}),
|
||||||
};
|
};
|
||||||
while input.lookahead1().peek(Ident) {
|
while input.lookahead1().peek(Ident) {
|
||||||
|
@ -80,7 +82,20 @@ impl Parse for O {
|
||||||
o.flags &= Flags::LEGACY.complement();
|
o.flags &= Flags::LEGACY.complement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => return Err(syn::Error::new(i.span(), "unexpected type")),
|
_ => {
|
||||||
|
match i
|
||||||
|
.to_string()
|
||||||
|
.as_str()
|
||||||
|
.strip_suffix("_path")
|
||||||
|
.map(|a| a.to_owned())
|
||||||
|
{
|
||||||
|
None => return Err(syn::Error::new(i.span(), "unexpected type")),
|
||||||
|
Some(a) => {
|
||||||
|
let s: syn::LitStr = input.parse()?;
|
||||||
|
o.roots.insert(a, s.parse()?);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
let _comma: Token![,] = input.parse()?;
|
let _comma: Token![,] = input.parse()?;
|
||||||
}
|
}
|
||||||
|
@ -102,6 +117,7 @@ pub fn wars(a: TokenStream) -> TokenStream {
|
||||||
flags: o.flags,
|
flags: o.flags,
|
||||||
embed: o.embed,
|
embed: o.embed,
|
||||||
data: o.data,
|
data: o.data,
|
||||||
|
roots: o.roots,
|
||||||
// cfg: o.cfg,
|
// cfg: o.cfg,
|
||||||
}
|
}
|
||||||
.to_mod(),
|
.to_mod(),
|
||||||
|
|
|
@ -3,7 +3,4 @@ wars_macro::wars!(
|
||||||
r#async = true,
|
r#async = true,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn x<A: Wars>(){
|
fn x<A: Wars>() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,13 @@ edition = "2021"
|
||||||
anyhow = "1.0.86"
|
anyhow = "1.0.86"
|
||||||
castaway = "0.2.2"
|
castaway = "0.2.2"
|
||||||
derive_more = "0.99.17"
|
derive_more = "0.99.17"
|
||||||
|
either = "1.13.0"
|
||||||
|
ic-stable-structures = { version = "0.6.5", optional = true }
|
||||||
paste = "1.0.15"
|
paste = "1.0.15"
|
||||||
tramp = "0.3.0"
|
tramp = "0.3.0"
|
||||||
tuple_list = "0.1.3"
|
tuple_list = "0.1.3"
|
||||||
wars-macro = { version = "0.1.0", path = "../wars-macro" }
|
wars-macro = { version = "0.1.0", path = "../wars-macro" }
|
||||||
wasm_runtime_layer = "0.4.0"
|
wasm_runtime_layer = "0.4.0"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
ic-stable-structures = ["dep:ic-stable-structures"]
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
use std::sync::Arc;
|
use std::{
|
||||||
|
iter::{empty, once},
|
||||||
|
sync::Arc,
|
||||||
|
};
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use tramp::{tramp, BorrowRec, Thunk};
|
use tramp::{tramp, BorrowRec, Thunk};
|
||||||
|
@ -6,9 +9,8 @@ pub mod unsync;
|
||||||
pub fn ret<'a, T>(a: T) -> BorrowRec<'a, T> {
|
pub fn ret<'a, T>(a: T) -> BorrowRec<'a, T> {
|
||||||
BorrowRec::Ret(a)
|
BorrowRec::Ret(a)
|
||||||
}
|
}
|
||||||
pub trait CtxSpec: Sized {
|
pub use crate::CtxSpec;
|
||||||
type ExternRef: Clone;
|
use crate::Traverse;
|
||||||
}
|
|
||||||
pub enum Value<C: CtxSpec> {
|
pub enum Value<C: CtxSpec> {
|
||||||
I32(u32),
|
I32(u32),
|
||||||
I64(u64),
|
I64(u64),
|
||||||
|
@ -20,12 +22,31 @@ pub enum Value<C: CtxSpec> {
|
||||||
&'a mut C,
|
&'a mut C,
|
||||||
Vec<Value<C>>,
|
Vec<Value<C>>,
|
||||||
) -> tramp::BorrowRec<'a, anyhow::Result<Vec<Value<C>>>>
|
) -> tramp::BorrowRec<'a, anyhow::Result<Vec<Value<C>>>>
|
||||||
+ Send + Sync + 'static,
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ 'static,
|
||||||
>,
|
>,
|
||||||
),
|
),
|
||||||
Null,
|
Null,
|
||||||
ExRef(C::ExternRef),
|
ExRef(C::ExternRef),
|
||||||
}
|
}
|
||||||
|
impl<C: CtxSpec> Traverse<C> for Value<C> {
|
||||||
|
fn traverse<'a>(&'a self) -> Box<dyn Iterator<Item = &'a <C as CtxSpec>::ExternRef> + 'a> {
|
||||||
|
match self {
|
||||||
|
Value::ExRef(e) => Box::new(once(e)),
|
||||||
|
_ => Box::new(empty()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn traverse_mut<'a>(
|
||||||
|
&'a mut self,
|
||||||
|
) -> Box<dyn Iterator<Item = &'a mut <C as CtxSpec>::ExternRef> + 'a> {
|
||||||
|
match self {
|
||||||
|
Value::ExRef(e) => Box::new(once(e)),
|
||||||
|
_ => Box::new(empty()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pub fn call_ref<'a, A: CoeVec<C> + 'static, B: CoeVec<C> + 'static, C: CtxSpec + 'static>(
|
pub fn call_ref<'a, A: CoeVec<C> + 'static, B: CoeVec<C> + 'static, C: CtxSpec + 'static>(
|
||||||
ctx: &'a mut C,
|
ctx: &'a mut C,
|
||||||
go: Df<A, B, C>,
|
go: Df<A, B, C>,
|
||||||
|
@ -143,8 +164,9 @@ pub fn map_rec<'a, T: 'a, U>(
|
||||||
})),
|
})),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub type Df<A, B, C> =
|
pub type Df<A, B, C> = Arc<
|
||||||
Arc<dyn for<'a> Fn(&'a mut C, A) -> tramp::BorrowRec<'a, anyhow::Result<B>> + Send + Sync + 'static>;
|
dyn for<'a> Fn(&'a mut C, A) -> tramp::BorrowRec<'a, anyhow::Result<B>> + Send + Sync + 'static,
|
||||||
|
>;
|
||||||
|
|
||||||
pub fn da<
|
pub fn da<
|
||||||
A,
|
A,
|
||||||
|
@ -165,6 +187,8 @@ impl<C: CtxSpec + 'static, A: CoeVec<C> + 'static, B: CoeVec<C> + 'static> Coe<C
|
||||||
&'a mut C,
|
&'a mut C,
|
||||||
Vec<Value<C>>,
|
Vec<Value<C>>,
|
||||||
) -> tramp::BorrowRec<'a, anyhow::Result<Vec<Value<C>>>>
|
) -> tramp::BorrowRec<'a, anyhow::Result<Vec<Value<C>>>>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
+ 'static,
|
+ 'static,
|
||||||
>(
|
>(
|
||||||
a: T,
|
a: T,
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
use std::{future::Future, pin::Pin, sync::Arc};
|
use std::{
|
||||||
|
future::Future,
|
||||||
|
iter::{empty, once},
|
||||||
|
pin::Pin,
|
||||||
|
sync::Arc,
|
||||||
|
};
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
// use tramp::{tramp, BorrowRec, Thunk};
|
// use tramp::{tramp, BorrowRec, Thunk};
|
||||||
|
@ -7,7 +12,7 @@ pub fn ret<'a,T>(a: T) -> AsyncRec<'a,T>{
|
||||||
}
|
}
|
||||||
pub enum AsyncRec<'a, T> {
|
pub enum AsyncRec<'a, T> {
|
||||||
Ret(T),
|
Ret(T),
|
||||||
Async(Pin<Box<dyn Future<Output = AsyncRec<'a,T>> + Send + Sync + 'a>>)
|
Async(Pin<Box<dyn Future<Output = AsyncRec<'a, T>> + Send + Sync + 'a>>),
|
||||||
}
|
}
|
||||||
impl<'a, T> AsyncRec<'a, T> {
|
impl<'a, T> AsyncRec<'a, T> {
|
||||||
pub async fn go(mut self) -> T {
|
pub async fn go(mut self) -> T {
|
||||||
|
@ -19,9 +24,8 @@ impl<'a,T> AsyncRec<'a,T>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub trait CtxSpec: Sized {
|
pub use crate::CtxSpec;
|
||||||
type ExternRef: Clone;
|
use crate::Traverse;
|
||||||
}
|
|
||||||
pub enum Value<C: CtxSpec> {
|
pub enum Value<C: CtxSpec> {
|
||||||
I32(u32),
|
I32(u32),
|
||||||
I64(u64),
|
I64(u64),
|
||||||
|
@ -29,16 +33,32 @@ pub enum Value<C: CtxSpec> {
|
||||||
F64(f64),
|
F64(f64),
|
||||||
FunRef(
|
FunRef(
|
||||||
Arc<
|
Arc<
|
||||||
dyn for<'a> Fn(
|
dyn for<'a> Fn(&'a mut C, Vec<Value<C>>) -> AsyncRec<'a, anyhow::Result<Vec<Value<C>>>>
|
||||||
&'a mut C,
|
+ Send
|
||||||
Vec<Value<C>>,
|
+ Sync
|
||||||
) -> AsyncRec<'a, anyhow::Result<Vec<Value<C>>>>
|
+ 'static,
|
||||||
+ Send + Sync + 'static,
|
|
||||||
>,
|
>,
|
||||||
),
|
),
|
||||||
Null,
|
Null,
|
||||||
ExRef(C::ExternRef),
|
ExRef(C::ExternRef),
|
||||||
}
|
}
|
||||||
|
impl<C: CtxSpec> Traverse<C> for Value<C> {
|
||||||
|
fn traverse<'a>(&'a self) -> Box<dyn Iterator<Item = &'a <C as CtxSpec>::ExternRef> + 'a> {
|
||||||
|
match self {
|
||||||
|
Value::ExRef(e) => Box::new(once(e)),
|
||||||
|
_ => Box::new(empty()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn traverse_mut<'a>(
|
||||||
|
&'a mut self,
|
||||||
|
) -> Box<dyn Iterator<Item = &'a mut <C as CtxSpec>::ExternRef> + 'a> {
|
||||||
|
match self {
|
||||||
|
Value::ExRef(e) => Box::new(once(e)),
|
||||||
|
_ => Box::new(empty()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
pub fn call_ref<'a, A: CoeVec<C> + 'static, B: CoeVec<C> + 'static, C: CtxSpec + 'static>(
|
pub fn call_ref<'a, A: CoeVec<C> + 'static, B: CoeVec<C> + 'static, C: CtxSpec + 'static>(
|
||||||
ctx: &'a mut C,
|
ctx: &'a mut C,
|
||||||
go: Df<A, B, C>,
|
go: Df<A, B, C>,
|
||||||
|
@ -174,10 +194,7 @@ impl<C: CtxSpec + 'static, A: CoeVec<C> + 'static, B: CoeVec<C> + 'static> Coe<C
|
||||||
fn coe(self) -> Value<C> {
|
fn coe(self) -> Value<C> {
|
||||||
pub fn x<
|
pub fn x<
|
||||||
C: CtxSpec,
|
C: CtxSpec,
|
||||||
T: for<'a> Fn(
|
T: for<'a> Fn(&'a mut C, Vec<Value<C>>) -> AsyncRec<'a, anyhow::Result<Vec<Value<C>>>>
|
||||||
&'a mut C,
|
|
||||||
Vec<Value<C>>,
|
|
||||||
) -> AsyncRec<'a, anyhow::Result<Vec<Value<C>>>>
|
|
||||||
+ 'static,
|
+ 'static,
|
||||||
>(
|
>(
|
||||||
a: T,
|
a: T,
|
||||||
|
|
|
@ -1,80 +1,183 @@
|
||||||
pub mod func;
|
pub mod func;
|
||||||
pub mod wrl;
|
|
||||||
pub mod wasix;
|
pub mod wasix;
|
||||||
use std::sync::{Arc, Mutex};
|
pub mod wrl;
|
||||||
|
use std::{
|
||||||
|
iter::empty,
|
||||||
|
sync::{Arc, Mutex},
|
||||||
|
};
|
||||||
|
pub type AnyCell = ::std::sync::Arc<::std::cell::UnsafeCell<Box<dyn ::std::any::Any>>>;
|
||||||
|
pub fn any_cell<T: ::std::any::Any>(a: T) -> AnyCell{
|
||||||
|
return ::std::sync::Arc::new(::std::cell::UnsafeCell::new(Box::new(a)));
|
||||||
|
}
|
||||||
|
pub unsafe fn get_cell<T: ::std::any::Any>(a: &AnyCell) -> Option<&mut T>{
|
||||||
|
let r = unsafe{
|
||||||
|
&mut *a.get()
|
||||||
|
};
|
||||||
|
return r.downcast_mut();
|
||||||
|
}
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct Pit<X>{
|
||||||
|
pub id: [u8; 32],
|
||||||
|
pub x: X,
|
||||||
|
pub s: [u8;32],
|
||||||
|
}
|
||||||
// use as_ref::AsSlice;
|
// use as_ref::AsSlice;
|
||||||
use func::CtxSpec;
|
// use func::CtxSpec;
|
||||||
pub use func::Value;
|
pub use func::Value;
|
||||||
pub trait Memory {
|
pub trait CtxSpec: Sized {
|
||||||
fn read<'a>(&'a self, a: usize, s: usize) -> anyhow::Result<Box<dyn AsRef<[u8]> + 'a>>;
|
type ExternRef: Clone;
|
||||||
fn write(&mut self, a: usize, x: &[u8]) -> anyhow::Result<()>;
|
|
||||||
fn size(&self) -> anyhow::Result<usize>;
|
|
||||||
fn grow(&mut self, x: usize) -> anyhow::Result<()>;
|
|
||||||
}
|
}
|
||||||
impl Memory for Vec<u8> {
|
pub trait Traverse<C: CtxSpec> {
|
||||||
fn read<'a>(&'a self, a: usize, s: usize) -> anyhow::Result<Box<dyn AsRef<[u8]> + 'a>>{
|
fn traverse<'a>(&'a self) -> Box<dyn Iterator<Item = &'a C::ExternRef> + 'a>;
|
||||||
Ok(Box::new(&self[a..][..s]))
|
fn traverse_mut<'a>(&'a mut self) -> Box<dyn Iterator<Item = &'a mut C::ExternRef> + 'a>;
|
||||||
|
}
|
||||||
|
impl<C: CtxSpec, V: Traverse<C>> Traverse<C> for Vec<V> {
|
||||||
|
fn traverse<'a>(&'a self) -> Box<dyn Iterator<Item = &'a <C as CtxSpec>::ExternRef> + 'a> {
|
||||||
|
Box::new(self.iter().flat_map(|a| a.traverse()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write(&mut self, a: usize, x: &[u8]) -> anyhow::Result<()> {
|
fn traverse_mut<'a>(
|
||||||
self[a..][..x.len()].copy_from_slice(x);
|
&'a mut self,
|
||||||
|
) -> Box<dyn Iterator<Item = &'a mut <C as CtxSpec>::ExternRef> + 'a> {
|
||||||
|
Box::new(self.iter_mut().flat_map(|x| x.traverse_mut()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl<C: CtxSpec> Traverse<C> for u32 {
|
||||||
|
fn traverse<'a>(&'a self) -> Box<dyn Iterator<Item = &'a <C as CtxSpec>::ExternRef> + 'a> {
|
||||||
|
Box::new(empty())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn traverse_mut<'a>(
|
||||||
|
&'a mut self,
|
||||||
|
) -> Box<dyn Iterator<Item = &'a mut <C as CtxSpec>::ExternRef> + 'a> {
|
||||||
|
Box::new(empty())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl<C: CtxSpec> Traverse<C> for u64 {
|
||||||
|
fn traverse<'a>(&'a self) -> Box<dyn Iterator<Item = &'a <C as CtxSpec>::ExternRef> + 'a> {
|
||||||
|
Box::new(empty())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn traverse_mut<'a>(
|
||||||
|
&'a mut self,
|
||||||
|
) -> Box<dyn Iterator<Item = &'a mut <C as CtxSpec>::ExternRef> + 'a> {
|
||||||
|
Box::new(empty())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub trait Memory {
|
||||||
|
fn read<'a>(&'a self, a: u64, s: u64) -> anyhow::Result<Box<dyn AsRef<[u8]> + 'a>>;
|
||||||
|
fn write(&mut self, a: u64, x: &[u8]) -> anyhow::Result<()>;
|
||||||
|
fn size(&self) -> anyhow::Result<u64>;
|
||||||
|
fn grow(&mut self, x: u64) -> anyhow::Result<()>;
|
||||||
|
}
|
||||||
|
#[cfg(feature = "ic-stable-structures")]
|
||||||
|
pub mod ic{
|
||||||
|
#[repr(transparent)]
|
||||||
|
pub struct Stable<T>(pub T);
|
||||||
|
|
||||||
|
impl<T: ic_stable_structures::Memory> super::Memory for Stable<T>{
|
||||||
|
fn read<'a>(&'a self, a: u64, s: u64) -> anyhow::Result<Box<dyn AsRef<[u8]> + 'a>> {
|
||||||
|
let mut v = vec![0u8;s as usize];
|
||||||
|
self.0.read(a, &mut v);
|
||||||
|
Ok(Box::new(v))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write(&mut self, a: u64, x: &[u8]) -> anyhow::Result<()> {
|
||||||
|
self.0.write(a,x);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn size(&self) -> anyhow::Result<usize> {
|
fn size(&self) -> anyhow::Result<u64> {
|
||||||
Ok(self.len())
|
let s = self.0.size();
|
||||||
|
Ok(s * 65536)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn grow(&mut self, x: usize) -> anyhow::Result<()> {
|
fn grow(&mut self, x: u64) -> anyhow::Result<()> {
|
||||||
|
if self.0.grow((x + 65535) / 65536) == -1{
|
||||||
|
anyhow::bail!("stable growth failed")
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Memory for Vec<u8> {
|
||||||
|
fn read<'a>(&'a self, a: u64, s: u64) -> anyhow::Result<Box<dyn AsRef<[u8]> + 'a>> {
|
||||||
|
Ok(Box::new(&self[(a as usize)..][..(s as usize)]))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write(&mut self, a: u64, x: &[u8]) -> anyhow::Result<()> {
|
||||||
|
self[(a as usize)..][..x.len()].copy_from_slice(x);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn size(&self) -> anyhow::Result<u64> {
|
||||||
|
Ok(self.len() as u64)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn grow(&mut self, x: u64) -> anyhow::Result<()> {
|
||||||
self.extend((0..x).map(|a| 0u8));
|
self.extend((0..x).map(|a| 0u8));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl<T: Memory + ?Sized> Memory for Box<T> {
|
||||||
|
fn read<'a>(&'a self, a: u64, s: u64) -> anyhow::Result<Box<dyn AsRef<[u8]> + 'a>> {
|
||||||
|
self.as_ref().read(a, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write(&mut self, a: u64, x: &[u8]) -> anyhow::Result<()> {
|
||||||
|
self.as_mut().write(a, x)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn size(&self) -> Result<u64, anyhow::Error> {
|
||||||
|
self.as_ref().size()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn grow(&mut self, x: u64) -> anyhow::Result<()> {
|
||||||
|
self.as_mut().grow(x)
|
||||||
|
}
|
||||||
|
}
|
||||||
impl<T: Memory> Memory for Arc<Mutex<T>> {
|
impl<T: Memory> Memory for Arc<Mutex<T>> {
|
||||||
fn read<'a>(&'a self, a: usize, s: usize) -> anyhow::Result<Box<dyn AsRef<[u8]> + 'a>> {
|
fn read<'a>(&'a self, a: u64, s: u64) -> anyhow::Result<Box<dyn AsRef<[u8]> + 'a>> {
|
||||||
let l = self.lock().unwrap();
|
let l = self.lock().unwrap();
|
||||||
let r = l.read(a, s)?;
|
let r = l.read(a, s)?;
|
||||||
return Ok(Box::new(r.as_ref().as_ref().to_vec()));
|
return Ok(Box::new(r.as_ref().as_ref().to_vec()));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write(&mut self, a: usize, x: &[u8]) -> anyhow::Result<()> {
|
fn write(&mut self, a: u64, x: &[u8]) -> anyhow::Result<()> {
|
||||||
let mut l = self.lock().unwrap();
|
let mut l = self.lock().unwrap();
|
||||||
return l.write(a, x);
|
return l.write(a, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn size(&self) -> anyhow::Result<usize> {
|
fn size(&self) -> Result<u64, anyhow::Error> {
|
||||||
let l = self.lock().unwrap();
|
let l = self.lock().unwrap();
|
||||||
return l.size();
|
return l.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn grow(&mut self, x: usize) -> anyhow::Result<()> {
|
fn grow(&mut self, x: u64) -> anyhow::Result<()> {
|
||||||
let mut l = self.lock().unwrap();
|
let mut l = self.lock().unwrap();
|
||||||
return l.grow(x)
|
return l.grow(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub unsafe fn host_memory() -> impl Memory {
|
pub unsafe fn host_memory() -> impl Memory {
|
||||||
struct W {}
|
struct W {}
|
||||||
impl Memory for W {
|
impl Memory for W {
|
||||||
fn read<'a>(&'a self, a: usize, s: usize) -> anyhow::Result<Box<dyn AsRef<[u8]> + 'a>> {
|
fn read<'a>(&'a self, a: u64, s: u64) -> anyhow::Result<Box<dyn AsRef<[u8]> + 'a>> {
|
||||||
return Ok(Box::new(unsafe {
|
return Ok(Box::new(unsafe {
|
||||||
std::slice::from_raw_parts(a as *const u8, s)
|
std::slice::from_raw_parts(a as usize as *const u8, s as usize)
|
||||||
}))
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write(&mut self, a: usize, x: &[u8]) -> anyhow::Result<()> {
|
fn write(&mut self, a: u64, x: &[u8]) -> anyhow::Result<()> {
|
||||||
let n = unsafe{
|
let n = unsafe { std::slice::from_raw_parts_mut(a as usize as *mut u8, x.len()) };
|
||||||
std::slice::from_raw_parts_mut(a as *mut u8, x.len())
|
|
||||||
};
|
|
||||||
n.copy_from_slice(x);
|
n.copy_from_slice(x);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn size(&self) -> anyhow::Result<usize> {
|
fn size(&self) -> Result<u64, anyhow::Error> {
|
||||||
anyhow::bail!("host memory cannot use size")
|
anyhow::bail!("host memory cannot use size")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn grow(&mut self, x: usize) -> anyhow::Result<()> {
|
fn grow(&mut self, x: u64) -> anyhow::Result<()> {
|
||||||
anyhow::bail!("host memory cannot use grow")
|
anyhow::bail!("host memory cannot use grow")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,59 +316,59 @@ macro_rules! int_ty{
|
||||||
Ok(tuple_list::tuple_list!(a.wrapping_sub(b)))
|
Ok(tuple_list::tuple_list!(a.wrapping_sub(b)))
|
||||||
}
|
}
|
||||||
//LOADS and STORES
|
//LOADS and STORES
|
||||||
pub fn [<$p load>]<T: TryInto<usize>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
pub fn [<$p load>]<T: TryInto<u64>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
||||||
let r = a.read(b.try_into()?,std::mem::size_of::<$int>())?;
|
let r = a.read(b.try_into()?,std::mem::size_of::<$int>().try_into()?)?;
|
||||||
Ok(tuple_list::tuple_list!($int::from_ne_bytes(r.as_ref().as_ref().try_into()?)))
|
Ok(tuple_list::tuple_list!($int::from_ne_bytes(r.as_ref().as_ref().try_into()?)))
|
||||||
}
|
}
|
||||||
pub fn [<$p store>]<T: TryInto<usize>,M: Memory + ?Sized>(a: &mut M, b: T, c: $int) -> anyhow::Result<()> where T::Error: std::error::Error + Send + Sync + 'static{
|
pub fn [<$p store>]<T: TryInto<u64>,M: Memory + ?Sized>(a: &mut M, b: T, c: $int) -> anyhow::Result<()> where T::Error: std::error::Error + Send + Sync + 'static{
|
||||||
// let mut r = &mut a[b.try_into()?..][..std::mem::size_of::<$int>()];
|
// let mut r = &mut a[b.try_into()?..][..std::mem::size_of::<$int>()];
|
||||||
// r.copy_from_slice(&c.to_ne_bytes());
|
// r.copy_from_slice(&c.to_ne_bytes());
|
||||||
a.write(b.try_into()?,&c.to_ne_bytes())?;
|
a.write(b.try_into()?,&c.to_ne_bytes())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
//8 BIT
|
//8 BIT
|
||||||
pub fn [<$p load8u>]<T: TryInto<usize>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
pub fn [<$p load8u>]<T: TryInto<u64>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
||||||
let r = a.read(b.try_into()?,1)?.as_ref().as_ref()[0];
|
let r = a.read(b.try_into()?,1)?.as_ref().as_ref()[0];
|
||||||
Ok(tuple_list::tuple_list!(r as $int))
|
Ok(tuple_list::tuple_list!(r as $int))
|
||||||
}
|
}
|
||||||
pub fn [<$p load8s>]<T: TryInto<usize>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
pub fn [<$p load8s>]<T: TryInto<u64>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
||||||
let r = a.read(b.try_into()?,1)?.as_ref().as_ref()[0];
|
let r = a.read(b.try_into()?,1)?.as_ref().as_ref()[0];
|
||||||
Ok(tuple_list::tuple_list!(r as i8 as $p as $int))
|
Ok(tuple_list::tuple_list!(r as i8 as $p as $int))
|
||||||
}
|
}
|
||||||
pub fn [<$p store8>]<T: TryInto<usize>,M: Memory + ?Sized>(a: &mut M, b: T, c: $int) -> anyhow::Result<()> where T::Error: std::error::Error + Send + Sync + 'static{
|
pub fn [<$p store8>]<T: TryInto<u64>,M: Memory + ?Sized>(a: &mut M, b: T, c: $int) -> anyhow::Result<()> where T::Error: std::error::Error + Send + Sync + 'static{
|
||||||
// let mut r = &mut a[b.try_into()?..][..1];
|
// let mut r = &mut a[b.try_into()?..][..1];
|
||||||
// r[0] = (c & 0xff) as u8;
|
// r[0] = (c & 0xff) as u8;
|
||||||
a.write(b.try_into()?,&[(c & 0xff) as u8])?;
|
a.write(b.try_into()?,&[(c & 0xff) as u8])?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
//16 BIT
|
//16 BIT
|
||||||
pub fn [<$p load16u>]<T: TryInto<usize>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
pub fn [<$p load16u>]<T: TryInto<u64>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
||||||
let r = a.read(b.try_into()?,2)?;
|
let r = a.read(b.try_into()?,2)?;
|
||||||
let r = u16::from_ne_bytes(r.as_ref().as_ref().try_into()?);
|
let r = u16::from_ne_bytes(r.as_ref().as_ref().try_into()?);
|
||||||
Ok(tuple_list::tuple_list!(r as $int))
|
Ok(tuple_list::tuple_list!(r as $int))
|
||||||
}
|
}
|
||||||
pub fn [<$p load16s>]<T: TryInto<usize>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
pub fn [<$p load16s>]<T: TryInto<u64>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
||||||
let r = a.read(b.try_into()?,2)?;
|
let r = a.read(b.try_into()?,2)?;
|
||||||
let r = u16::from_ne_bytes(r.as_ref().as_ref().try_into()?);
|
let r = u16::from_ne_bytes(r.as_ref().as_ref().try_into()?);
|
||||||
Ok(tuple_list::tuple_list!(r as i16 as $p as $int))
|
Ok(tuple_list::tuple_list!(r as i16 as $p as $int))
|
||||||
}
|
}
|
||||||
pub fn [<$p store16>]<T: TryInto<usize>,M: Memory + ?Sized>(a: &mut M, b: T, c: $int) -> anyhow::Result<()> where T::Error: std::error::Error + Send + Sync + 'static{
|
pub fn [<$p store16>]<T: TryInto<u64>,M: Memory + ?Sized>(a: &mut M, b: T, c: $int) -> anyhow::Result<()> where T::Error: std::error::Error + Send + Sync + 'static{
|
||||||
// let mut r = &mut a[b.try_into()?..][..2];
|
// let mut r = &mut a[b.try_into()?..][..2];
|
||||||
a.write(b.try_into()?,&((c & 0xffff) as u16).to_ne_bytes())?;
|
a.write(b.try_into()?,&((c & 0xffff) as u16).to_ne_bytes())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
//32 BIT
|
//32 BIT
|
||||||
pub fn [<$p load32u>]<T: TryInto<usize>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
pub fn [<$p load32u>]<T: TryInto<u64>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
||||||
let r = a.read(b.try_into()?,4)?;
|
let r = a.read(b.try_into()?,4)?;
|
||||||
let r = u32::from_ne_bytes(r.as_ref().as_ref().try_into()?);
|
let r = u32::from_ne_bytes(r.as_ref().as_ref().try_into()?);
|
||||||
Ok(tuple_list::tuple_list!(r as $int))
|
Ok(tuple_list::tuple_list!(r as $int))
|
||||||
}
|
}
|
||||||
pub fn [<$p load32s>]<T: TryInto<usize>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
pub fn [<$p load32s>]<T: TryInto<u64>,M: Memory + ?Sized>(a: &mut M, b: T) -> anyhow::Result<tuple_list::tuple_list_type!($int)> where T::Error: std::error::Error + Send + Sync + 'static{
|
||||||
let r = a.read(b.try_into()?,4)?;
|
let r = a.read(b.try_into()?,4)?;
|
||||||
let r = u32::from_ne_bytes(r.as_ref().as_ref().try_into()?);
|
let r = u32::from_ne_bytes(r.as_ref().as_ref().try_into()?);
|
||||||
Ok(tuple_list::tuple_list!(r as i32 as $p as $int))
|
Ok(tuple_list::tuple_list!(r as i32 as $p as $int))
|
||||||
}
|
}
|
||||||
pub fn [<$p store32>]<T: TryInto<usize>,M: Memory + ?Sized>(a: &mut M, b: T, c: $int) -> anyhow::Result<()> where T::Error: std::error::Error + Send + Sync + 'static{
|
pub fn [<$p store32>]<T: TryInto<u64>,M: Memory + ?Sized>(a: &mut M, b: T, c: $int) -> anyhow::Result<()> where T::Error: std::error::Error + Send + Sync + 'static{
|
||||||
// let mut r = &mut a[b.try_into()?..][..4];
|
// let mut r = &mut a[b.try_into()?..][..4];
|
||||||
a.write(b.try_into()?,&((c & 0xffffffff) as u32).to_ne_bytes())?;
|
a.write(b.try_into()?,&((c & 0xffffffff) as u32).to_ne_bytes())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
use crate::{CtxSpec, Memory};
|
||||||
|
|
||||||
|
pub trait XSpec: CtxSpec {
|
||||||
|
fn wasix_memory<'a>(&'a mut self) -> &'a mut (dyn Memory + 'a);
|
||||||
|
}
|
|
@ -27,6 +27,57 @@ impl MetaType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub trait Native: Sized {
|
||||||
|
fn to_val(&self, v: &mut wasm_runtime_layer::Value);
|
||||||
|
fn val(&self) -> wasm_runtime_layer::Value {
|
||||||
|
let mut x = wasm_runtime_layer::Value::I32(0);
|
||||||
|
self.to_val(&mut x);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
fn from_val(v: &wasm_runtime_layer::Value) -> anyhow::Result<Self>;
|
||||||
|
}
|
||||||
|
pub trait Natives: Sized {
|
||||||
|
fn to_val(&self, v: &mut [wasm_runtime_layer::Value]);
|
||||||
|
fn from_val(v: &[wasm_runtime_layer::Value]) -> anyhow::Result<Self>;
|
||||||
|
}
|
||||||
|
impl Natives for () {
|
||||||
|
fn to_val(&self, v: &mut [wasm_runtime_layer::Value]) {}
|
||||||
|
|
||||||
|
fn from_val(v: &[wasm_runtime_layer::Value]) -> anyhow::Result<Self> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl<T: Native, U: Natives> Natives for (T, U) {
|
||||||
|
fn to_val(&self, v: &mut [wasm_runtime_layer::Value]) {
|
||||||
|
self.0.to_val(&mut v[0]);
|
||||||
|
self.1.to_val(&mut v[1..]);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn from_val(v: &[wasm_runtime_layer::Value]) -> anyhow::Result<Self> {
|
||||||
|
Ok((T::from_val(&v[0])?, U::from_val(&v[1..])?))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
macro_rules! native {
|
||||||
|
($t:ty as $i:ident) => {
|
||||||
|
impl Native for $t {
|
||||||
|
fn to_val(&self, v: &mut wasm_runtime_layer::Value) {
|
||||||
|
*v = wasm_runtime_layer::Value::$i(self.clone());
|
||||||
|
}
|
||||||
|
fn from_val(v: &wasm_runtime_layer::Value) -> anyhow::Result<Self> {
|
||||||
|
match v {
|
||||||
|
wasm_runtime_layer::Value::$i(w) => Ok(w.clone()),
|
||||||
|
_ => anyhow::bail!("invalid value"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
native!(i32 as I32);
|
||||||
|
native!(i64 as I64);
|
||||||
|
native!(f32 as F32);
|
||||||
|
native!(f64 as F64);
|
||||||
|
native!(Option<wasm_runtime_layer::Func> as FuncRef);
|
||||||
|
native!(Option<wasm_runtime_layer::ExternRef> as ExternRef);
|
||||||
pub fn translate_in<C: CtxSpec + AsContextMut<UserState = D> + 'static, D: AsMut<C>>(
|
pub fn translate_in<C: CtxSpec + AsContextMut<UserState = D> + 'static, D: AsMut<C>>(
|
||||||
val: &crate::func::Value<C>,
|
val: &crate::func::Value<C>,
|
||||||
ctx: &mut C,
|
ctx: &mut C,
|
||||||
|
@ -72,7 +123,7 @@ where
|
||||||
crate::Value::Null => match wrl_ty {
|
crate::Value::Null => match wrl_ty {
|
||||||
MetaType::ExternRef => wasm_runtime_layer::Value::ExternRef(None),
|
MetaType::ExternRef => wasm_runtime_layer::Value::ExternRef(None),
|
||||||
MetaType::FunRef { params, returns } => wasm_runtime_layer::Value::FuncRef(None),
|
MetaType::FunRef { params, returns } => wasm_runtime_layer::Value::FuncRef(None),
|
||||||
_ => anyhow::bail!("invalid null")
|
_ => anyhow::bail!("invalid null"),
|
||||||
},
|
},
|
||||||
crate::Value::ExRef(e) => {
|
crate::Value::ExRef(e) => {
|
||||||
wasm_runtime_layer::Value::ExternRef(Some(ExternRef::new(ctx, e.clone())))
|
wasm_runtime_layer::Value::ExternRef(Some(ExternRef::new(ctx, e.clone())))
|
||||||
|
|
|
@ -7,11 +7,14 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "2.5.0"
|
bitflags = "2.5.0"
|
||||||
|
hex = "0.4.3"
|
||||||
|
|
||||||
portal-pc-waffle.workspace = true
|
portal-pc-waffle.workspace = true
|
||||||
proc-macro2 = "1.0.85"
|
proc-macro2 = "1.0.85"
|
||||||
quasiquote = "0.1.1"
|
quasiquote = "0.1.1"
|
||||||
quote = "1.0.36"
|
quote = "1.0.36"
|
||||||
relooper = "0.1.0"
|
relooper = "0.1.0"
|
||||||
|
sha3 = "0.10.8"
|
||||||
syn = "2.0.66"
|
syn = "2.0.66"
|
||||||
waffle-func-reloop = { version = "0.1.0", path = "../waffle-func-reloop" }
|
waffle-func-reloop = { version = "0.1.0", path = "../waffle-func-reloop" }
|
||||||
witx = {git="https://github.com/wasix-org/wasix-witx.git",branch="main"}
|
witx = {git="https://github.com/wasix-org/wasix-witx.git",branch="main"}
|
||||||
|
|
322
wars/src/lib.rs
322
wars/src/lib.rs
|
@ -1,12 +1,21 @@
|
||||||
use std::{collections::BTreeMap, convert::Infallible, iter::once, sync::Arc};
|
use std::{
|
||||||
|
collections::{BTreeMap, BTreeSet},
|
||||||
|
convert::Infallible,
|
||||||
|
f32::consts::E,
|
||||||
|
iter::once,
|
||||||
|
sync::Arc,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
use proc_macro2::{Span, TokenStream};
|
use proc_macro2::{Span, TokenStream};
|
||||||
use quasiquote::quasiquote;
|
use quasiquote::quasiquote;
|
||||||
use quote::{format_ident, quote, ToTokens};
|
use quote::{format_ident, quote, ToTokens};
|
||||||
use relooper::{reloop, BranchMode, ShapedBlock};
|
use relooper::{reloop, BranchMode, ShapedBlock};
|
||||||
|
use sha3::Digest;
|
||||||
use syn::{Ident, Lifetime};
|
use syn::{Ident, Lifetime};
|
||||||
use waffle::{
|
use waffle::{
|
||||||
cfg::CFGInfo, entity::EntityRef, Block, BlockTarget, Export, ExportKind, Func, ImportKind, Memory, Module, Operator, Signature, SignatureData, Type, Value
|
cfg::CFGInfo, entity::EntityRef, Block, BlockTarget, Export, ExportKind, Func, ImportKind,
|
||||||
|
Memory, Module, Operator, Signature, SignatureData, Type, Value,
|
||||||
};
|
};
|
||||||
bitflags::bitflags! {
|
bitflags::bitflags! {
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||||
|
@ -14,7 +23,9 @@ bitflags::bitflags! {
|
||||||
const HOST_MEMORY = 0x1;
|
const HOST_MEMORY = 0x1;
|
||||||
const ASYNC = 0x2;
|
const ASYNC = 0x2;
|
||||||
const LEGACY = 0x4;
|
const LEGACY = 0x4;
|
||||||
// const WASIX = 0x8;
|
const WASIX = 0x8;
|
||||||
|
const BIND = 0x10;
|
||||||
|
const PIT = 0x20;
|
||||||
// const UNSANDBOXED = 0x2;
|
// const UNSANDBOXED = 0x2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +81,15 @@ impl Opts<Module<'static>> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if self.flags.contains(Flags::WASIX) {
|
||||||
|
if i.module == "wasi_snapshot_preview1" || i.module == "wasix_32v1" {
|
||||||
|
if i.name == "memory" {
|
||||||
|
return quote! {
|
||||||
|
ctx.wasix_memory()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let m2 = format_ident!("{m}");
|
let m2 = format_ident!("{m}");
|
||||||
quote! {
|
quote! {
|
||||||
|
@ -91,6 +111,36 @@ impl Opts<Module<'static>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if self.flags.contains(Flags::WASIX) {
|
||||||
|
if module == "wasi_snapshot_preview1" || module == "wasix_32v1" {
|
||||||
|
return quasiquote! {
|
||||||
|
#root::wasix::#{format_ident!("{name}")}(#(#params),*)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if self.flags.contains(Flags::BIND) {
|
||||||
|
if module == "wars/bind" {
|
||||||
|
if name == "!!drop" {
|
||||||
|
return quasiquote! {
|
||||||
|
{
|
||||||
|
let v = self.data().rust_table.remove(#(#params),*).unwrap();
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
let params = params.collect::<Vec<_>>();
|
||||||
|
return quasiquote! {
|
||||||
|
{
|
||||||
|
let v = #{syn::parse_str::<TokenStream>(&name).unwrap()}(#(unsafe{#root::get_cell(self.data().rust_table.get(&#params)).unwrap()}),*)#{if self.flags.contains(Flags::ASYNC){
|
||||||
|
quote!{.await}
|
||||||
|
}else{
|
||||||
|
quote!{}
|
||||||
|
}};
|
||||||
|
v.map(|x|(alloc(&mut self.data().rust_table,#root::any_cell(x)),()))
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
// if a == "fs" {
|
// if a == "fs" {
|
||||||
// match name {
|
// match name {
|
||||||
// "open" => {
|
// "open" => {
|
||||||
|
@ -156,6 +206,114 @@ impl Opts<Module<'static>> {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
if self.flags.contains(Flags::PIT) {
|
||||||
|
if let Some(i) = module.strip_prefix("pit/") {
|
||||||
|
let x: [u8; 32] = hex::decode(i).unwrap().try_into().unwrap();
|
||||||
|
if let Some(s) = name.strip_prefix("~") {
|
||||||
|
let s = {
|
||||||
|
let mut h = sha3::Sha3_256::default();
|
||||||
|
h.update(s);
|
||||||
|
h.finalize()
|
||||||
|
};
|
||||||
|
return quasiquote! {
|
||||||
|
#{self.fp()}::ret(Ok(#{self.fp()}::Value::<C>::ExternRef(#root::Pit{
|
||||||
|
id: [#(#x),*],
|
||||||
|
x: #{self.fp()}::CoeVec::coe(#root::tuple_list::tuple_list!(#(#params),*)),
|
||||||
|
s: [#(#s),*],
|
||||||
|
}.into())))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut f = params.next().unwrap();
|
||||||
|
// let id = format_ident!("{}", bindname(&format!("pit/{i}/~{PIT_NS}/{name}")));
|
||||||
|
// ctx.#id(x.x,#(#params),*)
|
||||||
|
let params = params.collect::<Vec<_>>();
|
||||||
|
let cases = self
|
||||||
|
.module
|
||||||
|
.exports
|
||||||
|
.iter()
|
||||||
|
.filter_map(|x| x.name.strip_prefix(&format!("pit/{i}/~")))
|
||||||
|
.filter_map(|x| x.strip_suffix(&format!("/{name}")))
|
||||||
|
.map(|s| {
|
||||||
|
let id = format_ident!("{}", bindname(&format!("pit/{i}/~{s}/{name}")));
|
||||||
|
let s = {
|
||||||
|
let mut h = sha3::Sha3_256::default();
|
||||||
|
h.update(s);
|
||||||
|
h.finalize()
|
||||||
|
};
|
||||||
|
quasiquote! {
|
||||||
|
[#(#s),*] => {
|
||||||
|
let mut y = #{self.fp()}::CoeVec::coe(#root::tuple_list::tuple_list!(#(#params),*));
|
||||||
|
y.extend(&mut x.x.clone());
|
||||||
|
ctx.#id(#{self.fp()}::CoeVec::uncoe(y))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return quasiquote! {
|
||||||
|
'a: {
|
||||||
|
let x = #f;
|
||||||
|
let #{self.fp()}::Value::<C>::ExternRef(x) = x else{
|
||||||
|
break 'a #{self.fp()}::ret(Err(#root::_rexport::anyhow::anyhow!("not an externref")))
|
||||||
|
};
|
||||||
|
let Ok(x) = x.try_into() else{
|
||||||
|
break 'a #{self.fp()}::ret(Err(#root::_rexport::anyhow::anyhow!("not a pit externref")))
|
||||||
|
};
|
||||||
|
let x: #root::Pit = x;
|
||||||
|
match x.s{
|
||||||
|
#(#cases),*,
|
||||||
|
_ => break 'a #{self.fp()}::ret(Err(#root::_rexport::anyhow::anyhow!("invalid target")))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if module == "pit" && name == "drop" {
|
||||||
|
let mut f = params.next().unwrap();
|
||||||
|
let cases = self
|
||||||
|
.module
|
||||||
|
.exports
|
||||||
|
.iter()
|
||||||
|
.filter_map(|x| {
|
||||||
|
let x = x.name.as_str();
|
||||||
|
let x = x.strip_prefix("pit/")?;
|
||||||
|
let (a, x) = x.split_once("/~")?;
|
||||||
|
let s = x.strip_suffix(".drop")?;
|
||||||
|
return Some((a, s));
|
||||||
|
})
|
||||||
|
.map(|(a, s)| {
|
||||||
|
let x = hex::decode(a).unwrap();
|
||||||
|
let id = format_ident!("{}", bindname(&format!("pit/{a}/~{s}.drop")));
|
||||||
|
let s = {
|
||||||
|
let mut h = sha3::Sha3_256::default();
|
||||||
|
h.update(s);
|
||||||
|
h.finalize()
|
||||||
|
};
|
||||||
|
// let id = format_ident!(
|
||||||
|
// "{}",
|
||||||
|
// bindname(&format!("pit/{}/~{PIT_NS}.drop", i.rid_str()))
|
||||||
|
// ); ctx.#id(x.x)
|
||||||
|
quasiquote!(
|
||||||
|
([#(#x),*],[#(#s),*]) => ctx.#id(#{self.fp()}::CoeVec::uncoe(x.x))
|
||||||
|
)
|
||||||
|
});
|
||||||
|
return quasiquote! {
|
||||||
|
'a: {
|
||||||
|
let x = #f;
|
||||||
|
let #{self.fp()}::Value::<C>::ExternRef(x) = x else{
|
||||||
|
break 'a #{self.fp()}::ret(Ok(()));
|
||||||
|
};
|
||||||
|
if let Ok(x) = x.try_into(){
|
||||||
|
let x: #root::Pit = x;
|
||||||
|
break 'a match (x.id,x.s){
|
||||||
|
#(#cases),*,
|
||||||
|
_ => #{self.fp()}::ret(Ok(()))
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
break 'a #{self.fp()}::ret(Ok(()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
let id = format_ident!("{}_{}", bindname(module), bindname(name));
|
let id = format_ident!("{}_{}", bindname(module), bindname(name));
|
||||||
return quote! {
|
return quote! {
|
||||||
ctx.#id(#(#params),*)
|
ctx.#id(#(#params),*)
|
||||||
|
@ -220,7 +378,7 @@ impl Opts<Module<'static>> {
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(a, _)| format_ident!("p{a}"));
|
.map(|(a, _)| format_ident!("p{a}"));
|
||||||
let returns = data.returns.iter().map(|x| self.render_ty(&ctx, *x));
|
let returns = data.returns.iter().map(|x| self.render_ty(&ctx, *x));
|
||||||
if self.flags.contains(Flags::ASYNC) {
|
let mut x = if self.flags.contains(Flags::ASYNC) {
|
||||||
quote! {
|
quote! {
|
||||||
fn #name<'a,C: #base + 'static>(ctx: &'a mut C, #root::_rexport::tuple_list::tuple_list!(#(#param_ids),*): #root::_rexport::tuple_list::tuple_list_type!(#(#params),*)) -> #root::func::unsync::AsyncRec<'a,#root::_rexport::anyhow::Result<#root::_rexport::tuple_list::tuple_list_type!(#(#returns),*)>>
|
fn #name<'a,C: #base + 'static>(ctx: &'a mut C, #root::_rexport::tuple_list::tuple_list!(#(#param_ids),*): #root::_rexport::tuple_list::tuple_list_type!(#(#params),*)) -> #root::func::unsync::AsyncRec<'a,#root::_rexport::anyhow::Result<#root::_rexport::tuple_list::tuple_list_type!(#(#returns),*)>>
|
||||||
}
|
}
|
||||||
|
@ -228,7 +386,17 @@ impl Opts<Module<'static>> {
|
||||||
quote! {
|
quote! {
|
||||||
fn #name<'a,C: #base + 'static>(ctx: &'a mut C, #root::_rexport::tuple_list::tuple_list!(#(#param_ids),*): #root::_rexport::tuple_list::tuple_list_type!(#(#params),*)) -> #root::_rexport::tramp::BorrowRec<'a,#root::_rexport::anyhow::Result<#root::_rexport::tuple_list::tuple_list_type!(#(#returns),*)>>
|
fn #name<'a,C: #base + 'static>(ctx: &'a mut C, #root::_rexport::tuple_list::tuple_list!(#(#param_ids),*): #root::_rexport::tuple_list::tuple_list_type!(#(#params),*)) -> #root::_rexport::tramp::BorrowRec<'a,#root::_rexport::anyhow::Result<#root::_rexport::tuple_list::tuple_list_type!(#(#returns),*)>>
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
if let Some(t) = self.roots.get("tracing") {
|
||||||
|
x = quote! {
|
||||||
|
#[#t::instrument]
|
||||||
|
#x
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
pub fn fname(&self, a: Func) -> Ident {
|
||||||
|
format_ident!("{a}_{}", bindname(self.module.funcs[a].name()))
|
||||||
}
|
}
|
||||||
pub fn render_fun_ref(&self, ctx: &TokenStream, x: Func) -> TokenStream {
|
pub fn render_fun_ref(&self, ctx: &TokenStream, x: Func) -> TokenStream {
|
||||||
let root = self.crate_path.clone();
|
let root = self.crate_path.clone();
|
||||||
|
@ -239,7 +407,7 @@ impl Opts<Module<'static>> {
|
||||||
}
|
}
|
||||||
let generics =
|
let generics =
|
||||||
self.render_generics(ctx, &self.module.signatures[self.module.funcs[x].sig()]);
|
self.render_generics(ctx, &self.module.signatures[self.module.funcs[x].sig()]);
|
||||||
let x = format_ident!("{x}");
|
let x = self.fname(x);
|
||||||
quasiquote! {
|
quasiquote! {
|
||||||
#{self.fp()}::da::<#generics,C,_>(|ctx,arg|#x(ctx,arg))
|
#{self.fp()}::da::<#generics,C,_>(|ctx,arg|#x(ctx,arg))
|
||||||
}
|
}
|
||||||
|
@ -387,7 +555,7 @@ impl Opts<Module<'static>> {
|
||||||
Operator::Call { function_index } => {
|
Operator::Call { function_index } => {
|
||||||
match self.module.funcs[*function_index].body(){
|
match self.module.funcs[*function_index].body(){
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
let func = format_ident!("{function_index}");
|
let func = self.fname(*function_index);
|
||||||
let vals = vals.iter().map(|a|format_ident!("{a}"));
|
let vals = vals.iter().map(|a|format_ident!("{a}"));
|
||||||
quasiquote! {
|
quasiquote! {
|
||||||
{
|
{
|
||||||
|
@ -523,7 +691,7 @@ impl Opts<Module<'static>> {
|
||||||
Ok(a) => a,
|
Ok(a) => a,
|
||||||
Err(e) => return #{self.fp()}::ret(Err(e))
|
Err(e) => return #{self.fp()}::ret(Err(e))
|
||||||
}) / 65536;
|
}) / 65536;
|
||||||
match #root::Memory::grow(ctx.#m(),(#a .clone() as usize) * 65536){
|
match #root::Memory::grow(ctx.#m(),(#a .clone() as u64) * 65536){
|
||||||
Ok(a) => a,
|
Ok(a) => a,
|
||||||
Err(e) => return #{self.fp()}::ret(Err(e))
|
Err(e) => return #{self.fp()}::ret(Err(e))
|
||||||
};
|
};
|
||||||
|
@ -539,8 +707,8 @@ impl Opts<Module<'static>> {
|
||||||
let len = format_ident!("{}",vals[2].to_string());
|
let len = format_ident!("{}",vals[2].to_string());
|
||||||
quote!{
|
quote!{
|
||||||
{
|
{
|
||||||
let m = #src[(#src_ptr as usize)..][..(#len as usize)].to_owned();
|
let m = #src.read(#src_ptr as u64,#len as u64)?.as_ref().as_ref().to_owned();
|
||||||
#dst[(#dst_ptr as usize)..][..(#len as usize)].copy_from_slice(&m);
|
#dst.write(#dst_ptr as u64,&m)?;
|
||||||
()
|
()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -779,7 +947,7 @@ impl Opts<Module<'static>> {
|
||||||
#{self.fp()}::cast::<_,_,C>(#a)
|
#{self.fp()}::cast::<_,_,C>(#a)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let func = format_ident!("{func}");
|
let func = self.fname(*func);
|
||||||
if self.flags.contains(Flags::ASYNC) {
|
if self.flags.contains(Flags::ASYNC) {
|
||||||
quote! {
|
quote! {
|
||||||
#func(ctx,#root::_rexport::tuple_list::tuple_list!(#(#values),*))
|
#func(ctx,#root::_rexport::tuple_list::tuple_list!(#(#values),*))
|
||||||
|
@ -948,7 +1116,7 @@ impl Opts<Module<'static>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn render_fn(&self, f: Func) -> TokenStream {
|
pub fn render_fn(&self, f: Func) -> TokenStream {
|
||||||
let name = format_ident!("{f}");
|
let name = self.fname(f);
|
||||||
let sig = self.render_fn_sig(
|
let sig = self.render_fn_sig(
|
||||||
name.clone(),
|
name.clone(),
|
||||||
&self.module.signatures[self.module.funcs[f].sig()],
|
&self.module.signatures[self.module.funcs[f].sig()],
|
||||||
|
@ -1075,6 +1243,7 @@ impl Opts<Module<'static>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct Opts<B> {
|
pub struct Opts<B> {
|
||||||
pub crate_path: syn::Path,
|
pub crate_path: syn::Path,
|
||||||
pub module: B,
|
pub module: B,
|
||||||
|
@ -1082,6 +1251,7 @@ pub struct Opts<B> {
|
||||||
pub flags: Flags,
|
pub flags: Flags,
|
||||||
pub embed: TokenStream,
|
pub embed: TokenStream,
|
||||||
pub data: BTreeMap<Ident, TokenStream>,
|
pub data: BTreeMap<Ident, TokenStream>,
|
||||||
|
pub roots: BTreeMap<String, TokenStream>,
|
||||||
// pub cfg: Arc<dyn ImportCfg>,
|
// pub cfg: Arc<dyn ImportCfg>,
|
||||||
}
|
}
|
||||||
impl<X: AsRef<[u8]>> Opts<X> {
|
impl<X: AsRef<[u8]>> Opts<X> {
|
||||||
|
@ -1104,6 +1274,7 @@ impl<X: AsRef<[u8]>> Opts<X> {
|
||||||
flags: opts.flags,
|
flags: opts.flags,
|
||||||
embed: opts.embed.clone(),
|
embed: opts.embed.clone(),
|
||||||
data: opts.data.clone(),
|
data: opts.data.clone(),
|
||||||
|
roots: opts.roots.clone(),
|
||||||
// cfg: opts.cfg.clone(),
|
// cfg: opts.cfg.clone(),
|
||||||
};
|
};
|
||||||
return opts;
|
return opts;
|
||||||
|
@ -1115,6 +1286,20 @@ impl ToTokens for Opts<Module<'static>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
||||||
|
// let mut opts = opts.clone();
|
||||||
|
// let is = if opts.flags.contains(Flags::PIT) {
|
||||||
|
// pit_patch::get_interfaces(&opts.module)
|
||||||
|
// .unwrap()
|
||||||
|
// .into_iter()
|
||||||
|
// .collect::<BTreeSet<_>>()
|
||||||
|
// } else {
|
||||||
|
// Default::default()
|
||||||
|
// };
|
||||||
|
// if opts.flags.contains(Flags::PIT) {
|
||||||
|
// for x in is.iter() {
|
||||||
|
// pit_patch::canon::canon(&mut opts.module, &x.rid_str(), PIT_NS).unwrap();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
// let mut module = waffle::Module::from_wasm_bytes(&opts.module, &Default::default()).unwrap();
|
// let mut module = waffle::Module::from_wasm_bytes(&opts.module, &Default::default()).unwrap();
|
||||||
// module.expand_all_funcs().unwrap();
|
// module.expand_all_funcs().unwrap();
|
||||||
// let mut module = module.without_orig_bytes();
|
// let mut module = module.without_orig_bytes();
|
||||||
|
@ -1135,6 +1320,7 @@ pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
||||||
let funcs = opts.module.funcs.iter().map(|a| opts.render_fn(a));
|
let funcs = opts.module.funcs.iter().map(|a| opts.render_fn(a));
|
||||||
let mut z = vec![];
|
let mut z = vec![];
|
||||||
let mut fields = vec![];
|
let mut fields = vec![];
|
||||||
|
let mut sfields = vec![];
|
||||||
let mut fs = vec![];
|
let mut fs = vec![];
|
||||||
fs.push(opts.embed.clone());
|
fs.push(opts.embed.clone());
|
||||||
for (k, v) in opts.data.iter() {
|
for (k, v) in opts.data.iter() {
|
||||||
|
@ -1143,6 +1329,13 @@ pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
||||||
#k : #v
|
#k : #v
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (opts.flags.contains(Flags::BIND)) {
|
||||||
|
let k = format_ident!("rust_table");
|
||||||
|
fields.push(k.clone());
|
||||||
|
z.push(quote! {
|
||||||
|
#k: ::std::collections::BTreeMap<u32,AnyCell>,
|
||||||
|
})
|
||||||
|
}
|
||||||
let mut init = vec![];
|
let mut init = vec![];
|
||||||
for (t, d) in opts.module.tables.entries() {
|
for (t, d) in opts.module.tables.entries() {
|
||||||
// let dty = opts.render_ty("e! {Target}, d.ty.clone());
|
// let dty = opts.render_ty("e! {Target}, d.ty.clone());
|
||||||
|
@ -1151,6 +1344,7 @@ pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
||||||
#n: Vec<#{opts.fp()}::Value<Target>>
|
#n: Vec<#{opts.fp()}::Value<Target>>
|
||||||
});
|
});
|
||||||
fields.push(n.clone());
|
fields.push(n.clone());
|
||||||
|
sfields.push(n.clone());
|
||||||
if let Some(e) = d.func_elements.as_ref() {
|
if let Some(e) = d.func_elements.as_ref() {
|
||||||
let e = e.iter().map(|x| opts.render_fun_ref("e! {C}, *x));
|
let e = e.iter().map(|x| opts.render_fun_ref("e! {C}, *x));
|
||||||
init.push(if opts.flags.contains(Flags::ASYNC) {
|
init.push(if opts.flags.contains(Flags::ASYNC) {
|
||||||
|
@ -1177,6 +1371,7 @@ pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
||||||
#n : #t
|
#n : #t
|
||||||
});
|
});
|
||||||
fields.push(n.clone());
|
fields.push(n.clone());
|
||||||
|
sfields.push(n.clone());
|
||||||
fs.push(quote! {
|
fs.push(quote! {
|
||||||
fn #n<'a>(&'a mut self) -> &'a mut #t{
|
fn #n<'a>(&'a mut self) -> &'a mut #t{
|
||||||
return &mut self.data().#n;
|
return &mut self.data().#n;
|
||||||
|
@ -1208,32 +1403,50 @@ pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
||||||
let n = Ident::new(&me.to_string(), Span::call_site());
|
let n = Ident::new(&me.to_string(), Span::call_site());
|
||||||
match import {
|
match import {
|
||||||
None => {
|
None => {
|
||||||
|
let mut t = quote! {
|
||||||
|
Vec<u8>
|
||||||
|
};
|
||||||
|
if d.shared {
|
||||||
|
t = quote! {
|
||||||
|
::std::sync::Arc<::std::lock::Mutex<#t>>
|
||||||
|
};
|
||||||
|
};
|
||||||
z.push(quote! {
|
z.push(quote! {
|
||||||
#n : Vec<u8>
|
#n : #t
|
||||||
});
|
});
|
||||||
fields.push(n.clone());
|
fields.push(n.clone());
|
||||||
fs.push(quote! {
|
fs.push(quote! {
|
||||||
fn #n<'a>(&'a mut self) -> &'a mut Vec<u8>{
|
fn #n<'a>(&'a mut self) -> &'a mut #t{
|
||||||
return &mut self.data().#n;
|
return &mut self.data().#n;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Some((a, b)) => {
|
Some((a, b)) => {
|
||||||
if a == "!!unsafe" && b == "host" && opts.flags.contains(Flags::HOST_MEMORY) {
|
if a == "!!unsafe" && b == "host" && opts.flags.contains(Flags::HOST_MEMORY) {
|
||||||
|
} else if (a == "wasi_snapshot_preview1" || a == "wasix_32v1")
|
||||||
|
&& b == "memory"
|
||||||
|
&& opts.flags.contains(Flags::WASIX)
|
||||||
|
{
|
||||||
|
} else if a.starts_with("pit") && opts.flags.contains(Flags::PIT) {
|
||||||
} else {
|
} else {
|
||||||
// let a = bindname(&a);
|
// let a = bindname(&a);
|
||||||
// let b = bindname(&b);
|
// let b = bindname(&b);
|
||||||
let m = Ident::new(&format!("{a}_{b}"), Span::call_site());
|
let m = Ident::new(&format!("{a}_{b}"), Span::call_site());
|
||||||
let p = if opts.flags.contains(Flags::LEGACY) {
|
let mut p = if opts.flags.contains(Flags::LEGACY) {
|
||||||
quote! {dyn #root::Memory}
|
quote! {dyn #root::Memory + 'a}
|
||||||
} else {
|
} else {
|
||||||
quote! {
|
quote! {
|
||||||
impl #root::Memory
|
impl #root::Memory + 'a
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if d.shared {
|
||||||
|
p = quote! {
|
||||||
|
::std::sync::Arc<::std::lock::Mutex<#p>>
|
||||||
|
};
|
||||||
|
};
|
||||||
fs.push(quote! {
|
fs.push(quote! {
|
||||||
fn #m<'a>(&'a mut self) -> &'a mut #p;
|
fn #m<'a>(&'a mut self) -> &'a mut (#p);
|
||||||
fn #n<'a>(&'a mut self) -> &'a mut #p{
|
fn #n<'a>(&'a mut self) -> &'a mut (#p){
|
||||||
return self.#m();
|
return self.#m();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1242,8 +1455,9 @@ pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
||||||
}
|
}
|
||||||
let pk = d.initial_pages * 65536;
|
let pk = d.initial_pages * 65536;
|
||||||
init.push(quote! {
|
init.push(quote! {
|
||||||
let l = #pk.max(ctx.#n().len());
|
let l = #pk.max(ctx.#n().size()?);
|
||||||
ctx.#n().resize(l,0);
|
let s = ctx.#n().size()?;
|
||||||
|
ctx.#n().grow(l - s)?;
|
||||||
});
|
});
|
||||||
for s in d.segments.clone() {
|
for s in d.segments.clone() {
|
||||||
for (i, d) in s.data.chunks(65536).enumerate() {
|
for (i, d) in s.data.chunks(65536).enumerate() {
|
||||||
|
@ -1260,7 +1474,7 @@ pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
||||||
// let out_str = out.to_str().unwrap().to_owned();
|
// let out_str = out.to_str().unwrap().to_owned();
|
||||||
// eprintln!("emuitting data");
|
// eprintln!("emuitting data");
|
||||||
init.push(quote! {
|
init.push(quote! {
|
||||||
ctx.#n()[#o..#pk].copy_from_slice(&[#(#d),*])
|
ctx.#n().write(#o,&[#(#d),*])?
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1268,14 +1482,14 @@ pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
||||||
for xp in opts.module.exports.iter() {
|
for xp in opts.module.exports.iter() {
|
||||||
let xp = Export {
|
let xp = Export {
|
||||||
name: bindname(&xp.name),
|
name: bindname(&xp.name),
|
||||||
kind: xp.kind.clone()
|
kind: xp.kind.clone(),
|
||||||
};
|
};
|
||||||
match &xp.kind {
|
match &xp.kind {
|
||||||
ExportKind::Func(f) => {
|
ExportKind::Func(f) => {
|
||||||
let f = *f;
|
let f = *f;
|
||||||
let d = opts.render_self_sig(
|
let d = opts.render_self_sig(
|
||||||
format_ident!("{}", xp.name),
|
format_ident!("{}", xp.name),
|
||||||
format_ident!("{f}"),
|
opts.fname(f),
|
||||||
&opts.module.signatures[opts.module.funcs[f].sig()],
|
&opts.module.signatures[opts.module.funcs[f].sig()],
|
||||||
);
|
);
|
||||||
fs.push(quote! {
|
fs.push(quote! {
|
||||||
|
@ -1310,13 +1524,21 @@ pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
||||||
let x = Ident::new(&m.to_string(), Span::call_site());
|
let x = Ident::new(&m.to_string(), Span::call_site());
|
||||||
let mn = Ident::new(&xp.name, Span::call_site());
|
let mn = Ident::new(&xp.name, Span::call_site());
|
||||||
let i = quasiquote! {
|
let i = quasiquote! {
|
||||||
fn #mn(&mut self) -> &mut #{if opts.flags.contains(Flags::LEGACY) {
|
fn #mn<'a>(&'a mut self) -> &'a mut (#{
|
||||||
quote! {dyn #root::Memory}
|
let mut p = if opts.flags.contains(Flags::LEGACY) {
|
||||||
|
quote! {dyn #root::Memory + 'a}
|
||||||
} else {
|
} else {
|
||||||
quote! {
|
quote! {
|
||||||
impl #root::Memory
|
impl #root::Memory + 'a
|
||||||
}
|
}
|
||||||
}}{
|
};
|
||||||
|
if opts.module.memories[*m].shared{
|
||||||
|
p = quote!{
|
||||||
|
::std::sync::Arc<::std::lock::Mutex<#p>>
|
||||||
|
};
|
||||||
|
};
|
||||||
|
p
|
||||||
|
}){
|
||||||
return self.#x()
|
return self.#x()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1328,6 +1550,21 @@ pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
||||||
if i.module.starts_with(INTRINSIC) {
|
if i.module.starts_with(INTRINSIC) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if opts.flags.contains(Flags::WASIX) {
|
||||||
|
if i.module == "wasi_snapshot_preview1" || i.module == "wasix_32v1" {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if opts.flags.contains(Flags::BIND) {
|
||||||
|
if i.module == "wars/bind" {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if opts.flags.contains(Flags::PIT) {
|
||||||
|
if i.module.starts_with("pit") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
if let ImportKind::Func(f) = &i.kind {
|
if let ImportKind::Func(f) = &i.kind {
|
||||||
let name = format_ident!("{}_{}", bindname(&i.module), bindname(&i.name));
|
let name = format_ident!("{}_{}", bindname(&i.module), bindname(&i.name));
|
||||||
fs.push(opts.render_self_sig_import(
|
fs.push(opts.render_self_sig_import(
|
||||||
|
@ -1370,6 +1607,8 @@ pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
||||||
quasiquote! {
|
quasiquote! {
|
||||||
mod #internal_path{
|
mod #internal_path{
|
||||||
#(#funcs)*
|
#(#funcs)*
|
||||||
|
use #root::Memory;
|
||||||
|
use #root::AnyCell;
|
||||||
pub fn alloc<T>(m: &mut ::std::collections::BTreeMap<u32,T>, x: T) -> u32{
|
pub fn alloc<T>(m: &mut ::std::collections::BTreeMap<u32,T>, x: T) -> u32{
|
||||||
let mut u = 0;
|
let mut u = 0;
|
||||||
while m.contains_key(&u){
|
while m.contains_key(&u){
|
||||||
|
@ -1381,11 +1620,38 @@ pub fn go(opts: &Opts<Module<'static>>) -> proc_macro2::TokenStream {
|
||||||
pub struct #data<Target: #name + ?Sized>{
|
pub struct #data<Target: #name + ?Sized>{
|
||||||
#(#z),*
|
#(#z),*
|
||||||
}
|
}
|
||||||
pub trait #name: #{opts.fp()}::CtxSpec #{if opts.flags.contains(Flags::ASYNC){
|
impl<Target: #name + ?Sized> #root::Traverse<Target> for #data<Target>{
|
||||||
|
fn traverse<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Target::ExternRef> + 'a>{
|
||||||
|
return #{
|
||||||
|
let x = sfields.iter().map(|a|quote!{#root::Traverse::<Target>::traverse(&self.#a)});
|
||||||
|
quote!{
|
||||||
|
Box::new(::std::iter::empty()#(.chain(#x))*)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn traverse_mut<'a>(&'a mut self) -> Box<dyn Iterator<Item = &'a mut Target::ExternRef> + 'a>{
|
||||||
|
return #{
|
||||||
|
let x = sfields.iter().map(|a|quote!{#root::Traverse::<Target>::traverse_mut(&mut self.#a)});
|
||||||
|
quote!{
|
||||||
|
Box::new(::std::iter::empty()#(.chain(#x))*)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub trait #name: #{opts.fp()}::CtxSpec<ExternRef = Self::_ExternRef> #{if opts.flags.contains(Flags::ASYNC){
|
||||||
quote! {+ Send + Sync}
|
quote! {+ Send + Sync}
|
||||||
}else{
|
}else{
|
||||||
quote! {}
|
quote! {}
|
||||||
|
}} #{if opts.flags.contains(Flags::WASIX){
|
||||||
|
quote!{+ #root::wasix::XSpec}
|
||||||
|
}else{
|
||||||
|
quote! {}
|
||||||
}}{
|
}}{
|
||||||
|
type _ExternRef: Clone #{if opts.flags.contains(Flags::PIT){
|
||||||
|
quote!{+ From<#root::Pit<Vec<#{opts.fp()}::Value<Self>>>> + TryInto<#root::Pit<Vec<#{opts.fp()}::Value<Self>>>>}
|
||||||
|
}else{
|
||||||
|
quote!{}
|
||||||
|
}};
|
||||||
fn data(&mut self) -> &mut #data<Self>;
|
fn data(&mut self) -> &mut #data<Self>;
|
||||||
#(#fs)*
|
#(#fs)*
|
||||||
|
|
||||||
|
|
15
wasm-compile-layer/Cargo.toml
Normal file
15
wasm-compile-layer/Cargo.toml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[package]
|
||||||
|
name = "wasm-compile-layer"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow = "1.0.86"
|
||||||
|
portal-pc-waffle.workspace = true
|
||||||
|
proc-macro2 = "1.0.86"
|
||||||
|
quasiquote = "0.1.1"
|
||||||
|
quote = "1.0.36"
|
||||||
|
relooper = "0.1.0"
|
||||||
|
syn = "2.0.67"
|
||||||
|
waffle-func-reloop = { version = "0.1.0", path = "../waffle-func-reloop" }
|
||||||
|
wars = { version = "0.1.0", path = "../wars" }
|
16
wasm-compile-layer/src/lib.rs
Normal file
16
wasm-compile-layer/src/lib.rs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
use quote::format_ident;
|
||||||
|
use syn::Ident;
|
||||||
|
use waffle::{entity::EntityRef, Block, Func, Module};
|
||||||
|
|
||||||
|
pub fn mangle(m: &Module, f: Func, mut b: Block) -> Ident {
|
||||||
|
if let Some(d) = m.funcs[f].body() {
|
||||||
|
if d.entry == b {
|
||||||
|
b = Block::invalid()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
format_ident!("{f}_{b}")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Compiler<'a> {
|
||||||
|
pub module: &'a Module<'static>,
|
||||||
|
}
|
Loading…
Reference in a new issue