mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-02 08:17:13 +00:00
Merge branch 'ripple/se/fees' into ripple/smart-escrow
This commit is contained in:
@@ -1528,5 +1528,20 @@ pub extern "C" fn finish() -> i32 {
|
||||
)
|
||||
});
|
||||
|
||||
// ensure that the Slice index desync issue is fixed
|
||||
let empty: &[u8] = b"";
|
||||
check_result(
|
||||
unsafe {
|
||||
host::trace_account(
|
||||
empty.as_ptr(),
|
||||
empty.len(),
|
||||
account.0.as_ptr(),
|
||||
account.0.len(),
|
||||
)
|
||||
},
|
||||
34,
|
||||
"trace_account_check_desync",
|
||||
);
|
||||
|
||||
1 // <-- If we get here, finish the escrow.
|
||||
}
|
||||
|
||||
@@ -661,250 +661,251 @@ extern std::string const codecovTestsWasmHex =
|
||||
"61696e5f6b65796c6574000108686f73745f6c69620e7369676e6572735f6b65796c657400"
|
||||
"0008686f73745f6c69620d7469636b65745f6b65796c6574000108686f73745f6c69620c76"
|
||||
"61756c745f6b65796c657400010303020a0505030100110619037f01418080c0000b7f0041"
|
||||
"8f9ec0000b7f0041909ec0000b072e04066d656d6f727902000666696e697368003d0a5f5f"
|
||||
"646174615f656e6403010b5f5f686561705f6261736503020a892702460002402000200147"
|
||||
"a99ec0000b7f0041b09ec0000b072e04066d656d6f727902000666696e697368003d0a5f5f"
|
||||
"646174615f656e6403010b5f5f686561705f6261736503020a9e2702460002402000200147"
|
||||
"04402002200341004100410010001a20004100480d01418b80c000410b2000ad1001000b20"
|
||||
"0220032000ac10011a0f0b418b80c000410b2000ac1001000bbf26020a7f017e230041f001"
|
||||
"0220032000ac10011a0f0b418b80c000410b2000ac1001000bd426020a7f017e230041f001"
|
||||
"6b22002400419680c000412341004100410010001a100241b9e00041b980c000410e103c10"
|
||||
"0341b2920441c780c0004116103c200041f0006a22054200370300200041e8006a22064200"
|
||||
"0341b2920441c780c0004116103c200041f0006a22044200370300200041e8006a22064200"
|
||||
"370300200041e0006a2203420037030020004200370358200041d8006a2201412010044120"
|
||||
"41be8cc0004116103c1005410a41dd80c000410c103c200041186a2207428182848890a0c0"
|
||||
"41d88cc0004116103c1005410a41dd80c000410c103c200041186a2207428182848890a0c0"
|
||||
"8001370300200041106a2208428182848890a0c08001370300200041086a22094281828488"
|
||||
"90a0c080013703002000428182848890a0c0800137030041e980c000410e1006410141f780"
|
||||
"c0004111103c200041201006410141f780c0004111103c4181802020014114100722024114"
|
||||
"4604400240200041266a200041da006a2d00003a00002000200029005f3703c80120002000"
|
||||
"41e4006a2900003700cd01200041306a20002900cd01370000200020002f00583b01242000"
|
||||
"200028005b360027200020002903c80137002b200542003703002006420037030020034200"
|
||||
"37030020004200370358200041246a2205411420014120100822024120470d002000413a6a"
|
||||
"200028005b360027200020002903c80137002b200442003703002006420037030020034200"
|
||||
"37030020004200370358200041246a2204411420014120100822024120470d002000413a6a"
|
||||
"20002d005a3a0000200041d0016a2202200041e7006a290000220a370300200041c7006a20"
|
||||
"0a370000200041cf006a200041ef006a290000370000200041d7006a200041f7006a2d0000"
|
||||
"3a0000200020002f01583b01382000200028005b36003b2000200029005f37003f20004138"
|
||||
"6a4120410010094101418881c0004110103c20064100360200200342003703002000420037"
|
||||
"03584181802020014114100a411441d48cc000411c103c2006410036020020034200370300"
|
||||
"2000420037035841014181802020014114100b411441f08cc0004114103c20004104360298"
|
||||
"03584181802020014114100a411441ee8cc000411c103c2006410036020020034200370300"
|
||||
"2000420037035841014181802020014114100b4114418a8dc0004114103c20004104360298"
|
||||
"01200041818020360258200041d8016a2203410036020020024200370300200042003703c8"
|
||||
"0120014104200041c8016a22064114100c411441848dc0004113103c200341003602002002"
|
||||
"4200370300200042003703c801200120002802980120064114100d411441978dc000412310"
|
||||
"0120014104200041c8016a22064114100c4114419e8dc0004113103c200341003602002002"
|
||||
"4200370300200042003703c801200120002802980120064114100d411441b18dc000412310"
|
||||
"3c2003410036020020024200370300200042003703c8014101200120002802980120064114"
|
||||
"100e411441ba8dc000411b103c4189803c100f4120419881c0004110103c4189803c101041"
|
||||
"100e411441d48dc000411b103c4189803c100f4120419881c0004110103c4189803c101041"
|
||||
"2041a881c0004120103c41014189803c1011412041c881c0004118103c2001200028029801"
|
||||
"1012412041e081c0004117103c20012000280298011013412041f781c0004127103c410120"
|
||||
"0120002802980110144120419e82c000411f103c200541141015411441bd82c000410b103c"
|
||||
"200041e0016a220442003703002003420037030020024200370300200042003703c8012001"
|
||||
"200028029801200641201016412041d58dc0004113103c41c882c000410c41d482c000410b"
|
||||
"0120002802980110144120419e82c000411f103c200441141015411441bd82c000410b103c"
|
||||
"200041e0016a220542003703002003420037030020024200370300200042003703c8012001"
|
||||
"200028029801200641201016412041ef8dc0004113103c41c882c000410c41d482c000410b"
|
||||
"41df82c000410e1017410141ed82c0004109103c200041b8016a2007290300370300200041"
|
||||
"b0016a2008290300370300200041a8016a2009290300370300200020002903003703a00120"
|
||||
"0341003b010020024200370300200042003703c80120054114200041a0016a220741202006"
|
||||
"41121018411241e88dc0004107103c2003410036020020024200370300200042003703c801"
|
||||
"20074120200641141019411441ef8dc000410e103c200041003602c8012007412020064104"
|
||||
"101a410441fd8dc000410d103c20074120101b410841f682c000410d103c20074120101c41"
|
||||
"0a418383c0004114103c200041003602c8012007412020064104101d4104418a8ec000410e"
|
||||
"103c419783c000410d20054114101e412f41a483c000410d103c419783c000410d41b183c0"
|
||||
"0341003b010020024200370300200042003703c80120044114200041a0016a220741202006"
|
||||
"41121018411241828ec0004107103c2003410036020020024200370300200042003703c801"
|
||||
"20074120200641141019411441898ec000410e103c200041003602c8012007412020064104"
|
||||
"101a410441978ec000410d103c20074120101b410841f682c000410d103c20074120101c41"
|
||||
"0a418383c0004114103c200041003602c8012007412020064104101d410441a48ec000410e"
|
||||
"103c419783c000410d20044114101e412f41a483c000410d103c419783c000410d41b183c0"
|
||||
"004108101f411341b983c000410c103c419783c000410d41c583c0004108101f411241cd83"
|
||||
"c0004111103c417f41041004417141de83c000411e103c200041003602c8012006417f1004"
|
||||
"417141988ec000411e103c200041ca016a41003a0000200041003b01c80120064103100441"
|
||||
"7d41b68ec0004124103c200041003602c8012006418094ebdc031004417341da8ec0004123"
|
||||
"103c419783c000410d20054114101e412f41a483c000410d103c419783c000410d41b183c0"
|
||||
"004108101f411341b983c000410c103c200442003703002003420037030020024200370300"
|
||||
"200042003703c801200041d894ebdc036a220741082006412041001020417341fd8ec00041"
|
||||
"17103c200442003703002003420037030020024200370300200042003703c8012001200028"
|
||||
"0298012006412041001020417141948fc0004119103c4102100f416f41fc83c000411f103c"
|
||||
"417141b28ec000411e103c200041ca016a41003a0000200041003b01c80120064103100441"
|
||||
"7d41d08ec0004124103c200041003602c8012006418094ebdc031004417341f48ec0004123"
|
||||
"103c419783c000410d20044114101e412f41a483c000410d103c419783c000410d41b183c0"
|
||||
"004108101f411341b983c000410c103c200542003703002003420037030020024200370300"
|
||||
"200042003703c801200041d894ebdc036a220741082006412041001020417341978fc00041"
|
||||
"17103c200542003703002003420037030020024200370300200042003703c8012001200028"
|
||||
"0298012006412041001020417141ae8fc0004119103c4102100f416f41fc83c000411f103c"
|
||||
"417f20002802980110124171419b84c000411f103c2001417f1012417141ba84c000411f10"
|
||||
"3c20014181201012417441d984c0004120103c20072000280298011012417341f984c00041"
|
||||
"1f103c2007200028029801410110094173419885c0004118103c2001200028029801410110"
|
||||
"09417141b085c000411a103c20044200370300200342003703002002420037030020004200"
|
||||
"3703c8012007200028029801200641201008417341ad8fc0004116103c2004420037030020"
|
||||
"09417141b085c000411a103c20054200370300200342003703002002420037030020004200"
|
||||
"3703c8012007200028029801200641201008417341c78fc0004116103c2005420037030020"
|
||||
"03420037030020024200370300200042003703c80120012000280298012006412010084171"
|
||||
"41c38fc0004118103c200442003703002003420037030020024200370300200042003703c8"
|
||||
"0120054114200541142007200028029801200641201021417341db8fc000411c103c200442"
|
||||
"003703002003420037030020024200370300200042003703c8012005411420054114200120"
|
||||
"0028029801200641201021417141f78fc000411e103c200442003703002003420037030020"
|
||||
"024200370300200042003703c80141fb9dc000411420072000280298012006412010224173"
|
||||
"419590c0004119103c200442003703002003420037030020024200370300200042003703c8"
|
||||
"0141fb9dc00041142001200028029801200641201022417141ae90c000411f103c20044200"
|
||||
"3703002003420037030020024200370300200042003703c80141fb9dc000411441ca85c000"
|
||||
"4114200641201022417141cd90c0004129103c200442003703002003420037030020024200"
|
||||
"370300200042003703c80141de85c000412841fb9dc0004114200641201022417141f690c0"
|
||||
"41dd8fc0004118103c200542003703002003420037030020024200370300200042003703c8"
|
||||
"0120044114200441142007200028029801200641201021417341f58fc000411c103c200542"
|
||||
"003703002003420037030020024200370300200042003703c8012004411420044114200120"
|
||||
"00280298012006412010214171419190c000411e103c200542003703002003420037030020"
|
||||
"024200370300200042003703c80141959ec000411420072000280298012006412010224173"
|
||||
"41af90c0004119103c200542003703002003420037030020024200370300200042003703c8"
|
||||
"0141959ec00041142001200028029801200641201022417141c890c000411f103c20054200"
|
||||
"3703002003420037030020024200370300200042003703c80141959ec000411441ca85c000"
|
||||
"4114200641201022417141e790c0004129103c200542003703002003420037030020024200"
|
||||
"370300200042003703c80141de85c000412841959ec00041142006412010224171419091c0"
|
||||
"004125103c200041dc016a200041346a280100360200200041d4016a2000412c6a29010037"
|
||||
"0200200020002901243702cc01200041808080083602c801200041003b01c0012006411841"
|
||||
"fb9dc0004114200041c0016a2203410210224171419b91c000410e103c2007200028029801"
|
||||
"422a10014173418686c0004111103c200041003b01c0014102200341021007416f41a991c0"
|
||||
"00411b103c200041003b01c001410220034102100a416f41c491c000412b103c200041003b"
|
||||
"01c0014101410220034102100b416f41ef91c0004123103c4102100f416f41fc83c000411f"
|
||||
"959ec0004114200041c0016a220341021022417141b591c000410e103c2007200028029801"
|
||||
"422a10014173418686c0004111103c200041003b01c0014102200341021007416f41c391c0"
|
||||
"00411b103c200041003b01c001410220034102100a416f41de91c000412b103c200041003b"
|
||||
"01c0014101410220034102100b416f418992c0004123103c4102100f416f41fc83c000411f"
|
||||
"103c41021010416f419786c000412f103c410141021011416f41c686c0004127103c41e980"
|
||||
"c0004181201006417441ed86c000411f103c41e980c00041c10010064174418c87c000411a"
|
||||
"103c200041003b01c001200141812020034102100c4174419292c0004121103c200041003b"
|
||||
"01c001200141812020034102100d417441b392c0004131103c200041003b01c00141012001"
|
||||
"41812020034102100e417441e492c0004129103c20014181201012417441a687c000412510"
|
||||
"103c200041003b01c001200141812020034102100c417441ac92c0004121103c200041003b"
|
||||
"01c001200141812020034102100d417441cd92c0004131103c200041003b01c00141012001"
|
||||
"41812020034102100e417441fe92c0004129103c20014181201012417441a687c000412510"
|
||||
"3c20014181201013417441cb87c0004135103c4101200141812010144174418088c000412d"
|
||||
"103c20014181201015417441ad88c0004119103c419783c00041812041d482c000410b41df"
|
||||
"82c000410e1017417441ed82c0004109103c419783c000410d41d482c00041812041df82c0"
|
||||
"00410e1017417441ed82c0004109103c419783c000410d41d482c000410b41df82c0004181"
|
||||
"201017417441ed82c0004109103c200041003b01c00120014181202003410210164174418d"
|
||||
"93c0004121103c200041003b01c00141fb9dc00041812041fb9dc000411420034102102241"
|
||||
"7441ae93c0004118103c200041003b01c00120054114200541142001418120200341021023"
|
||||
"417441c693c000411f103c200041003b01c001200641812020054114200341021024417441"
|
||||
"e593c0004122103c419783c000410d200720002802980141001000417341c688c000410f10"
|
||||
"3c200042d487b6f4c7d4b1c0003700c001419783c000410d200041c095ebdc036a22044108"
|
||||
"201017417441ed82c0004109103c200041003b01c0012001418120200341021016417441a7"
|
||||
"93c0004121103c200041003b01c00141959ec00041812041959ec000411420034102102241"
|
||||
"7441c893c0004118103c200041003b01c00120044114200441142001418120200341021023"
|
||||
"417441e093c000411f103c200041003b01c001200641812020044114200341021024417441"
|
||||
"ff93c0004122103c419783c000410d200720002802980141001000417341c688c000410f10"
|
||||
"3c200042d487b6f4c7d4b1c0003700c001419783c000410d200041c095ebdc036a22054108"
|
||||
"1025417341d588c000411c103c419783c000410d2007200028029801101f417341f188c000"
|
||||
"4116103c200441082003410810264173418789c0004118103c200341082004410810264173"
|
||||
"419f89c0004118103c200041003b01ec012004410820034108200041ec016a220241024100"
|
||||
"10274173418794c0004114103c200041003b01ec0120034108200441082002410241001027"
|
||||
"4173419b94c0004114103c200041003b01ec01200441082003410820024102410010284173"
|
||||
"41af94c0004119103c200041003b01ec0120034108200441082002410241001028417341c8"
|
||||
"94c0004119103c200041003b01ec0120044108200341082002410241001029417341e194c0"
|
||||
"004119103c200041003b01ec0120034108200441082002410241001029417341fa94c00041"
|
||||
"19103c200041003b01ec012004410820034108200241024100102a4173419395c000411710"
|
||||
"3c200041003b01ec012003410820044108200241024100102a417341aa95c0004117103c20"
|
||||
"0041003b01ec01200441084103200241024100102b417341c195c0004114103c200041003b"
|
||||
"01ec01200441084103200241024100102c417341d595c0004113103c200041003b01ec0120"
|
||||
"044108200241024100102d417341e895c0004113103c200120002802980141001009417141"
|
||||
"b789c0004123103c200041003b01ec01200541142001200028029801200241021018417141"
|
||||
"fb95c000411a103c200041003b01ec0120012000280298012002410210194171419596c000"
|
||||
"4121103c200041003b01ec01200120002802980120024102101a417141b696c0004120103c"
|
||||
"4116103c200541082003410810264173418789c0004118103c200341082005410810264173"
|
||||
"419f89c0004118103c200041003b01ec012005410820034108200041ec016a220241024100"
|
||||
"1027417341a194c0004114103c200041003b01ec0120034108200541082002410241001027"
|
||||
"417341b594c0004114103c200041003b01ec01200541082003410820024102410010284173"
|
||||
"41c994c0004119103c200041003b01ec0120034108200541082002410241001028417341e2"
|
||||
"94c0004119103c200041003b01ec0120054108200341082002410241001029417341fb94c0"
|
||||
"004119103c200041003b01ec01200341082005410820024102410010294173419495c00041"
|
||||
"19103c200041003b01ec012005410820034108200241024100102a417341ad95c000411710"
|
||||
"3c200041003b01ec012003410820054108200241024100102a417341c495c0004117103c20"
|
||||
"0041003b01ec01200541084103200241024100102b417341db95c0004114103c200041003b"
|
||||
"01ec01200541084103200241024100102c417341ef95c0004113103c200041003b01ec0120"
|
||||
"054108200241024100102d4173418296c0004113103c200120002802980141001009417141"
|
||||
"b789c0004123103c200041003b01ec01200441142001200028029801200241021018417141"
|
||||
"9596c000411a103c200041003b01ec012001200028029801200241021019417141af96c000"
|
||||
"4121103c200041003b01ec01200120002802980120024102101a417141d096c0004120103c"
|
||||
"2001200028029801101b417141da89c0004120103c2001200028029801101c417141fa89c0"
|
||||
"004127103c200041003602ec01200120002802980120024104101d417141d696c000412110"
|
||||
"3c200041003b01ec012001200028029801200241021008417141f796c0004123103c200041"
|
||||
"003b01ec012001200028029801410120024102102e4171419a97c0004121103c200041003b"
|
||||
"01ec01200120002802980122042005411420012004200241021023417141bb97c000412710"
|
||||
"3c200041003b01ec01200541142001200028029801220420012004200241021023417141e2"
|
||||
"97c0004127103c200041003b01ec0120012000280298012005411420024102102f41714189"
|
||||
"98c0004125103c200041003b01ec0120054114200120002802980120024102102f417141ae"
|
||||
"98c0004125103c200041003b01ec01200120002802980120054114200241021030417141d3"
|
||||
"98c000412c103c200041003b01ec01200541142001200028029801200241021030417141ff"
|
||||
"98c000412c103c200041003b01ec012001200028029801200241021031417141ab99c00041"
|
||||
"1f103c200041003b01ec0120012000280298014101200241021032417141ca99c000412210"
|
||||
"3c200041003b01ec0120012000280298012005411441ca85c0004114200241021021417141"
|
||||
"ec99c0004121103c200041003b01ec0120054114200120002802980141ca85c00041142002"
|
||||
"410210214171418d9ac0004121103c200041003b01ec012001200028029801410120024102"
|
||||
"1033417141ae9ac0004128103c200041003b01ec0120064118200120002802980120024102"
|
||||
"1024417141d69ac0004123103c200041003b01ec0120012000280298014101200241021034"
|
||||
"417141f99ac0004125103c200041003b01ec01200120002802980141012002410210354171"
|
||||
"419e9bc0004121103c200041003b01ec0120012000280298014101200241021036417141bf"
|
||||
"9bc0004122103c200041003b01ec0120012000280298012005411441012002410210374171"
|
||||
"41e19bc0004124103c200041003b01ec012005411420012000280298014101200241021037"
|
||||
"417141859cc0004124103c200041003b01ec01200120002802980141012002410210384171"
|
||||
"41a99cc000412f103c200041003b01ec012001200028029801200241021039417141d89cc0"
|
||||
"004123103c200041003b01ec012001200028029801410120024102103a417141fb9cc00041"
|
||||
"22103c200041003b01ec012001200028029801410120024102103b4171419d9dc000412110"
|
||||
"3c200041003b01ec01200120002802980141a18ac0004120200241021018417141be9dc000"
|
||||
"004127103c200041003602ec01200120002802980120024104101d417141f096c000412110"
|
||||
"3c200041003b01ec0120012000280298012002410210084171419197c0004123103c200041"
|
||||
"003b01ec012001200028029801410120024102102e417141b497c0004121103c200041003b"
|
||||
"01ec01200120002802980122052004411420012005200241021023417141d597c000412710"
|
||||
"3c200041003b01ec01200441142001200028029801220520012005200241021023417141fc"
|
||||
"97c0004127103c200041003b01ec0120012000280298012004411420024102102f417141a3"
|
||||
"98c0004125103c200041003b01ec0120044114200120002802980120024102102f417141c8"
|
||||
"98c0004125103c200041003b01ec01200120002802980120044114200241021030417141ed"
|
||||
"98c000412c103c200041003b01ec0120044114200120002802980120024102103041714199"
|
||||
"99c000412c103c200041003b01ec012001200028029801200241021031417141c599c00041"
|
||||
"1f103c200041003b01ec0120012000280298014101200241021032417141e499c000412210"
|
||||
"3c200041003b01ec0120012000280298012004411441ca85c0004114200241021021417141"
|
||||
"869ac0004121103c200041003b01ec0120044114200120002802980141ca85c00041142002"
|
||||
"41021021417141a79ac0004121103c200041003b01ec012001200028029801410120024102"
|
||||
"1033417141c89ac0004128103c200041003b01ec0120064118200120002802980120024102"
|
||||
"1024417141f09ac0004123103c200041003b01ec0120012000280298014101200241021034"
|
||||
"417141939bc0004125103c200041003b01ec01200120002802980141012002410210354171"
|
||||
"41b89bc0004121103c200041003b01ec0120012000280298014101200241021036417141d9"
|
||||
"9bc0004122103c200041003b01ec0120012000280298012004411441012002410210374171"
|
||||
"41fb9bc0004124103c200041003b01ec012004411420012000280298014101200241021037"
|
||||
"4171419f9cc0004124103c200041003b01ec01200120002802980141012002410210384171"
|
||||
"41c39cc000412f103c200041003b01ec012001200028029801200241021039417141f29cc0"
|
||||
"004123103c200041003b01ec012001200028029801410120024102103a417141959dc00041"
|
||||
"22103c200041003b01ec012001200028029801410120024102103b417141b79dc000412110"
|
||||
"3c200041003b01ec01200120002802980141a18ac0004120200241021018417141d89dc000"
|
||||
"411c103c419783c000410d2001200028029801101e417141c18ac0004122103c419797abdd"
|
||||
"03410d41a18ac000412041001000417341e38ac0004110103c419797abdd03410d20034108"
|
||||
"1025417341f38ac000411d103c419797abdd03410d20054114101e417341908bc000411810"
|
||||
"1025417341f38ac000411d103c419797abdd03410d20044114101e417341908bc000411810"
|
||||
"3c419797abdd03410d41b183c0004108101f417341a88bc0004117103c2001200028029801"
|
||||
"200141812041001000417441bf8bc000410e103c200141812042011001417441cd8bc00041"
|
||||
"12103c419783c000418120200341081025417441df8bc000411b103c419783c00041812020"
|
||||
"054114101e417441fa8bc0004116103c419783c00041812041b183c0004108101f41744190"
|
||||
"044114101e417441fa8bc0004116103c419783c00041812041b183c0004108101f41744190"
|
||||
"8cc0004115103c419783c000410d2001200028029801101f417141a58cc0004119103c2000"
|
||||
"41003b01ec01200120002802980120054114200241021024417141da9dc0004121103c2000"
|
||||
"41f0016a240041010f0b0b418080c000410b417f20022002417f4e1bac1001000b0be61d02"
|
||||
"00418080c0000bde056572726f725f636f64653d54455354204641494c4544242424242420"
|
||||
"5354415254494e47205741534d20455845435554494f4e2024242424246765745f6c656467"
|
||||
"65725f73716e6765745f706172656e745f6c65646765725f74696d656765745f626173655f"
|
||||
"666565746573745f616d656e646d656e74616d656e646d656e745f656e61626c6564636163"
|
||||
"68655f6c65646765725f6f626a6765745f74785f61727261795f6c656e6765745f63757272"
|
||||
"656e745f6c65646765725f6f626a5f61727261795f6c656e6765745f6c65646765725f6f62"
|
||||
"6a5f61727261795f6c656e6765745f74785f6e65737465645f61727261795f6c656e676574"
|
||||
"5f63757272656e745f6c65646765725f6f626a5f6e65737465645f61727261795f6c656e67"
|
||||
"65745f6c65646765725f6f626a5f6e65737465645f61727261795f6c656e7570646174655f"
|
||||
"6461746174657374206d65737361676574657374207075626b657974657374207369676e61"
|
||||
"74757265636865636b5f7369676765745f6e66745f666c6167736765745f6e66745f747261"
|
||||
"6e736665725f66656574657374696e6720747261636574726163655f6163636f756e744000"
|
||||
"00000000005f74726163655f616d6f756e74400000000000000074726163655f616d6f756e"
|
||||
"745f7a65726f6765745f706172656e745f6c65646765725f686173685f6e65675f70747267"
|
||||
"65745f74785f61727261795f6c656e5f696e76616c69645f736669656c646765745f74785f"
|
||||
"6e65737465645f61727261795f6c656e5f6e65675f7074726765745f74785f6e6573746564"
|
||||
"5f61727261795f6c656e5f6e65675f6c656e6765745f74785f6e65737465645f6172726179"
|
||||
"5f6c656e5f746f6f5f6c6f6e676765745f74785f6e65737465645f61727261795f6c656e5f"
|
||||
"7074725f6f6f6263616368655f6c65646765725f6f626a5f7074725f6f6f6263616368655f"
|
||||
"6c65646765725f6f626a5f77726f6e675f6c656e5553443030303030303030303030303030"
|
||||
"30303000418686c0000bf51774726163655f6e756d5f6f6f625f7374726765745f63757272"
|
||||
"656e745f6c65646765725f6f626a5f61727261795f6c656e5f696e76616c69645f73666965"
|
||||
"6c646765745f6c65646765725f6f626a5f61727261795f6c656e5f696e76616c69645f7366"
|
||||
"69656c64616d656e646d656e745f656e61626c65645f746f6f5f6269675f736c696365616d"
|
||||
"656e646d656e745f656e61626c65645f746f6f5f6c6f6e676765745f74785f6e6573746564"
|
||||
"5f61727261795f6c656e5f746f6f5f6269675f736c6963656765745f63757272656e745f6c"
|
||||
"65646765725f6f626a5f6e65737465645f61727261795f6c656e5f746f6f5f6269675f736c"
|
||||
"6963656765745f6c65646765725f6f626a5f6e65737465645f61727261795f6c656e5f746f"
|
||||
"6f5f6269675f736c6963657570646174655f646174615f746f6f5f6269675f736c69636574"
|
||||
"726163655f6f6f625f736c69636574726163655f6f70617175655f666c6f61745f6f6f625f"
|
||||
"736c69636574726163655f616d6f756e745f6f6f625f736c696365666c6f61745f636f6d70"
|
||||
"6172655f6f6f625f736c69636531666c6f61745f636f6d706172655f6f6f625f736c696365"
|
||||
"3263616368655f6c65646765725f6f626a5f77726f6e675f73697a655f75696e7432353667"
|
||||
"65745f6e66745f666c6167735f77726f6e675f73697a655f75696e743235366765745f6e66"
|
||||
"745f7472616e736665725f6665655f77726f6e675f73697a655f75696e7432353630303030"
|
||||
"3030303030303030303030303030303030303030303030303030303174726163655f616363"
|
||||
"6f756e745f77726f6e675f73697a655f6163636f756e74696474726163655f6f6f625f7374"
|
||||
"72696e6774726163655f6f70617175655f666c6f61745f6f6f625f737472696e6774726163"
|
||||
"655f6163636f756e745f6f6f625f737472696e6774726163655f616d6f756e745f6f6f625f"
|
||||
"737472696e6774726163655f746f6f5f6c6f6e6774726163655f6e756d5f746f6f5f6c6f6e"
|
||||
"6774726163655f6f70617175655f666c6f61745f746f6f5f6c6f6e6774726163655f616363"
|
||||
"6f756e745f746f6f5f6c6f6e6774726163655f616d6f756e745f746f6f5f6c6f6e67747261"
|
||||
"63655f616d6f756e745f77726f6e675f6c656e6774686765745f706172656e745f6c656467"
|
||||
"65725f686173686765745f63757272656e745f6c65646765725f6f626a5f6669656c646765"
|
||||
"745f6c65646765725f6f626a5f6669656c646765745f74785f6e65737465645f6669656c64"
|
||||
"6765745f63757272656e745f6c65646765725f6f626a5f6e65737465645f6669656c646765"
|
||||
"745f6c65646765725f6f626a5f6e65737465645f6669656c64636f6d707574655f73686135"
|
||||
"31325f68616c666765745f6e66746765745f6e66745f6973737565726765745f6e66745f74"
|
||||
"61786f6e6765745f6e66745f73657269616c6765745f706172656e745f6c65646765725f68"
|
||||
"6173685f6e65675f6c656e6765745f706172656e745f6c65646765725f686173685f627566"
|
||||
"5f746f6f5f736d616c6c6765745f706172656e745f6c65646765725f686173685f6c656e5f"
|
||||
"746f6f5f6c6f6e67666c6f61745f66726f6d5f75696e745f6c656e5f6f6f62666c6f61745f"
|
||||
"66726f6d5f75696e745f77726f6e675f6c656e6163636f756e745f6b65796c65745f6c656e"
|
||||
"5f6f6f626163636f756e745f6b65796c65745f77726f6e675f6c656e6c696e655f6b65796c"
|
||||
"65745f6c656e5f6f6f625f63757272656e63796c696e655f6b65796c65745f77726f6e675f"
|
||||
"6c656e5f63757272656e6379616d6d5f6b65796c65745f6c656e5f6f6f625f617373657432"
|
||||
"616d6d5f6b65796c65745f6c656e5f77726f6e675f6c656e5f617373657432616d6d5f6b65"
|
||||
"796c65745f6c656e5f77726f6e675f6e6f6e5f7872705f63757272656e63795f6c656e616d"
|
||||
"6d5f6b65796c65745f6c656e5f77726f6e675f7872705f63757272656e63795f6c656e616d"
|
||||
"6d5f6b65796c65745f6d70746765745f74785f6669656c645f696e76616c69645f73666965"
|
||||
"6c646765745f63757272656e745f6c65646765725f6f626a5f6669656c645f696e76616c69"
|
||||
"645f736669656c646765745f6c65646765725f6f626a5f6669656c645f696e76616c69645f"
|
||||
"736669656c646765745f74785f6e65737465645f6669656c645f746f6f5f6269675f736c69"
|
||||
"63656765745f63757272656e745f6c65646765725f6f626a5f6e65737465645f6669656c64"
|
||||
"5f746f6f5f6269675f736c6963656765745f6c65646765725f6f626a5f6e65737465645f66"
|
||||
"69656c645f746f6f5f6269675f736c696365636f6d707574655f7368613531325f68616c66"
|
||||
"5f746f6f5f6269675f736c696365616d6d5f6b65796c65745f746f6f5f6269675f736c6963"
|
||||
"6563726564656e7469616c5f6b65796c65745f746f6f5f6269675f736c6963656d70746f6b"
|
||||
"656e5f6b65796c65745f746f6f5f6269675f736c6963655f6d70746964666c6f61745f6164"
|
||||
"645f6f6f625f736c69636531666c6f61745f6164645f6f6f625f736c69636532666c6f6174"
|
||||
"5f73756274726163745f6f6f625f736c69636531666c6f61745f73756274726163745f6f6f"
|
||||
"625f736c69636532666c6f61745f6d756c7469706c795f6f6f625f736c69636531666c6f61"
|
||||
"745f6d756c7469706c795f6f6f625f736c69636532666c6f61745f6469766964655f6f6f62"
|
||||
"5f736c69636531666c6f61745f6469766964655f6f6f625f736c69636532666c6f61745f72"
|
||||
"6f6f745f6f6f625f736c696365666c6f61745f706f775f6f6f625f736c696365666c6f6174"
|
||||
"5f6c6f675f6f6f625f736c6963656765745f6e66745f77726f6e675f73697a655f75696e74"
|
||||
"3235366765745f6e66745f6973737565725f77726f6e675f73697a655f75696e7432353667"
|
||||
"65745f6e66745f7461786f6e5f77726f6e675f73697a655f75696e743235366765745f6e66"
|
||||
"745f73657269616c5f77726f6e675f73697a655f75696e743235366163636f756e745f6b65"
|
||||
"796c65745f77726f6e675f73697a655f6163636f756e746964636865636b5f6b65796c6574"
|
||||
"5f77726f6e675f73697a655f6163636f756e74696463726564656e7469616c5f6b65796c65"
|
||||
"745f77726f6e675f73697a655f6163636f756e7469643163726564656e7469616c5f6b6579"
|
||||
"6c65745f77726f6e675f73697a655f6163636f756e7469643264656c65676174655f6b6579"
|
||||
"6c65745f77726f6e675f73697a655f6163636f756e7469643164656c65676174655f6b6579"
|
||||
"6c65745f77726f6e675f73697a655f6163636f756e746964326465706f7369745f70726561"
|
||||
"7574685f6b65796c65745f77726f6e675f73697a655f6163636f756e746964316465706f73"
|
||||
"69745f707265617574685f6b65796c65745f77726f6e675f73697a655f6163636f756e7469"
|
||||
"64326469645f6b65796c65745f77726f6e675f73697a655f6163636f756e74696465736372"
|
||||
"6f775f6b65796c65745f77726f6e675f73697a655f6163636f756e7469646c696e655f6b65"
|
||||
"796c65745f77726f6e675f73697a655f6163636f756e746964316c696e655f6b65796c6574"
|
||||
"5f77726f6e675f73697a655f6163636f756e746964326d70745f69737375616e63655f6b65"
|
||||
"796c65745f77726f6e675f73697a655f6163636f756e7469646d70746f6b656e5f6b65796c"
|
||||
"65745f77726f6e675f73697a655f6163636f756e7469646e66745f6f666665725f6b65796c"
|
||||
"65745f77726f6e675f73697a655f6163636f756e7469646f666665725f6b65796c65745f77"
|
||||
"726f6e675f73697a655f6163636f756e7469646f7261636c655f6b65796c65745f77726f6e"
|
||||
"675f73697a655f6163636f756e7469647061796368616e5f6b65796c65745f77726f6e675f"
|
||||
"73697a655f6163636f756e746964317061796368616e5f6b65796c65745f77726f6e675f73"
|
||||
"697a655f6163636f756e746964327065726d697373696f6e65645f646f6d61696e5f6b6579"
|
||||
"6c65745f77726f6e675f73697a655f6163636f756e7469647369676e6572735f6b65796c65"
|
||||
"745f77726f6e675f73697a655f6163636f756e7469647469636b65745f6b65796c65745f77"
|
||||
"726f6e675f73697a655f6163636f756e7469647661756c745f6b65796c65745f77726f6e67"
|
||||
"5f73697a655f6163636f756e7469646765745f6e66745f77726f6e675f73697a655f616363"
|
||||
"6f756e7469646d70746f6b656e5f6b65796c65745f6d707469645f77726f6e675f6c656e67"
|
||||
"7468004d0970726f64756365727302086c616e6775616765010452757374000c70726f6365"
|
||||
"737365642d6279010572757374631d312e38352e3120283465623136313235302032303235"
|
||||
"2d30332d313529002c0f7461726765745f6665617475726573022b0f6d757461626c652d67"
|
||||
"6c6f62616c732b087369676e2d657874";
|
||||
"41003b01ec01200120002802980120044114200241021024417141f49dc0004121103c4101"
|
||||
"410020044114101e412241be8cc000411a103c200041f0016a240041010f0b0b418080c000"
|
||||
"410b417f20022002417f4e1bac1001000b0b801e0200418080c0000bde056572726f725f63"
|
||||
"6f64653d54455354204641494c45442424242424205354415254494e47205741534d204558"
|
||||
"45435554494f4e2024242424246765745f6c65646765725f73716e6765745f706172656e74"
|
||||
"5f6c65646765725f74696d656765745f626173655f666565746573745f616d656e646d656e"
|
||||
"74616d656e646d656e745f656e61626c656463616368655f6c65646765725f6f626a676574"
|
||||
"5f74785f61727261795f6c656e6765745f63757272656e745f6c65646765725f6f626a5f61"
|
||||
"727261795f6c656e6765745f6c65646765725f6f626a5f61727261795f6c656e6765745f74"
|
||||
"785f6e65737465645f61727261795f6c656e6765745f63757272656e745f6c65646765725f"
|
||||
"6f626a5f6e65737465645f61727261795f6c656e6765745f6c65646765725f6f626a5f6e65"
|
||||
"737465645f61727261795f6c656e7570646174655f6461746174657374206d657373616765"
|
||||
"74657374207075626b657974657374207369676e6174757265636865636b5f736967676574"
|
||||
"5f6e66745f666c6167736765745f6e66745f7472616e736665725f66656574657374696e67"
|
||||
"20747261636574726163655f6163636f756e74400000000000005f74726163655f616d6f75"
|
||||
"6e74400000000000000074726163655f616d6f756e745f7a65726f6765745f706172656e74"
|
||||
"5f6c65646765725f686173685f6e65675f7074726765745f74785f61727261795f6c656e5f"
|
||||
"696e76616c69645f736669656c646765745f74785f6e65737465645f61727261795f6c656e"
|
||||
"5f6e65675f7074726765745f74785f6e65737465645f61727261795f6c656e5f6e65675f6c"
|
||||
"656e6765745f74785f6e65737465645f61727261795f6c656e5f746f6f5f6c6f6e67676574"
|
||||
"5f74785f6e65737465645f61727261795f6c656e5f7074725f6f6f6263616368655f6c6564"
|
||||
"6765725f6f626a5f7074725f6f6f6263616368655f6c65646765725f6f626a5f77726f6e67"
|
||||
"5f6c656e555344303030303030303030303030303030303000418686c0000b8f1874726163"
|
||||
"655f6e756d5f6f6f625f7374726765745f63757272656e745f6c65646765725f6f626a5f61"
|
||||
"727261795f6c656e5f696e76616c69645f736669656c646765745f6c65646765725f6f626a"
|
||||
"5f61727261795f6c656e5f696e76616c69645f736669656c64616d656e646d656e745f656e"
|
||||
"61626c65645f746f6f5f6269675f736c696365616d656e646d656e745f656e61626c65645f"
|
||||
"746f6f5f6c6f6e676765745f74785f6e65737465645f61727261795f6c656e5f746f6f5f62"
|
||||
"69675f736c6963656765745f63757272656e745f6c65646765725f6f626a5f6e6573746564"
|
||||
"5f61727261795f6c656e5f746f6f5f6269675f736c6963656765745f6c65646765725f6f62"
|
||||
"6a5f6e65737465645f61727261795f6c656e5f746f6f5f6269675f736c6963657570646174"
|
||||
"655f646174615f746f6f5f6269675f736c69636574726163655f6f6f625f736c6963657472"
|
||||
"6163655f6f70617175655f666c6f61745f6f6f625f736c69636574726163655f616d6f756e"
|
||||
"745f6f6f625f736c696365666c6f61745f636f6d706172655f6f6f625f736c69636531666c"
|
||||
"6f61745f636f6d706172655f6f6f625f736c6963653263616368655f6c65646765725f6f62"
|
||||
"6a5f77726f6e675f73697a655f75696e743235366765745f6e66745f666c6167735f77726f"
|
||||
"6e675f73697a655f75696e743235366765745f6e66745f7472616e736665725f6665655f77"
|
||||
"726f6e675f73697a655f75696e743235363030303030303030303030303030303030303030"
|
||||
"30303030303030303030303174726163655f6163636f756e745f77726f6e675f73697a655f"
|
||||
"6163636f756e74696474726163655f6f6f625f737472696e6774726163655f6f7061717565"
|
||||
"5f666c6f61745f6f6f625f737472696e6774726163655f6163636f756e745f6f6f625f7374"
|
||||
"72696e6774726163655f616d6f756e745f6f6f625f737472696e6774726163655f746f6f5f"
|
||||
"6c6f6e6774726163655f6e756d5f746f6f5f6c6f6e6774726163655f6f70617175655f666c"
|
||||
"6f61745f746f6f5f6c6f6e6774726163655f6163636f756e745f746f6f5f6c6f6e67747261"
|
||||
"63655f616d6f756e745f746f6f5f6c6f6e6774726163655f616d6f756e745f77726f6e675f"
|
||||
"6c656e67746874726163655f6163636f756e745f636865636b5f646573796e636765745f70"
|
||||
"6172656e745f6c65646765725f686173686765745f63757272656e745f6c65646765725f6f"
|
||||
"626a5f6669656c646765745f6c65646765725f6f626a5f6669656c646765745f74785f6e65"
|
||||
"737465645f6669656c646765745f63757272656e745f6c65646765725f6f626a5f6e657374"
|
||||
"65645f6669656c646765745f6c65646765725f6f626a5f6e65737465645f6669656c64636f"
|
||||
"6d707574655f7368613531325f68616c666765745f6e66746765745f6e66745f6973737565"
|
||||
"726765745f6e66745f7461786f6e6765745f6e66745f73657269616c6765745f706172656e"
|
||||
"745f6c65646765725f686173685f6e65675f6c656e6765745f706172656e745f6c65646765"
|
||||
"725f686173685f6275665f746f6f5f736d616c6c6765745f706172656e745f6c6564676572"
|
||||
"5f686173685f6c656e5f746f6f5f6c6f6e67666c6f61745f66726f6d5f75696e745f6c656e"
|
||||
"5f6f6f62666c6f61745f66726f6d5f75696e745f77726f6e675f6c656e6163636f756e745f"
|
||||
"6b65796c65745f6c656e5f6f6f626163636f756e745f6b65796c65745f77726f6e675f6c65"
|
||||
"6e6c696e655f6b65796c65745f6c656e5f6f6f625f63757272656e63796c696e655f6b6579"
|
||||
"6c65745f77726f6e675f6c656e5f63757272656e6379616d6d5f6b65796c65745f6c656e5f"
|
||||
"6f6f625f617373657432616d6d5f6b65796c65745f6c656e5f77726f6e675f6c656e5f6173"
|
||||
"73657432616d6d5f6b65796c65745f6c656e5f77726f6e675f6e6f6e5f7872705f63757272"
|
||||
"656e63795f6c656e616d6d5f6b65796c65745f6c656e5f77726f6e675f7872705f63757272"
|
||||
"656e63795f6c656e616d6d5f6b65796c65745f6d70746765745f74785f6669656c645f696e"
|
||||
"76616c69645f736669656c646765745f63757272656e745f6c65646765725f6f626a5f6669"
|
||||
"656c645f696e76616c69645f736669656c646765745f6c65646765725f6f626a5f6669656c"
|
||||
"645f696e76616c69645f736669656c646765745f74785f6e65737465645f6669656c645f74"
|
||||
"6f6f5f6269675f736c6963656765745f63757272656e745f6c65646765725f6f626a5f6e65"
|
||||
"737465645f6669656c645f746f6f5f6269675f736c6963656765745f6c65646765725f6f62"
|
||||
"6a5f6e65737465645f6669656c645f746f6f5f6269675f736c696365636f6d707574655f73"
|
||||
"68613531325f68616c665f746f6f5f6269675f736c696365616d6d5f6b65796c65745f746f"
|
||||
"6f5f6269675f736c69636563726564656e7469616c5f6b65796c65745f746f6f5f6269675f"
|
||||
"736c6963656d70746f6b656e5f6b65796c65745f746f6f5f6269675f736c6963655f6d7074"
|
||||
"6964666c6f61745f6164645f6f6f625f736c69636531666c6f61745f6164645f6f6f625f73"
|
||||
"6c69636532666c6f61745f73756274726163745f6f6f625f736c69636531666c6f61745f73"
|
||||
"756274726163745f6f6f625f736c69636532666c6f61745f6d756c7469706c795f6f6f625f"
|
||||
"736c69636531666c6f61745f6d756c7469706c795f6f6f625f736c69636532666c6f61745f"
|
||||
"6469766964655f6f6f625f736c69636531666c6f61745f6469766964655f6f6f625f736c69"
|
||||
"636532666c6f61745f726f6f745f6f6f625f736c696365666c6f61745f706f775f6f6f625f"
|
||||
"736c696365666c6f61745f6c6f675f6f6f625f736c6963656765745f6e66745f77726f6e67"
|
||||
"5f73697a655f75696e743235366765745f6e66745f6973737565725f77726f6e675f73697a"
|
||||
"655f75696e743235366765745f6e66745f7461786f6e5f77726f6e675f73697a655f75696e"
|
||||
"743235366765745f6e66745f73657269616c5f77726f6e675f73697a655f75696e74323536"
|
||||
"6163636f756e745f6b65796c65745f77726f6e675f73697a655f6163636f756e7469646368"
|
||||
"65636b5f6b65796c65745f77726f6e675f73697a655f6163636f756e74696463726564656e"
|
||||
"7469616c5f6b65796c65745f77726f6e675f73697a655f6163636f756e7469643163726564"
|
||||
"656e7469616c5f6b65796c65745f77726f6e675f73697a655f6163636f756e746964326465"
|
||||
"6c65676174655f6b65796c65745f77726f6e675f73697a655f6163636f756e746964316465"
|
||||
"6c65676174655f6b65796c65745f77726f6e675f73697a655f6163636f756e746964326465"
|
||||
"706f7369745f707265617574685f6b65796c65745f77726f6e675f73697a655f6163636f75"
|
||||
"6e746964316465706f7369745f707265617574685f6b65796c65745f77726f6e675f73697a"
|
||||
"655f6163636f756e746964326469645f6b65796c65745f77726f6e675f73697a655f616363"
|
||||
"6f756e746964657363726f775f6b65796c65745f77726f6e675f73697a655f6163636f756e"
|
||||
"7469646c696e655f6b65796c65745f77726f6e675f73697a655f6163636f756e746964316c"
|
||||
"696e655f6b65796c65745f77726f6e675f73697a655f6163636f756e746964326d70745f69"
|
||||
"737375616e63655f6b65796c65745f77726f6e675f73697a655f6163636f756e7469646d70"
|
||||
"746f6b656e5f6b65796c65745f77726f6e675f73697a655f6163636f756e7469646e66745f"
|
||||
"6f666665725f6b65796c65745f77726f6e675f73697a655f6163636f756e7469646f666665"
|
||||
"725f6b65796c65745f77726f6e675f73697a655f6163636f756e7469646f7261636c655f6b"
|
||||
"65796c65745f77726f6e675f73697a655f6163636f756e7469647061796368616e5f6b6579"
|
||||
"6c65745f77726f6e675f73697a655f6163636f756e746964317061796368616e5f6b65796c"
|
||||
"65745f77726f6e675f73697a655f6163636f756e746964327065726d697373696f6e65645f"
|
||||
"646f6d61696e5f6b65796c65745f77726f6e675f73697a655f6163636f756e746964736967"
|
||||
"6e6572735f6b65796c65745f77726f6e675f73697a655f6163636f756e7469647469636b65"
|
||||
"745f6b65796c65745f77726f6e675f73697a655f6163636f756e7469647661756c745f6b65"
|
||||
"796c65745f77726f6e675f73697a655f6163636f756e7469646765745f6e66745f77726f6e"
|
||||
"675f73697a655f6163636f756e7469646d70746f6b656e5f6b65796c65745f6d707469645f"
|
||||
"77726f6e675f6c656e677468004d0970726f64756365727302086c616e6775616765010452"
|
||||
"757374000c70726f6365737365642d6279010572757374631d312e38352e31202834656231"
|
||||
"363132353020323032352d30332d313529002c0f7461726765745f6665617475726573022b"
|
||||
"0f6d757461626c652d676c6f62616c732b087369676e2d657874";
|
||||
|
||||
extern std::string const floatTestsWasmHex =
|
||||
"0061736d0100000001430860077f7f7f7f7f7f7f017f60057f7f7f7f7f017f60047f7f7f7f"
|
||||
|
||||
@@ -7,42 +7,93 @@
|
||||
|
||||
namespace ripple {
|
||||
|
||||
struct WasmiResult
|
||||
template <class T, void (*Create)(T*, size_t), void (*Destroy)(T*)>
|
||||
struct WasmVec
|
||||
{
|
||||
wasm_val_vec_t r;
|
||||
bool f; // failure flag
|
||||
T vec_;
|
||||
|
||||
WasmiResult(unsigned N = 0) : r{0, nullptr}, f(false)
|
||||
WasmVec(size_t s = 0) : vec_ WASM_EMPTY_VEC
|
||||
{
|
||||
if (N)
|
||||
wasm_val_vec_new_uninitialized(&r, N);
|
||||
if (s > 0)
|
||||
Create(&vec_, s); // zeroes memory
|
||||
}
|
||||
|
||||
~WasmiResult()
|
||||
~WasmVec()
|
||||
{
|
||||
if (r.size)
|
||||
wasm_val_vec_delete(&r);
|
||||
clear();
|
||||
}
|
||||
|
||||
WasmiResult(WasmiResult const&) = delete;
|
||||
WasmiResult&
|
||||
operator=(WasmiResult const&) = delete;
|
||||
WasmVec(WasmVec const&) = delete;
|
||||
WasmVec&
|
||||
operator=(WasmVec const&) = delete;
|
||||
|
||||
WasmiResult(WasmiResult&& o)
|
||||
WasmVec(WasmVec&& other) noexcept : vec_ WASM_EMPTY_VEC
|
||||
{
|
||||
*this = std::move(o);
|
||||
*this = std::move(other);
|
||||
}
|
||||
|
||||
WasmiResult&
|
||||
operator=(WasmiResult&& o)
|
||||
WasmVec&
|
||||
operator=(WasmVec&& other) noexcept
|
||||
{
|
||||
r = o.r;
|
||||
o.r = {0, nullptr};
|
||||
f = o.f;
|
||||
o.f = false;
|
||||
if (this != &other)
|
||||
{
|
||||
clear();
|
||||
vec_ = other.vec_;
|
||||
other.vec_ = WASM_EMPTY_VEC;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
// operator wasm_val_vec_t &() {return r;}
|
||||
|
||||
void
|
||||
clear()
|
||||
{
|
||||
Destroy(&vec_); // call destructor for every elements too
|
||||
vec_ = WASM_EMPTY_VEC;
|
||||
}
|
||||
|
||||
T
|
||||
release()
|
||||
{
|
||||
T result = vec_;
|
||||
vec_ = WASM_EMPTY_VEC;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
using WasmValtypeVec = WasmVec<
|
||||
wasm_valtype_vec_t,
|
||||
&wasm_valtype_vec_new_uninitialized,
|
||||
&wasm_valtype_vec_delete>;
|
||||
using WasmValVec = WasmVec<
|
||||
wasm_val_vec_t,
|
||||
&wasm_val_vec_new_uninitialized,
|
||||
&wasm_val_vec_delete>;
|
||||
using WasmExternVec = WasmVec<
|
||||
wasm_extern_vec_t,
|
||||
&wasm_extern_vec_new_uninitialized,
|
||||
&wasm_extern_vec_delete>;
|
||||
using WasmExporttypeVec = WasmVec<
|
||||
wasm_exporttype_vec_t,
|
||||
&wasm_exporttype_vec_new_uninitialized,
|
||||
&wasm_exporttype_vec_delete>;
|
||||
using WasmImporttypeVec = WasmVec<
|
||||
wasm_importtype_vec_t,
|
||||
&wasm_importtype_vec_new_uninitialized,
|
||||
&wasm_importtype_vec_delete>;
|
||||
|
||||
struct WasmiResult
|
||||
{
|
||||
WasmValVec r;
|
||||
bool f; // failure flag
|
||||
|
||||
WasmiResult(unsigned N = 0) : r(N), f(false)
|
||||
{
|
||||
}
|
||||
|
||||
~WasmiResult() = default;
|
||||
WasmiResult(WasmiResult&& o) = default;
|
||||
WasmiResult&
|
||||
operator=(WasmiResult&& o) = default;
|
||||
};
|
||||
|
||||
using ModulePtr = std::unique_ptr<wasm_module_t, decltype(&wasm_module_delete)>;
|
||||
@@ -56,17 +107,17 @@ using FuncInfo = std::pair<wasm_func_t const*, wasm_functype_t const*>;
|
||||
struct InstanceWrapper
|
||||
{
|
||||
wasm_store_t* store_ = nullptr;
|
||||
wasm_extern_vec_t exports_;
|
||||
WasmExternVec exports_;
|
||||
InstancePtr instance_;
|
||||
beast::Journal j_ = beast::Journal(beast::Journal::getNullSink());
|
||||
|
||||
private:
|
||||
static InstancePtr
|
||||
init(
|
||||
wasm_store_t* s,
|
||||
wasm_module_t* m,
|
||||
wasm_extern_vec_t* expt,
|
||||
wasm_extern_vec_t const& imports,
|
||||
StorePtr& s,
|
||||
ModulePtr& m,
|
||||
WasmExternVec& expt,
|
||||
WasmExternVec const& imports,
|
||||
beast::Journal j);
|
||||
|
||||
public:
|
||||
@@ -78,19 +129,18 @@ public:
|
||||
operator=(InstanceWrapper&& o);
|
||||
|
||||
InstanceWrapper(
|
||||
wasm_store_t* s,
|
||||
wasm_module_t* m,
|
||||
wasm_extern_vec_t const& imports,
|
||||
StorePtr& s,
|
||||
ModulePtr& m,
|
||||
WasmExternVec const& imports,
|
||||
beast::Journal j);
|
||||
|
||||
~InstanceWrapper();
|
||||
~InstanceWrapper() = default;
|
||||
|
||||
operator bool() const;
|
||||
|
||||
FuncInfo
|
||||
getFunc(
|
||||
std::string_view funcName,
|
||||
wasm_exporttype_vec_t const& export_types) const;
|
||||
getFunc(std::string_view funcName, WasmExporttypeVec const& exportTypes)
|
||||
const;
|
||||
|
||||
wmem
|
||||
getMem() const;
|
||||
@@ -105,12 +155,12 @@ struct ModuleWrapper
|
||||
{
|
||||
ModulePtr module_;
|
||||
InstanceWrapper instanceWrap_;
|
||||
wasm_exporttype_vec_t exportTypes_;
|
||||
WasmExporttypeVec exportTypes_;
|
||||
beast::Journal j_ = beast::Journal(beast::Journal::getNullSink());
|
||||
|
||||
private:
|
||||
static ModulePtr
|
||||
init(wasm_store_t* s, Bytes const& wasmBin, beast::Journal j);
|
||||
init(StorePtr& s, Bytes const& wasmBin, beast::Journal j);
|
||||
|
||||
public:
|
||||
ModuleWrapper();
|
||||
@@ -118,12 +168,12 @@ public:
|
||||
ModuleWrapper&
|
||||
operator=(ModuleWrapper&& o);
|
||||
ModuleWrapper(
|
||||
wasm_store_t* s,
|
||||
StorePtr& s,
|
||||
Bytes const& wasmBin,
|
||||
bool instantiate,
|
||||
ImportVec const& imports,
|
||||
beast::Journal j);
|
||||
~ModuleWrapper();
|
||||
~ModuleWrapper() = default;
|
||||
|
||||
operator bool() const;
|
||||
|
||||
@@ -136,20 +186,14 @@ public:
|
||||
getInstance(int i = 0) const;
|
||||
|
||||
int
|
||||
addInstance(
|
||||
wasm_store_t* s,
|
||||
wasm_extern_vec_t const& imports = WASM_EMPTY_VEC);
|
||||
addInstance(StorePtr& s, WasmExternVec const& imports);
|
||||
|
||||
std::int64_t
|
||||
getGas();
|
||||
|
||||
private:
|
||||
static void
|
||||
makeImpParams(wasm_valtype_vec_t& v, WasmImportFunc const& imp);
|
||||
static void
|
||||
makeImpReturn(wasm_valtype_vec_t& v, WasmImportFunc const& imp);
|
||||
wasm_extern_vec_t
|
||||
buildImports(wasm_store_t* s, ImportVec const& imports);
|
||||
WasmExternVec
|
||||
buildImports(StorePtr& s, ImportVec const& imports);
|
||||
};
|
||||
|
||||
class WasmiEngine
|
||||
@@ -237,9 +281,7 @@ private:
|
||||
runFunc(std::string_view const funcName, int32_t p);
|
||||
|
||||
int32_t
|
||||
makeModule(
|
||||
Bytes const& wasmCode,
|
||||
wasm_extern_vec_t const& imports = WASM_EMPTY_VEC);
|
||||
makeModule(Bytes const& wasmCode, WasmExternVec const& imports = {});
|
||||
|
||||
FuncInfo
|
||||
getFunc(std::string_view funcName);
|
||||
|
||||
@@ -80,11 +80,11 @@ getDataSField(IW const* _runtime, wasm_val_vec_t const* params, int32_t& i)
|
||||
{
|
||||
auto const& m = SField::getKnownCodeToField();
|
||||
auto const it = m.find(params->data[i].of.i32);
|
||||
i++;
|
||||
if (it == m.end())
|
||||
{
|
||||
return Unexpected(HostFunctionError::INVALID_FIELD);
|
||||
}
|
||||
i++;
|
||||
return *it->second;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@ getDataSlice(
|
||||
{
|
||||
int64_t const ptr = params->data[i].of.i32;
|
||||
int64_t const size = params->data[i + 1].of.i32;
|
||||
i += 2;
|
||||
if (ptr < 0 || size < 0)
|
||||
return Unexpected(HostFunctionError::INVALID_PARAMS);
|
||||
|
||||
@@ -117,7 +118,6 @@ getDataSlice(
|
||||
return Unexpected(HostFunctionError::POINTER_OUT_OF_BOUNDS);
|
||||
|
||||
Slice data(memory.p + ptr, size);
|
||||
i += 2;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,56 +51,47 @@ print_wasm_error(std::string_view msg, wasm_trap_t* trap, beast::Journal jlog)
|
||||
|
||||
InstancePtr
|
||||
InstanceWrapper::init(
|
||||
wasm_store_t* s,
|
||||
wasm_module_t* m,
|
||||
wasm_extern_vec_t* expt,
|
||||
wasm_extern_vec_t const& imports,
|
||||
StorePtr& s,
|
||||
ModulePtr& m,
|
||||
WasmExternVec& expt,
|
||||
WasmExternVec const& imports,
|
||||
beast::Journal j)
|
||||
{
|
||||
wasm_trap_t* trap = nullptr;
|
||||
InstancePtr mi = InstancePtr(
|
||||
wasm_instance_new(s, m, &imports, &trap), &wasm_instance_delete);
|
||||
wasm_instance_new(s.get(), m.get(), &imports.vec_, &trap),
|
||||
&wasm_instance_delete);
|
||||
|
||||
if (!mi || trap)
|
||||
{
|
||||
print_wasm_error("can't create instance", trap, j);
|
||||
throw std::runtime_error("can't create instance");
|
||||
}
|
||||
wasm_instance_exports(mi.get(), expt);
|
||||
wasm_instance_exports(mi.get(), &expt.vec_);
|
||||
return mi;
|
||||
}
|
||||
|
||||
InstanceWrapper::InstanceWrapper()
|
||||
: exports_{0, nullptr}, instance_(nullptr, &wasm_instance_delete)
|
||||
InstanceWrapper::InstanceWrapper() : instance_(nullptr, &wasm_instance_delete)
|
||||
{
|
||||
}
|
||||
|
||||
// LCOV_EXCL_START
|
||||
InstanceWrapper::InstanceWrapper(InstanceWrapper&& o)
|
||||
: exports_{0, nullptr}, instance_(nullptr, &wasm_instance_delete)
|
||||
: instance_(nullptr, &wasm_instance_delete)
|
||||
{
|
||||
*this = std::move(o);
|
||||
}
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
InstanceWrapper::InstanceWrapper(
|
||||
wasm_store_t* s,
|
||||
wasm_module_t* m,
|
||||
wasm_extern_vec_t const& imports,
|
||||
StorePtr& s,
|
||||
ModulePtr& m,
|
||||
WasmExternVec const& imports,
|
||||
beast::Journal j)
|
||||
: store_(s)
|
||||
, exports_ WASM_EMPTY_VEC
|
||||
, instance_(init(s, m, &exports_, imports, j))
|
||||
, j_(j)
|
||||
: store_(s.get()), instance_(init(s, m, exports_, imports, j)), j_(j)
|
||||
{
|
||||
}
|
||||
|
||||
InstanceWrapper::~InstanceWrapper()
|
||||
{
|
||||
if (exports_.size)
|
||||
wasm_extern_vec_delete(&exports_);
|
||||
}
|
||||
|
||||
InstanceWrapper&
|
||||
InstanceWrapper::operator=(InstanceWrapper&& o)
|
||||
{
|
||||
@@ -109,11 +100,7 @@ InstanceWrapper::operator=(InstanceWrapper&& o)
|
||||
|
||||
store_ = o.store_;
|
||||
o.store_ = nullptr;
|
||||
if (exports_.size)
|
||||
wasm_extern_vec_delete(&exports_); // LCOV_EXCL_LINE
|
||||
exports_ = o.exports_;
|
||||
o.exports_ = {0, nullptr};
|
||||
|
||||
exports_ = std::move(o.exports_);
|
||||
instance_ = std::move(o.instance_);
|
||||
|
||||
j_ = o.j_;
|
||||
@@ -129,39 +116,37 @@ InstanceWrapper::operator bool() const
|
||||
FuncInfo
|
||||
InstanceWrapper::getFunc(
|
||||
std::string_view funcName,
|
||||
wasm_exporttype_vec_t const& export_types) const
|
||||
WasmExporttypeVec const& exportTypes) const
|
||||
{
|
||||
wasm_func_t* f = nullptr;
|
||||
wasm_functype_t* ft = nullptr;
|
||||
wasm_func_t const* f = nullptr;
|
||||
wasm_functype_t const* ft = nullptr;
|
||||
|
||||
if (!instance_)
|
||||
throw std::runtime_error("no instance"); // LCOV_EXCL_LINE
|
||||
|
||||
if (!export_types.size)
|
||||
if (!exportTypes.vec_.size)
|
||||
throw std::runtime_error("no export"); // LCOV_EXCL_LINE
|
||||
if (export_types.size != exports_.size)
|
||||
if (exportTypes.vec_.size != exports_.vec_.size)
|
||||
throw std::runtime_error("invalid export"); // LCOV_EXCL_LINE
|
||||
|
||||
for (unsigned i = 0; i < export_types.size; ++i)
|
||||
for (unsigned i = 0; i < exportTypes.vec_.size; ++i)
|
||||
{
|
||||
auto const* exp_type(export_types.data[i]);
|
||||
auto const* expType(exportTypes.vec_.data[i]);
|
||||
|
||||
wasm_name_t const* name = wasm_exporttype_name(exp_type);
|
||||
wasm_externtype_t const* exn_type = wasm_exporttype_type(exp_type);
|
||||
if (wasm_externtype_kind(exn_type) == WASM_EXTERN_FUNC)
|
||||
wasm_name_t const* name = wasm_exporttype_name(expType);
|
||||
wasm_externtype_t const* exnType = wasm_exporttype_type(expType);
|
||||
if (wasm_externtype_kind(exnType) == WASM_EXTERN_FUNC)
|
||||
{
|
||||
if (funcName == std::string_view(name->data, name->size))
|
||||
{
|
||||
auto* exn(exports_.data[i]);
|
||||
if (wasm_extern_kind(exn) != WASM_EXTERN_FUNC)
|
||||
throw std::runtime_error(
|
||||
"invalid export"); // LCOV_EXCL_LINE
|
||||
if (funcName != std::string_view(name->data, name->size))
|
||||
continue;
|
||||
|
||||
ft = wasm_externtype_as_functype(
|
||||
const_cast<wasm_externtype_t*>(exn_type));
|
||||
f = wasm_extern_as_func(exn);
|
||||
break;
|
||||
}
|
||||
auto const* exn(exports_.vec_.data[i]);
|
||||
if (wasm_extern_kind(exn) != WASM_EXTERN_FUNC)
|
||||
throw std::runtime_error("invalid export"); // LCOV_EXCL_LINE
|
||||
|
||||
ft = wasm_externtype_as_functype_const(exnType);
|
||||
f = wasm_extern_as_func_const(exn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,9 +164,9 @@ InstanceWrapper::getMem() const
|
||||
throw std::runtime_error("no instance"); // LCOV_EXCL_LINE
|
||||
|
||||
wasm_memory_t* mem = nullptr;
|
||||
for (unsigned i = 0; i < exports_.size; ++i)
|
||||
for (unsigned i = 0; i < exports_.vec_.size; ++i)
|
||||
{
|
||||
auto* e(exports_.data[i]);
|
||||
auto* e(exports_.vec_.data[i]);
|
||||
if (wasm_extern_kind(e) == WASM_EXTERN_MEMORY)
|
||||
{
|
||||
mem = wasm_extern_as_memory(e);
|
||||
@@ -219,9 +204,11 @@ InstanceWrapper::setGas(std::int64_t gas) const
|
||||
wasm_store_set_fuel(store_, static_cast<std::uint64_t>(gas));
|
||||
if (err)
|
||||
{
|
||||
print_wasm_error(
|
||||
"Can't set instance gas", nullptr, j_); // LCOV_EXCL_LINE
|
||||
throw std::runtime_error("Can't set instance gas"); // LCOV_EXCL_LINE
|
||||
// LCOV_EXCL_START
|
||||
print_wasm_error("Can't set instance gas", nullptr, j_);
|
||||
wasmi_error_delete(err);
|
||||
throw std::runtime_error("Can't set instance gas");
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
|
||||
return gas;
|
||||
@@ -230,10 +217,11 @@ InstanceWrapper::setGas(std::int64_t gas) const
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ModulePtr
|
||||
ModuleWrapper::init(wasm_store_t* s, Bytes const& wasmBin, beast::Journal j)
|
||||
ModuleWrapper::init(StorePtr& s, Bytes const& wasmBin, beast::Journal j)
|
||||
{
|
||||
wasm_byte_vec_t const code{wasmBin.size(), (char*)(wasmBin.data())};
|
||||
ModulePtr m = ModulePtr(wasm_module_new(s, &code), &wasm_module_delete);
|
||||
ModulePtr m =
|
||||
ModulePtr(wasm_module_new(s.get(), &code), &wasm_module_delete);
|
||||
if (!m)
|
||||
throw std::runtime_error("can't create module");
|
||||
|
||||
@@ -241,41 +229,33 @@ ModuleWrapper::init(wasm_store_t* s, Bytes const& wasmBin, beast::Journal j)
|
||||
}
|
||||
|
||||
// LCOV_EXCL_START
|
||||
ModuleWrapper::ModuleWrapper()
|
||||
: module_(nullptr, &wasm_module_delete), exportTypes_{0, nullptr}
|
||||
ModuleWrapper::ModuleWrapper() : module_(nullptr, &wasm_module_delete)
|
||||
{
|
||||
}
|
||||
|
||||
ModuleWrapper::ModuleWrapper(ModuleWrapper&& o)
|
||||
: module_(nullptr, &wasm_module_delete), exportTypes_{0, nullptr}
|
||||
: module_(nullptr, &wasm_module_delete)
|
||||
{
|
||||
*this = std::move(o);
|
||||
}
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
ModuleWrapper::ModuleWrapper(
|
||||
wasm_store_t* s,
|
||||
StorePtr& s,
|
||||
Bytes const& wasmBin,
|
||||
bool instantiate,
|
||||
ImportVec const& imports,
|
||||
beast::Journal j)
|
||||
: module_(init(s, wasmBin, j)), exportTypes_{0, nullptr}, j_(j)
|
||||
: module_(init(s, wasmBin, j)), j_(j)
|
||||
{
|
||||
wasm_module_exports(module_.get(), &exportTypes_);
|
||||
wasm_module_exports(module_.get(), &exportTypes_.vec_);
|
||||
if (instantiate)
|
||||
{
|
||||
auto wimports = buildImports(s, imports);
|
||||
addInstance(s, wimports);
|
||||
wasm_extern_vec_delete(&wimports);
|
||||
}
|
||||
}
|
||||
|
||||
ModuleWrapper::~ModuleWrapper()
|
||||
{
|
||||
if (exportTypes_.size)
|
||||
wasm_exporttype_vec_delete(&exportTypes_);
|
||||
}
|
||||
|
||||
// LCOV_EXCL_START
|
||||
ModuleWrapper&
|
||||
ModuleWrapper::operator=(ModuleWrapper&& o)
|
||||
@@ -285,10 +265,7 @@ ModuleWrapper::operator=(ModuleWrapper&& o)
|
||||
|
||||
module_ = std::move(o.module_);
|
||||
instanceWrap_ = std::move(o.instanceWrap_);
|
||||
if (exportTypes_.size)
|
||||
wasm_exporttype_vec_delete(&exportTypes_);
|
||||
exportTypes_ = o.exportTypes_;
|
||||
o.exportTypes_ = {0, nullptr};
|
||||
exportTypes_ = std::move(o.exportTypes_);
|
||||
j_ = o.j_;
|
||||
|
||||
return *this;
|
||||
@@ -301,27 +278,25 @@ ModuleWrapper::operator bool() const
|
||||
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
void
|
||||
ModuleWrapper::makeImpParams(wasm_valtype_vec_t& v, WasmImportFunc const& imp)
|
||||
static WasmValtypeVec
|
||||
makeImpParams(WasmImportFunc const& imp)
|
||||
{
|
||||
auto const paramSize = imp.params.size();
|
||||
if (!paramSize)
|
||||
return {};
|
||||
|
||||
WasmValtypeVec v(paramSize);
|
||||
|
||||
if (paramSize)
|
||||
{
|
||||
wasm_valtype_vec_new_uninitialized(&v, paramSize);
|
||||
}
|
||||
else
|
||||
v = WASM_EMPTY_VEC;
|
||||
for (unsigned i = 0; i < paramSize; ++i)
|
||||
{
|
||||
auto const vt = imp.params[i];
|
||||
switch (vt)
|
||||
{
|
||||
case WT_I32:
|
||||
v.data[i] = wasm_valtype_new_i32();
|
||||
v.vec_.data[i] = wasm_valtype_new_i32();
|
||||
break;
|
||||
case WT_I64:
|
||||
v.data[i] = wasm_valtype_new_i64();
|
||||
v.vec_.data[i] = wasm_valtype_new_i64();
|
||||
break;
|
||||
// LCOV_EXCL_START
|
||||
default:
|
||||
@@ -329,59 +304,55 @@ ModuleWrapper::makeImpParams(wasm_valtype_vec_t& v, WasmImportFunc const& imp)
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
void
|
||||
ModuleWrapper::makeImpReturn(wasm_valtype_vec_t& v, WasmImportFunc const& imp)
|
||||
static WasmValtypeVec
|
||||
makeImpReturn(WasmImportFunc const& imp)
|
||||
{
|
||||
if (imp.result)
|
||||
if (!imp.result)
|
||||
return {}; // LCOV_EXCL_LINE
|
||||
|
||||
WasmValtypeVec v(1);
|
||||
switch (*imp.result)
|
||||
{
|
||||
wasm_valtype_vec_new_uninitialized(&v, 1);
|
||||
switch (*imp.result)
|
||||
{
|
||||
case WT_I32:
|
||||
v.data[0] = wasm_valtype_new_i32();
|
||||
break;
|
||||
// LCOV_EXCL_START
|
||||
case WT_I64:
|
||||
v.data[0] = wasm_valtype_new_i64();
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error("invalid return type");
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
case WT_I32:
|
||||
v.vec_.data[0] = wasm_valtype_new_i32();
|
||||
break;
|
||||
// LCOV_EXCL_START
|
||||
case WT_I64:
|
||||
v.vec_.data[0] = wasm_valtype_new_i64();
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error("invalid return type");
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
else
|
||||
v = WASM_EMPTY_VEC; // LCOV_EXCL_LINE
|
||||
return v;
|
||||
}
|
||||
|
||||
wasm_extern_vec_t
|
||||
ModuleWrapper::buildImports(wasm_store_t* s, ImportVec const& imports)
|
||||
WasmExternVec
|
||||
ModuleWrapper::buildImports(StorePtr& s, ImportVec const& imports)
|
||||
{
|
||||
wasm_importtype_vec_t importTypes = WASM_EMPTY_VEC;
|
||||
wasm_module_imports(module_.get(), &importTypes);
|
||||
std::
|
||||
unique_ptr<wasm_importtype_vec_t, decltype(&wasm_importtype_vec_delete)>
|
||||
itDeleter(&importTypes, &wasm_importtype_vec_delete);
|
||||
WasmImporttypeVec importTypes;
|
||||
wasm_module_imports(module_.get(), &importTypes.vec_);
|
||||
|
||||
wasm_extern_vec_t wimports = WASM_EMPTY_VEC;
|
||||
if (!importTypes.size)
|
||||
return wimports;
|
||||
if (!importTypes.vec_.size)
|
||||
return {};
|
||||
|
||||
wasm_extern_vec_new_uninitialized(&wimports, importTypes.size);
|
||||
WasmExternVec wimports(importTypes.vec_.size);
|
||||
|
||||
unsigned impCnt = 0;
|
||||
for (unsigned i = 0; i < importTypes.size; ++i)
|
||||
for (unsigned i = 0; i < importTypes.vec_.size; ++i)
|
||||
{
|
||||
wasm_importtype_t const* importtype = importTypes.data[i];
|
||||
wasm_importtype_t const* importType = importTypes.vec_.data[i];
|
||||
|
||||
// wasm_name_t const* mn = wasm_importtype_module(importtype);
|
||||
// auto modName = std::string_view(mn->data, mn->num_elems);
|
||||
wasm_name_t const* fn = wasm_importtype_name(importtype);
|
||||
wasm_name_t const* fn = wasm_importtype_name(importType);
|
||||
auto fieldName = std::string_view(fn->data, fn->size);
|
||||
|
||||
wasm_externkind_t const itype =
|
||||
wasm_externtype_kind(wasm_importtype_type(importtype));
|
||||
wasm_externtype_kind(wasm_importtype_type(importType));
|
||||
if ((itype) != WASM_EXTERN_FUNC)
|
||||
throw std::runtime_error(
|
||||
"Invalid import type " +
|
||||
@@ -398,17 +369,19 @@ ModuleWrapper::buildImports(wasm_store_t* s, ImportVec const& imports)
|
||||
if (imp.name != fieldName)
|
||||
continue;
|
||||
|
||||
wasm_valtype_vec_t params = WASM_EMPTY_VEC,
|
||||
results = WASM_EMPTY_VEC;
|
||||
makeImpReturn(results, imp);
|
||||
makeImpParams(params, imp);
|
||||
WasmValtypeVec params(makeImpParams(imp));
|
||||
WasmValtypeVec results(makeImpReturn(imp));
|
||||
|
||||
std::unique_ptr<wasm_functype_t, decltype(&wasm_functype_delete)>
|
||||
ftype(
|
||||
wasm_functype_new(¶ms.vec_, &results.vec_),
|
||||
&wasm_functype_delete);
|
||||
|
||||
params.release();
|
||||
results.release();
|
||||
|
||||
using ftype_ptr = std::
|
||||
unique_ptr<wasm_functype_t, decltype(&wasm_functype_delete)>;
|
||||
ftype_ptr ftype(
|
||||
wasm_functype_new(¶ms, &results), &wasm_functype_delete);
|
||||
wasm_func_t* func = wasm_func_new_with_env(
|
||||
s,
|
||||
s.get(),
|
||||
ftype.get(),
|
||||
reinterpret_cast<wasm_func_callback_with_env_t>(imp.wrap),
|
||||
(void*)&obj,
|
||||
@@ -421,7 +394,7 @@ ModuleWrapper::buildImports(wasm_store_t* s, ImportVec const& imports)
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
|
||||
wimports.data[i] = wasm_func_as_extern(func);
|
||||
wimports.vec_.data[i] = wasm_func_as_extern(func);
|
||||
++impCnt;
|
||||
impSet = true;
|
||||
|
||||
@@ -435,11 +408,11 @@ ModuleWrapper::buildImports(wasm_store_t* s, ImportVec const& imports)
|
||||
}
|
||||
}
|
||||
|
||||
if (impCnt != importTypes.size)
|
||||
if (impCnt != importTypes.vec_.size)
|
||||
{
|
||||
print_wasm_error(
|
||||
std::string("Imports not finished: ") + std::to_string(impCnt) +
|
||||
"/" + std::to_string(importTypes.size),
|
||||
"/" + std::to_string(importTypes.vec_.size),
|
||||
nullptr,
|
||||
j_);
|
||||
}
|
||||
@@ -466,9 +439,9 @@ ModuleWrapper::getInstance(int) const
|
||||
}
|
||||
|
||||
int
|
||||
ModuleWrapper::addInstance(wasm_store_t* s, wasm_extern_vec_t const& imports)
|
||||
ModuleWrapper::addInstance(StorePtr& s, WasmExternVec const& imports)
|
||||
{
|
||||
instanceWrap_ = {s, module_.get(), imports, j_};
|
||||
instanceWrap_ = {s, module_, imports, j_};
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -547,12 +520,13 @@ WasmiEngine::addModule(
|
||||
{
|
||||
// LCOV_EXCL_START
|
||||
print_wasm_error("Error setting gas", nullptr, j_);
|
||||
wasmi_error_delete(err);
|
||||
throw std::runtime_error("can't set gas");
|
||||
// LCOV_EXCL_STOP
|
||||
}
|
||||
|
||||
moduleWrap_ = std::make_unique<ModuleWrapper>(
|
||||
store_.get(), wasmCode, instantiate, imports, j_);
|
||||
store_, wasmCode, instantiate, imports, j_);
|
||||
|
||||
if (!moduleWrap_)
|
||||
throw std::runtime_error(
|
||||
@@ -697,7 +671,7 @@ WasmiEngine::call(FuncInfo const& f, std::vector<wasm_val_t>& in)
|
||||
auto const start = usecs();
|
||||
#endif
|
||||
|
||||
wasm_trap_t* trap = wasm_func_call(f.first, &inv, &ret.r);
|
||||
wasm_trap_t* trap = wasm_func_call(f.first, &inv, &ret.r.vec_);
|
||||
|
||||
#ifdef SHOW_CALL_TIME
|
||||
auto const finish = usecs();
|
||||
@@ -849,16 +823,16 @@ WasmiEngine::runHlp(
|
||||
|
||||
if (res.f)
|
||||
throw std::runtime_error("<" + std::string(funcName) + "> failure");
|
||||
else if (!res.r.size)
|
||||
else if (!res.r.vec_.size)
|
||||
throw std::runtime_error(
|
||||
"<" + std::string(funcName) +
|
||||
"> return nothing"); // LCOV_EXCL_LINE
|
||||
|
||||
assert(res.r.data[0].kind == WASM_I32);
|
||||
assert(res.r.vec_.data[0].kind == WASM_I32);
|
||||
if (gas == -1)
|
||||
gas = std::numeric_limits<decltype(gas)>::max();
|
||||
WasmResult<int32_t> const ret{
|
||||
res.r.data[0].of.i32, gas - moduleWrap_->getGas()};
|
||||
res.r.vec_.data[0].of.i32, gas - moduleWrap_->getGas()};
|
||||
|
||||
// #ifdef DEBUG_OUTPUT
|
||||
// auto& j = std::cerr;
|
||||
@@ -957,11 +931,11 @@ WasmiEngine::allocate(int32_t sz)
|
||||
{
|
||||
auto res = call<1>(W_ALLOC, static_cast<int32_t>(sz));
|
||||
|
||||
if (res.f || !res.r.size || (res.r.data[0].kind != WASM_I32) ||
|
||||
!res.r.data[0].of.i32)
|
||||
if (res.f || !res.r.vec_.size || (res.r.vec_.data[0].kind != WASM_I32) ||
|
||||
!res.r.vec_.data[0].of.i32)
|
||||
throw std::runtime_error(
|
||||
"can't allocate memory, " + std::to_string(sz) + " bytes");
|
||||
return res.r.data[0].of.i32;
|
||||
return res.r.vec_.data[0].of.i32;
|
||||
}
|
||||
|
||||
wasm_trap_t*
|
||||
@@ -973,7 +947,12 @@ WasmiEngine::newTrap(std::string const& txt)
|
||||
if (!txt.empty())
|
||||
wasm_name_new(&msg, txt.size() + 1, txt.c_str()); // include 0
|
||||
|
||||
return wasm_trap_new(store_.get(), &msg);
|
||||
wasm_trap_t* trap = wasm_trap_new(store_.get(), &msg);
|
||||
|
||||
if (!txt.empty())
|
||||
wasm_byte_vec_delete(&msg);
|
||||
|
||||
return trap;
|
||||
}
|
||||
|
||||
// LCOV_EXCL_START
|
||||
|
||||
Reference in New Issue
Block a user